c3d2-wiki/Vim.mw

42 lines
1.5 KiB
Plaintext
Raw Normal View History

2006-02-12 02:33:38 +01:00
=Automatically close ( [ { and "=
<pre>
imap ( ()<Left>
imap [ []<Left>
imap { {}<Left>
imap " <C-V>"<C-V>"<Left>
</pre>
2006-03-13 21:47:53 +01:00
''%'' springt auf die öffnende oder schließende Klammer.
2006-02-07 20:08:23 +01:00
=Tab-Completion=
2006-06-12 09:31:32 +02:00
unter [http://gentoo.org Gentoo] gibts das auch als ebuild unter [http://gentoo-portage.com/app-vim/supertab app-vim/supertab]
2006-02-07 20:09:14 +01:00
<pre>
2006-02-07 20:08:23 +01:00
function InsertTabWrapper(direction) " automagically decide what to do with <tab>
let col = col('.') -1 " <s-tab> in insert mode
if !col
return "\<tab>" " insert Tab at the beginning of the line
elseif a:direction < 0
return "\<c-p>" " insert Backward-Completion
elseif getline('.')[col - 1] == '<space>'
return "\<BS>\<TAB>" " replace <space><tab> with <tab>
elseif getline('.')[col - 1] !~ '\k'
return "\<tab>" " insert Tab if preceding character is not a keyword character
else
return "\<c-n>" " insert Forward-Completion
endfunction
inoremap <tab> <c-r>=InsertTabWrapper(1)<cr>
inoremap <s-tab> <c-r>=InsertTabWrapper(-1)<cr>
2006-02-07 20:09:14 +01:00
</pre>
=lange Zeilen und Whitespaces markieren=
Sofern ''textwidth'' einen Wert größer 0 hat, wird hiermit alles jenseits dieser Grenze
, sowie Whitespaces am Zeilenende weiß auf rot (''Error'') markiert.
<pre>
au BufEnter * if &textwidth > 0 | exec 'match Error /\%>' . &textwidth . 'v.\+\|\s\+$/' | endif
</pre>
2006-07-20 11:20:21 +02:00
=XML-Files=
Zum bearbeiten von XML-Files gibt es ein Plugin mit dem der Vim im Insert-Mode automatisch die Tags schließt.
2006-07-20 11:20:36 +02:00
http://www.vim.org/scripts/script.php?script_id=301