1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
set nocompatible
" Environment http://tlvince.com/vim-respect-xdg
if !exists($XDG_CONFIG_HOME)
let $XDG_CONFIG_HOME=expand('~/.config')
endif
if !exists($XDG_DATA_HOME)
let $XDG_DATA_HOME=expand('~/.local/share')
endif
if !exists($XDG_CACHE_HOME)
let $XDG_CACHE_HOME=expand('~/.cache')
endif
set directory=$XDG_CACHE_HOME/vim/swp//,/var/tmp//,/tmp//
set undodir=$XDG_CACHE_HOME/vim/undo//,/var/tmp//,/tmp//
set backupdir=$XDG_CACHE_HOME/vim/backup,/var/tmp,/tmp
set viminfo+=n$XDG_CACHE_HOME/vim/viminfo
set rtp=$XDG_CONFIG_HOME/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$XDG_CONFIG_HOME/vim/after
" dein.vim
let s:dein_base = $XDG_DATA_HOME . '/vim/dein'
let s:dein_repo_path = s:dein_base . '/repos/github.com/Shougo/dein.vim'
let s:dein_repo_url = 'https://github.com/Shougo/dein.vim'
let s:dein_toml = $XDG_CONFIG_HOME . '/vim/dein.toml'
let s:plugrc = $XDG_CONFIG_HOME . '/vim/plugrc'
let &runtimepath.=','.s:dein_repo_path
function! s:hook_source() abort
let l:rcfile = s:plugrc . '/' . g:dein#plugin.normalized_name . '.rc.vim'
let g:dein#plugin.hook_source = "source " . l:rcfile
endfunction
" dein.vim
let g:dein#types#git#clone_depth = 1
try
if dein#load_state(s:dein_base)
call dein#begin(s:dein_base)
call dein#load_toml(s:dein_toml)
call dein#end()
call dein#save_state()
endif
catch /E117:/ " dein not installed
execute "silent !git clone" s:dein_repo_url s:dein_repo_path
call dein#begin(s:dein_base)
call dein#load_toml(s:dein_toml)
set nomore
call dein#install()
call dein#end()
quit
endtry
if dein#tap('denite.nvim')
nnoremap [Denite] <Nop>
nmap <leader>d [Denite]
nnoremap [Denite]g :<C-u>Denite grep -auto-action=preview -split=no -no-empty<CR>
nnoremap [Denite]f :<C-u>Denite file/rec -start-filter -split=no<CR>
nnoremap [Denite]l :<C-u>Denite buffer file/old -split=no<CR>
nnoremap [Denite]r :<C-u>Denite -resume -refresh<CR>
nnoremap [Denite]gf :DeniteCursorWord file/rec<CR>
nnoremap [Denite]gg :DeniteCursorWord grep<Cr>
nnoremap [Denite]g/ :DeniteCursorWord line<Cr>
function! s:denite_my_settings() abort
nnoremap <silent><buffer><expr> <CR> denite#do_map('do_action')
nnoremap <silent><buffer><expr> p denite#do_map('do_action', 'preview')
nnoremap <silent><buffer><expr> q denite#do_map('quit')
nnoremap <silent><buffer><expr> i denite#do_map('open_filter_buffer')
nnoremap <silent><buffer><expr> <Space> denite#do_map('toggle_select').'j'
endfunction
autocmd FileType denite call s:denite_my_settings()
endif
if dein#tap('vimfiler.vim')
call s:hook_source()
endif
if dein#tap('neosnippet.vim')
let g:neosnippet#snippets_directory =
\ $XDG_CONFIG_HOME . '/vim/snippets'
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_or_jump)
endif
if dein#tap('vim-easy-align')
nmap ga <Plug>(EasyAlign)
endif
if dein#tap('vim-textobj-between')
let g:textobj_between_no_default_key_mappings = 1
omap af <Plug>(textobj-between-a)
omap if <Plug>(textobj-between-i)
xmap af <Plug>(textobj-between-a)
xmap if <Plug>(textobj-between-i)
endif
if dein#tap('vim-textobj-indent')
let g:textobj_indent_no_default_key_mappings = 1
omap ai <Plug>(textobj-indent-a)
omap ii <Plug>(textobj-indent-i)
xmap ai <Plug>(textobj-indent-a)
xmap ii <Plug>(textobj-indent-i)
omap aI <Plug>(textobj-indent-same-a)
omap iI <Plug>(textobj-indent-same-i)
xmap aI <Plug>(textobj-indent-same-a)
xmap iI <Plug>(textobj-indent-same-i)
endif
if dein#tap('vim-operator-surround')
nmap <silent>sa <Plug>(operator-surround-append)
nmap <silent>sd <Plug>(operator-surround-delete)
nmap <silent>sr <Plug>(operator-surround-replace)
endif
if dein#tap('vim-addon-local-vimrc')
let g:local_vimrc = {'names':['.lvimrc'],'hash_fun':'LVRHashOfFile'}
endif
if dein#tap('vim-lsp')
if executable('ccls')
au User lsp_setup call lsp#register_server({
\ 'name': 'ccls',
\ 'cmd': {server_info->['ccls']},
\ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))},
\ 'initialization_options': {'cache': {'directory': '/var/tmp/ccls/cache' }},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
\ })
endif
if executable('rustup')
au User lsp_setup call lsp#register_server({
\ 'name': 'rls',
\ 'cmd': {server_info->['rustup', 'run', 'nightly', 'rls']},
\ 'whitelist': ['rust'],
\ })
endif
if executable('ghcide')
au User lsp_setup call lsp#register_server({
\ 'name': 'ghcide',
\ 'cmd': {server_info->['ghcide', '--lsp']},
\ 'whitelist': ['haskell'],
\ })
endif
if executable('texlab')
au User lsp_setup call lsp#register_server({
\ 'name': 'texlab',
\ 'cmd': {server_info->['texlab']},
\ 'whitelist': ['tex', 'plaintex'],
\ })
endif
function! s:on_lsp_buffer_enabled() abort
setl omnifunc=lsp#complete
setl signcolumn=yes
endfunction
augroup lsp_install
au!
au User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup end
nnoremap [Lsp] <Nop>
nmap <leader>l [Lsp]
nmap [Lsp]dd <Plug>(lsp-definition)
nmap [Lsp]s <Plug>(lsp-document-symbol)
nmap [Lsp]i <Plug>(lsp-document-diagnostics)
nmap [Lsp]r <Plug>(lsp-rename)
endif
if dein#tap('base16-vim')
set bg=dark
let base16colorspace=256
colorscheme base16-monokai
endif
let g:markdown_fenced_languages = ['haskell']
filetype plugin indent on
syntax on
set ai
set bs=2
set cc=80,120
set fdm=syntax
set formatoptions+=j
set lcs=tab:\│\ ,trail:·,eol:¬
set ls=2
set nu
set rnu
set ru
set si
set sta
set sw=4
set ts=4
set ttyfast
set udf
set wmnu
if has('gui_running')
set go=m
endif
" Filebin
com -range=% Fb :exec "<line1>,<line2>w !fb -e ".&filetype." -n ".expand("%:t")
" Write with sudo
com W w !sudo tee % > /dev/null
|