I want to use ctrl + arrow keys to resize windows created from window splitting, following this video by DistroTube.
" use arrow keys to resize windows
noremap <silent> <C-Left> :vertical resize +3<CR>
noremap <silent> <C-Right> :vertical resize -3<CR>
noremap <silent> <C-Up> :resize +3<CR>
noremap <silent> <C-Down> :resize -3<CR>
The above works well in Windows 10. However, in my terminal in Mac OS only ctrl+Left and ctrl+Right are working for resizing window width, and Ctrl+Up and ctrl+Down don’t resize window height as expected. Instead, they result in the cursor moving up or down.
User Mars_kritiqual on reddit suggested me to use nnoremap
instead of noremap
, and swap the key mappings for and as shown below.
" use arrow keys to resize windows
nnoremap <silent> <C-Left> :vertical resize +3<CR>
nnoremap <silent> <C-Right> :vertical resize -3<CR>
nnoremap <C-Up> :resize -3<CR>
nnoremap <C-Down> :resize +3<CR>
However, it still doesn’t work for the and key mappings.
May I ask if I missed anything here, especially relevant to the Mac OS system?
Thanks.
PS: Strangely, all four key mappings shown above work well inside vscode’s terminal which is the same (zsh) terminal of the Mac OS system by default…