vim安裝與配置

vim安裝與配置
1、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()


" 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 + .)
然後如果還想再縮進 , 按 “. ” 就可以重複前面的操作了

如果想要反縮進也很簡單,  把 “>” 改爲 “<” 就可以了。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章