Linux vim插件安装

在写Python的过程中经常会遇到依赖包在Linux可以轻松安装却在Windows上安装不了的情况,除了在Linux桌面发行版上开,还可以在Linux下搭建一个编辑器,下面就记录一下给vim安装依赖插件的过程。

首先安装git 和 vim,git 其中是用来下载插件包的,使用 apt install -y vim git来安装(Ubuntu),yum  install -y vim git(centos)。

vim的插件都是默认安装在~/.vim下面,vim缺乏默认的插件管理器,如果每个插件都手动下载然后在vi ~/.vimrc中配置的话会很繁琐很费劲,所以选用Vundle来管理插件,vundle分别是 Vim 和 Bundle 的缩写,它是一款能够管理 Vim 插件的工具,Vundle 为每一个你安装的插件创建一个独立的目录树,并在相应的插件目录中存储附加的配置文件。因此,相互之间没有混淆的文件。简言之,Vundle 允许你安装新的插件、配置已有的插件、更新插件配置、搜索安装的插件和清理不使用的插件,所有的操作都可以在一键交互模式下完成。

使用 git clone https://github.com/VundleVim/Vundle.vim.git  ~/.vim/bundle/Vundle.vim将vundle插件安装到vim,然后在 用户目录下新建文件 vim ~/.vimrc,在里面写配置文件 

----------

set nocompatible " be iMproved, required
set autoindent  
set tabstop=4    
set shiftwidth=4    
set expandtab    
set number  
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'rkulla/pydiction'
Plugin 'git://git.wincent.com/command-t.git'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
call vundle#end() " required
filetype plugin indent on " required
filetype plugin on
let g:pydiction_location ='/root/.vim/bundle/pydiction/complete-dict'

------------------------------

然后打开vim 输入 :PluginInstall安装插件(命令模式),输入后不用管,插件会自动下载,安装成功会在每个插件面前会显示+号,或者使用 vim +PluginInstall +qall (Linux命令)命令安装插件。

需要添加新的插件只需要在配置文件里面添加 Plugin '用户/插件名'(GitHub用户/仓库名),然后同样执行插件安装命令就可以安装了,然后配置插件工作目录就行比如 let g:pydiction_location ='/root/.vim/bundle/pydiction/complete-dict'。
记录几个插件常用命令:
:PluginList 列出安装的插件列表
:PluginUpdate 更新插件
:PluginClean 在配置文件中注释掉不要的插件行,然后执行这个命令就可以卸载对应的插件
:PluginSearch xxx 查找vim插件

一个应该有用的插件推荐:https://blog.csdn.net/zzyczzyc/article/details/83244516

------------插件目录样例-------

.
|-- bundle
|   |-- Vundle.vim
|   |   |-- CONTRIBUTING.md
|   |   |-- LICENSE-MIT.txt
|   |   |-- README.md
|   |   |-- README_KR.md
|   |   |-- README_ZH_CN.md
|   |   |-- README_ZH_TW.md
|   |   |-- autoload
|   |   |   |-- vundle
|   |   |   |   |-- config.vim
|   |   |   |   |-- installer.vim
|   |   |   |   `-- scripts.vim
|   |   |   `-- vundle.vim
|   |   |-- changelog.md
|   |   |-- doc
|   |   |   |-- tags
|   |   |   `-- vundle.txt
|   |   |-- ftplugin
|   |   |   `-- vundlelog.vim
|   |   |-- syntax
|   |   |   `-- vundlelog.vim
|   |   `-- test
|   |       |-- files
|   |       |   `-- test.erl
|   |       |-- minirc.vim
|   |       `-- vimrc
|   |-- command-t
|   |   |-- CODE_OF_CONDUCT.md
|   |   |-- CONTRIBUTING.md
|   |   |-- Gemfile
|   |   |-- Gemfile.lock
|   |   |-- LICENSE
|   |   |-- README.md
|   |   |-- Rakefile
|   |   |-- appstream
|   |   |   `-- vim-command-t.metainfo.xml
|   |   |-- autoload
|   |   |   |-- commandt
|   |   |   |   |-- isengard.vim
|   |   |   |   |-- mirkwood.vim
|   |   |   |   `-- private.vim
|   |   |   `-- commandt.vim
|   |   |-- bin
|   |   |   `-- benchmarks
|   |   |       |-- matcher.rb
|   |   |       `-- watchman.rb
|   |   |-- data
|   |   |   `-- benchmark.yml
|   |   |-- doc
|   |   |   |-- command-t.txt
|   |   |   `-- tags
|   |   |-- fixtures
|   |   |   |-- bar
|   |   |   |   |-- abc
|   |   |   |   `-- xyz
|   |   |   |-- baz
|   |   |   |-- bing
|   |   |   `-- foo
|   |   |       |-- alpha
|   |   |       |   |-- t1
|   |   |       |   `-- t2
|   |   |       `-- beta
|   |   |-- plugin
|   |   |   `-- command-t.vim
|   |   |-- ruby
|   |   |   `-- command-t
|   |   |       |-- bin
|   |   |       |   `-- commandtd
|   |   |       |-- command-t.gemspec
|   |   |       |-- ext
|   |   |       |   `-- command-t
|   |   |       |       |-- depend
|   |   |       |       |-- ext.c
|   |   |       |       |-- ext.h
|   |   |       |       |-- extconf.rb
|   |   |       |       |-- heap.c
|   |   |       |       |-- heap.h
|   |   |       |       |-- match.c
|   |   |       |       |-- match.h
|   |   |       |       |-- matcher.c
|   |   |       |       |-- matcher.h
|   |   |       |       |-- ruby_compat.h
|   |   |       |       |-- watchman.c
|   |   |       |       `-- watchman.h
|   |   |       `-- lib
|   |   |           |-- command-t
|   |   |           |   |-- controller.rb
|   |   |           |   |-- finder
|   |   |           |   |   |-- buffer_finder.rb
|   |   |           |   |   |-- command_finder.rb
|   |   |           |   |   |-- file_finder.rb
|   |   |           |   |   |-- help_finder.rb
|   |   |           |   |   |-- history_finder.rb
|   |   |           |   |   |-- jump_finder.rb
|   |   |           |   |   |-- line_finder.rb
|   |   |           |   |   |-- mru_buffer_finder.rb
|   |   |           |   |   `-- tag_finder.rb
|   |   |           |   |-- finder.rb
|   |   |           |   |-- match_window.rb
|   |   |           |   |-- metadata
|   |   |           |   |   `-- fallback.rb
|   |   |           |   |-- mru.rb
|   |   |           |   |-- path_utilities.rb
|   |   |           |   |-- progress_reporter.rb
|   |   |           |   |-- prompt.rb
|   |   |           |   |-- scanner
|   |   |           |   |   |-- buffer_scanner.rb
|   |   |           |   |   |-- command_scanner.rb
|   |   |           |   |   |-- file_scanner
|   |   |           |   |   |   |-- find_file_scanner.rb
|   |   |           |   |   |   |-- git_file_scanner.rb
|   |   |           |   |   |   |-- ruby_file_scanner.rb
|   |   |           |   |   |   `-- watchman_file_scanner.rb
|   |   |           |   |   |-- file_scanner.rb
|   |   |           |   |   |-- help_scanner.rb
|   |   |           |   |   |-- history_scanner.rb
|   |   |           |   |   |-- jump_scanner.rb
|   |   |           |   |   |-- line_scanner.rb
|   |   |           |   |   |-- mru_buffer_scanner.rb
|   |   |           |   |   `-- tag_scanner.rb
|   |   |           |   |-- scanner.rb
|   |   |           |   |-- scm_utilities.rb
|   |   |           |   |-- settings.rb
|   |   |           |   |-- stub.rb
|   |   |           |   |-- util.rb
|   |   |           |   |-- vim
|   |   |           |   |   |-- screen.rb
|   |   |           |   |   `-- window.rb
|   |   |           |   `-- vim.rb
|   |   |           `-- command-t.rb
|   |   |-- spec
|   |   |   |-- command-t
|   |   |   |   |-- controller_spec.rb
|   |   |   |   |-- finder
|   |   |   |   |   |-- buffer_finder_spec.rb
|   |   |   |   |   `-- file_finder_spec.rb
|   |   |   |   |-- matcher_spec.rb
|   |   |   |   |-- scanner
|   |   |   |   |   |-- buffer_scanner_spec.rb
|   |   |   |   |   |-- file_scanner
|   |   |   |   |   |   |-- ruby_file_scanner_spec.rb
|   |   |   |   |   |   `-- watchman_file_scanner_spec.rb
|   |   |   |   |   `-- file_scanner_spec.rb
|   |   |   |   |-- vim_spec.rb
|   |   |   |   `-- watchman
|   |   |   |       `-- utils_spec.rb
|   |   |   `-- spec_helper.rb
|   |   `-- vendor
|   |       |-- vimscriptuploader
|   |       |   |-- README.markdown
|   |       |   |-- vimscriptdef.rb
|   |       |   `-- vimscriptuploader.rb
|   |       `-- vroom
|   |           |-- CONTRIBUTING.md
|   |           |-- LICENSE
|   |           |-- README.md
|   |           |-- examples
|   |           |   |-- basics.vroom
|   |           |   |-- blocks.vroom
|   |           |   |-- buffer.vroom
|   |           |   |-- continuations.vroom
|   |           |   |-- controls.vroom
|   |           |   |-- directives.vroom
|   |           |   |-- escaping.vroom
|   |           |   |-- messages.vroom
|   |           |   |-- mode.vroom
|   |           |   |-- range.vroom
|   |           |   `-- system.vroom
|   |           |-- scripts
|   |           |   |-- respond.vroomfaker
|   |           |   |-- shell.vroomfaker
|   |           |   `-- vroom
|   |           |-- setup.cfg
|   |           |-- setup.py
|   |           `-- vroom
|   |               |-- __init__.py
|   |               |-- actions.py
|   |               |-- args.py
|   |               |-- buffer.py
|   |               |-- color.py
|   |               |-- command.py
|   |               |-- controls.py
|   |               |-- environment.py
|   |               |-- messages.py
|   |               |-- neovim_mod.py
|   |               |-- output.py
|   |               |-- runner.py
|   |               |-- shell.py
|   |               |-- test.py
|   |               `-- vim.py
|   |-- pydiction
|   |   |-- README
|   |   |-- README.md
|   |   |-- after
|   |   |   `-- ftplugin
|   |   |       `-- python_pydiction.vim
|   |   |-- complete-dict
|   |   `-- pydiction.py
|   |-- sparkup
|   |   |-- Makefile
|   |   |-- README.md
|   |   |-- TextMate
|   |   |   `-- Sparkup.tmbundle
|   |   |       |-- Commands
|   |   |       |   `-- Sparkup\ expand.tmCommand
|   |   |       |-- Support
|   |   |       |   `-- sparkup.py -> ../../../sparkup.py
|   |   |       `-- info.plist
|   |   |-- ftdetect
|   |   |   `-- hsb.vim
|   |   |-- ftplugin -> vim/ftplugin
|   |   |-- mit-license.txt
|   |   |-- sparkup-unittest.py
|   |   |-- sparkup.py
|   |   `-- vim
|   |       |-- README.txt
|   |       `-- ftplugin
|   |           |-- html
|   |           |   |-- sparkup.py -> ../../../sparkup.py
|   |           |   `-- sparkup.vim
|   |           |-- htmldjango -> html
|   |           |-- smarty -> html
|   |           `-- xml -> html
|   `-- vim-fugitive
|       |-- CONTRIBUTING.markdown
|       |-- README.markdown
|       |-- autoload
|       |   `-- fugitive.vim
|       |-- doc
|       |   |-- fugitive.txt
|       |   `-- tags
|       |-- ftdetect
|       |   `-- fugitive.vim
|       |-- plugin
|       |   `-- fugitive.vim
|       `-- syntax
|           `-- fugitive.vim
`-- test.py

68 directories, 171 files

-----------------------------------

 

 

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值