Just in case you discover you are annoyed by this mapping : You may
want to check if there is text after the cursor before inserting the
closing tocken, e.g. autoclosing a " (a double quote) can be annoying
if you just wanted to comment something in you vimrc. I use this
mapping to avoid this situation.

function! InsertIfNoTrailingWord(closingChar)
    " gets what is after the cursor
    let trailing = strpart(getline("."), col("."))
    " if it matches a non blank character
    if trailing !~ '\S'
        execute "normal! a" . a:closingChar
        execute "normal! h"
    endif
endfunction

inoremap " "<esc>:call InsertIfNoTrailingWord('"')<cr>a

There are tons of plugins that handle bracketting, but I prefer to
stick to something simple...

-- 
Christophe-Marie Duquesne

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to