vim 樹形目錄插件NERDTree安裝及簡單用法

一、安裝NERDTree插件php

先下載,官網:http://www.vim.org/scripts/script.php?script_id=1658linux

解壓縮以後,把 plugin/NERD_tree.vim 和doc/NERD_tree.txt分別拷貝到~/.vim/plugin 和 ~/.vim/doc 目錄。vim


二、使用

一、在linux命令行界面,輸入vimide

二、輸入  :NERDTree ,回車this

三、進入當前目錄的樹形界面,經過小鍵盤上下鍵,能移動選中的目錄或文件spa

四、目錄前面有+號,摁Enter會展開目錄,文件前面是-號,摁Enter會在右側窗口展示該文件的內容,並光標的焦點focus右側。插件

五、ctr+w+h  光標focus左側樹形目錄,ctrl+w+l 光標focus右側文件顯示窗口。屢次摁 ctrl+w,光標自動在左右側窗口切換命令行

六、光標focus左側樹形窗口,摁? 彈出NERDTree的幫助,再次摁?關閉幫助顯示code

七、輸入:q回車,關閉光標所在窗口orm




Q. How can I open a NERDTree automatically when vim starts up?

A. Stick this in your vimrc: autocmd vimenter * NERDTree

Q. How can I open a NERDTree automatically when vim starts up if no files were specified?

A. Stick this in your vimrc

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

Q. How can I map a specific key or shortcut to open NERDTree?

A. Stick this in your vimrc to open NERDTree with Ctrl+n (you can set whatever key you want): map <C-n> :NERDTreeToggle<CR>

Q. How can I close vim if the only window left open is a NERDTree?

A. Stick this in your vimrc:

autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif

相關文章
相關標籤/搜索