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


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

 

轉自:

http://blog.csdn.net/love__coder/article/details/6659103

 1,安裝NERDTree插件

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

  

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

  如果.vim下面沒有這些目錄,就手動創建。

  或者:

/home/wangkongming/下載/nerdtree
cp -r doc/ ~/.vim/
cp -r doc/ ~/.vim/

 

2,使用

  1、在linux命令行界面,用vim打開一個文件。

  2、輸入  :NERDTree ,回車

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

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

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

 

NERDTree快捷鍵

復制代碼
o 打開關閉文件或者目錄
t 在標簽頁中打開
T 在后台標簽頁中打開
! 執行此文件
p 到上層目錄
P 到根目錄
K 到第一個節點
J 到最后一個節點
u 打開上層目錄
m 顯示文件系統菜單(添加、刪除、移動操作)
? 幫助
q 關閉
復制代碼

 

附件是我電腦上面的vimrc里面的配置

復制代碼
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set nobackup
set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let eq = ''
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      let cmd = '""' . $VIMRUNTIME . '\diff"'
      let eq = '"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
    "顯示行號
     set nu!
     colorscheme desert 
     syntax enable 
     syntax on
     
    set encoding=utf-8
    set fileencodings=utf-8,chinese,latin-1
    if has("win32")
    set fileencoding=chinese
    else
    set fileencoding=utf-8
    endif
    "解決菜單亂碼
    source $VIMRUNTIME/delmenu.vim
    source $VIMRUNTIME/menu.vim
    "解決consle輸出亂碼
    language messages zh_CN.utf-8
"NERDTree快捷鍵
nmap <F2> :NERDTree  <CR>
" NERDTree.vim
let g:NERDTreeWinPos="left"
let g:NERDTreeWinSize=25
let g:NERDTreeShowLineNumbers=1
let g:neocomplcache_enable_at_startup = 1 

"默認最大化窗口打開
au GUIEnter * simalt ~x 
復制代碼

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM