Ubuntu16.04Vim+Vundle+Python编辑器(傻瓜操作版)

本文详细介绍了如何在Ubuntu16.04上安装Vim,使用Vundle管理插件,特别是安装Python开发所需的Vim配置,包括YouCompleteMe自动补全插件的安装和解决依赖问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

    一般ubuntu都会默认安装vim-tiny版本


1 vim插件

    在用户主目录下的 ~/.vimrc 文件中完成的,如果没有的话,需要自己新建一下:

cd ~
touch .vimrc

    touch是在linux中比较常用的创建文件命令, 关于touch和mkdir的区别请自行百度

    vim插件中最主要的就是vundle了,vundle用来管理vim的其它插件

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

    首先下载源码:

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
    如果~/.vim/bundle目录不存在,则新建目录:
cd ~
mkdir .vim
cd .vim
mkdir bundle

    然后将下列配置放在.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()
 
" 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中执行输入linux命令vim,回车,然后输入:

:PluginInstall

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

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

github上的插件
Plugin 'tpope/vim-fugitive'
来自于http://vim-scripts.org/vim/scripts.html的插件
Plugin 'L9'
非github上的git插件
Plugin 'git://git.wincent.com/command-t.git'
本地插件
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/'}
有旧插件的情况下,下载新的插件并重命名以避免冲突
Plugin 'ascenator/L9', {'name': 'newL9'}

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

vim +PluginInstall +qall

这部分也可参考以下链接:

https://www.cnblogs.com/linxiyue/p/7834817.html

2 简单设置.vimrc

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值