博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Using Vim as c/c++ editor
阅读量:6886 次
发布时间:2019-06-27

本文共 2033 字,大约阅读时间需要 6 分钟。

hot3.png

1. install VIM plugin management

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Put this at the top of ~/.vimrc file

set nocompatible              " be iMproved, requiredfiletype off                  " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, requiredPlugin 'VundleVim/Vundle.vim'Plugin 'Valloric/YouCompleteMe'" All of your Plugins must be added before the following linecall vundle#end()            " requiredfiletype 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

2.Install

mkdir -p ~/.vim/autoload ~/.vim/bundle && \curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

将下面代码添加到.vimrc

execute pathogen#infect()syntax onfiletype plugin indent on

3. install code auto complete plugin  测试发现通过Vundle安装YouCompleteMe不成功,只能通过下面手工方法安装此插件

cd ~/.vim/bundlegit clone https://github.com/Valloric/YouCompleteMe.gitcd YouCompleteMegit submodule update --init --recursive./install.py --clang-completer --system-libclangcd ~/.vim/wget https://github.com/Valloric/ycmd/blob/master/cpp/ycm/.ycm_extra_conf.py

将下面配置放到.vimrc 后面

let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"let g:ycm_key_list_select_completion=[]let g:ycm_key_list_previous_completion=[]

编辑一个.c文件查看YouCompleteMe的效果。

4、总结

要打造一款合适的vim工具还是挺啰嗦的,如无必要,最好还是用IDE,不要浪费时间在上面!这里个有链接,一般windows平台用visual studio,Linux或Mac OS用IDEA。

参考:

转载于:https://my.oschina.net/swingcoder/blog/790898

你可能感兴趣的文章
bzoj4035【HAOI2015】数组游戏
查看>>
wchar_t与char转换、wstring与string转换
查看>>
git 命令
查看>>
Linux 查询服务数据
查看>>
【Luogu 2014】选课
查看>>
CSS 的介绍
查看>>
Latex自定义文档纸张大小
查看>>
2018QBXT刷题游记(23)
查看>>
函数递归
查看>>
android框架Java API接口总注释/**@hide*/和internal API
查看>>
20175318 2018-2019-2 《Java程序设计》第七周学习总结
查看>>
比特币:一种点对点的电子现金系统
查看>>
Android - 按钮组件详解
查看>>
MEF简单学习笔记
查看>>
Srping - bean的依赖注入(Dependency injection)
查看>>
NSAutoreleasePool 用处
查看>>
import matplotlib.pyplot as plt出错
查看>>
常用集合与Dictionary用例
查看>>
MVC
查看>>
AI - TensorFlow - 张量(Tensor)
查看>>