Computer Science Canada

Four of my favourite lines of Vimscript

Author:  btiffin [ Thu Jul 25, 2013 12:04 pm ]
Post subject:  Four of my favourite lines of Vimscript

code:

" Mucking with no cursor movement on escape from insert mode
let CursorColumnI = 0 "the cursor column position in INSERT
augroup inserttweak
autocmd!
autocmd InsertEnter * let CursorColumnI = col('.')
autocmd CursorMovedI * let CursorColumnI = col('.')
autocmd InsertLeave * if col('.') != CursorColumnI | call cursor(0, col('.')+1) | endif
augroup END


Ok, four lines plus three lines of grouping and a comment.

Makes toggling insert mode in Vim a lot easier on the brain and fingers. Placed in ~/.vimrc

Cheers

Author:  jackie15 [ Sat Oct 26, 2013 7:23 am ]
Post subject:  RE:Four of my favourite lines of Vimscript

thanks for sharing...!

Author:  BigBear [ Sat Oct 26, 2013 10:29 am ]
Post subject:  RE:Four of my favourite lines of Vimscript

What does it do?

Allows you to toggle insert mode with '.'?

Author:  btiffin [ Sun Oct 27, 2013 5:08 pm ]
Post subject:  RE:Four of my favourite lines of Vimscript

BigBear;

Normally vim backspaces when escaping out of insert mode. It gets rid of an end-of-line off by one error that scripts might bump into. But it kinda blows getting used to. This slows the editor down, but leaves the cursor position alone when you leave insert mode. Umm, which in itself can kinda blow if your fingers have gotten used to normal back positioning behaviour.

Author:  kashu123 [ Fri Nov 01, 2013 1:02 am ]
Post subject:  RE:Four of my favourite lines of Vimscript

I am waiting you give me a more interested information.

Author:  btiffin [ Sat Nov 02, 2013 4:24 pm ]
Post subject:  RE:Four of my favourite lines of Vimscript

kashu123;

But, but; unlike the Dos Equis guy, I'm the most Uninteresting Nerd in the World. Smile

Cheers


: