Hi I'm trying to optimise my window management in vim by mapping ctrlk to ctrl+w, k so i can just press ctrl+k to switch to the split window above the one I'm working in (I'm doing this for h,j and l also but it's only k that's causing the problem).
I've added this into my .vimrc
noremap <silent> <c-k> <C-W>k
noremap <silent> <c-j> <C-W>j
noremap <silent> <c-h> <C-W>h
noremap <silent> <c-l> <C-W>l
However if I press ctrl+k, then something weird happens. It changes depending on where I am in the document.
I've tested and removing the above lines causes the symptoms to stop happening. I'm just really confused as to what is going on!
Some info: I'm using the vim binary that comes with macvim via the command line.
Any help would be greatly appreciated!
Thanks!
Ctrl-w = tells Vim to assign an equal number of lines to each viewport. To move between the viewports while working, use Ctrl-w j to move down, and Ctrl-w k to move up. This should prove easy to remember — Ctrl-w for “window” commands, and the normal vi movement commands j for down and k for up.
Sometimes when you execute a command call in Vim, it gets echoed. Adding <silent> removes the echo. It does not remove error message though.
<ctrl>l. Redraw screen. <ctrl>g. Display current line number and. file information.
To scroll forward (move down) one screenful, press Ctrl-F. (Hold down the Control key and press the F key.) The cursor moves to the upper left corner of the new screen.
on linux, CTRL-Z in vi/vim/gvim mean escape to the console, or put this in the background. you then do whatever you want on the console and type fg (foreground) to bring you back into vim edit session.
Like most of the capitalized movement pairs, b moves by word, but B moves by WORD. The difference is that vim considers a "word" to be letters, numbers, and underscores (and you can configure this with the iskeyword setting), but a "WORD" is always anything that isn't whitespace.
I can’t explain the second problem, but if you pasted everything directly from the vimrc then you have lots of trailing spaces that must not be there. It can explain the first problem. Try running
:%sm/\s\+$
then save and see whether problem disappears. If it is so, use
:set list listchars=trail:-
to be able to see trailing spaces so that you won’t run into this problem again.
Maybe <C-k>
is already mapped to something else. Try :verbose map <C-k>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With