vim配置以及Vundle安装插件
文章目录
- 配置vim
- 设置vim C/C++开发环境
- 安装Vundle进行插件管理
- 输入以下命令
- 配置插件
- 安装插件
- 括号和引号匹配
- 自动补全
- Formatter
配置vim
设置vim C/C++开发环境
在~/.vimrc
中输入以下内容
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" disable vi compatibility (emulation of old bugs)
set nocompatible
" use indentation of previous line
set autoindent
" use intelligent indentation for C
set smartindent
" configure tabwidth and insert spaces instead of tabs
set tabstop=4 " tab width is 4 spaces
set shiftwidth=4 " indent also with 4 spaces
set expandtab " expand tabs to spaces
" wrap lines at 120 chars. 80 is somewaht antiquated with nowadays displays.
set textwidth=120
" turn syntax highlighting on
set t_Co=256
syntax on
" colorscheme wombat256
" turn line numbers on
set number
" highlight matching braces
set showmatch
" intelligent comments
set comments=sl:/*,mb:\ *,elx:\ */" Install OmniCppComplete like described on http://vim.wikia.com/wiki/C++_code_completion
" This offers intelligent C++ completion when typing ‘.’ ‘->’ or <C-o>
" Load standard tag files
set tags+=~/.vim/tags/cpp
set tags+=~/.vim/tags/gl
set tags+=~/.vim/tags/sdl
set tags+=~/.vim/tags/qt4" Install DoxygenToolkit from http://www.vim.org/scripts/script.php?script_id=987
let g:DoxygenToolkit_authorName="John Doe <john@doe.com>"" Enhanced keyboard mappings
"
" in normal mode F2 will save the file
nmap <F2> :w<CR>
" in insert mode F2 will exit insert, save, enters insert again
imap <F2> <ESC>:w<CR>i
" switch between header/source with F4
map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
" recreate tags file with F5
map <F5> :!ctags -R –c++-kinds=+p –fields=+iaS –extra=+q .<CR>
" create doxygen comment
map <F6> :Dox<CR>
" build using makeprg with <F7>
map <F7> :make<CR>
" build using makeprg with <S-F7>
map <S-F7> :make clean all<CR>
" goto definition with F12
map <F12> <C-]>
" in diff mode we use the spell check keys for merging
if &diff” diff settingsmap <M-Down> ]cmap <M-Up> [cmap <M-Left> domap <M-Right> dpmap <F9> :new<CR>:read !svn diff<CR>:set syntax=diff buftype=nofile<CR>gg
else" spell settings:setlocal spell spelllang=en" set the spellfile - folders must existset spellfile=~/.vim/spellfile.addmap <M-Down> ]smap <M-Up> [s
endif
安装Vundle进行插件管理
输入以下命令
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
配置插件
把以下命令输入~/.vimrc
的顶部
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('~/some/path/here')" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}. Plugin 'Raimondi/delimitMate'
. Plugin 'Chiel92/vim-autoformat'
. Plugin 'ycm-core/YouCompleteMe' Plugin 'flazz/vim-colorschemes' " All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
安装插件
打开vim
然后输入:PluginInstall
命令来安装插件。
vim
下方出现Done
表示安装成功。
括号和引号匹配
可以安装delimitMate
插件处理各种括号和引号匹配的问题。
可以使用Vundle的形式安装。
在~/.vimrc
添加Plugin 'Raimondi/delimitMate'
,然后打开vim
输入:PluginInstall
进行插件安装。
自动补全
对于代码自动补全功能,可以安装YouCompleteMe。
首先输入以下命令
cd ~/.vim/bundle
git clone https://github.com/ycm-core/YouCompleteMe.git
下载完成后进入YCM目录下
cd ~/.vim/bundle/YouCompleteMe
然后输入以下命令
git submodule --init --recursive
这个过程比较慢,如果初始化不成功,需要手动初始化。
以上过程结束后,需要执行下面的文件
./install.py
安装完毕之后,在~/.vimrc
中添加
Plugin 'ycm-core/YouCompleteMe'
打开vim
输入:PluginInstall
安装插件。
Formatter
在vim
中提供格式化功能。
在~/.vimrc
中输入
Plugin 'Chiel92/vim-autoformat'
然后打开vim
,输入:PluinInstall
进行插件的安装。
vim-autoformat
只是一个格式化框架,还需要安装其他工具才可以格式化代码。其他工具点击这里,打开网站进行安装即可。
如安装astyle
,点击。
输入
$ sudo apt-get install astyle
网站上有一些对应的配置。配置。
在~/.vimrc
中输入
let g:formatdef_harttle = '"astyle --style=kr --pad-oper -xg -c -N"'
let g:formatters_cpp = ['harttle']
noremap <F3> :Autoformat<CR>
vim配置以及Vundle安装插件相关推荐
- 【Jmeter】安装配置:Jmeter 安装插件 Redis Data Set
目录 一.插件安装 二.插件作用 一.插件安装 使用插件管理器进行安装插件:Redis Data Set [Jmeter]安装配置:Jmeter 安装插件管理器 Plugins Manager
- 简单的vim配置+下载好的插件(复制即用!)
速用!!! 我的vim配置和插件都在这里,直接克隆到用户目录下就可以直接使用啦. https://github.com/zzzghttt/myVim 详细 vim重度使用患者,最近进实验室了,新搭的服 ...
- sublime Text3安装及配置与解决安装插件失败
1.下载sublime Text3的官网:https://www.sublimetext.com/3 2.安装Package Control 下载Package Contoral地址: 链接:h ...
- vim配置及常用插件安装
前言 作为一个程序员,一个常用的工具就是编辑器,常用的编辑器有Sublime Text.Emacs.Vim.Source Insight.Atom.TextMate. 引用知乎大佬刘尚奇的言论 中国范 ...
- Vim安装插件管理器Vundle
安装vundle $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 默认安装在/.vim ...
- vim 中的杀手级插件: vundle (vim 插件管理器)
From:http://zuyunfei.com/2013/04/12/killer-plugin-of-vim-vundle/ vundle.txt:https://github.com/Vundl ...
- 有哪些编程必备的 Vim 配置?
韦易笑优秀回答者办公室就是我di家,电脑爱我我爱ta 99 人赞同 能不能推荐下自己写的用了好几年的编程插件:vimmake ?完美支持 vim的异步模式: GitHub - skywind3000/ ...
- vim配置python3开发环境
1.1环境 OS:CentOS Linux release 7.6.1810 (Core) python版本:Python 3.9.6 需求:配置vim使能支持python程序开发的类似IDE环境,实 ...
- 使用Vundle安装YouCompleteMe
使用Vundle安装YouCompleteMe Linux x64系统 1. Vundle简介 Vundle是Vim bundle的缩写,是Vim插件管理器. Vundle允许你- 跟踪并配置您的插件 ...
最新文章
- 【JavaScript框架封装】公共框架的封装
- Windows Azure Virtual Machine (30) 修改Azure VM 的Subnet
- php 处理 http 请求,PHP的http请求处理类
- android -上传文件到服务器
- pycharm怎么编写python代码_如何设置PyCharm中的Python代码模版(推荐)
- xml文件c语言读取函数,读写xml文件的2个小函数
- HDU 4081 Qin Shi Huang's National Road System
- C#调用VC的DLL的接口函数参数类型转换一览表
- poj1062 昂贵的聘礼
- MATLAB常见问题:小数保留有效数字位数相关问题/除法结果问题/数据显示格式设置
- 非线性动力学中的同步,同步有哪几类?
- 机器学习开篇之机器学习的分类
- 瞎琢磨先生のJava笔记之读取SpringBoot配置文件的几种方式
- MyEclipse 10.5下载地址及破解方法
- c# 如何改变ToolStrip的大小,并向ToolStripButton加载合适大小的Image
- oracle 00600 kccpb,ora-00600 [kccpb_sanity_check_2] 错误处理
- 计算机毕业设计垃圾分类回收微信小程序源码
- 彩虹显IP软件即使合法也不合理
- java多个pdf合成一个pdf
- 揭秘吴孟达周星驰恩怨情仇
热门文章
- 如何确定当前的S7-1200PLC使用的具体的博途软件和固件版本?
- cmd快速进入指定目录方法
- 从Ethernet到TSN:实时通信一小步,工业4.0一大步
- OneFlow获得首届“全国颠覆性技术创新大赛”最高奖
- 元宇宙营销策略、玩法与案例
- K-Means和轮廓系数
- 用计算机把手机储存放大,嫌手机屏幕小?3图教你将手机画面放大(有线篇)...
- 接口和协议组成 聊一聊游戏的接口测试落地
- NTP反射放大攻击(三)ntp.conf配置文件详解
- Springboot:整合redis对接口数据进行缓存