/
plugins.vim
243 lines (185 loc) · 7.26 KB
/
plugins.vim
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
" {{{ dein settings
" {{{ dein initialize
let s:plugins_path = expand('~/.config/nvim/')
let s:dein_path = s:plugins_path . 'dein'
if has('vim_starting')
let &runtimepath = s:dein_path . '/repos/github.com/Shougo/dein.vim,' . &runtimepath
let $NVIM_RPLUGIN_MANIFEST = s:plugins_path . 'rplugin.vim'
endif
" }}}
" list up plugins
if dein#load_state(s:dein_path)
call dein#begin(s:dein_path)
" dein
call dein#add('Shougo/dein.vim')
call dein#add('haya14busa/dein-command.vim', {'lazy': 1, 'on_cmd': 'Dein'})
" completions
call dein#add('Shougo/deoplete.nvim')
call dein#add('Shougo/neosnippet')
call dein#add('Shougo/neosnippet-snippets')
call dein#add('Shougo/neco-syntax')
call dein#add('ujihisa/neco-look', {'lazy': 1, 'on_ft': 'text'})
" extension
call dein#add('Shougo/denite.nvim')
call dein#add('Shougo/neomru.vim')
call dein#add('kana/vim-textobj-user')
call dein#add('tpope/vim-surround')
call dein#add('tyru/eskk.vim')
call dein#add('atton/gundo.vim', {'lazy': 1, 'on_cmd': 'GundoToggle'})
call dein#add('fedorenchik/VimCalc3', {'lazy': 1, 'on_cmd': 'Calc'})
" utility
call dein#add('Konfekt/FastFold')
call dein#add('rhysd/clever-f.vim')
call dein#add('tpope/vim-rails')
call dein#add('tyru/open-browser.vim.git')
call dein#add('h1mesuke/vim-alignta', {'lazy': 1, 'on_cmd': ['Alignta', 'Align']})
call dein#add('slim-template/vim-slim', {'lazy': 1, 'on_path': '.*\.slim'})
call dein#add('tpope/vim-markdown', {'lazy': 1, 'on_path': '.*\.md'})
call dein#end()
call dein#save_state()
endif
filetype plugin indent on
syntax enable
if dein#check_install()
echomsg 'Uninstalled plugin detected. Please execute `:call dein#install()`'
finish
endif
" }}}
" plugins settings
" {{{ deoplete
let g:deoplete#enable_at_startup = 1
let g:deoplete#data_directory = s:plugins_path . 'deoplete'
let s:keyword_patterns = {}
let s:keyword_patterns['_'] = '[a-zA-Z_]\k*'
let s:keyword_patterns['ruby'] = '[a-zA-Z_@]\w*[!?]?'
let s:keyword_patterns['text'] = '[0-9a-zA-Z][0-9a-zA-Z_.-]*'
let s:keyword_patterns['zsh'] = '[a-zA-Z_][a-zA-Z_-]*'
call deoplete#custom#option('keyword_patterns', s:keyword_patterns)
call deoplete#custom#option('sources', {'denite-filter': '_'}) " Disable completions in denite-filter
" }}}
" {{{ neosnippet
" snippet mapping : ^k
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
" My snnipets
let g:neosnippet#snippets_directory = s:plugins_path . 'snippets'
let g:neosnippet#data_directory = s:plugins_path . 'neosnippet'
" }}}
" {{{ Denite
call denite#custom#option('_', 'start_filter', v:true) " Always start at denite-filter
call denite#custom#source('_', 'matchers', ['matcher/substring', 'matcher/fuzzy'])
autocmd FileType denite call s:denite_my_settings()
function! s:denite_my_settings() abort
nnoremap <silent><buffer><expr> <CR> denite#do_map('do_action')
nnoremap <silent><buffer><expr> <Tab> denite#do_map('choose_action')
nnoremap <silent><buffer><expr> <C-g> denite#do_map('quit')
nnoremap <silent><buffer><expr> i denite#do_map('open_filter_buffer')
endfunction
autocmd FileType denite-filter call s:denite_filter_my_settings()
function! s:denite_filter_my_settings() abort
imap <silent><buffer> <C-g> <Plug>(denite_filter_quit)
nmap <silent><buffer> <C-g> <Plug>(denite_filter_quit)
imap <silent><buffer> <C-l> <Plug>(denite_filter_update)
nmap <silent><buffer> <C-l> <Plug>(denite_filter_update)
imap <silent><buffer> <CR> <C-g><CR>
nmap <silent><buffer> <CR> <C-g><CR>
inoremap <silent><buffer> <C-n> <Esc><C-w>p:call cursor(line('.')+1,0)<CR><C-w>pA
inoremap <silent><buffer> <C-p> <Esc><C-w>p:call cursor(line('.')-1,0)<CR><C-w>pA
inoremap <silent><buffer><expr> <Tab> denite#do_map('choose_action')
endfunction
call denite#custom#var('file/rec', 'command', [ 'find', '-L', ':directory',
\ '-path', '*/.*/*', '-prune', '-o',
\ '-type', 'l', '-print', '-o',
\ '-type', 'f', '-print'])
call denite#custom#var('grep', 'default_opts',
\ ['--exclude-dir=tmp', '--exclude-dir=log', '-iRHn'])
function! s:denite_grep_by_selected_word_in_current_dir()
try
let s:register_save = @a
normal! gv"ay
let s:command = 'Denite grep:.::' . @a
exec s:command
finally
let @a = s:register_save
endtry
endfunction
command! -nargs=0 -range DeniteGrepBySelectedWord call s:denite_grep_by_selected_word_in_current_dir()
" Shortcut Mappings
nnoremap <Leader>b :<C-u> Denite buffer<CR>
nnoremap <Leader>f :<C-u> Denite file/rec <CR>
nnoremap <Leader>r :<C-u> Denite register<CR>
nnoremap <Leader>m :<C-u> Denite file_mru<CR>
nnoremap <Leader>g :Denite grep:. <CR>
nnoremap <Leader><Leader> :<C-u> Denite menu:commands<CR>
vnoremap <Leader>k :DeniteGrepBySelectedWord<CR>
" {{{ Denite : neomru
let g:neomru#file_mru_path = s:plugins_path . 'neomru/file'
let g:neomru#directory_mru_path = s:plugins_path . 'neomru/directory'
" }}}
" {{{ Define denite source 'menu:commands' for shortcuts
let s:denite_commands = {}
let s:denite_commands.description = 'command shortcuts'
" commands
let s:denite_commands.command_candidates = [
\ ['EditVimrc', 'edit ~/.config/nvim/init.vim'],
\ ['EditVimrcPlugins', 'edit ~/.config/nvim/plugins.vim'],
\ ['EditZProfile', 'edit ~/.zprofile'],
\ ['EditZProfileLocal', 'edit ~/.config/zsh/zprofile.local'],
\ ['EditZProfileMac', 'edit ~/.config/zsh/zprofile.mac'],
\ ['EditZProfileUtil', 'edit ~/.config/zsh/zprofile.util'],
\ ['InsertTimeStamps', 'InsertTimeStampsFromUndoHistory'],
\ ['LoadLazyPlugins', 'Dein soure'],
\ ['PluginUpdate', 'Dein update'],
\ ['ReloadVimrc', 'ReloadVimrc'],
\ ]
call denite#custom#var('menu', 'menus', {'commands': s:denite_commands})
" }}}
" }}}
" {{{ VimCalc3
let g:VCalc_WindowPosition = 'bottom'
" }}}
" {{{ eskk.vim
let g:eskk#directory = expand('~/.config/nvim/eskk')
let g:eskk#dictionary = {'path': expand('~/.config/nvim/eskk/skk-jisyo'), 'sorted': 0, 'encoding': 'utf-8'}
let g:eskk#large_dictionary = {'path': expand('~/.config/nvim/eskk/SKK-JISYO.L'), 'sorted': 1, 'encoding': 'euc-jp',}
imap <C-J> <Plug>(eskk:enable)
cmap <C-J> <Plug>(eskk:enable)
lmap <C-J> <Plug>(eskk:enable)
" }}}
" {{{ gundo.vim
let g:gundo_prefer_python3 = 1
nnoremap U :GundoToggle<CR>
" }}}
" {{{ vim-surround
" manual mapping for eskk.vim (ignore ISurruond)
let g:surround_no_mappings = 1
" diff original mapping : Visual mode surround use 's' (original is 'S')
if has('vim_starting')
nmap ds <Plug>Dsurround
nmap cs <Plug>Csurround
nmap ys <Plug>Ysurround
nmap yS <Plug>YSurround
nmap yss <Plug>Yssurround
nmap ySs <Plug>YSsurround
nmap ySS <Plug>YSsurround
xmap s <Plug>VSurround
xmap gs <Plug>VgSurround
endif
" }}}
" {{{ alignta
let g:alignta_default_arguments = " = "
vnoremap <Leader>= :Alignta = <CR>
vnoremap <Leader>: :Alignta : <CR>
" }}}
" {{{ open-browser
" open URL
nmap gx <Plug>(openbrowser-smart-search)
vmap gx <Plug>(openbrowser-smart-search)
" }}}
" {{{ clever-f
let g:clever_f_use_migemo = 1
" compatible default keys
let g:clever_f_across_no_line = 1
nmap ; <Plug>(clever-f-repeat-forward)
nmap , <Plug>(clever-f-repeat-back)
" }}}