plugins: Change easychair2 url
[vimconf.git] / plugins.vim
1 function! Cond(cond, ...)
2 let opts = get(a:000, 0, {})
3 return a:cond ? opts : extend(opts, { 'on': [], 'for': [] })
4 endfunction
5
6 Plug 'mhinz/vim-startify'
7 Plug 'dstein64/vim-startuptime'
8
9 Plug 'vim-airline/vim-airline'
10 Plug 'gruvbox-community/gruvbox'
11 Plug 'liuchengxu/vim-which-key'
12
13 Plug 'benknoble/vim-auto-origami'
14
15 Plug 'scrooloose/nerdcommenter'
16 Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'}
17
18 Plug 'roryokane/detectindent'
19
20 " This plugin cannot be conditionally loaded, see github issue #18
21 Plug 'derekwyatt/vim-fswitch' ", {'for': ['c', 'cpp', 'objc']}
22
23 Plug 'godlygeek/tabular'
24 Plug 'junegunn/vim-easy-align'
25
26 Plug 'thinca/vim-fontzoom'
27
28 Plug 'lambdalisue/vim-manpager', {'on': 'MANPAGER'}
29
30 " Make . more useful after a plugin map
31 Plug 'tpope/vim-repeat'
32 Plug 'flwyd/vim-conjoin'
33
34
35 function PluginsConfig()
36
37 " Some preferences for indent detection
38 let g:detectindent_min_indent = 2
39 let g:detectindent_max_indent = 4
40 let g:detectindent_preferred_indent = 4
41
42 " Minimum indenting for source code
43 au FileType c,cpp,objc,java,cs let g:detectindent_min_indent = 4
44 " Consider using localvimrc config file or editorconfig instead
45 "au BufReadPost *.java :DetectIndent
46
47 let g:airline_powerline_fonts=1
48 let g:airline#extensions#tabline#enabled=1
49 let g:airline#extensions#branch#enabled=1
50
51 let g:gruvbox_contrast_light='hard'
52 let g:gruvbox_contrast_dark='hard'
53 set bg=dark
54
55 if &term =~ 'linux'
56 let g:gruvbox_termcolors=16
57 else
58 " Setting termguicolors has two implications:
59 " - Breaks colors for some versions of mosh, but not if tmux is used on top of
60 " mosh. See https://github.com/mobile-shell/mosh/issues/928
61 set termguicolors
62 let g:gruvbox_italic = 1
63 endif
64 colorscheme gruvbox
65
66 " let NERDTreeWinPos="right"
67 let NERDTreeHijackNetrw=0
68 let NERDTreeWinSize=22
69 let NERDTreeQuitOnOpen=1
70 "au VimEnter * if !argc() | Startify | NERDTree | wincmd w
71
72 let g:startify_files_number = 5
73 let g:startify_session_persistence = 1
74 let g:startify_lists = [
75 \ { 'type': 'dir', 'header': [' Recent files'] },
76 \ { 'type': 'sessions', 'header': [' Saved sessions'] },
77 \ ]
78
79 if has('nvim')
80 let verstr = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
81 let g:startify_custom_header = [
82 \ '',
83 \ ' ╻ ╻ ╻ ┏┳┓',
84 \ ' NEO ┃┏┛ ┃ ┃┃┃',
85 \ ' ┗┛ ╹ ╹ ╹ ' . verstr,
86 \ '',
87 \ ]
88 else
89 let verstr = matchstr(execute('version'), 'IMproved \zs[^\n ]*')
90 let g:startify_custom_header = [
91 \ '',
92 \ ' ╻ ╻ ╻ ┏┳┓',
93 \ ' ┃┏┛ ┃ ┃┃┃',
94 \ ' ┗┛ ╹ ╹ ╹ ' . verstr,
95 \ '',
96 \ ]
97 endif
98
99 au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.'
100 au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.'
101 au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh'
102 au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp'
103
104 let g:mapleader = "\<Space>"
105 let g:maplocalleader = ','
106 nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
107 nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
108 vnoremap <silent> <leader> :<c-u>WhichKeyVisual '<Space>'<CR>
109 vnoremap <silent> <localleader> :<c-u>WhichKeyVisual ','<CR>
110
111 let g:which_key_map = {}
112 au VimEnter * call which_key#register('<Space>', 'g:which_key_map')
113 let g:which_key_map.b = {
114 \ 'name': '+buffer',
115 \ '1': ['b1', 'buffer 1'],
116 \ '2': ['b2', 'buffer 2'],
117 \ 'd': ['bd', 'delete-buffer'],
118 \ 'f': ['bfirst', 'first-buffer'],
119 \ 'h': ['Startify', 'home-buffer'],
120 \ 'l': ['blast', 'last-buffer'],
121 \ 'n': ['bnext', 'next-buffer'],
122 \ 'p': ['bprevious', 'previous-buffer'],
123 \ }
124
125 endfunction
126