在Ubuntu 16.04 LTS 下用Vim 打造自己的Python IDE 问题总结
来源:互联网 发布:六十甲子单双计算法 编辑:程序博客网 时间:2024/06/05 04:39
在Ubuntu 16.04 LTS 下用Vim 打造自己的Python IDE 问题总结
原文英文地址:https://realpython.com/blog/python/vim-and-python-a-match-made-in-heaven/
原文中文地址:http://www.jianshu.com/p/bc19b91354ef
安装过程遇到的问题及解决方案
1. 按照步骤安装之前
原作者并没有给出安装 https://github.com/amix/vimrc 的步骤,只是给了一个链接,所以这个首先要配置上,它是别人vim的一个配置。
2. Python 代码缩进问题
以下是原作者在~/.vimrc中的设置方法:
au BufNewFile,BufRead *.py \ set tabstop=4 \ set softtabstop=4 \ set shiftwidth=4 \ set textwidth=79 \ set expandtab \ set autoindent \ set fileformat=unix
按照步骤设置过程中遇到如下问题:
Error detected while processing BufRead Auto commands for "*.py":E518: Unknown option: set
原因分析:如果自动缩进的 set 设置有多项并且在多行,每一项后面要用空格加竖线分割|
(最后一项除外)
解决办法网址:http://stackoverflow.com/questions/36741450/vim-setting-error-under-bufread/36742908
最后调整如下:
au BufNewFile,BufRead *.py \ set tabstop=4 | \ set softtabstop=4 | \ set shiftwidth=4 | \ set textwidth=79 | \ set expandtab | \ set autoindent | \ set fileformat=unix
3. 标示不必要的空白字符出现的问题
以下是原作者在~/.vimrc中的设置方法:
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
设置过程中遇到的问题:
E28: No such highlight group name: BadWhitespace
原因分析:提前没有对BadWhitespace
进行声明
解决办法网址:http://stackoverflow.com/questions/11087041/gvim-to-custom-highlight-group-in-vimrc-not-working
最后调整如下:
"Flagging Unnecessary Whitespacehighlight BadWhitespace ctermbg=red guibg=darkredau BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
4. 安装YouCompleteMe
原配置方法:
Bundle 'Valloric/YouCompleteMe'
这段代码要放在~/.vimrc
中的。
安装过程中问题:
ERROR: some folders in /home/jeff/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party are empty; you probably forgot to run: git submodule update --init --recursive
按问题说明执行:
git submodule update --init --recursive
这个过程比较漫长,要有耐心。也可以按照以下链接安装 http://www.linuxidc.com/Linux/2015-07/120352.htm
5. 转到定义快捷方式不起作用
原配置方法:
let g:ycm_autoclose_preview_window_after_completion=1map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
这里的leader
是指自己自定义vim组合快捷键的时候的第一个键,原作者是空格键,你要看一下自己的leader
快捷键是哪一个,如果你第一步安装成功了,那么mapleader
应该是逗号,
,然后再用map命令看一下g是否已经被用了
:map
最后我的配置把g 调整成了q:
let g:ycm_autoclose_preview_window_after_completion=1map <leader>q :YcmCompleter GoToDefinitionElseDeclaration<CR>
6. 配色方案中出现的问题
原作者有一段代码如下:
if has('gui_running') set background=dark colorscheme solarizedelse colorscheme Zenburnendif
结果配置过程报错如下:
Error detected while processing /home/jeff/.vimrc:line 512:E14: Invalid addressline 513:E185: Cannot find color scheme 'Zenburn'
这个有点搞笑,最后发现竟然是大小写的原因,把代码中的Zenburn
修改成zenburn
即可。
修改如下:
if has('gui_running') set background=dark colorscheme solarizedelse colorscheme zenburnendif
最终效果如下(前提是对vim命令比较熟悉):
- 在Ubuntu 16.04 LTS 下用Vim 打造自己的Python IDE 问题总结
- [VIM]Linux下打造自己的IDE
- linux 下打造自己的 Python IDE
- 为Ubuntu打造vim-Python IDE
- 打造自己的Vim的IDE
- 使用Vim打造自己的IDE
- 配置vim,打造自己的C IDE
- Vim打造属于自己的IDE
- 打造属于自己的Vim IDE
- vim 打造python IDE
- vim---打造Python IDE
- 使用Vim打造现代化的Python IDE
- 强化vim打造python的IDE
- linux下懒人打造自己的IDE
- 在Ubuntu下用Vim建立IDE编程环境
- 打造超强ubuntu下的C++ IDE
- vim+cscope+ctags打造属于自己的IDE
- 配置vim,打造自己的C IDE(二)
- asp时间的判断
- 数据结构学习笔记
- parse第三方服务好像要不能使用了
- 第三方开源库:个推
- 关于C++域作用符详解
- 在Ubuntu 16.04 LTS 下用Vim 打造自己的Python IDE 问题总结
- Android中dp px sp之间转化
- Gradle笔记2-构建脚本
- openH264编码流程
- 手机视频直播系统开发技术难点分析
- 告别Spinner下拉列表,用popupWindow 更美好
- linux下的编程问题
- bat-1
- 通讯录的获取