Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Horizontal navigation in long lines

Tags:

vim

navigation

How can I do the following:

  1. shift faster to the right, something like zw (analogy to zl but jump on words)
  2. shift only the one long line where is the cursor. The rest of the file will remain in its position

I have .vimrc settings set nowrap. That's because the code looks nicer than wrapped lines. But there is a problem with horizontal navigation.

I noticed that zl (don't confuse l (L) with 1) shortcut which shifts to the right (zh to the left).

like image 289
xralf Avatar asked May 13 '11 09:05

xralf


1 Answers

Did you try :help scroll-horizontal?

You could use a mapping to scroll, for example, 20 characters to the left or to the right:

map <C-L> 20zl " Scroll 20 characters to the right map <C-H> 20zh " Scroll 20 characters to the left 

Without applying a mapping, you could use zL to move the view a half screenwidth to the right and zH to do it to the left.

Regarding the second part of your question: I don't think that this is possible. You could yank the whole line, paste it into a second (scratch) buffer and scroll there. This would work as long as you're just reading the lines. Problems will arise as soon as you want to change something. But it's quite cumbersome...

like image 150
eckes Avatar answered Oct 21 '22 20:10

eckes