forked from rafi/vim-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdenite.vim
More file actions
129 lines (110 loc) · 4.63 KB
/
denite.vim
File metadata and controls
129 lines (110 loc) · 4.63 KB
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
" denite.nvim
" -----------
" INTERFACE
call denite#custom#option('_', {
\ 'auto_resume': 1,
\ 'start_filter': 1,
\ 'statusline': 1,
\ 'smartcase': 1,
\ 'vertical_preview': 1,
\ 'direction': 'dynamicbottom',
\ 'prompt': '❯',
\ 'max_dynamic_update_candidates': 50000,
\ 'winwidth': &columns,
\ 'winheight': &lines / 3,
\ 'wincol': 0,
\ 'winrow': (&lines - 3) - (&lines / 3),
\ })
if has('nvim')
call denite#custom#option('_', { 'split': 'floating', 'statusline': 0 })
endif
" MATCHERS
" Default is 'matcher/fuzzy'
" call denite#custom#source('tag', 'matchers', ['matcher/substring'])
" SORTERS
" Default is 'sorter/rank'
" call denite#custom#source('file/rec,grep', 'sorters', ['sorter/sublime'])
call denite#custom#source('z', 'sorters', ['sorter_z'])
" CONVERTERS
" Default is none
call denite#custom#source(
\ 'buffer,file_mru,file_old',
\ 'converters', ['converter_relative_word'])
" FIND and GREP COMMANDS
if executable('ag')
" The Silver Searcher
call denite#custom#var('file/rec', 'command',
\ ['ag', '-U', '--hidden', '--follow', '--nocolor', '--nogroup', '-g', ''])
" Setup ignore patterns in your .agignore file!
" https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage
call denite#custom#var('grep', 'command', ['ag'])
call denite#custom#var('grep', 'recursive_opts', [])
call denite#custom#var('grep', 'pattern_opt', [])
call denite#custom#var('grep', 'separator', ['--'])
call denite#custom#var('grep', 'final_opts', [])
call denite#custom#var('grep', 'default_opts',
\ [ '--skip-vcs-ignores', '--vimgrep', '--smart-case', '--hidden' ])
elseif executable('rg')
" Ripgrep
call denite#custom#var('file/rec', 'command',
\ ['rg', '--files', '--glob', '!.git'])
call denite#custom#var('grep', 'command', ['rg', '--threads', '1'])
call denite#custom#var('grep', 'recursive_opts', [])
call denite#custom#var('grep', 'final_opts', [])
call denite#custom#var('grep', 'separator', ['--'])
call denite#custom#var('grep', 'default_opts',
\ ['-i', '--vimgrep', '--no-heading'])
elseif executable('ack')
" Ack command
call denite#custom#var('grep', 'command', ['ack'])
call denite#custom#var('grep', 'recursive_opts', [])
call denite#custom#var('grep', 'pattern_opt', ['--match'])
call denite#custom#var('grep', 'separator', ['--'])
call denite#custom#var('grep', 'final_opts', [])
call denite#custom#var('grep', 'default_opts',
\ ['--ackrc', $HOME.'/.config/ackrc', '-H',
\ '--nopager', '--nocolor', '--nogroup', '--column'])
endif
" KEY MAPPINGS
augroup user_plugin_denite
autocmd!
autocmd FileType denite call s:denite_settings()
autocmd FileType denite-filter call s:denite_filter_settings()
autocmd VimResized * call denite#custom#option('_', {
\ 'winwidth': &columns,
\ 'winheight': &lines / 3,
\ 'winrow': (&lines - 3) - (&lines / 3),
\ })
augroup END
function! s:denite_settings() abort
setlocal signcolumn=no cursorline
nnoremap <silent><buffer><expr> <CR> denite#do_map('do_action')
nnoremap <silent><buffer><expr> i denite#do_map('open_filter_buffer')
nnoremap <silent><buffer><expr> / denite#do_map('open_filter_buffer')
nnoremap <silent><buffer><expr> dd denite#do_map('do_action', 'delete')
nnoremap <silent><buffer><expr> p denite#do_map('do_action', 'preview')
nnoremap <silent><buffer><expr> st denite#do_map('do_action', 'tabopen')
nnoremap <silent><buffer><expr> sg denite#do_map('do_action', 'vsplit')
nnoremap <silent><buffer><expr> sv denite#do_map('do_action', 'split')
nnoremap <silent><buffer><expr> ' denite#do_map('quick_move')
nnoremap <silent><buffer><expr> q denite#do_map('quit')
nnoremap <silent><buffer><expr> r denite#do_map('redraw')
nnoremap <silent><buffer><expr> yy denite#do_map('do_action', 'yank')
nnoremap <silent><buffer><expr> <Esc> denite#do_map('quit')
nnoremap <silent><buffer><expr> <Tab> denite#do_map('choose_action')
nnoremap <silent><buffer><expr><nowait> <Space> denite#do_map('toggle_select').'j'
endfunction
function! s:denite_filter_settings() abort
setlocal signcolumn=yes nocursorline nonumber norelativenumber
call deoplete#custom#buffer_option('auto_complete', v:false)
nnoremap <silent><buffer><expr> <Esc> denite#do_map('quit')
" inoremap <silent><buffer><expr> <Esc> denite#do_map('quit')
nnoremap <silent><buffer><expr> q denite#do_map('quit')
inoremap <silent><buffer><expr> <C-c> denite#do_map('quit')
nnoremap <silent><buffer><expr> <C-c> denite#do_map('quit')
inoremap <silent><buffer> kk <Esc><C-w>p
nnoremap <silent><buffer> kk <C-w>p
inoremap <silent><buffer> jj <Esc><C-w>p
nnoremap <silent><buffer> jj <C-w>p
endfunction
" vim: set ts=2 sw=2 tw=80 noet :