Vundle is the VIM plug-in management tool used to manage Vim plug-ins, Vim-autoformat is a code-formatted plug-in
1. Installation Vundle (reference click to open link)
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/vundle.vim
2. Add the following content to the. vimrc file
Set Nocompatible "is 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 is added before the following Linecall Vundle#end ()" Requiredfiletype plugin indent on "Requi Red "to ignore plugin indent changes instead with:" FileType plugin on "" Brief Help ":P luginlist-lists configured Plugins ":P Lugininstall-installs plugins; Append '! ' to update or just:P luginupdate ':P luginsearch foo-searches for foo; Append '! ' to refresh the local cache ':P luginclean-confirms removal of unused plugins; Append '! ' to Auto-approve removal ' "see:h vundle for more details or wikis for FAQs" Put your non-plugin stuff Line
3. Restart Vim, execute in VIM: Plugininstall, install Vim-autoformat
4. Install Astyle
sudo apt-get install Astyle
You can also install the formatting plug-ins for other languages, and when the installation is complete, the default formatting settings are performed
5. Custom Astyle format, add the following code in. VIMRC
Let G:formatdef_my_cpp = ' "Astyle--style=google" ' let
g:formatters_cpp = [' my_cpp ']
au bufwrite *: Autoformat
When the code is saved, it is automatically formatted