m (Move through wrapped lines. moved to Move through wrapped lines: Page moved by JohnBot to improve title) |
m (fix typos) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{review}} |
{{review}} |
||
+ | {{TipImported |
||
− | {{Tip |
||
|id=308 |
|id=308 |
||
+ | |previous=306 |
||
− | |title=Move through wrapped lines. |
||
+ | |next=309 |
||
− | |created=August 12, 2002 |
+ | |created=August 12, 2002 |
|complexity=intermediate |
|complexity=intermediate |
||
|author=Little Dragon |
|author=Little Dragon |
||
|version=5.7 |
|version=5.7 |
||
|rating=155/58 |
|rating=155/58 |
||
+ | |category1= |
||
− | |text= |
||
+ | |category2= |
||
⚫ | |||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | |||
− | |||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | |||
}} |
}} |
||
⚫ | |||
+ | <pre> |
||
⚫ | |||
⚫ | |||
− | just make sure that you don't do something odd like I did and copy the spaces at the end of the code :S. |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | </pre> |
||
⚫ | |||
− | '''Anonymous''' |
||
⚫ | |||
− | , March 9, 2003 16:55 |
||
− | ---- |
||
⚫ | |||
− | + | In paste mode you will be able to navigate from line to line without the cursor jumping around *and* you won't have the long text wrap if you put a space in, which usually is not a desired effect. |
|
+ | <pre> |
||
− | :set paste |
+ | :set paste |
⚫ | |||
⚫ | |||
+ | </pre> |
||
⚫ | |||
− | |||
⚫ | |||
− | |||
− | '''Anonymous''' |
||
− | , March 5, 2004 15:53 |
||
---- |
---- |
||
− | My current settings are: |
+ | My current settings are: |
+ | <pre> |
||
− | map <silent> <up> gk |
||
− | + | map <silent> <Up> gk |
|
− | + | imap <silent> <Up> <C-o>gk |
|
− | + | map <silent> <Down> gj |
|
+ | imap <silent> <Down> <C-o>gj |
||
− | map <silent> <home> g<home> |
||
− | + | map <silent> <home> g<home> |
|
+ | imap <silent> <home> <C-o>g<home> |
||
− | map <silent> <end> g<end> |
||
+ | map <silent> <End> g<End> |
||
− | imap <silent> <end> <C-o>g<end> |
||
+ | imap <silent> <End> <C-o>g<End> |
||
− | setlocal linebreak |
+ | setlocal linebreak |
− | setlocal nolist |
+ | setlocal nolist |
− | setlocal display+=lastline |
+ | setlocal display+=lastline |
+ | </pre> |
||
− | But |
+ | But I'm still trying to find a way to avoid "jumps" when I'm scrolling and a wrapped line enters or exits the screen... |
− | + | See also [[VimTip38]]. |
|
− | |||
− | '''Anonymous''' |
||
− | , August 14, 2004 17:19 |
||
− | ---- |
||
− | I have the same problem in long line cases. |
||
− | That is, can vim scroll in screen lines instead of physical lines |
||
− | when one long line is about to scroll out of window (up or down)? |
||
− | lei.wang--AT--computer.org |
||
− | , August 25, 2004 0:59 |
||
---- |
---- |
||
− | <!-- parsed by vimtips.py in 0.460624 seconds--> |
Latest revision as of 09:03, 30 March 2011
Tip 308 Printable Monobook Previous Next
created August 12, 2002 · complexity intermediate · author Little Dragon · version 5.7
If you don't like the fact that when you press Up and Down on a wrapped line, you get to the next physical line instead of the next line on the screen, you can do something like this:
imap <silent> <Down> <C-o>gj imap <silent> <Up> <C-o>gk nmap <silent> <Down> gj nmap <silent> <Up> gk
Comments[]
Or you can just jump into paste mode.
In paste mode you will be able to navigate from line to line without the cursor jumping around *and* you won't have the long text wrap if you put a space in, which usually is not a desired effect.
:set paste or :set pastetoggle=<F9> (or whatever keybinding you want) in your .vimrc
My current settings are:
map <silent> <Up> gk imap <silent> <Up> <C-o>gk map <silent> <Down> gj imap <silent> <Down> <C-o>gj map <silent> <home> g<home> imap <silent> <home> <C-o>g<home> map <silent> <End> g<End> imap <silent> <End> <C-o>g<End> setlocal linebreak setlocal nolist setlocal display+=lastline
But I'm still trying to find a way to avoid "jumps" when I'm scrolling and a wrapped line enters or exits the screen...
See also VimTip38.