问题
I use NERDTree plugin, and I want to create a mapping that focuses NERDTree window and enters search mode (to easily select files, of course). The difficult part here is focusing NERDTree window. I want the mapping to work from any window - even from the NERDTree window itself. So how can I focus that window using vimscript?
I found out that NERDTree's buffer has name "NERD_tree_1" (if only one NERDTree buffer exists, but that's enough for me). Can I somehow use it to focus a window containing that buffer?
回答1:
use the :NERDTreeFocus command. You can bind it to a key, for example:
noremap <F2> :NERDTreeFocus <BAR> call feedkeys('/') <CR>
来源:https://stackoverflow.com/questions/12127439/how-to-focus-a-particular-window