@Scrazy
2016-12-14T03:40:21.000000Z
字数 4319
阅读 1539
vim
刚新装了 manjaro
于是,也重新配置下 Vim。先安装大杀器:
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
按照提示设置下。把下面一堆配置添加到 .vimrc
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)
Plugin 'file:///home/gmarik/path/to/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
我把第40行注释掉了,因为安装插件时报错。接下来就要安装本次要安装的插件啦以及简单配置。打开 Vundle 输入 :PluginInstall 回车即可。
[nerdtree]
vim-monokai
在 .vimrc 添加
`colorscheme monokai`
即可。
vim-autopep8
安装完成后要
此插件默认 F8 触发,可以更换自己喜欢的键位,如:F3 把下面代码添加到 .vimrc 即可。
autocmd FileType python map <buffer> <F3> :call Autopep8()<CR>
顺便添加一句
let g:autopep8_disable_show_diff=1
以便让其不会每次都提示格式化前后的差异。
nerdtree
添加快捷启动方式
map <C-n> :NERDTreeToggle<CR>
置于 .vimrc 即可
这是我的 .vimrc
```bash
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)
Plugin 'file:///home/gmarik/path/to/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'}
" youcompleteme
Plugin 'Valloric/YouCompleteMe'
"Nerdtree
Plugin 'scrooloose/nerdtree'
Plugin 'sickill/vim-monokai'
"Plugin 'Lokaltog/vim-powerline'
Plugin 'Yggdroot/indentLine'
Plugin 'tell-k/vim-autopep8'
Plugin 'jiangmiao/auto-pairs'
" 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
"按F5运行python"
map :Autopep8 :w :call RunPython()
function RunPython()
let mp = &makeprg
let ef = &errorformat
let exeFile = expand("%:t")
setlocal makeprg=python\ -u
set efm=%C\ %.%#,%A\ \ File\ \"%f\"\,\ line\ %l%.%#,%Z%[%^\ ]%\@=%m
silent make %
copen
let &makeprg = mp
let &errorformat = ef
endfunction
syntax on
let g:molokai_original = 1
set clipboard=unnamedplus
set nu!
set t_Co=256
set encoding=utf-8
" 解决Vundle 安装插件时报错,仅限fish shell
set shell=/bin/bash
colorscheme monokai
" 配置autopep8
let g:autopep8_disable_show_diff=1
autocmd FileType python map :call Autopep8()
" indentLine
let g:indentLine_setColors = 0
let g:indentLine_char = '|'
" 目录树 nerdtree
map :NERDTreeToggle
```此处输入链接的描述
以上只是本人总结,并不详细,难免有错误和疏漏,详细文档可去官网进行查看。