忽略错误vim窗口中的某些命令
很常见的情况是,我在quickfix、nerdtree或其他特殊窗口中按Ctrl-O键,以为自己在主窗口中。我要做的是回到我的主窗口中以前的位置。我也会犯这个错误,在我的quickfix窗口中由bufexplorer打开,这会导致一些非常奇怪的问题忽略错误vim窗口中的某些命令,vim,keyboard,ignore,buffer,Vim,Keyboard,Ignore,Buffer,很常见的情况是,我在quickfix、nerdtree或其他特殊窗口中按Ctrl-O键,以为自己在主窗口中。我要做的是回到我的主窗口中以前的位置。我也会犯这个错误,在我的quickfix窗口中由bufexplorer打开,这会导致一些非常奇怪的问题 有没有一种简单的方法可以忽略某些类型缓冲区中的某些命令 您始终可以将某些内容映射到(无操作) 例如在netrw中(:e.) nnoremap “不再有效 当然,这种方法的适用性取决于所讨论的情况。与自动命令中的文件类型和相结合,可能会产生良好的效果
有没有一种简单的方法可以忽略某些类型缓冲区中的某些命令 您始终可以将某些内容映射到
(无操作)
例如在netrw中(:e.)
nnoremap
“不再有效
当然,这种方法的适用性取决于所讨论的情况。与自动命令中的文件类型和
相结合,可能会产生良好的效果。要在向后跳转后向前跳转,可以按Ctrl+I
发件人:
与web浏览器一样,您可以先返回,然后再前进:
Press Ctrl-O to jump back to the previous (older) location.
Press Ctrl-I (same as Tab) to jump forward to the next (newer) location.
使用以下内容显示当前窗口的跳转列表:
:jumps
跳转列表中的当前位置用“>”表示,并且
每行的第一个数字是一个可用于跳转到该数字的计数
位置。例如,按Ctrl-O三次后:跳转
命令可能会显示如下内容:
jump line col file/text
4 102 0 somefile.txt
3 93 0 -invalid-
2 23 0 the current line 23 is shown here
1 89 34 the current line 89 is shown here
> 0 22 40 Display the jump list for the current window with:
1 39 0 the current line 39 is shown here
2 995 0 anotherfile.txt
3 53 102 the current line 53 is shown here
鉴于上述情况,您可以按:
Ctrl-I to jump to line 39 in the current buffer.
Ctrl-O to jump to line 89 in the current buffer.
4 then Ctrl-O to jump to line 102 in file somefile.txt.
3 then Ctrl-I to jump to line 53 in the current buffer.
在上面的示例中:最后一行是在
按下了第一个Ctrl-O键(因此您可以返回到初始值)
位置:第53行,第102列)。当前缓冲区编号中的第93行
不再存在(跳转位置无效)
p
让我们转到上一个窗口。对不起,我不是很清楚。我知道如何在历史中来回移动。只是我想忽略这些命令或将它们重定向到正确的窗口。谢谢你的帮助。@notid啊,我的错。不过,我认为不可能重新映射vim命令以跨多个窗口工作ows,但我希望为了你我错了)。谢谢,这很有效,至少对nerdtree来说是这样。我还没有完全让它在quickfix窗口中起作用,因为当quickfix窗口打开时,它不算作bufenter。如果我离开并重新进入quickfix窗口,它会起作用。下面是我的.vimrc:`au bufenter NERD_tree.*map au BufEnter NERD_tree_*map au BufEnter*调用TurnOffQFCommands()au BufEnter*调用TurnOffQFCommands()函数!TurnOffQFCommands()if&ft==“qf”map endif end函数`
Ctrl-I to jump to line 39 in the current buffer.
Ctrl-O to jump to line 89 in the current buffer.
4 then Ctrl-O to jump to line 102 in file somefile.txt.
3 then Ctrl-I to jump to line 53 in the current buffer.