故障映射<C-j>在带有乳胶套件的 Vim 中 [英] Trouble mapping <C-j> in Vim with latex-suite

查看:24
本文介绍了故障映射<C-j>在带有乳胶套件的 Vim 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想映射 <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}<++>

问题总结:

  1. 映射后;<C-w>j, <C-j> 进入插入模式.
  2. imap 之后<Plug>IMAP_JumpForward<C-space> 不会跳转到下一个 <++> 占位符.它退出插入模式,光标后退一个字符.
  1. After map <C-j> <C-w>j, <C-j> goes into Insert mode.
  2. 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?

推荐答案

我建议两件事:

  1. 首先,定位映射:

  1. 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

    这篇关于故障映射&lt;C-j&gt;在带有乳胶套件的 Vim 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆