" Define mappings augroup vimrc_denite autocmd! autocmd FileType denite call s:denite_my_settings() autocmd FileType denite-filter call s:denite_filter_my_settings() augroup END function! s:denite_my_settings() abort nnoremap \ denite#do_map('do_action') nnoremap d \ denite#do_map('do_action', 'delete') nnoremap p \ denite#do_map('do_action', 'preview') nnoremap q \ denite#do_map('quit') nnoremap \ denite#do_map('quit') nnoremap i \ denite#do_map('open_filter_buffer') nnoremap \ denite#do_map('toggle_select').'j' endfunction " concept: I don't use "Normal mode" with denite function! s:denite_filter_my_settings() abort " let in filter buffer also quit denite (note the after `(denite_filter_quit)`) imap (denite_filter_quit) " let in filter buffer invoke the 'do_action' (note the after `(denite_filter_update)`) imap (denite_filter_update) " move cursor in denite buffer while in filter buffer setlocal complete="" call deoplete#custom#buffer_option('auto_complete', v:false) inoremap \:call denite#move_to_parent() \:call cursor(line('.')+1,0) \:call denite#move_to_filter()A inoremap \:call denite#move_to_parent() \:call cursor(line('.')-1,0) \:call denite#move_to_filter()A endfunction " Use ripgrep for file/rec call denite#custom#var('file/rec', 'command', \ ['rg', '--files', '--glob', '!.git', '--color', 'never']) " Change matchers. " TODO: Try matcher/cpsm call denite#custom#source( \ 'file_mru', 'matchers', ['matcher/fuzzy']) call denite#custom#source( \ 'file/rec', 'matchers', ['matcher/fuzzy']) " Change sorters. call denite#custom#source( \ 'file/rec', 'sorters', ['sorter/sublime']) " Use ripgrep command on grep source call denite#custom#var('grep', { \ 'command': ['rg'], \ 'default_opts': ['-i', '--vimgrep', '--no-heading'], \ 'recursive_opts': [], \ 'pattern_opt': ['--regexp'], \ 'separator': ['--'], \ 'final_opts': [], \ }) " Custom action " Note: lambda function is not supported in Vim8. call denite#custom#action('file', 'test', \ {context -> execute('let g:foo = 1')}) call denite#custom#action('file', 'test2', \ {context -> denite#do_action( \ context, 'open', context['targets'])}) " Source specific action call denite#custom#action('source/file', 'test', \ {context -> execute('let g:bar = 1')})