工欲善其事,必先利其器。
配置好了Django的环境,该把vim好好配置一下当做python的IDE来用。
在Windows下用惯了各种现成的工具,转到Linux下,一下没了头绪……好歹google出一些别人的心得,折腾来折腾去,也算是把开发环境配好了。
1. 安装完整的vim
# apt-get install vim-gnome
2. 安装ctags,ctags用于支持taglist,必需!
# apt-get install ctags
3. 安装taglist
#apt-get install vim-scripts
#apt-get install vim-addon-manager // 貌似我在安装vim-scripts的时候,已经附带安装了vim-addon-manager
# vim-addons install taglist
4. 安装pydiction(实现代码补全)
#wget http://www.pythonclub.org/_media/python-basic/pydiction-1.2.zip
#unzip pydiction-1.2.zip
// ~/.vim/after/ftplugin和~/.vim/tools/pydiction/目录默认不存在,需要自行创建
#cp pydiction-1.2/python_pydiction.vim ~/.vim/after/ftplugin
#cp pydiction-1.2/complete-dict ~/.vim/tools/pydiction/complete-dict
5. 编辑配置文件
# 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
|
let Tlist_Auto_Highlight_Tag=1 let Tlist_Auto_Open=1 let Tlist_Auto_Update=1 let Tlist_Display_Tag_Scope=1 let Tlist_Exit_OnlyWindow=1 let Tlist_Enable_Dold_Column=1 let Tlist_File_Fold_Auto_Close=1 let Tlist_Show_One_File=1 let Tlist_Use_Right_Window=1 let Tlist_Use_SingleClick=1 nnoremap <silent> <F8> :TlistToggle<CR> // 设定F8为taglist开关 filetype plugin on autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType c set omnifunc=ccomplete#Complete let g:pydiction_location='~/.vim/tools/pydiction/complete-dict' set autoindent // 实现自动缩进 set tabstop=4 set shiftwidth=4 set expandtab set number |
至此,python IDE的环境就算是搭好了,来张完成图:
右边即为taglist窗口,按F8打开,使用Ctrl+w,再按w可以在code窗口和taglist窗口间切换。
附加:highlight
http://www.vim.org/scripts/script.php?script_id=1599Line mode Highlight current line Advance color for next line highlight Clear last line highlight Pattern mode Highlight word under cursor (whole word match) Highlight all lines having word under cursor (whole word match) Highlight word under cursor (partial word match) Highlight all lines having word under cursor (partial word match) Highlight last search pattern Highlight all lines having last search pattern Clear last pattern highlight Clear all highlights All above commands work in both normal & insert modes. also works in visual mode. (Select desired lines & hit ) python_fold自动折叠 http://vim.sourceforge.net/scripts/script.php?script_id=515 zo 展开 zc 收起 zn 全部展开 zN 全部折叠
安装NERD_TREE 目录树(文件浏览,强烈推荐)
1.下载插件文件
http://www.vim.org/scripts/script.php?script_id=1658
解压文件到~/.vim/目录下,如果没有此目录,则要自己创建。
2.添加配置文件
在~/.vimrc 或 /etc/vim/vimrc文件里添加如下配置
1
2
3
4
5
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " F7 NERDTree """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" map <F7> :NERDTreeToggle<CR> imap <F7> <ESC>:NERDTreeToggle<CR> |
则在VIM里按下F7就可打开关闭目录树。具体操作命令请查看插件doc目录下的帮助文件。
Auto Complete
http://www.vim.org/scripts/script.php?script_id=1879
过程同上。
最后,来张既有NERDTree,又有taglist的图。
相关推荐
ubuntu中配置vim 打造Python IDE
本文件是在ubuntu下配置vim,变成C/C++集成开发环境,实现代码自动补全,函数参数提示,代码跳转,文件列表和函数项显示等功能,在ubuntu12.04 和ubuntu14.04中测试通过,只需执行vim.sh脚本即可,注意脚本中的vim73...
ubuntu下,针对c/c++的vim开发环境搭建配置文件,重命名为.vimrc,放在~目录下即可
Python-mode:将 Vim 变成 Python IDE 的一款多合一插件
ubuntu下的vim插件集合,包括了cscope、ctags、c-support、taglist、minibufexpl等常用的插件,只要运行文件夹下的Install.sh脚本就能自动安装。
下载vimconfig.tar.tgz,将文件拷贝到ubuntu, 执行下面命令: tar zxvf vimconfig.tar.tgz cd vimconfig cp .* ~/ -rvf 部分配置情况: "-------------TagList--------------- "设置ctags路径 let Tlist_Ctags_Cmd ...
vim配置的例子 以及说明 可以学习下
本文档主要对ubuntu下的vim进行了一些配置,在创建文件可以自动将个人信息和头文件加上。需要的朋友可以下载试试
将vim配置为python的开发平台,本文件自带插件,其中 .vim文件夹下的目录直接拷贝到<vim安装路径>\<vim版本号>下,例如在我的电脑上,就将.vim下的所有目录拷贝至:C:\Program Files\Vim\vim73 即可。 .vimrc文件...
ubuntu离线安装vim
简洁vimrc配置,实现代码补全,自动执行脚本,只配置的python的
ubuntu 用vim配置c/c++ 集成ide
最全,最好用 自己试试啊ubuntu12.04 vim 配置
针对python的VIM配置文件,包含如何配置YCM过程,具体不懂欢迎咨询。
mac下vim之python配置步骤,自动缩进,语法高亮,背景,自动补全,文件管理
自己用的vim配置环境,感觉不错,希望能对大家有所帮助。
Ubuntu20.04安装vim出现的相关问题及解决方法
个人习惯的vim配置 比如能保存上次的编辑的位置 解决windowx文件打开乱码问题 高亮等等
vim配置和插件打包 博文链接:https://guozhiwei.iteye.com/blog/1005940