WikiStart: vimrc

File vimrc, 4.8 KB (added by dsl, 3 months ago)
Line 
1" ----------------------------------
2" Section to define vim-plug plugins
3" ----------------------------------
4call plug#begin('~/.vim/plugged')
5
6Plug 'bronson/vim-trailing-whitespace'
7Plug 'scrooloose/nerdtree'
8Plug 'Xuyuanp/nerdtree-git-plugin'
9Plug 'majutsushi/tagbar'
10Plug 'xolox/vim-misc'
11Plug 'xolox/vim-easytags'
12Plug 'vim-airline/vim-airline'
13Plug 'vim-airline/vim-airline-themes'
14Plug 'w0rp/ale'
15Plug 'mhinz/vim-startify'
16Plug 'sainnhe/vim-color-ice-age'
17Plug 'sainnhe/vim-color-forest-night'
18Plug 'sainnhe/vim-color-lost-shrine'
19Plug 'arcticicestudio/nord-vim'
20
21call plug#end()
22
23" -----------------------------
24" General configuration options
25" -----------------------------
26"set clipboard=unnamed          " yank to the system clipboard
27set clipboard=unnamedplus       " yank to the system clipboard
28set number                      " show line numbers
29set tabstop=8                   " tab width
30set shiftwidth=8                " indent width
31set softtabstop=0               " sets the number of columns for a TAB
32set noexpandtab                 " do not expand tabs to spaces
33set nohlsearch                  " do not highlight search values
34"set list
35"set listchars=tab:__,eol:¬
36set guioptions-=a
37set guioptions-=A
38set guioptions-=aA
39set guioptions-=L
40set guioptions-=r
41set guioptions-=m               " hide menu bar
42set guioptions-=T               " hide toolbar
43set guioptions-=r               " hide scrollbar
44set encoding=utf-8
45set guitablabel=%N/\ %t\ %M
46
47" ----------------------------
48" Airline themes configuration
49" ----------------------------
50if !exists('g:airline_symbols')
51        let g:airline_symbols = {}
52endif
53let g:airline_theme = 'tomorrow'
54
55" --------------------------
56" Remaped keys configuration
57" --------------------------
58nnoremap <silent> <c-j> <c-w>h
59nnoremap <silent> <c-k> <c-w>j
60nnoremap <silent> <c-i> <c-w>k
61nnoremap <silent> <c-l> <c-w>l
62nnoremap <C-o> :NERDTreeToggle<CR>
63nnoremap <C-p> :TagbarToggle<CR>
64nnoremap <C-t> :tabe<CR>
65nnoremap <C-w> :tabclose<CR>
66nnoremap <C-F9> :ALEPreviousWrap<CR>
67nnoremap <C-F10> :ALENextWrap<CR>
68
69" -----------------------------
70" NERDTree plugin configuration
71" -----------------------------
72let g:NERDTreeWinSize = 35
73autocmd BufWinEnter * NERDTreeMirror
74
75" ---------------------
76" Margins configuration
77" ---------------------
78if (exists('+colorcolumn')) " Highlight 80th column
79        "set colorcolumn=80
80        "highlight ColorColumn ctermbg=9
81        au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
82endif
83
84" ----------------------------------
85" vim-gitgutter plugin configuration
86" ----------------------------------
87set updatetime=250
88let g:gitgutter_sign_added = '+'
89let g:gitgutter_sign_modified = '~'
90let g:gitgutter_sign_removed = '-'
91let g:gitgutter_sign_removed_first_line = '--'
92let g:gitgutter_sign_modified_removed = '>-'
93
94" ---------------------------------
95" vim-easytags plugin configuration
96" ---------------------------------
97let g:easytags_async = 1
98
99" -------------------------
100" ALE linters configuration
101" -------------------------
102let g:ale_linters = {
103\       'c': [ 'cppcheck', 'clangcheck' ],
104\       'cpp': [ 'cppcheck', 'clangcheck' ],
105\}
106let g:ale_linters_explicit = 1
107
108" ------------------
109" Font configuration
110" ------------------
111if has("gui_running")
112        if has("gui_gtk2") || has("gui_gtk3")
113                set guifont=DejaVu\ Sans\ Mono\ 10
114        endif
115endif
116
117hi clear
118
119if exists("syntax_on")
120        syntax reset
121endif
122
123" -------------------------
124" Color theme configuration
125" -------------------------
126"let g:colors_name="firesparks-256-bright"
127"colorscheme nord
128colorscheme lost-shrine
129
130" ------------------
131" Tabs configuration
132" ------------------
133" Rename tabs to show tab number.
134" (Based on http://stackoverflow.com/questions/5927952/whats-implementation-
135"       of-vims-default-tabline-function)
136if exists("+showtabline")
137    function! MyTabLine()
138        let s = ''
139        let wn = ''
140        let t = tabpagenr()
141        let i = 1
142        while i <= tabpagenr('$')
143            let buflist = tabpagebuflist(i)
144            let winnr = tabpagewinnr(i)
145            let s .= '%' . i . 'T'
146            let s .= (i == t ? '%1*' : '%2*')
147            let s .= ' '
148            let wn = tabpagewinnr(i,'$')
149
150            let s .= '%#TabNum#'
151            let s .= i
152            " let s .= '%*'
153            let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#')
154            let bufnr = buflist[winnr - 1]
155            let file = bufname(bufnr)
156            let buftype = getbufvar(bufnr, 'buftype')
157            if buftype == 'nofile'
158                if file =~ '\/.'
159                    let file = substitute(file, '.*\/\ze.', '', '')
160                endif
161            else
162                let file = fnamemodify(file, ':p:t')
163            endif
164            if file == ''
165                let file = '[No Name]'
166            endif
167            let s .= ' ' . file . ' '
168            let i = i + 1
169        endwhile
170        let s .= '%T%#TabLineFill#%='
171        let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
172        return s
173    endfunction
174    set stal=2
175    set tabline=%!MyTabLine()
176    set showtabline=1
177    highlight link TabNum Special
178endif