Automatically closing curly quotes in Vim

I would like to configure Vim to automatically close the pair 'and (italic quotes).

I tried to configure all five plug-ins that I could find (two autoclaves, an environment, closepairs and delimitmate), but without success. I can't even reassign at all (using :imap ‘ ‘’<left>or similar).

I use Vim 7.3 to log into Arch Linux and uim 1.7.0; I insert 'and through the shortcut defined in .XCompose. Remodeling works great for my other key combinations, such as ¡! or ?.

+3
source share
3 answers

This is similar to a vim error, in particular an error with vim internal escape sequences that begin with \x80(the second byte of the corresponding character \x80) and encodes various things, such as NULL, function keys, or \x80itself. I think you can delve into the vim source code and find out how this byte is escaped, and try to replace the last byte with this escape code or wait until it is fixed (although I will not expect a correction to come soon : here is a quote from todo.txt

UTF-8: multibyte key mapping, where the second byte is 0x80, is not displayed to work. (Tony Mechelink, 2007 March 2)

So, you see that the problem has been known for four years and has not yet been fixed.)

+4
source

Avoid recursion with

inoremap ' ''<left>
+3

:

function! CloseQuotes()
    normal! i'' 
    startinsert
endfunction

' :

inoremap ' <ESC>:call CloseQuotes()<CR>

normal!, .

0

All Articles