Vim Notes on Fedora

Source: Internet
Author: User
Tags autoload save file set background

1. Install Vim
sudo DNF install vim

2, plug-in management
Choose Vim-plug,vim-plug is Korean Junegunn (Junegunn Choi) wrote, the fastest plug-in manager, whether it is the update, installation, are all concurrent (https://github.com/junegunn/vim-plug ) 。
Download the Vim-plug in the user directory and put it in the AutoLoad directory:

        curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Execute the above command, and then create a new plugged directory under the. Vim directory to place the plug-in, and finally the. Vim directory has a directory of autoload and plugged two.

3, configuration. VIMRC

Call Plug#begin (' ~/.vim/plugged ')

"Shorthand notation; Fetches Https://github.com/Valloric/YouCompleteMe.git
Plug ' Valloric/youcompleteme ' "auto-complete
Plug ' scrooloose/nerdtree ' "Tree-shaped catalogue
Plug ' xuyuanp/nerdtree-git-plugin ' tree-shaped directory git support
Plug ' vim-airline/vim-airline ' status bar enhancements
Plug ' vim-airline/vim-airline-themes ' status bar theme
Plug ' Majutsushi/tagbar ' "right window
Plug ' Morhetz/gruvbox ' "color theme
Plug ' Kien/ctrlp.vim ' "Search plugin
Plug ' yggdroot/indentline ' "Indent line
Plug ' vim-scripts/indentpython.vim ' python auto indent
Plug ' W0rp/ale ' "Code detection
Plug ' Nvie/vim-flake8 ' "Add Flake8 code style check
Plug ' TELL-K/VIM-AUTOPEP8 ' automatic formatting tool
Plug ' Chiel92/vim-autoformat ' Automatic one-click Formatting code
Plug ' tpope/vim-fugitive ' git integration plugin
Plug ' Mhinz/vim-startify ' "show recently opened file
Plug ' Kien/rainbow_parentheses.vim ' "different color distinguishes parentheses matching

"Initialize Plugin System
Call Plug#end ()

"----------Indentline Configure--------------
Let g:indentline_char= ' ┆ '
Let g:indentline_enabled = 1

"----------Ale Configure---------------------
Let G:ale_fix_on_save = 1
Let g:ale_completion_enabled = 1
Let G:ale_sign_column_always = 1
Let g:airline#extensions#ale#enabled = 1

"----------Autopep8 Configure-------------
Let G:autopep8_disable_show_diff=1
Autocmd FileType python noremap : Call AUTOPEP8 ()

"----------Autoformat Configure-------------
Nnoremap : Autoformat
Let g:autoformat_autoindent = 0
Let G:autoformat_retab = 0
Let g:autoformat_remove_trailing_spaces = 0

----------rainbow_parentheses Configure--------------------
Let g:rbpt_colorpairs = [
? ['] Brown ', ' RoyalBlue3 '],
? [' Darkblue ', ' SeaGreen3 '],
? [' Darkgray ', ' DarkOrchid3 '],
? [' Darkgreen ', ' Firebrick3 '],
? [' Darkcyan ', ' RoyalBlue3 '],
? [' Darkred ', ' SeaGreen3 '],
? [' Darkmagenta ', ' DarkOrchid3 '],
? [' Brown ', ' Firebrick3 '],
? [' Gray ', ' RoyalBlue3 '],
? [' Darkmagenta ', ' DarkOrchid3 '],
? [' Darkblue ', ' Firebrick3 '],
? [' Darkgreen ', ' RoyalBlue3 '],
? [' Darkcyan ', ' SeaGreen3 '],
? [' Darkred ', ' DarkOrchid3 '],
? [' Red ', ' Firebrick3 '],
?]
Let G:rbpt_max = +
Let g:rbpt_loadcmd_toggle = 0
au vimenter * rainbowparenthesestoggle
au Syntax * RAINBOWP Arenthesesloadround
au Syntax * rainbowparenthesesloadsquare
au Syntax * rainbowparenthesesloadbraces

----------Color Configure---------------
Syntax enable
"Set syntax highlighting for specific file types
Autocmd Bufread,bufnewfile . MD Set Filetype=markdown
"Color scheme
Set Background=dark
ColorScheme Gruvbox
Highlight current line
au winleave
set nocursorline nocursorcolumn
au winenter * set cursorline C Ursorcolumn
Set Cursorline cursorcolumn

----------Airline Configure----------------
"Always show the status bar
set laststatus=2
" must be set after installing the font
Let G:airline_ powerline_fonts = 1
Select airline Theme
Let G:airline_theme= ' bubblegum '
' opens tabline function for easy viewing of buffer and switching, Eliminates the MINIBUFEXPL plug-in
Let g:airline#extensions#tabline#enabled = 1
Let G:airline#extensions#tabline#buffer_nr_ Show = 1
Set toggle buffer shortcut key
Nnoremap : bn
Nnoremap : BP
"off status Show blank symbol Count
Let g:airline#extensions#whitespace#enabled = 0
Let G:airline#extensions#whitespace#symbol = '! '
If!exists (' G:airline_symbols ')
Let g:airline_symbols = {}
endif
"Unicode symbols
Let g:airline_left_sep = '? '
Let g:airline_left_alt_sep = '? '
Let g:airline_right_sep = '? '
Let g:airline_right_alt_sep = '? '
Let G:airline_symbols.linenr = '? '
Let G:airline_symbols.branch = '? '

"----------Youcompleteme Configure------------
"Sets the path to the global profile
Let g:ycm_global_ycm_extra_conf = ' ~/.ycm_extra_conf.py '
"No longer asks whether to load ycm_extra_conf.py configuration when Vim is turned on"
Let G:ycm_confirm_extra_conf=0
"Python Interpreter Path"
Let G:ycm_python_binary_path = '/usr/bin/python3 '
"Automatically pops up without the user's active triggering
Let g:ycm_semantic_triggers = {
? ' C,cpp,python,java,go,erlang,perl ': [' re!\w{2} ',
? ' Cs,lua,javascript ': [' re!\w{2} ',
?}
"Make Vim's complement menu behavior consistent with the General IDE
Set Completeopt=longest,menu
"Automatically close the preview window after leaving insert mode
Autocmd Insertleave * If pumvisible () = = 0|pclose|endif
"Enter to select the current item
Inoremap Pumvisible ()? "<C-y>": "<CR>"
"Youcompleteme default tab s-tab and Ultisnips conflicts
Let g:ycm_key_list_select_completion = [' ']
Let g:ycm_key_list_previous_completion = [' ']
"turn on YCM based label engine
Let G:ycm_collect_identifiers_from_ Tags_files=1
"Start listing matches from the 2nd type of character
let g:ycm_min_num_of_chars_for_completion=2
" suppress cache matches, regenerate matches every time
L ET g:ycm_cache_omnifunc=0
Syntax keyword completion
let g:ycm_seed_identifiers_with_syntax=1
"can also be complete in comment input
let G:YC m_complete_in_comments = 1
"can also be complete in string input
Let g:ycm_complete_in_strings = 1
" comments and text in the string will also be revenue complement
let g:ycm_collect_identifiers_from_comments_and_strings = 0
Let g:clang_user_options= ' | | exit 0 '
"jump to the definition at
N Noremap jd:ycmcompleter gotodefinition
"jump to Declaration
Nnoremap GL:YC Mcompleter gotodeclaration
"jump to the definition or declaration at
Nnoremap gg:ycmcompleter Go Todefinitionelsedeclaration

"----------NERD tree Configure-------------
Let Nerdchristmastree=0
Let nerdtreewinsize=30
Let nerdtreechdirmode=2
Let nerdtreeignore=[' ~$ ', '. pyc$ ', '. swp$ ']
Let Nerdtreeshowbookmarks=1
Let nerdtreewinpos= "left"
"Automatically open a nerdtree if no files where specified
Autocmd Vimenter * If!ARGC () | Nerdtree | endif
"Close vim if the only window left open is a nerdtree
Autocmd Bufenter * if (WINNR ("$") = = 1 && exists ("B:nerdtreetype") && B:nerdtreetype = = "PRIMARY") | Q | endif
The shortcut key configuration
Nmap : Nerdtreetoggle

"----------Tagbar Configure------------
Let g:tagbar_width=30
Let G:tagbar_autofocus=0
Let g:tagbar_ctags_bin= '/usr/bin/ctags '
Autocmd bufreadpost . cpp,. C,. h,. HPP,. CC,. Cxx Call Tagbar#autoopen ()
Nmap : Tagbartoggle
"Executing in the Directory of code: CTAGS-R *

The configuration of the-----------base-----------
Set nocompatible "Off compatibility mode with VI
Set number "Displays line numbers
Set nowrap "does not automatically fold rows
Set Showmatch "Display matching parentheses
Set scrolloff=3 "distance from top and bottom 3 rows
Set Encoding=utf-8 "encoding
Set FILEENCODINGS=UTF-8,UCS-BOM,GB2312,BIG5 "encoding
Set Mouse=a "Enable mouse
Set Hlsearch "Search highlighting
Syntax on "syntax highlighting

"----------Automatic code execution by F5--------------
Map : Call COMPILERUNGCC ()
func! COMPILERUNGCC ()
Exec "W"
if &filetype = = ' C '
Exec "!GCC%-O%<"
Exec "!time ./%<"
ElseIf &filetype = = ' cpp '
Exec "!g++%-O%<"
Exec "!time ./%<"
ElseIf &filetype = = ' Python '
Exec "!clear"
Exec "!time python3%"
endif
Endfunc

"------------Code Folding--------------
Set Foldmethod=indent
Set foldlevel=99
"Use the ZC key combination to create a fold, turn the fold on or off using za
"Replace za with empty SPACEBAR
Nnoremap za

The------------split window--------------
Set Splitbelow
Set Splitright
"Switch shortcut keys between Settings window
Nnoremap "ctrl-j switch to the following
Nnoremap "ctrl-k Switch to the top
Nnoremap "ctrl-l switch to the right
Nnoremap "ctrl-h switch to the left

"Set Python code to indent in accordance with the PEP8 standard
Au bufnewfile,bufread *.py
? set tabstop=4 "tab width
? Set softtabstop=4
? Set shiftwidth=4
? set textwidth=79 "Row maximum width
? Set expandtab "tab Replace with space key
? set autoindent "Auto Indent
? set Fileformat=unix "Save file format

4:, install plug-ins
Input in vim Normal mode: Pluginstall, waiting for installation to complete

5, auto-complete plug-in Youcompleteme configuration
Install Clang:
sudo DNF install clang
Enter directory:
CD ~/.vim/bundle/youcompleteme
Compile:
./install.sh--clang-completer--system-libclang
--clang-completer indicates support for C-series completion.

Configuration. ycm_extra_conf.py
Copy to ~ directory First
CP ~/.vim/bundle/youcompleteme/third_party/ycmd/examples/.ycm_extra_conf.py ~/
Re-Modify
Vim ~/.ycm_extra_conf.py

To view the library path with a command:
echo | Clang-v-e-x C + +-
The results may be as follows:
Clang version 3.6.2 (tags/release_362/final)
Target:i386-pc-linux-gnu
Thread Model:posix
Found candidate GCC Installation:/usr/lib/gcc/i686-redhat-linux/4.4.4
Found candidate GCC Installation:/usr/lib/gcc/i686-redhat-linux/4.4.7
Found candidate GCC Installation:/usr/local/bin/.. /lib/gcc/i686-pc-linux-gnu/4.8.1
Selected GCC Installation:/usr/local/bin/. /lib/gcc/i686-pc-linux-gnu/4.8.1
Candidate Multilib:.; @m32
Selected multilib:.; @m32
It's too long, it omits some of the middle content; The content that represents the raw
Here is the path that needs to be included below these are the paths that need to be included
/usr/local/bin/. /LIB/GCC/I686-PC-LINUX-GNU/4.8.1/. /.. /.. /.. /include/c++/4.8.1
/usr/local/bin/. /LIB/GCC/I686-PC-LINUX-GNU/4.8.1/. /.. /.. /.. /include/c++/4.8.1/i686-pc-linux-gnu
/usr/local/bin/. /LIB/GCC/I686-PC-LINUX-GNU/4.8.1/. /.. /.. /.. /include/c++/4.8.1/backward
/usr/local/include
/usr/local/bin/. /lib/clang/3.6.2/include
/usr/include

Organize the above and add to flag

Copy the above content and modify it as follows:
'-isystem ',
'/usr/local/bin/. /LIB/GCC/I686-PC-LINUX-GNU/4.8.1/. /.. /.. /.. /include/c++/4.8.1 ',
'-isystem ',
'/usr/local/bin/. /LIB/GCC/I686-PC-LINUX-GNU/4.8.1/. /.. /.. /.. /include/c++/4.8.1/i686-pc-linux-gnu ',
'-isystem ',
'/usr/local/bin/. /LIB/GCC/I686-PC-LINUX-GNU/4.8.1/. /.. /.. /.. /include/c++/4.8.1/backward ',
'-isystem ',
'/usr/local/include ',
'-isystem ',
'/usr/local/bin/. /lib/clang/5.0.1/include ',
'-isystem ',
'/usr/include ',

Vim Notes on Fedora

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.