Linux-Vim插件-Nerdtree

1. 下载插件

  • 进入.vim/bundle目录.
  • 执行git clone https://github.com/scrooloose/nerdtree.
  • 下载完成后,在bundle下会多出一个nerdtree的文件夹,所有相关插件都在该文件夹下.
  • 在终端进入项目文件夹, 输入vim .,即可看到树形目录.

2.创建 .vimrc文件

~ cat  .vimrc
filetype plugin indent on

set smartindent
set autowrite
set enc=utf-8
set backspace=indent,eol,start

set fileencodings=utf-8,gbk,ucs-bom,cp936,latin1,big5,utf-16

set encoding=utf-8
set fileencoding=utf-8
set termencoding=utf-8

set nowrap
set backspace=indent,eol,start
set nobackup
set showcmd
set sts=4
set autoindent
set history=1000
set incsearch
set laststatus=2
set matchtime=2
set hlsearch
set ruler


set scrolloff=10
set showmatch
set showcmd
set tabstop=4
set softtabstop=4

map <silent> bu :w<cr>:!sh build.sh  <cr>
map <silent> bb :w<cr>:!sh svn.sh <esc>
map <silent> co :w<cr>:!sh copy.sh <esc>
map <silent> bn :w<cr>:! ~/php/bin/php http.php <esc>

map <F9> O/*<CR>@brief: <CR>@date:[<Esc>:read !date <CR>kJ$a]<CR>@author: wuyanfei<CR>@param: <CR>@return: <CR>/<ESC><s-i><backspace><ESC>

nmap <leader>w :w<CR>
nmap <leader>q :q<CR>
au BufRead * set whichwrap=<,>,h,l
au BufRead,bufNewFile * set nobackup

au BufRead,bufNewFile *.inc  set filetype=html.javascript
au BufRead,bufNewFile *.tpl  set filetype=html.javascript
au BufRead,bufNewFile *.html set filetype=html.javascript
au BufRead,bufNewFile *.php set filetype=php
au BufRead,bufNewFile *.java set filetype=java

nmap q :q!

nmap <silent> ( 5<c-w><
nmap <silent> ) 5<c-w>>
nmap <silent> - 10<c-w>-
nmap <silent> = 10<c-w>+
nmap <c-j> <c-w>j
nmap <c-k> <c-w>k
nmap <c-h> <c-w>h
imap <silent> <c-w> <esc>:w<cr>
nmap <c-p> <s-o><esc>jo<esc>h

nmap <silent> <s-s> <esc>:w<cr>
nmap <silent> ee zR
nmap cp yaw
nmap p <s-p>

set nocp
autocmd FileType php set omnifunc=phpcomplete#CompletePHP

""""""""
" ctags
"""""""""
let generate_tags=1
let g:ctags_title=1
let g:ctags_statusline=1
set tags=tags;

""""""""
" taglist
""""""""
let Tlist_Ctags_Cmd='/usr/bin/ctags'
map <c-x> :Tlist<cr>

""""""""""""""""
"winManager
""""""""""""""""
let g:winManagerWindowLayout = "BufExplorer,FileExplorer|TagList"
let g:winManagerWidth = 30
let g:defaultExplorer = 0
map wm :WMToggle<cr>
map <c-w><c-t> :WMToggle<cr>
map <tab> <c-w><c-w>
map tp :tabp<cr>
map tn :tabn<cr>
map tt <c-t>
map ff <c-]>
set clipboard+=unnamed
set novisualbell

""""""""""""""""""""""""""""
" NERDTree
""""""""""""""""""""""""""""
map nd :NERDTree
map nc :NERDTreeClose



""""""""""""""""""""""""""""""
" netrw setting
""""""""""""""""""""""""""""""
let g:netrw_winsize = 30
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")|execute("normal `\"")|endif
vnoremap < <gv
vnoremap > >gv

colorscheme koehler

"set foldmethod=marker
"set foldmethod=indent
"set foldmethod=manual

set formatoptions+=tcrqvmMB
let mapleader = ","

nmap <silent> <F6> :set number!<CR>
nmap <silent> <F8> :set nowrap!<CR>
nmap <silent> <leader>cl :set nowrap!<CR>
nmap <HOME> ^i
imap <HOME> <ESC>^i

set nu
syntax on
set shiftwidth=4


"set rtp+=~/.vim/bundle/vundle/
"call vundle#rc()
"Bundle 'gmarik/vundle'
"Bundle 'tpope/vim-fugitive'
"Bundle 'Lokaltog/vim-easymotion'
"Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
"Bundle 'tpope/vim-rails.git'
"Bundle 'L9'
"Bundle 'php.vim'
"Bundle 'pig.vim'
"Bundle 'php-doc'
"Bundle 'php_check_syntax.vim'
"Bundle 'php_funcinfo.vim'
"Bundle 'php_template'
"Bundle 'The-NERD-tree'
"Bundle 'FuzzyFinder'
"Bundle 'git://git.wincent.com/command-t.git'

"Bundle 'desert256.vim'
"Bundle 'Impact'
"Bundle 'matrix.vim'
"Bundle 'vibrantink'
"Bundle 'tir_black'
"Bundle 'vividchalk.vim'
"Bundle 'molokai'

augroup filetypedetect
	au BufNewFile,BufRead *.pig set filetype=pig syntax=pig
augroup END

map \\ :call AddComment()<cr>
func AddComment()
	if &filetype == 'cpp'
		if matchstr(getline('.'), '[^ \t]') == '/'
			normal ^xx
		else
			normal ^i//
		endif
	else
		if matchstr(getline('.'), '[^ \t]') == '#'
			normal ^x
		else
			normal ^i#
		endif
	endif
endfunc

快捷键介绍

效果:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值