故障映射< C-j>在Vim中使用乳胶套件 [英] Trouble mapping <C-j> in Vim with latex-suite
问题描述
我想映射<C-j>
切换到当前窗口下方的下一个窗口
I wanted to map <C-j>
to switch to the next window below the current one
map <C-j> <C-w>j
但是,它进入了插入模式,而不是移动下面的窗口.为什么?
However, it goes into Insert mode instead of moving the window below. Why?
我已经安装了latex-suite
.所以我试图查询<C-j>
映射到什么
I have latex-suite
installed. So I tried to query what <C-j>
is mapped to
:map <C-j>
我得到以下输出:
v <NL> <Plug>IMAP_JumpForward
n <NL> <Plug>IMAP_JumpForward
o <NL> <C-W>j
这意味着我应该更改<Plug>IMAP_JumpForward
的映射.我读了一些,发现它与<++>
占位符有关,您可以在插入模式下使用<C-j>
跳转到该占位符.因此,根据我的阅读,我了解到可以使用.vimrc
中的以下行来更改映射:
This means that I should change the mapping of <Plug>IMAP_JumpForward
. I read around a bit and I found out it's related to the <++>
placeholders that you can jump to using <C-j>
during Insert mode. So, based on my reading, I learned I could change the mapping using the following line in .vimrc
:
imap <C-space> <Plug>IMAP_JumpForward
但是不,它不能像<C-j>
那样工作.我会尝试说明.我输入以下内容(_
代表光标):
But no, it doesn't work as <C-j>
used to. I'll try to illustrate. I type the following (the _
represents the cursor):
\documentclass{}_
然后我得到
\documentclass{_}<++>
然后我尝试输入一些文字
Then I try to type in some text
\documentclass{article_}<++>
所以现在我按<C-space>
.这就是发生的情况:它退出了插入"模式,我将处于以下情况:
So now I press <C-space>
. This is what happens: it goes out of Insert mode and I'll be in the following situation:
\documentclass{articl_e}<++>
问题摘要:
-
map <C-j> <C-w>j
之后,<C-j>
进入插入模式. -
imap <C-space> <Plug>IMAP_JumpForward
之后,<C-space>
不会跳到下一个<++>
占位符.它退出了插入"模式,并且光标备份了一个字符.
- After
map <C-j> <C-w>j
,<C-j>
goes into Insert mode. - After
imap <C-space> <Plug>IMAP_JumpForward
,<C-space>
doesn't jump to the next<++>
placeholder. It goes out of Insert mode and cursor backs up one character.
怎么了?我错过了什么吗?
What's the matter? Anything I missed?
推荐答案
我建议两件事:
-
首先,定位映射:
firstly, target the mappings:
nnoremap <C-j> <C-w>j
其次,找出这样做会干扰哪些映射(以及它们来自何处)
secondly, find out what mappings interfere (and where they come from) by doing
verbose nmap <C-j>
verbose nmap <C-w>
verbose nmap j
另请参阅:map
,:imap
,:vmap
,:noremap
等.
这篇关于故障映射< C-j>在Vim中使用乳胶套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!