Vim Tip of the Week : SHIFT-K

By | 2007/07/20

Well you asked for it. Last week I did the first vim tip of the week and it looks like you all want more. I got another goodie today that you might enjoy. How many of you know what SHIFT-K does in command mode? No, don’t go look it up. Do you know right now? If not keep reading. If so, I’m impressed.

Instead of just telling you what it does I want you to give it a try for yourself (no better way to learn than to do, right?). Follow the below instructions and see if you can figure out what it does. First person to figure it out and comment with the answer wins!

Ready, Set, Go!

Open up a new file with vim:

vim file1

switch to insert mode (i,I,a,A,o,O, etc).

type a few linux commands into a new line (any command you want):

vim awk man aptitude

switch back to command mode (esc)

put your cursor on any of the commands and press SHIFT-K.

Pretty slick, particularly when trying to decipher shell scripts if you’re unfamiliar with the commands, or reading documentation that refers to related apps!

…so, what does it do? Enjoy.. and be back next week for another tip! Thanks Dax for pointing this out to me.

7 thoughts on “Vim Tip of the Week : SHIFT-K

  1. LaserJock

    This one rocks. I’m still amazed at how powerful vim is while still being so “light”.

  2. tomchuk

    You can also set keyword programs in your vimrc. For instance, for php functions:

    In your ~/.vimrc
    autocmd FileType php set keywordprg=~/.vim/php_doc

    And ~/.vim/php_doc:
    #!/bin/sh

    FN=`echo $1 | sed ‘s/_/-/g’`
    echo ********************** $FN **********************

    lynx -dump -nolist http://www.php.net/manual/en/print/function.$FN.php | sed -n /^$1/,/^.*User\ Contributed\ Notes/p | grep -v ‘User\ Contributed\ Notes’

  3. Pingback: University Update - Linux - Vim Tip of the Week : SHIFT-K

  4. Elaine

    Good tip and a new one for me, even though I think of myself as a power vim users. I keep trying “prettier” editors and keep coming back go vim for the functionality.

  5. Pingback: Vim Tip of the Week - Encryption : Aug 3, 2007 : Ubuntu Tutorials : Breezy - Dapper - Edgy - Feisty

Comments are closed.