2

I'm trying to remap in my vimrc the keys Ctrl+w Shift+[H,J,K,L] to Ctrl+Shift+[H,J,K,L]. I'm using gnome vim version 8.1

This is what I have

" Easy window positioning
"nnoremap <leader>h <C-w>H
"nnoremap <leader>j <C-w>J
"nnoremap <leader>k <C-w>K
"nnoremap <leader>l <C-w>L
nnoremap <C-Shift-h> <C-w><Shift-h>
nnoremap <C-Shift-j> <C-w><Shift-j>
nnoremap <C-Shift-k> <C-w><Shift-k>
nnoremap <C-Shift-l> <C-w><Shift-l>

" Easy window navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

If I use the remap with the leader key works ok but is not really how I would like the mapping to be.

The navigation works but the window positioning doesn't.

I would like to be able, if it is possible, to press Ctrl+Shift+[H,J,K,L] to move the panes around the screen.

I've tried:

" Easy window positioning
nnoremap <C-Shift-h> <C-w><Shift-h>
nnoremap <C-Shift-j> <C-w><Shift-j>
nnoremap <C-Shift-k> <C-w><Shift-k>
nnoremap <C-Shift-l> <C-w><Shift-l>

" Easy window positioning
nnoremap <C-Shift-H> <C-w><Shift-H>
nnoremap <C-Shift-J> <C-w><Shift-J>
nnoremap <C-Shift-K> <C-w><Shift-K>
nnoremap <C-Shift-L> <C-w><Shift-L>

" Easy window positioning
nnoremap <C-SHIFT-H> <C-w><SHIFT-H>
nnoremap <C-SHIFT-J> <C-w><SHIFT-J>
nnoremap <C-SHIFT-K> <C-w><SHIFT-K>
nnoremap <C-SHIFT-L> <C-w><SHIFT-L>

" Easy window positioning
nnoremap <C-S-H> <C-w><S-H>
nnoremap <C-S-J> <C-w><S-J>
nnoremap <C-S-K> <C-w><S-K>
nnoremap <C-S-L> <C-w><S-L>
5
  • 2
    Does this answer your question? Can I map a Ctrl + upper-case letter separately from Ctrl + lower-case letter? Furthermore, what you tried on the right-hand side won't work, what you wrote for the leader mappings is what you want: <C-w>H.
    – Biggybi
    Jul 21, 2020 at 14:48
  • 1
    Also welcome to Vi and Vim!
    – D. Ben Knoble
    Jul 21, 2020 at 16:32
  • @Biggybi Thank! that was really helpful. I'll try to use a different combination of keys. I was trying to mimic my gnome key bindings.
    – Zeek Lopez
    Jul 21, 2020 at 17:04
  • Yeah, I totaly get it. I too would like it to be easy to use these combinations, it'd be useful in some cases. Fortunately, there's plenty of combinations available on the keyboard, especially with vim chorded keys, so we can always get around any limitation.
    – Biggybi
    Jul 21, 2020 at 18:10
  • Just for the record I ended up using the <leader> [HJKL] config and is working fine for me.
    – Zeek Lopez
    Jul 29, 2020 at 14:17

0

Browse other questions tagged or ask your own question.