alg
alg

Reputation: 53

Navigate in gvim like in most

I'd like to use gvim to view files with long lines. It's a table, so I'm not wrapping the lines. Is this possible to configure gvim so arrows navigation will be like in "most" tool? Arrow key will move the whole screen 1 character lef/right/top/bottom? Thanks a lot.

Upvotes: 2

Views: 73

Answers (1)

Dan Lowe
Dan Lowe

Reputation: 56518

I think this should do what you want.

set nocompatible
set nowrap
set virtualedit=all

nnoremap <Left> zh
nnoremap <Right> zl
nnoremap <Up> <C-y>
nnoremap <Down> <C-e>

If you want the same behavior in insert mode, add the same mappings again as a second set, but use inoremap instead of nnoremap.

The virtualedit setting will allow the cursor to move beyond the end of the line and continue on as if the line had infinite whitespace to the right.

NOTE: virtualedit is only available if Vim was compiled with that feature. You can check with :version. If this feature is available, you should see a + next to it, e.g. +virtualedit.

Upvotes: 1

Related Questions