mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 22:50:06 +08:00
Use rg for deinte grep by default
This commit is contained in:
parent
9b30006891
commit
649d913015
@ -5,108 +5,127 @@ let s:sys = SpaceVim#api#import('system')
|
|||||||
|
|
||||||
" denite option
|
" denite option
|
||||||
let s:denite_options = {'default' : {
|
let s:denite_options = {'default' : {
|
||||||
\ 'winheight' : 15,
|
\ 'winheight' : 15,
|
||||||
\ 'mode' : 'insert',
|
\ 'mode' : 'insert',
|
||||||
\ 'quit' : 'true',
|
\ 'quit' : 'true',
|
||||||
\ 'highlight_matched_char' : 'MoreMsg',
|
\ 'highlight_matched_char' : 'MoreMsg',
|
||||||
\ 'highlight_matched_range' : 'MoreMsg',
|
\ 'highlight_matched_range' : 'MoreMsg',
|
||||||
\ 'direction': 'rightbelow',
|
\ 'direction': 'rightbelow',
|
||||||
\ 'statusline' : 'false',
|
\ 'statusline' : 'false',
|
||||||
\ 'prompt' : '➭',
|
\ 'prompt' : '➭',
|
||||||
\ }}
|
\ }}
|
||||||
|
|
||||||
function! s:profile(opts) abort
|
function! s:profile(opts) abort
|
||||||
for fname in keys(a:opts)
|
for fname in keys(a:opts)
|
||||||
for dopt in keys(a:opts[fname])
|
for dopt in keys(a:opts[fname])
|
||||||
call denite#custom#option(fname, dopt, a:opts[fname][dopt])
|
call denite#custom#option(fname, dopt, a:opts[fname][dopt])
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call s:profile(s:denite_options)
|
call s:profile(s:denite_options)
|
||||||
|
|
||||||
" buffer source
|
" buffer source
|
||||||
call denite#custom#var(
|
call denite#custom#var(
|
||||||
\ 'buffer',
|
\ 'buffer',
|
||||||
\ 'date_format', '%m-%d-%Y %H:%M:%S')
|
\ 'date_format', '%m-%d-%Y %H:%M:%S')
|
||||||
|
|
||||||
" denite command
|
" denite command
|
||||||
if !s:sys.isWindows
|
if !s:sys.isWindows
|
||||||
if executable('rg')
|
if executable('rg')
|
||||||
" For ripgrep
|
" For ripgrep
|
||||||
" Note: It is slower than ag
|
" Note: It is slower than ag
|
||||||
call denite#custom#var('file_rec', 'command',
|
call denite#custom#var('file_rec', 'command',
|
||||||
\ ['rg', '--files', '--glob', '!.git', '']
|
\ ['rg', '--hidden', '--files', '--glob', '!.git', '']
|
||||||
\ + zvim#util#Generate_ignore(g:spacevim_wildignore, 'rg')
|
\ + zvim#util#Generate_ignore(g:spacevim_wildignore, 'rg')
|
||||||
\ )
|
\ )
|
||||||
elseif executable('ag')
|
elseif executable('ag')
|
||||||
" Change file_rec command.
|
" Change file_rec command.
|
||||||
call denite#custom#var('file_rec', 'command',
|
call denite#custom#var('file_rec', 'command',
|
||||||
\ ['ag' , '--nocolor', '--nogroup', '-g', '']
|
\ ['ag' , '--nocolor', '--nogroup', '-g', '']
|
||||||
\ + zvim#util#Generate_ignore(g:spacevim_wildignore, 'ag')
|
\ + zvim#util#Generate_ignore(g:spacevim_wildignore, 'ag')
|
||||||
\ )
|
\ )
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
if executable('pt')
|
if executable('pt')
|
||||||
" For Pt(the platinum searcher)
|
" For Pt(the platinum searcher)
|
||||||
" NOTE: It also supports windows.
|
" NOTE: It also supports windows.
|
||||||
call denite#custom#var('file_rec', 'command',
|
call denite#custom#var('file_rec', 'command',
|
||||||
\ ['pt', '--follow', '--nocolor', '--nogroup', '-g:', ''])
|
\ ['pt', '--follow', '--nocolor', '--nogroup', '-g:', ''])
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
" FIND and GREP COMMANDS
|
" FIND and GREP COMMANDS
|
||||||
if executable('ag')
|
if executable('rg')
|
||||||
call denite#custom#var('grep', 'command', ['ag'])
|
" Ripgrep command on grep source
|
||||||
call denite#custom#var('grep', 'recursive_opts', [])
|
call denite#custom#var('grep', 'command', ['rg'])
|
||||||
call denite#custom#var('grep', 'pattern_opt', [])
|
call denite#custom#var('grep', 'default_opts',
|
||||||
call denite#custom#var('grep', 'separator', ['--'])
|
\ ['--vimgrep', '--no-heading'])
|
||||||
call denite#custom#var('grep', 'final_opts', [])
|
call denite#custom#var('grep', 'recursive_opts', [])
|
||||||
call denite#custom#var('grep', 'default_opts',
|
call denite#custom#var('grep', 'pattern_opt', ['--regexp'])
|
||||||
\ [ '--vimgrep', '--smart-case' ])
|
call denite#custom#var('grep', 'separator', ['--'])
|
||||||
|
call denite#custom#var('grep', 'final_opts', [])
|
||||||
|
|
||||||
|
elseif executable('pt')
|
||||||
|
" Pt command on grep source
|
||||||
|
call denite#custom#var('grep', 'command', ['pt'])
|
||||||
|
call denite#custom#var('grep', 'default_opts',
|
||||||
|
\ ['--nogroup', '--nocolor', '--smart-case'])
|
||||||
|
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', [])
|
||||||
|
elseif executable('ag')
|
||||||
|
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',
|
||||||
|
\ [ '--vimgrep', '--smart-case' ])
|
||||||
elseif executable('ack')
|
elseif executable('ack')
|
||||||
" Ack command
|
" Ack command
|
||||||
call denite#custom#var('grep', 'command', ['ack'])
|
call denite#custom#var('grep', 'command', ['ack'])
|
||||||
call denite#custom#var('grep', 'recursive_opts', [])
|
call denite#custom#var('grep', 'recursive_opts', [])
|
||||||
call denite#custom#var('grep', 'pattern_opt', ['--match'])
|
call denite#custom#var('grep', 'pattern_opt', ['--match'])
|
||||||
call denite#custom#var('grep', 'separator', ['--'])
|
call denite#custom#var('grep', 'separator', ['--'])
|
||||||
call denite#custom#var('grep', 'final_opts', [])
|
call denite#custom#var('grep', 'final_opts', [])
|
||||||
call denite#custom#var('grep', 'default_opts',
|
call denite#custom#var('grep', 'default_opts',
|
||||||
\ ['--ackrc', $HOME.'/.config/ackrc', '-H',
|
\ ['--ackrc', $HOME.'/.config/ackrc', '-H',
|
||||||
\ '--nopager', '--nocolor', '--nogroup', '--column'])
|
\ '--nopager', '--nocolor', '--nogroup', '--column'])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" KEY MAPPINGS
|
" KEY MAPPINGS
|
||||||
let s:insert_mode_mappings = [
|
let s:insert_mode_mappings = [
|
||||||
\ ['jk', '<denite:enter_mode:normal>', 'noremap'],
|
\ ['jk', '<denite:enter_mode:normal>', 'noremap'],
|
||||||
\ ['<Tab>', '<denite:move_to_next_line>', 'noremap'],
|
\ ['<Tab>', '<denite:move_to_next_line>', 'noremap'],
|
||||||
\ ['<S-tab>', '<denite:move_to_previous_line>', 'noremap'],
|
\ ['<S-tab>', '<denite:move_to_previous_line>', 'noremap'],
|
||||||
\ ['<Esc>', '<denite:enter_mode:normal>', 'noremap'],
|
\ ['<Esc>', '<denite:enter_mode:normal>', 'noremap'],
|
||||||
\ ['<C-N>', '<denite:assign_next_matched_text>', 'noremap'],
|
\ ['<C-N>', '<denite:assign_next_matched_text>', 'noremap'],
|
||||||
\ ['<C-P>', '<denite:assign_previous_matched_text>', 'noremap'],
|
\ ['<C-P>', '<denite:assign_previous_matched_text>', 'noremap'],
|
||||||
\ ['<Up>', '<denite:assign_previous_text>', 'noremap'],
|
\ ['<Up>', '<denite:assign_previous_text>', 'noremap'],
|
||||||
\ ['<Down>', '<denite:assign_next_text>', 'noremap'],
|
\ ['<Down>', '<denite:assign_next_text>', 'noremap'],
|
||||||
\ ['<C-Y>', '<denite:redraw>', 'noremap'],
|
\ ['<C-Y>', '<denite:redraw>', 'noremap'],
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
let s:normal_mode_mappings = [
|
let s:normal_mode_mappings = [
|
||||||
\ ["'", '<denite:toggle_select_down>', 'noremap'],
|
\ ["'", '<denite:toggle_select_down>', 'noremap'],
|
||||||
\ ['<C-n>', '<denite:jump_to_next_source>', 'noremap'],
|
\ ['<C-n>', '<denite:jump_to_next_source>', 'noremap'],
|
||||||
\ ['<C-p>', '<denite:jump_to_previous_source>', 'noremap'],
|
\ ['<C-p>', '<denite:jump_to_previous_source>', 'noremap'],
|
||||||
\ ['gg', '<denite:move_to_first_line>', 'noremap'],
|
\ ['gg', '<denite:move_to_first_line>', 'noremap'],
|
||||||
\ ['st', '<denite:do_action:tabopen>', 'noremap'],
|
\ ['st', '<denite:do_action:tabopen>', 'noremap'],
|
||||||
\ ['sg', '<denite:do_action:vsplit>', 'noremap'],
|
\ ['sg', '<denite:do_action:vsplit>', 'noremap'],
|
||||||
\ ['sv', '<denite:do_action:split>', 'noremap'],
|
\ ['sv', '<denite:do_action:split>', 'noremap'],
|
||||||
\ ['q', '<denite:quit>', 'noremap'],
|
\ ['q', '<denite:quit>', 'noremap'],
|
||||||
\ ['r', '<denite:redraw>', 'noremap'],
|
\ ['r', '<denite:redraw>', 'noremap'],
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
for s:m in s:insert_mode_mappings
|
for s:m in s:insert_mode_mappings
|
||||||
call denite#custom#map('insert', s:m[0], s:m[1], s:m[2])
|
call denite#custom#map('insert', s:m[0], s:m[1], s:m[2])
|
||||||
endfor
|
endfor
|
||||||
for s:m in s:normal_mode_mappings
|
for s:m in s:normal_mode_mappings
|
||||||
call denite#custom#map('normal', s:m[0], s:m[1], s:m[2])
|
call denite#custom#map('normal', s:m[0], s:m[1], s:m[2])
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
unlet s:m s:insert_mode_mappings s:normal_mode_mappings
|
unlet s:m s:insert_mode_mappings s:normal_mode_mappings
|
||||||
|
Loading…
Reference in New Issue
Block a user