配置VIM (Windows)
Posted toooney
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置VIM (Windows)相关的知识,希望对你有一定的参考价值。
软件介绍
Vim作为一个好用的编辑器,可以实现很多功能.如果配置的比较好,可以作为一个IDE来作为开发轻量级的开发工具,但是功能上绝对不失其他的几十G的大型IDE.
使用版本和操作系统
- 操作系统: Ubuntu 18.04
- python 3.7 64位
- VIM - Vi IMproved 8.0
- cmake version 3.10.2
智能补全: YCM
目标:实现对C语言自动补全
- 环境配置 官方提供
- 首先找到
vimrc
【不同的操作系统路径不同,本次使用的地址是/etc/vim/vimrc
】文件,使用Bundle
管理插件,在vimrc
文件中加入如下内容:
“”””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
“ Vundle
set nocompatible “ be iMproved, 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(‘~/.vim/bundle/‘)
“ let Vundle manage Vundle, required
Plugin ‘VundleVim/Vundle.vim’
“ The following are examples of different formats supported.
“ Keep Plugin commands between vundle#begin/end.
“ Autocomplete
Plugin ‘Valloric/YouCompleteMe’
“ All of your Plugins must be added before the following line
call vundle#end() “ required
filetype plugin indent on “ required
“ To ignore plugin indent changes, instead use:
filetype plugin on
“ Brief help
“ :PluginList - lists configured plugins
“ :PluginInstall - installs plugins; append ! to update or just
“ :PluginUpdate
“ :PluginSearch foo - searches for foo; append ! to refresh local cache
“ :PluginClean - confirms removal of unused plugins; append ! to
“ auto-approve removal
“ see :h vundle for more details or wiki for FAQ
“ Put your non-Plugin stuff after this line
“ “””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””
“ 使其能够找到自动补全的配置文件路径(注意文件路径不一定相同,根据实际情况改动,如果没有cpp文件夹,可以手动创建)
let g:ycm_global_ycm_extra_conf=’~/.vim/bundle/YouCompleteMe/cpp/.ycm_extra_conf.py’
注意比较.ycm_extra_conf.py
文件的差异,左边是改动之后的,右边是改动之前样子。
改动的时候可以参考说明:provide-the-flags-manually
C语言自动补全:C.vim
更改模版格式:借鉴经验
以上是关于配置VIM (Windows)的主要内容,如果未能解决你的问题,请参考以下文章