简体   繁体   English

Vim功能在终端Vim中不响应

[英]Vim function won't respond in terminal vim

I stumbled upon a function that is similar to a feature in Textmate. 我偶然发现了一个与Textmate中的功能相似的功能。

That displays the highlighting groups for the current word. 这将显示当前单词的突出显示组。

Everything works perfectly in gvim,but won't get an output when using vim, which leaves me puzzled. 一切在gvim中都可以正常运行,但是在使用vim时不会得到输出,这让我感到困惑。

Here is the relevant part: 这是相关的部分:

nmap <C-S-P> :call <SID>SynStack()<CR>
function! <SID>SynStack()
  if !exists("*synstack")
    return
  endif
  echo map(synstack(line('.'), col('.')), 
  \       'synIDattr(v:val, "name")')
endfunc$

My question is why it behaves like this and how to fix it, if possible -.- 我的问题是,为什么它会这样,以及如何解决(如果可能)-.-

I appreciate any help that one can provide. 感谢您能提供的任何帮助。

The problem was this line: 问题是这一行:

nmap <C-S-P> :call <SID>SynStack()<CR>

which asks vim to map c ontrol s hift p to the SynStack macro. 它要求VIM到呼叫控制小号 HIFT p映射到SynStack宏。 However, terminals such as xterm, which ultimately use ASCII characters and ECMA-48 control sequences have no way to treat these as distinct: 但是,最终使用ASCII字符和ECMA-48控制序列的诸如xterm之类的终端无法将它们区别对待:

  • c ontrol s hift P 呼叫控制小号 HIFT P
  • c ontrol s hift p 呼叫控制小号 HIFT p
  • c ontrol P 呼叫控制P
  • c ontrol p 呼叫控制p

They all come in as control P (ignoring case). 它们全部作为控件 P进入(忽略大小写)。 gvim works in a different environment, where most combinations of modifiers can be distinguished from each other. gvim在不同的环境中工作,在该环境中,可以将大多数修饰符组合区分开。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM