代码编辑器[0] -> Vim/gVim -> 基于 Python 的 gVim 环境配置(Windows)
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了代码编辑器[0] -> Vim/gVim -> 基于 Python 的 gVim 环境配置(Windows),小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3768字,纯文字阅读大概需要6分钟。
内容图文
环境配置 / Environment Setup
基于Python开发的 gVim 环境配置(Windows)
1 基于vundle进行配置
Vim有多个扩展管理器,但是强烈推荐Vundle。可以把它想象成Vim的pip。有了Vundle,安装和更新包这种事情不费吹灰之力。
安装Vundle:
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
该命令将下载Vundle插件管理器,并将它放置在你的Vim编辑器bundles文件夹中。现在,你可以通过.vimrc配置文件来管理所有扩展了。
Note: Windows 环境中 home 目录为 C:/Users/YourUserName/
将配置文件添加到你的用户的home文件夹中,Windows中可以直接新建文件:
touch ~/.vimrc
接下来,把下来的Vundle配置添加到配置文件的顶部:
set nocompatible " required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " alternatively, pass a path where Vundle should install plugins "call vundle#begin(‘~/some/path/here‘) " let Vundle manage Vundle, required "<strong>Plugin ‘gmarik/Vundle.vim‘</strong> " Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin) " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required
这样,你就完成了使用Vundle前的设置。之后,你就可以在配置文件中添加希望安装的插件,然后打开Vim编辑器,运行下面的命令:
:PluginInstall
这个命令告诉Vundle施展它的魔法——自动下载所有的插件,并为你进行安装和更新。
2 基本配置 / Basic Configuration
下面的命令可以用于 .vimrc 文件中进行环境配置修改。
set number "设置序号显示
syntax enable
syntax on "打开高亮
colorscheme desert "设置主题颜色desert
set nocompatible "不要vim模仿vi模式
set foldmethod=indent "设置折叠
set filetype=python "设置文件类型为Python
au BufNewFile,BufRead *.py,*.pyw setf python
set guifont=Courier\ New:h16 "设置字体大小
set lines=35 columns=118 "设置窗体大小
set encoding=utf-8 "设置encoding
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,Chinese
set writebackup " 正常关闭时写入备份,退出时取消备份
set nobackup " 取消自动备份
set noundofile " 取消undofile备份
set noswapfile " 取消swapfile备份
3 ctags配置 / ctags Configuration
下载对应的 ctags,将解压后得到的ctags.exe复制到安装目录下(C:\Program Files (x86)\Vim\vim80),并编辑_vimrc文件,添加以下内容
set tags=tags
set autochdir
随后在需要查看源代码的目录下运行ctags -R
4 taglist配置 / taglist Configuration
源代码分析工具taglist,可以查看当前文件中所有函数及变量等信息。首先下载 taglist_45.zip 压缩包,解压后的文件夹doc和plugin放到vim根目录下,在_vimrc文件中添加以下内容:
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
5 winManager配置 / winManager Configuration
文件浏览组件winManager,可以查看当前文件夹中所有文件信息。首先需要下载 winmanager.zip 压缩包,解压后的文件夹doc和plugin放到vim根目录下,在_vimrc文件中添加以下内容:
let g:winManagerWindowLayout=‘FileExplorer|TagList‘ nmap wm :WMToggle<cr>
6 minibufexpl配置 / minibufexpl Configuration
下载压缩包将解压后的 minibufexpl.vim 复制到vim80的plugin文件下,在_vimrc中添加以下内容:
let g:miniBufExplMapCTabSwitchBufs=1 let g:miniBufExplMapWindowsNavVim=1 let g:miniBufExplMapWindowNavArrows=1
7 grep配置 / grep Configuration
将下载的 grep.vim 文件拷贝到vim80\plugin文件夹里,在_vimrc中添加以下内容:
nnoremap <silent> <F3> :Grep<CR>
因为Windows不带grep,因此需要下载并安装 grep,同时将grep添加到系统path中
8 visualmark配置 / visualmark Configuration
将下载的 visualmark.vim 文件拷贝到vim80\plugin文件夹里
9 pydiction配置 / pydiction Configuration
下载 pydiction-1.2.zip 解压将里面的python_pydiction.vim文件复制到~\vim80\ftplugin,将complete-dict 和 pydiction.py复制到~\vim80\ftplugin\pydiction下,在_vimrc中添加以下内容:
filetype plugin on "启用filetype插件 let g:pydiction_location = ‘C:\Program Files (x86)\Vim\vim80\ftplugin\pydiction\complete-dict‘ let g:pydiction_menu_height = 20 "设置弹出菜单的高度,默认是15
10 pyflakes配置 / pydiction Configuration
下载 pyflakes.zip,解压缩后把pyflakes.vim文件和pyflakes目录拷贝到ftplugin\python目录中。
11 run配置 / run Configuration
在_vimrc中添加以下内容:
map <F5> :! C:\python34\python.exe %
即可将F5与Python3.4进行绑定
12 ctrl+v配置 / ctrl+v Configuration
在Gvim中ctrl+v进入visual模式与复制粘贴冲突,为此需要修改vim/vim80/mswin.vim, 修改如下:
" CTRL-V and SHIFT-Insert are Paste " map<C-V> "+gP
将map注释即可
参考链接
gVim -> 基于 Python 的 gVim 环境配置(Windows)' ref='nofollow'>代码编辑器[0] -> Vim/gVim -> 基于 Python 的 gVim 环境配置(Windows)
原文:https://www.cnblogs.com/stacklike/p/8167524.html
内容总结
以上是互联网集市为您收集整理的代码编辑器[0] -> Vim/gVim -> 基于 Python 的 gVim 环境配置(Windows)全部内容,希望文章能够帮你解决代码编辑器[0] -> Vim/gVim -> 基于 Python 的 gVim 环境配置(Windows)所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。