Cleaner non-wrapping cursor in Vim

The basic idea at Vim Tips Wiki works nicely, but it needs some polishing.

First, does anyone actually want

inoremap <buffer> <silent> <Home> <C-o>g<Home>
inoremap <buffer> <silent> <End>  <C-o>g<End>


I suppose if you were treating the file as one big matrix of characters, perhaps. I personally find it inconvenient. Another problem is an annoying glitch that happens when pressing <End> followed by <Up> on a blank line, and the cursor jumps to the last screen column. A hacky remap fixes it.

inoremap <buffer> <silent> <End> <End><Right><Left>

And even though Vim Tips Wiki calls it “poor practice” (I really can’t imagine why), I like blank lines to have the correct indentation:

:inoremap <CR> x<BS><CR>

(from the same page).

What I’d really like to know is if there is a way to make Vim insert the indent characters there in the first place without simulating actual typing. Oh well.

This entry was posted in vim. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s