forked from rafi/vim-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdenite.vim
102 lines (87 loc) · 3.14 KB
/
denite.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
" denite.nvim
" -----------
" INTERFACE
call denite#custom#option('_', {
\ 'prompt': 'λ:',
\ 'empty': 0,
\ 'winheight': 16,
\ 'source_names': 'short',
\ 'vertical_preview': 1,
\ 'auto-accel': 1,
\ 'auto-resume': 1,
\ })
call denite#custom#option('list', {})
call denite#custom#option('mpc', {
\ 'quit': 0,
\ 'mode': 'normal',
\ 'winheight': 20,
\ })
" MATCHERS
" Default is 'matcher_fuzzy'
call denite#custom#source('tag', 'matchers', ['matcher_substring'])
if has('nvim') && &runtimepath =~# '\/cpsm'
call denite#custom#source(
\ 'buffer,file_mru,file_old,file_rec,grep,mpc,line',
\ 'matchers', ['matcher_cpsm', 'matcher_fuzzy'])
endif
" SORTERS
" Default is 'sorter_rank'
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('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
let insert_mode_mappings = [
\ ['jj', '<denite:enter_mode:normal>', 'noremap'],
\ ['<Esc>', '<denite:enter_mode:normal>', 'noremap'],
\ ['<C-N>', '<denite:assign_next_matched_text>', 'noremap'],
\ ['<C-P>', '<denite:assign_previous_matched_text>', 'noremap'],
\ ['<Up>', '<denite:assign_previous_text>', 'noremap'],
\ ['<Down>', '<denite:assign_next_text>', 'noremap'],
\ ['<C-Y>', '<denite:redraw>', 'noremap'],
\ ]
let normal_mode_mappings = [
\ ["'", '<denite:toggle_select_down>', 'noremap'],
\ ['<C-n>', '<denite:jump_to_next_source>', 'noremap'],
\ ['<C-p>', '<denite:jump_to_previous_source>', 'noremap'],
\ ['gg', '<denite:move_to_first_line>', 'noremap'],
\ ['st', '<denite:do_action:tabopen>', 'noremap'],
\ ['sg', '<denite:do_action:vsplit>', 'noremap'],
\ ['sv', '<denite:do_action:split>', 'noremap'],
\ ['sc', '<denite:quit>', 'noremap'],
\ ['r', '<denite:redraw>', 'noremap'],
\ ]
for m in insert_mode_mappings
call denite#custom#map('insert', m[0], m[1], m[2])
endfor
for m in normal_mode_mappings
call denite#custom#map('normal', m[0], m[1], m[2])
endfor
" vim: set ts=2 sw=2 tw=80 noet :