我曾经是一个普通的Vim,但是最后我引入了插件管理。时间备忘录
dein.vim
https://github.com/Shougo/dein.vim
NeoBundle似乎仅支持错误修复,因此请使用dein.vim。
安装
1 2 | $ curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh $ sh ./installer.sh {インストールディレクトリ} |
当您执行
installer.sh时,将显示以下代码,因此添加vimrc并确定
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | Please add the following settings for dein to the top of your vimrc (Vim) or init.vim (NeoVim) file: "dein Scripts----------------------------- if &compatible set nocompatible " Be iMproved endif " Required: set runtimepath+=~/.vim/dein/repos/github.com/Shougo/dein.vim " Required: if dein#load_state('~/.vim/dein/') call dein#begin('~/.vim/dein/') " Let dein manage dein " Required: call dein#add('~/.vim/dein/repos/github.com/Shougo/dein.vim') " Add or remove your plugins here: call dein#add('Shougo/neosnippet.vim') call dein#add('Shougo/neosnippet-snippets') " You can specify revision/branch/tag. call dein#add('Shougo/vimshell', { 'rev': '3787e5' }) " Required: call dein#end() call dein#save_state() endif " Required: filetype plugin indent on syntax enable " If you want to install not installed plugins on startup. "if dein#check_install() " call dein#install() "endif "End dein Scripts------------------------- Done. Complete setup dein! |
之后,如下
如果您编写插件似乎不错,但是似乎可以使用toml文件管理插件,因此我将创建一个文件来与vimrc分开管理插件并加载它。
创建插件列表
这一次,我将dein.vim的安装目录设置为
1 2 | $ cd ~/.vim/dein $ mkdir userconfig |
plugins.toml
指定在启动时要加载的插件。
?/ .vim / dein / userconfig / plugins.toml
1 2 3 4 5 | [[plugins]] repo = 'Shougo/dein.vim' [[plugins]] repo = 'Shougo/vimproc.vim' |
plugins_lazy.toml
在某些情况下加载插件。
例如,仅当编写python
时,才能加载python插件。
?/ .vim / dein / userconfig / plugins_lazy.toml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [[plugins]] repo = 'Shougo/unite.vim' # unite.vim を読み込んだら一緒に読み込む [[plugins]] repo = 'Shougo/neomru.vim' on_source = ['unite.vim'] [[plugins]] repo = "davidhalter/jedi-vim" on_ft = ['python'] [[plugins]] repo = 'fatih/vim-go' on_ft = ['go'] |
可以通过启动vim并按
条件指定之类的详细信息。
修复vimrc
修复了vimrc,以便可以从toml加载
插件。顺便说一句,如果您没有dein.vim,则可以自动安装。
vimrc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | "dein Scripts----------------------------- if &compatible set nocompatible " Be iMproved endif let s:dein_path = expand('~/.vim/dein') let s:dein_repo_path = s:dein_path . '/repos/github.com/Shougo/dein.vim' " dein.vim がなければ github からclone if &runtimepath !~# '/dein.vim' if !isdirectory(s:dein_repo_path) execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_path endif execute 'set runtimepath^=' . fnamemodify(s:dein_repo_path, ':p') endif if dein#load_state(s:dein_path) call dein#begin(s:dein_path) let g:config_dir = expand('~/.vim/dein/userconfig') let s:toml = g:config_dir . '/plugins.toml' let s:lazy_toml = g:config_dir . '/plugins_lazy.toml' " TOML 読み込み call dein#load_toml(s:toml, {'lazy': 0}) call dein#load_toml(s:lazy_toml, {'lazy': 1}) call dein#end() call dein#save_state() endif " Required: filetype plugin indent on syntax enable " インストールされていないプラグインがあればインストールする " If you want to install not installed plugins on startup. if dein#check_install() call dein#install() endif "End dein Scripts------------------------- |
检查安装清单
检查vim上安装的插件。
打开test.py和
test.py
1 2 3 | # -*- coding: utf-8 -*- print('hello') |
执行
1 2 3 4 5 6 7 | Shougo/dein.vim # cespare/vim-toml Shougo/vimproc.vim # fatih/vim-go Shougo/neomru.vim Shougo/unite.vim davidhalter/jedi-vim |
列表显示如下
在plugins_lazy.toml中的特定条件下指定的插件为注释。由于我打开了python文件,因此
绝地武士
如果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | jedi-vim.txt - For Vim version 7.3 - Last change: 2014/07/29 __ _______ _______ __ ____ ____ __ .___ ___. | | | ____|| \ | | \ \ / / | | | \/ | | | | |__ | .--. || | _____\ \/ / | | | \ / | .--. | | | __| | | | || | |______\ / | | | |\/| | | `--' | | |____ | '--' || | \ / | | | | | | \______/ |_______||_______/ |__| \__/ |__| |__| |__| jedi-vim - awesome Python autocompletion with Vim ============================================================================== Contents jedi-vim-contents 1. Introduction jedi-vim-introduction 2. Installation jedi-vim-installation 2.0. Requirements jedi-vim-installation-requirements 2.1. Manually jedi-vim-installation-manually 2.2. Using Pathogen jedi-vim-installation-pathogen 2.3. Using Vundle jedi-vim-installation-vundle 2.4. Installing from Repositories jedi-vim-installation-repos 3. Supported Python features jedi-vim-support 4. Usage jedi-vim-usage 5. Mappings jedi-vim-keybindings 5.1. Start completion g:jedi#completions_command 5.2. Go to definition g:jedi#goto_command 5.3. Go to assignment g:jedi#goto_assignments_command 5.4 Go to definition (deprecated) g:jedi#goto_definitions_command 5.5. Show documentation g:jedi#documentation_command |
*就我而言,没有显示帮助屏幕,因此我在helptags中指定了运行时路径并执行了它。
由于帮助指向
执行
上瘾点
Vim启动时
pyenv切换版本。
经过调查,似乎需要重新编译python
https://rcmdnk.com/blog/2014/12/25/computer-vim/
补救措施
1 2 3 4 5 6 7 8 | ## pythonのバージョンを system に戻す $ pyenv global system $ pyenv versions * system (set by /Users/suyong/.pyenv/version) 3.6.2 ## vim の再インストール $ brew reinstall vim --HEAD |
参考站点
从NeoBundle切换到dein.vim时具有爆炸性的故事
移至dein.vim
[Python环境维护] De-NeoBundle。准备带有dein的超级方便的互补插件jedi-vim的环境,并将其设置为舒适
Vim注意:使用jedi-vim的Python输入完成
安装并使用Dein.vim。
使用dein.vim管理Vim插件
在Mac上使vim成为Python开发环境。