Open zhangshiboaa opened 1 year ago
The issue you're experiencing where the Alt+Left and Alt+Right keyboard shortcuts are not working as expected in Vim is likely due to Vim's keybindings conflicting with your terminal emulator or desktop environment's shortcuts. Vim has its own keybindings that might interfere with the system-wide shortcuts.
To resolve this issue, you can consider the following steps:
Check Vim Configuration:
.vimrc
or .vimrc.local
, to see if you have any custom key mappings that might override the Alt+Left and Alt+Right shortcuts. Look for lines like map
or noremap
that could be causing the conflict.Check Terminal Emulator Shortcuts:
Vim Key Mapping:
You can remap Vim's keybindings to use different key combinations if needed. For example, you can add the following lines to your .vimrc
to map Alt+Left and Alt+Right to switch between tabs:
" Map Alt+Left to switch to previous tab
nnoremap <M-Left> :tabprevious<CR>
inoremap <M-Left> <Esc>:tabprevious<CR>
" Map Alt+Right to switch to next tab
nnoremap <M-Right> :tabnext<CR>
inoremap <M-Right> <Esc>:tabnext<CR>
These mappings will allow you to use Alt+Left and Alt+Right to switch between Vim tabs.
Terminal Emulator Configuration:
Desktop Environment Shortcuts:
Test in Different Terminal Emulators:
1: I checked the vim configuration of the server and there is nothing map related. The same problem will occur in vi, I'm not sure about the other editors 2&4: my Terminal Emulator is tabby, so that i commit issue here. and i'm sure that there is no shortcuts conflicts in tabby's shortcuts settings 3: I have a large number of servers to access, and they are public, so I can't add vim configurations at will. 5: I am using Windows 11, I think there is no alt+left conflict configuration, and it is used when tabby is in focus, should not be obtained by other app shortcut keys 6: Previously, I used Xshell and configured the same shortcut keys and did not encounter this problem
I met the same problem today. Alt key won't work in vim with Alt/Meta setting off which in Setting-Terminal-Keyboard. But after set the setting on, there still another problem that quick tap
Describe the problem: i use alt+left and right to switch tab, but it's not work when i edit the file with vim. The function of the shortcut keys is replaced by word jumping