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