Vundle是vim插件管理工具,用来管理vim插件,vim-autoformat是代码格式化插件

1.安装Vundle(参考点击打开链接)

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

2.在.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'
Plugin 'Chiel92/vim-autoformat'

" 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
3.重启vim,在vim中执行:PluginInstall,安装vim-autoformat

4.安装 astyle

sudo apt-get install astyle

也可以安装其他语言对应的格式化插件,安装完成后,会执行默认格式化设置

5.自定义astyle格式化,在.vimrc中添加如下代码

let g:formatdef_my_cpp = '"astyle --style=google"'
let g:formatters_cpp = ['my_cpp']
au BufWrite * :Autoformat

代码保存时,会自动进行格式化

vim+Vundle+vim-autoformat+astyle格式化代码相关推荐

  1. vscode配置AStyle格式化代码

    伙伴们按照步骤来就可以成功,如果我写的不清楚,麻烦评论或者私信我. 一.打开vscode插件下载astyle 二.下载AStyle并配置环境 1.官网下载http://astyle.sourcefor ...

  2. Keil使用AStyle格式化代码

    目录: 1.添加Astyle菜单 2.添加Astyle All Files 和Astyle Current File菜单(自定义菜单名,可以使用中文) 3.添加Command命令 4.填写Argume ...

  3. qt 使用插件astyle_使用astyle格式化代码

    一.基本命令 astyle --style=ansi main.cs (ansi/linux:使用ansi/linux风格格式化main.cs) 了解上面的命令就可以格式化一个文件了,下面来看如何格式 ...

  4. 终端文本编辑神器--Vim命令详解。如何配置使用Vim、Vim插件?

    作者:Mintimate 博客:https://www.mintimate.cn Mintimate's Blog,只为与你分享 文章目录 Vim 发展历史 Vi&Vim Nano&E ...

  5. vim + vundle + YCM+自动格式化

    在虚拟机下安装了Pycharm发现好卡啊,就想着直接用vim加个自动补全插件好了,总结下刚刚装YouCompleteMed的过程吧: 1. 安装Vundle 先安装Vundle,用来管理其他插件. g ...

  6. vim代码格式化自动加空格_vim格式化代码实际上就是 缩进代码, 命令是等号=

    vim格式化代码实际上就是 "缩进代码", 命令是等号= 格式化就是 vim 根据 文件的类型, 自动的对代码进行 缩进 缩进的类型有多种, 都是用等号命令: = 全部格式化 : ...

  7. vim自动格式化代码转载

    让 Vim 在保存文件时自动格式化代码 2020 年 11 月 04 日 2020 年 11 月 05 日 Computer Skills 314 1.5k 3 分钟 写代码时,遵循一定的代码风格是很 ...

  8. vim在同一个窗口中同时编辑多个文件以及自动格式化代码

    一.如果在终端中开没有打开vim,可以: 横向分割显示: $ vim -o filename1 filename2 纵向分割显示: $ vim -O filename1 filename2 二.如果已 ...

  9. go语言笔记——调试还很弱,用gdb来做?可用panic和defer。格式化代码使用gofmt,貌似我的vim插件是自带...

    3.3 调试器 应用程序的开发过程中调试是必不可少的一个环节,因此有一个好的调试器是非常重要的,可惜的是,Go 在这方面的发展还不是很完善.目前可用的调试器是 gdb,最新版均以内置在集成开发环境 L ...

最新文章

  1. 教程-Delphi调用百度地图API(XE8+WIN7)
  2. go开源项目influxdb-relay源码分析(一)
  3. [转]Win下必备神器之Cmder
  4. beanpostprocessor使用场景_Spring因动态代理使用不注意导致的诡异现象
  5. Java设计模式详解
  6. zemax操作数_ZEMAX与像差理论:二级光谱的ZEMAX描述与详解
  7. mergesort_Mergesort算法的功能方法
  8. PaddleOCR和ChineseOCR的对比
  9. updateStateByKey算子入门案例
  10. 如何配置风骚的android studio编辑器,让编程更优雅?
  11. 【69】Sqrt(x)
  12. 获取中国气象台卫星云图
  13. tp5 mysql悲观锁_thinkphp悲观锁机制处理高并发
  14. JavaSE Map集合 HashMap和Hashtable的区别 Collections(集合工具类) 集合练习 模拟斗地主(洗牌,发牌,看牌)
  15. FTP协议 与 FXP协议区别
  16. EasyUI使用基础教程
  17. RSA组件之掩码生成函数(MGF)的实现(C源码)
  18. 根据观测时间,经纬度,求太阳高度角
  19. 零基础入门C语言,只需2小时轻松学会!
  20. 网络安全自学笔记04 - 路由器技术

热门文章

  1. UnRaid利用iGVT-g插件实现Nas宿主机、虚拟机同时使用intel核显输出或硬解(硬件加速)功能
  2. SLC NAND FLASH的物理结构
  3. linux在磁盘容量扩容后扩容文件系统
  4. Spring Cloud-Alibaba
  5. LVGL笔记10--lv_cont容器
  6. 2021-10-19 nlp_1 nltk的基本应用
  7. 【Linux rar,unrar命令安装详细实践】
  8. Linux IPC:匿名管道 与 命名管道
  9. Portapack应用开发教程(十五) APRS接收
  10. X站全称是什么_工作中学习-没有校惯导之前为什么PFD不显示飞机姿态,而IFSD却能显示...