ctrl+pgup
和 ctrl+pgdn
键组合。Vim的语法不起作用(即<PageUp>
和<PageDown>
,或<C-PageUp>
和<C-PageDown>
)。由于默认的Vim语法无效,我猜测终端没有发送Vim所期望的
ctrl+pgup
和ctrl+pgdn
字符代码。如果是这样,我不知道如何找到字面键码。我在Arch Linux上使用xfce4-terminal。这是我尝试过的:
The usual method:
map <C-PageUp> :bp<cr>
Setting it from the command line with this answer's method: Why <C-PageUp> and <C-PageDown> not work in vim?
:map <CTRL-V><CTRL-PAGEUP> :bp<cr>
When I type the command above in the command line, nothing shows:
map :bp<cr>
And Vim says
No mapping found
.This method from the Vim wiki: http://vim.wikia.com/wiki/Mapping_keys_in_Vim_-Tutorial(Part_2)#Key_notation
set <PageUp>=<type Ctrl-V><type PageUp> "^[[5~ map <C-PageUp> :bp<cr>
A modification of that answer:
set <C-PageUp>=<type Ctrl-V><type Ctrl+PageUp> "^M map <C-PageUp> :bp<cr>
After realizing that
<type *>
was a user command, I did these commands, and vim pasted output. I replaced<type *>
with this output:set <PageUp>=^[[5~ map <C-PageUp> :bp<cr> " Also: set <PageUp>=[[5~ map <C-PageUp> :bp<cr> " Also: set <PageUp>=<^[[5~> map <C-PageUp> :bp<cr> " Also: set <PageUp>=<[[5~> map <C-PageUp> :bp<cr> " Also: set <C-PageUp>=^M map <C-PageUp> :bp<cr> " Also: set <C-PageUp>=<^M> map <C-PageUp> :bp<cr>
Trying all of the methods in 5, but without setting an option first. E.g.:
map <C-[[5~> :bp<cr>
The method from this answer: https://groups.google.com/forum/#!topic/vim_use/j85-2xQkb7s
map [5~ :bp<cr>
The method from this answer: https://superuser.com/questions/322983/how-to-let-ctrl-page-down-switch-tabs-inside-vim-in-terminal-app
map \033[5;5~ :bp<cr>
Setting different term options:
set term=xterm " Also: set term=xterm-256color
My
$TERM
environment variable is set toxterm
.Using some of the methods which this answer hints at: https://superuser.com/questions/480215/how-to-map-pagedown-and-pageup-keys-to-function-normally
map <Esc>[5~ :bp<cr> map <kpp> :bp<cr>
- Trying everything above with a file under
.vim/after/plugin/
instead of in.vimrc
. - Trying everything above with
:MBEbp
instead of:bp
.
我还能尝试什么?
pgup
字符的下一个字面值时,它显示为^[[5~
。如果我用ctrl+pgup
尝试同样的操作,就不会显示任何东西。如果我按下ctrl+pgup
然后再按enter
,它会显示^M
,但这和只按enter
所显示的字符相同。这是否意味着vim无法读取此键组合? - GreenRaccoon23