Vim配置

這幾天基本都在服務器寫代碼,只有VIM能用生撕代碼實在彆扭javascript

首先在~創建.vimrcphp

而後下載Vundle.vimhtml

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

  

安裝 YouCompleteMe 的時候須要編譯一下java

cd ~/.vim/bundle
git clone https://github.com/Valloric/YouCompleteMe.git
git submodule update --init --recursive ./install.py --all
而後 在.vimrc 裏面添加
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py'

  

set number
" 顯示標尺
set ruler
" 歷史紀錄
set history=1000
" 輸入的命令顯示出來,看的清楚些
set showcmd
" 狀態行顯示的內容
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")}
" 啓動顯示狀態行1,老是顯示狀態行2
set laststatus=2
" 語法高亮顯示
syntax on
set fileencodings=utf-8,gb2312,gbk,cp936,latin-1
set fileencoding=utf-8
set termencoding=utf-8
set fileformat=unix
set encoding=utf-8
" 配色方案
colorscheme desert
" 指定配色方案是256色
set t_Co=256

set wildmenu

" 去掉有關vi一致性模式,避免之前版本的一些bug和侷限,解決backspace不能使用的問題
set nocompatible
set backspace=indent,eol,start
set backspace=2

" 啓用自動對齊功能,把上一行的對齊格式應用到下一行
set autoindent

" 依據上面的格式,智能的選擇對齊方式,對於相似C語言編寫頗有用處
set smartindent

" vim禁用自動備份
set nobackup
set nowritebackup
set noswapfile

" 用空格代替tab
set expandtab

" 設置顯示製表符的空格字符個數,改進tab縮進值,默認爲8,現改成4
set tabstop=4

" 統一縮進爲4,方便在開啓了et後使用退格(backspace)鍵,每次退格將刪除X個空格
set softtabstop=4

" 設定自動縮進爲4個字符,程序中自動縮進所使用的空白長度
set shiftwidth=4

" 設置幫助文件爲中文(須要安裝vimcdoc文檔)
set helplang=cn

" 顯示匹配的括號
set showmatch

" 文件縮進及tab個數
au FileType html,python,vim,javascript setl shiftwidth=4
au FileType html,python,vim,javascript setl tabstop=4
au FileType java,php setl shiftwidth=4
au FileType java,php setl tabstop=4
" 高亮搜索的字符串
set hlsearch

" 檢測文件的類型
filetype on
filetype plugin on
filetype indent on

" C風格縮進
set cindent
set completeopt=longest,menu

" 功能設置

" 去掉輸入錯誤提示聲音
set noeb
" 自動保存
set autowrite
" 突出顯示當前行 
set cursorline
" 突出顯示當前列
"set cursorcolumn
"設置光標樣式爲豎線vertical bar
" Change cursor shape between insert and normal mode in iTerm2.app
"if $TERM_PROGRAM =~ "iTerm"
let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode
let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode
"endif
" 共享剪貼板
set clipboard+=unnamed
" 文件被改動時自動載入
set autoread
" 頂部底部保持3行距離
set scrolloff=3

"安裝插件
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'jiangmiao/auto-pairs'
Plugin 'Lokaltog/vim-powerline'
call vundle#end()
filetype plugin indent on

 參考:https://www.jianshu.com/p/f0513d18742apython

https://my.oschina.net/chaenomeles/blog/824604git

相關文章
相關標籤/搜索