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

轉自:php

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

 1,安裝NERDTree插件vim

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

  

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

  若是.vim下面沒有這些目錄,就手動建立。插件

  或者:命令行

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

 

2,使用code

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

  二、輸入  :NERDTree ,回車ip

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

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

  五、輸入: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 
複製代碼
相關文章
相關標籤/搜索