autocmd - How to make vim move cursor a character to theright on insertleave? -


since mac os x's terminal.app not support many of vim visual aspects, including cursor change block line when switching insert mode, use osascript accopmlisch similar.

in .vimrc file i've written:

autocmd insertenter * silent !osascript -e 'tell application "terminal" set current settings of first window settings set 11`j autocmd insertleave * silent !osascript -e 'tell application "terminal" set current settings of first window settings set 12`j 

where settings set 11 set of terminal setting has line cursor , settings set 12 1 has block cursor.

this works quite there 1 small problem.. on insertleave cursor gets moved 1 character left, isn't such big deal can anoying.

i tried compensate putting autocmd insertleave h .vimrc, no avail (it gives me error).

how should tell vim to:

  1. not shift left?
  2. if above isn't possible, compensate shifting right

before answering question, i'd recommend have in macvim (if haven't). if (or need) stick terminal, maybe terminal iterm provide more functionality. anyway, cursor change between block - bar not present in iterm (at least think so) , way solve phenomenal, it's bookmarked here now. thanks!


an easy way solve adding autocommand, said. in yours, pattern , correct command execute missing.

the h not command. execute normal mode sequence, use :normal command. may work correctly:

au insertleave * normal! h 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -