How to focus a particular window?

久未见 提交于 2019-12-24 08:48:23

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!