Ubuntu下将vim配置为Python IDE(转)
工欲善其事,必先利其器。
配置好了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(转)的更多相关文章
- Windows下将gvim8配置为Python IDE
目录 1.准备工作 2.安装 3.配置 _vimrc 4.编写和编译运行程序 正文 Windows下将gvim配置为Python IDE 回到顶部 1.准备工作 将下面的安装包或者文件下载好 1) P ...
- Vim配置及说明——IDE编程环境
Vim配置及说明——IDE编程环境 Vim配置及说明——IDE编程环境 1.基本及字体 2.插件管理 3.主题风格 4.窗口设置 5.目录树导航 6.标签导航 7.taglist 8.多文档编辑 9. ...
- 两个命令把 Vim 打造成 Python IDE
运行下面两个命令,即可把 Vim(含插件)配置成 Python IDE.目前支持 MAC 和 Ubuntu. Shell curl -O https://raw.githubusercontent ...
- Ubuntu下更改Vim配置文件打造C/C++风格
转载:Ubuntu下更改Vim配置文件打造C/C++风格 Vim默认的配置使用起来还不能让人满意,还需要自己配置 默认配置文件是:/etc/vim/vimrc我们可以在家目录下建立自己的配置文件切换到 ...
- Use Vim as a Python IDE
Use Vim as a Python IDE I love vim and often use it to write Python code. Here are some useful plugi ...
- ubuntu之使用sublime text3搭建Python IDE
参考文章: 教你如何将 Sublime 3 打造成 Python/Django IDE开发利器 Ubuntu16.04下使用sublime text3搭建Python IDE 如何优雅地使用Subli ...
- Ubuntu下安装并配置VS Code编译C++
作者:tongqingliu 转载请注明出处:http://www.cnblogs.com/liutongqing/p/7069091.html Ubuntu下安装并配置VS Code编译C++ 安装 ...
- Ubuntu下OpenCV不能被某个python版本识别
Ubuntu下OpenCV不能被某个python版本识别 Solution: 可以进入相应版本的python,查看该python的path: python import sys print(sys.p ...
- Ubuntu下安装并配置TexStudio
作者:tongqingliu 转载请注明出处:http://www.cnblogs.com/liutongqing/p/7069715.html Ubuntu下安装并配置TexStudio Ubunt ...
随机推荐
- 大容量XFS异常处理
今天在检查报警的时候发现部分数据异常,登陆备份机查看文件状态的时候发现磁盘空间已经满了,inode也已经有问题了,因此先停掉了所有的备份进程,开始检查问题. 首先是磁盘空间满了,尝试删除部分文件,发现 ...
- JS - 焦点图
下载地址:http://www.lanrentuku.com/js/jiaodiantu-1076.html 修改焦点图: CSS代码: /* 懒人图库 搜集整理 www.lanrentuku.com ...
- Mybatis 数据库物理分页插件 PageHelper
以前使用ibatis/mybatis,都是自己手写sql语句进行物理分页,虽然稍微有点麻烦,但是都习惯了.最近试用了下mybatis的分页插件 PageHelper,感觉还不错吧.记录下其使用方法. ...
- IOS 轻量级数据持久化 DataLite
开发的过程中我们经常要保存一些配置信息,一般简单的是用 NSUserDefaults [[NSUserDefaults standardUserDefaults] objectForKey:key]; ...
- 首个spring mvc 测试例子搭建遇到问题记录
开发环境:jdk1.7 + tomcat7 + Eclipse Juno 首先下载spring 相关jar包 我用的是 spring-framework-3.2.1.RELEASE 下载地址:http ...
- Mysql RR隔离更新列没有索引 会锁全表
<pre name="code" class="html">mysql> show variables like '%tx_isolation ...
- 【设计模式】Singleton模式C++实现
Singleton是设计模式中比较简单的一个.园中的朋友们应该都很熟悉了.前段时间参加xxx外企的面试,和面试官讨论C++的时候正好写了一个.当时由于在有些地方考虑不太周全,代码出现了一些疏漏.不过最 ...
- 在使用supervisord 管理tomcat时遇到的小问题
使用 supervisord 监控管理的进程必须以 nodaemon 启动,而 tomcat 的 startup.sh 脚本是daemon方式的,假设不做改动的话,supervisord 会一直报错 ...
- 可能性dp+减少国家HDU4336
Card Collector Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Subm ...
- Python爬行动物(一):基本概念
定义网络爬虫 网络爬虫(Web Spider,也被称为网络蜘蛛,网络机器人,也被称为网页追逐者).按照一定的规则,维网信息的程序或者脚本.另外一些不常使用的名字还有蚂蚁,自己主动索引 ...