1 function! Cond(cond, ...)
2 let opts = get(a:000, 0, {})
3 return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
6 Plug 'mhinz/vim-startify'
7 Plug 'dstein64/vim-startuptime'
9 Plug 'vim-airline/vim-airline'
10 Plug 'gruvbox-community/gruvbox'
11 Plug 'liuchengxu/vim-which-key'
13 Plug 'benknoble/vim-auto-origami'
15 Plug 'scrooloose/nerdcommenter'
16 Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'}
18 Plug 'roryokane/detectindent'
20 " This plugin cannot be conditionally loaded, see github issue #18
21 Plug 'derekwyatt/vim-fswitch' ", {'for': ['c', 'cpp', 'objc']}
23 Plug 'godlygeek/tabular'
24 Plug 'junegunn/vim-easy-align'
26 Plug 'thinca/vim-fontzoom'
28 " vim-core on Gentoo does ship a manpager plugin that collides with MANPAGER
30 if has('nvim') || stridx(system("uname -r"), "-gentoo") == -1
31 Plug 'lambdalisue/vim-manpager', {'on': 'MANPAGER'}
34 " Make . more useful after a plugin map
35 Plug 'tpope/vim-repeat'
36 Plug 'flwyd/vim-conjoin'
39 function PluginsConfig()
41 " Some preferences for indent detection
42 let g:detectindent_min_indent = 2
43 let g:detectindent_max_indent = 4
44 let g:detectindent_preferred_indent = 4
46 " Minimum indenting for source code
47 au FileType c,cpp,objc,java,cs let g:detectindent_min_indent = 4
48 " Consider using localvimrc config file or editorconfig instead
49 "au BufReadPost *.java :DetectIndent
51 let g:airline_powerline_fonts=1
52 let g:airline#extensions#tabline#enabled=1
53 let g:airline#extensions#branch#enabled=1
55 let g:gruvbox_contrast_light='hard'
56 let g:gruvbox_contrast_dark='hard'
60 let g:gruvbox_termcolors=16
62 " Setting termguicolors has two implications:
63 " - Breaks colors for some versions of mosh, but not if tmux is used on top of
64 " mosh. See https://github.com/mobile-shell/mosh/issues/928
66 let g:gruvbox_italic = 1
70 " let NERDTreeWinPos="right"
71 let NERDTreeHijackNetrw=0
72 let NERDTreeWinSize=22
73 let NERDTreeQuitOnOpen=1
74 "au VimEnter * if !argc() | Startify | NERDTree | wincmd w
76 let g:startify_files_number = 5
77 let g:startify_session_persistence = 1
78 let g:startify_lists = [
79 \ { 'type': 'dir', 'header': [' Recent files'] },
80 \ { 'type': 'sessions', 'header': [' Saved sessions'] },
84 let verstr = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
85 let g:startify_custom_header = [
89 \ ' ┗┛ ╹ ╹ ╹ ' . verstr,
93 let verstr = matchstr(execute('version'), 'IMproved \zs[^\n ]*')
94 let g:startify_custom_header = [
98 \ ' ┗┛ ╹ ╹ ╹ ' . verstr,
103 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
104 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
105 au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
106 au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
108 let g:mapleader = "\<Space>"
109 let g:maplocalleader = ','
110 nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
111 nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
112 vnoremap <silent> <leader> :<c-u>WhichKeyVisual '<Space>'<CR>
113 vnoremap <silent> <localleader> :<c-u>WhichKeyVisual ','<CR>
115 let g:which_key_map = {}
116 au VimEnter * call which_key#register('<Space>', 'g:which_key_map')
117 let g:which_key_map.b = {
119 \ '1': ['b1', 'buffer 1'],
120 \ '2': ['b2', 'buffer 2'],
121 \ 'd': ['bd', 'delete-buffer'],
122 \ 'f': ['bfirst', 'first-buffer'],
123 \ 'h': ['Startify', 'home-buffer'],
124 \ 'l': ['blast', 'last-buffer'],
125 \ 'n': ['bnext', 'next-buffer'],
126 \ 'p': ['bprevious', 'previous-buffer'],