I have an SQL query that has over 5000 characters. I don't have access to mouse, just the terminal Vim editor. During testing, I need to change values of this query here and there. It is so long that, the next line number appears after 2 screens of pressing page-down.
So if I have to edit, I go to the beginning/end of the line and starts pressing
These settings will help you immensely:
"Make long lines wrap set wrap "Make wraps *not* occur in the middle of a word set linebreak "Make the last line look OK set display+=lastline "Make 'j' and 'k' go down a visual line, not an entire line nnoremap j gj nnoremap k gk "Make the arrow keys also go down a visual line nnoremap <Up> gk nnoremap <Down> gj "Allow the option to move up entire lines nnoremap gj j nnoremap gk k
Since lines starting with
" are comments, you can just directly copy and paste this into your
Another useful feature is the bar command
|. If you type 200 |, this will jump to the 200th character on the current line.
If you want, you could also include these settings:
nnoremap $ g$ nnoremap 0 g0 nnoremap g$ $ nnoremap g0 0
With these settings, you can use
g$ to jump to the first/last character on this visual line, rather than than the first/last character on the extremely long line. These settings don't hurt, but IMO the first group of settings I posted are more useful.