Townk / vim-autoclose

This plugin for Vim enable an auto-close chars feature for you. For instance if you type an '(', ``autoclose`` will automatically insert a ')' and put the cursor between than.
http://townk.github.com/vim-autoclose/
503 stars 66 forks source link

Problems with special keys (vt100-cursor-keys), sent as "^[OA" etc. #4

Closed blueyed closed 12 years ago

blueyed commented 13 years ago

While using the plugin I've noticed that it messes up special keys like the cursor keys, or .

When using Ctrl-V in insert mode I see that e.g. "" gets sent as ^[OA.
This is covered in Vim's help at :h vt100-cursor-keys.

What happens here is that the [ in this sequence appears to get used by autoclose and/or confuses Vim.
I can work around this by manually mapping the cursor keys, like map! ^[OA <up> (lhs via C-v<up>) in vimrc, but there might be a better fix for this.

btw: do you know about another AutoClose script, which is located at https://github.com/vim-scripts/AutoClose ? (it faces the same problem though)

blueyed commented 13 years ago

The "other autoclose" has code to address this, which I just had to expand to also fix "term=screen".

See https://github.com/blueyed/AutoClose/commit/a3c49439d02c976ed945605397b1b5871c830284 - please consider applying the same mechanism to fix this to "this autoclose".

blueyed commented 13 years ago

Fixed in https://github.com/blueyed/vim-autoclose/commit/91337868f6738b31f9c2bbe0a221a42152b64cce - should be in the pull request, too.

Townk commented 12 years ago

I did a pull of Artem's repositories with the fixes from blueyed. Can you check if I can close this issue?

artm commented 12 years ago

ah, in my master (next commit after the merge point ) there is an alternative implementation of this solution. It's probably a bit controversial though and I still want to read more how other projects go about this.

But so far in many combinations of osx, windows and linux terminals, and ssh and tmux sessions I haven't had this problem come back with either the solution in your tree or in mine. I've spent some time testing it (disabling and reenabling the workaround). But it could be just luck.