經常使用vimrc記錄

記錄下vim 的一些經常使用配置。每當換到一臺新電腦的時候,使用vim的時候,縮進等各類方式都不友好。每次都要到互聯網上去找,還要找半天,這篇博客,記錄下我經常使用的vim配置,以及擴展,可以快速的配置開發環境。提升工做效率,省下的時間用來玩耍或者陪家人朋友。html

set nu
  if has("autocmd")
    au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

set number   "顯示行號
set nowrap   "不換行
set shiftwidth=4  "默認縮進4個空格
set softtabstop=4  "使用tab時 tab空格數
set tabstop=4  "tab表明4個空格
set laststatus=2  "老是顯示狀態行

"backspace鍵
" indent 刪除自動縮進的值
" eol 刪除上一行行末尾的回車,兩行合併
" start 除了剛輸入的,還刪除原來的字符
set backspace=indent,eol,start
set expandtab "使用空格替換tab

set autoindent " 自動縮進
colorscheme evening  "顏色模式

syn on  "語法高亮
filetype on "文件類型

set encoding=utf-8 "編碼爲utf8

安裝vim 的擴展管理插件

Vundle是一款Vim的插件管理軟件(Linux),用起來很方便的緣由有幾點:git

  • 支持插件超多,能夠來源於github、Vundle自帶、Vim-scripts、本地倉庫等等。
  • 安裝流程很是簡單,配置好vimrc後一鍵安裝/更新全部
  • Vundle很容易上手,很方便

下載vundle到指定位置

$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

添加以下配置文件github

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

參考資料
http://www.javashuo.com/article/p-vxthqddw-kn.htmlvim

相關文章
相關標籤/搜索