我经常会在快速修复、nerdtree或其他特殊窗口中按下Ctrl-O,以为自己在主窗口中。我想做的是回到我的主窗口中之前的位置。我还倾向于在我的快速修复窗口中打开bufexplorer,这会导致一些非常奇怪的问题。
有没有一种简单的方法可以在某些类型的缓冲区中忽略某些命令?
<NOP>
(无操作),例如在netrw中 (:e .)。nnoremap <C-o> <NOP>
"<C-o> no longer works
<buffer>
,可以得到良好的结果。<C-w>p
可以让你跳转到前一个窗口。
如果要在跳回之后向前跳转,可以按下Ctrl+I。
Like a web browser, you can go back, then forward:
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.
Display the jump list for the current window with:
:jumps
Your current location in the jump list is indicated with '>', and the first number in each row is a count that can be used to jump to that position. For example, after pressing Ctrl-O three times, the :jumps command may show something like this:
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
Given the above, you could press:
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.
In the example above: The last line was added to the jump list when the first Ctrl-O was pressed (so you can return to the initial position: line 53, column 102). Line 93 in the current buffer no longer exists (the jump location is invalid).
au BufEnter NERD_tree_* map
au BufEnter NERD_tree_* map
au BufEnter * call TurnOffQFCommands()
au BufEnter * call TurnOffQFCommands()
function! TurnOffQFCommands()
if &ft=="qf"
map
map
endif
endfunction
- notid