parsed.org

Tips by tag: vi

Autocompletion in VIM using TAB by oozy on Apr 25, 2007 03:54 AM

Put this into ~/.vimrc:

fun! InsertTabWrapper()
    let col = col('.') - 1
    if !col || getline('.')[col - 1] !~ '\k'
       return "\<tab>"
    else
       return "\<c-p>"
    endif
endfun

fun! ShiftInsertTabWrapper()
    let col = col('.') - 1
    if !col || getline('.')[col - 1] !~ '\k'
       return "\<s-tab>"
    else
       return "\<c-n>"
    endif
endfun

inoremap <tab> <c-r>=InsertTabWrapper()<cr>
inoremap <s-tab> <c-r>=ShiftInsertTabWrapper()<cr>

:set dictionary+=dict.file
:set dictionary+=%
:set iskeyword+=:
:set complete+=k
autocompletionconfigurationeditorssettingsvivimvimrc
Opening Files in VIM by http://xinu.myopenid.com/ on Apr 22, 2008 05:00 PM

When you're choosing a file to open in vi(m), you can limit your search to a mask:

:e *.pl[tab]

At this point you're only tab'ing through the .pl files.

vivim
Syntax Highlighting by http://xinu.myopenid.com/ on Dec 31, 2005 04:11 PM

If you would like to have syntax highlighting on a file that would otherwise not have any highlighting at all, you can symlink the file to the appropriate extension and open it:

$ ln -s example.lxp example.html
$ vi example.html # opened with pretty highlighting

*Note: This should be used sparingly and you should clean up your symlinks.

commandseditorshighlightingshellsymlinksyntaxvi
Vim Uppercase by http://xinu.myopenid.com/ on Jan 22, 2008 09:06 AM

To take a series of lines, say from the cursor to the bottom of the file and make them uppercase, the following would be useful:

%,$s/\(.*\)/\U\1/
regexswapuppercasevivim
RSS