by godhw
1 min read

Categories

Tags

This is a summary of my vim settings.

center-aligned-image

For vim or neovim, use version 8.2 or higher. There was a vulnerability issue in the previous version.

refer to this site

Plugin

  • vim ver : 8.2
  • vim-plug
    • vim plugin manager
    • should be installed first
    • Use :Plug<Tab> to check if it is installed properly in vim
    • github
  • coc.nvim
    • depend on NodeJS ver 12.12 or higher
    • true snippet and additional text editing support
    • add LSP by :CocInstall <LSP server name>
    • LSP server list
    • if use C, type :CocInstall coc-clangd and follow the procedure
    • if there is no clangd, This will command: :CocCommand clangd.install and :CocCommand clangd.update
    • github
  • NERDTree
    • file system explorer for the Vim editor
    • github
  • tagbar
    • browse the tags of the current file
    • get an overview of its structure
    • must install ctags
    • github
  • vim-airline
    • nice statusline at the bottom of each vim window
    • managing other tabs
    • github
  • ctrlp
  • vim-indent-guides
    • visually displaying indent levels
    • github

Install Plugin

  1. add Plugin in .vimrc
  2. type :source % in vim command
  3. type :PlugInstall in vim command
  4. check each github in more details
" plug-in setting
call plug#begin('~/.vim/plugged')

" plug-in
Plug 'neoclide/coc.nvim', {'branch': 'release'}

Plug 'preservim/nerdtree'

Plug 'preservim/tagbar'

Plug 'vim-airline/vim-airline'

Plug 'ctrlpvim/ctrlp.vim'

Plug 'nathanaelkane/vim-indent-guides'

call plug#end()

editor setting

" Editor
"
" Syntax Highlighting
if has("syntax")
  syntax on
endif
 
" new lines inherit the indentation of previous lines
set autoindent

" c auto indent
set cindent

" numbering line
set number relativenumber

" hightlight matching parenthesis
set showmatch

" highlighting search
set hlsearch

" ignore case when searching
set ignorecase

" increase string when searching
set incsearch

" find exact string when search upper
set smartcase

" use an encoding that supports unicode
set encoding=utf-8

" always display the status bar
set laststatus=2

" status line config
" set statusline=\ %<%l:%v\ [%P]%=%a\ %h%m%r\ %F\
" show command
set showcmd

" Tab to space
set expandtab

" Tab to space = 2
set tabstop=2

" >> << to space = 2
set shiftwidth=2

" delete 2 space (recongize 2 space = 1 tab)
set softtabstop=2

" open files no fold
set nofoldenable

" set cursor
set ruler
set cul

" set cursor in last modified point
au BufReadPost * 
\ if line("'\"") > 0 && line("'\"") <= line("$") | 
\ exe "norm g`\"" | 
\ endif

" vim indent guides
let g:indent_guides_guide_size=1
let g:indent_guides_start_level=2