vim安裝與配置

vim安裝與配置
一、vim安裝
ubuntu下sudo apt-get install vim
centos下sudo yum install vim
mac os下brew install macvim

安裝完後,這麼配置
安裝Vundle管理插件



$ git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

接着修改 .vimrc 加上下面這段就能夠了

除了能夠直接裝上 vim-scripts 上面的外掛以外, 也能夠直接裝 github 上的 repo。 只須要修改 .vimrc 加上你要裝的 plugin, 像是 …

修改或建立一個.vimrc文件,內容以下:


"  配置vundle安裝
set nocompatible               " be iMproved
filetype off                   " required!

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()git


" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'

" My Bundles here:
"
" original repos on github
Bundle 'davidhalter/jedi-vim'
Bundle 'scrooloose/nerdtree'
Bundle 'kien/ctrlp.vim'
Bundle 'sjbach/lusty'
Bundle 'tpope/vim-fugitive'
Bundle 'vim-scripts/Syntastic'

" vim-scripts repos
Bundle 'L9'

" non github repos
" Bundle 'git://git.wincent.com/command-t.git'

"
" 一些基本配置
"
filetype plugin indent on     " required!
let mapleader = ','
let g:mapleader = ','

" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Use spaces instead of tabs
set expandtab

" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
"Always show current position
set ruler
"
"" Height of the command bar
set cmdheight=2

set nobackup
set noswapfile
set nowb

" 狀態欄配置
set laststatus =2 "always has status line
set statusline=%F%m%r%h%w\ [TYPE=%Y]\ [POS=%04l,%04v]\ [%p%%]  
set statusline+=%=\ %{fugitive#statusline()}
set statusline+=%{SyntasticStatuslineFlag()}


"
"插件相關配置
"

" NERDTree=====

map <F2> :NERDTreeToggle<CR>

"nmap  :NERDTreeToggle
"let NERDTreeWinSize=22
"let NERDTreeIgnore=['\.pyc', '\.swp']
"switch window


" LustyBufferExplorer=====
nnoremap lb :LustyBufExplorer
set hidden

"
" Brief help
" :BundleList          - list configured bundles
" :BundleInstall(!)    - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..
-------------------------------------
在命令方式下運行
以上內容是搜google來的
-------------------------------------
在命令方式下運行
:BundleInstall
-------------------------------------

1.插入註釋:
用v進入virtual模式
用上下鍵選中須要註釋的行數
按Control+v進入列模式
按大些「I」進入插入模式,輸入註釋符「#」,而後馬上按下ESC(兩下)

2.刪除註釋
先按Control+v進入列模式
按光標鍵選中須要刪除的註釋符
按x鍵刪除



鍵入 Ctrl+V
鍵入 「>」 (即shift + .)
而後若是還想再縮進 , 按 「. 」 就能夠重複前面的操做了

若是想要反縮進也很簡單,  把 「>」 改成 「<」 就能夠了。


github

相關文章
相關標籤/搜索