vim的插件管理器Vundle的使用

2019-06-15  本文已影响0人  beeworkshop

地址https://github.com/VundleVim/Vundle.vim

  1. 下载源码:

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

  1. 如果~/.vim/bundle目录不存在,则新建目录:

cd ~
mkdir -p .vim/bundle
将下列配置放在.vimrc文件的开头:
注意:" 表示vim配置的注释

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()
 
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
 
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

如果想下载某个插件,比如自动缩进indentpython.vim插件,需要将Plugin 'vim-scripts/indentpython.vim'置于call vundle#begin()和call vundle#end()之间,保存配置后在vim中执行

:PluginInstall

即可以自动下载indentpython.vim插件了。

  1. bundle可以管理下载几种不同的插件,方式如下:

下载方式除了在vim中运行:PluginInstall外,还可以在命令行中运行:

vim +PluginInstall +qall

其它常用的命令:

: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
  1. 安装插件

安装:

Plugin 'Yggdroot/indentLine'

开关:

:IndentLinesToggle
默认Tab键是功能切换键
可以定义一个快捷键
map <C-i> :IndentLinesToggle<CR>

注意:
上边的<C-i>表示Ctrl + i,而:IndentLinesToggle表示对应的命令。
<CR>表示回车。

地址https://github.com/Yggdroot/indentLine

首先安装autopep8:

$ pip install autopep8

Plugin 'tell-k/vim-autopep8'

可以设置快捷键F8代替:Autopep8:

autocmd FileType python noremap <buffer> <F8> :call Autopep8()<CR>

注意:
:q退出当前窗口
Ctrl + w(两下)可以在窗口间跳动

Plugin 'vim-scripts/indentpython.vim'
Plugin 'vim-syntastic/syntastic'
Plugin 'altercation/vim-colors-solarized'

syntax enable
set background=light 或者 dark
colorscheme solarized
Plugin 'scrooloose/nerdtree'

开关树形目录的快捷键:
map <C-n> :NERDTreeToggle<CR>

注意:
上边的<C-n>表示Ctrl + n,而:NERDTreeToggle表示对应的命令。
<CR>表示回车。

Plugin 'jiangmiao/auto-pairs'
上一篇 下一篇

猜你喜欢

热点阅读