mapping function keys in vim

后端 未结 2 378
感情败类
感情败类 2020-12-29 23:53

I want to map my F2 for nerdtree with the following entry:

map  :NERDTreeToggle

But even before that, and

2条回答
  •  佛祖请我去吃肉
    2020-12-30 00:11

    Your problem is that vim does not know what does terminal emit when you press . On some terminals it emits something like [12~, so the vim quits current mode (or just beeps if it can't) (), does nothing ([1: there must be some key after [, but not 1, so it does nothing) and changes case of two letters (2~). So, you should open .vimrc and write there the following:

    set =

    where means that you must press and then . This line should tell the Vim the exact sequence of codes which is emitted by terminal when you press . After that, use noremap whatever and it should work. If it is not the only terminal that you are using, then you may want to put if $TERM==#"=$TERM" before this line and endif after.

提交回复
热议问题