ubuntu下配置vim为IDE

来源:互联网 发布:淘宝买家秀怎么发视频 编辑:程序博客网 时间:2024/05/21 16:16

1.vim版本

建议最好将vim进行更新升级。sudo apt-get install vim。如果更新的源比较慢,可以设置源为阿里云的源。
这里写图片描述

vim --version | grep python

可以看到有些内容前面有+,有些前面是-。加号表示支持,减号表示不支持。我自己的是-python +python3.
可以进一步验证在vim中所支持的python3版本,在vim中输入

:python3 import sys; print(sys.version)

然后可以得到输出内容是

3.4.3 (default, Nov 17 2016, 01:12:14) [GCC 4.8.4]

备注:如果想让vim支持python(Python2),也是可行的,很多资料。当然,我从vim 7.4同时支持python 2.x和3.x问题调研看到:“vim中Python2和Python 3不能共存,当它们都支持时,它们必须是动态载入的方式。在Linux/Unix环境中,当导入全局符号时,会导致第二个Python版本崩溃。”这个我没有尝试。

2.安装vbundle

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

安装vbundle之后,在~/.vimrc中添加配置,参考github上的 Vundle.vim
然后安装相应插件,使用命令

:PluginInstall

我的~/.vimrc内容如下(参考另一个csdn博客,找不到原链接了):

set nocompatible              " be iMproved, requiredfiletype off                  " requiredset rtp+=~/.vim/bundle/vundle/call vundle#rc()" let Vundle manage VundleBundle 'gmarik/vundle'"my Bundle here:"" original repos on githubBundle 'kien/ctrlp.vim'Bundle 'sukima/xmledit'Bundle 'sjl/gundo.vim'Bundle 'jiangmiao/auto-pairs'Bundle 'klen/python-mode'Bundle 'Valloric/ListToggle'Bundle 'SirVer/ultisnips'Bundle 'Valloric/YouCompleteMe'Bundle 'scrooloose/syntastic'Bundle 't9md/vim-quickhl'" Bundle 'Lokaltog/vim-powerline'Bundle 'scrooloose/nerdcommenter'".................................." vim-scripts reposBundle 'YankRing.vim'Bundle 'vcscommand.vim'Bundle 'ShowPairs'Bundle 'SudoEdit.vim'Bundle 'EasyGrep'Bundle 'VOoM'Bundle 'VimIM'".................................." non github repos" Bundle 'git://git.wincent.com/command-t.git'"......................................filetype plugin indent on

3.YouCompleteMe安装

在第2步骤中,YouCompleteMe此插件很难安装成功,可以换种方式安装。手动方式安装YCM。【ps:此处当时参考了几个网页,不知道怎么装好的】

4.其他插件

4.1 NERDTree

在~/.vimrc中添加内容

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""setting of nerdtreeBundle 'scrooloose/nerdtree'let NERDTreeWinPos='left'let NERDTreeWinSize=31let NERDTreeChDirMode=1"F8 打开nerdtreemap f8 :NERDTreeToggle /media/My_Documents/htdocs<CR>"F7 新开一个tab标签map f7 :tabnew<CR>"F5 前一个tab标签map f5 :tabp<CR>"F6 后一个tab标签map f6 :tabn<CR>

然后在vim中执行:BundleInstall,就可以看到在~/.vim/bundle/目录下看到nerdtree文件夹了。

1、在linux命令行界面,用vim打开一个文件。
2、输入 :NERDTree ,回车
3、进入当前目录的树形界面,通过小键盘上下键,能移动选中的目录或文件
4、ctr+w+h 光标focus左侧树形目录,ctrl+w+l 光标focus右侧文件显示窗口。多次摁 ctrl+w,光标自动在左右侧窗口切换
5、输入:q回车,关闭光标所在窗口
http://www.cnblogs.com/wangkongming/p/4050833.html 这里还有快捷键说明

特别说明:

1,2部分参考Vim与Python真乃天作之合:打造强大的Python开发环境
其他一些好的插件,可以看
[Ubuntu] 使用Vundle管理vim的插件http://www.cnblogs.com/davidhhuan/archive/2013/01/06/2846982.html


原创粉丝点击