From 578400998673699c494221333e9846790cfba0ee Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Wed, 23 Dec 2020 09:02:35 +0100 Subject: [PATCH] plugni: Switch from ctrlp to denite --- init.vim | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++ keymaps.vim | 4 +++ plugins.vim | 5 ++-- 3 files changed, 91 insertions(+), 2 deletions(-) diff --git a/init.vim b/init.vim index d5ad8eb..e7c0dac 100644 --- a/init.vim +++ b/init.vim @@ -204,6 +204,90 @@ let g:VimMailContactsCommands={ \'sync': "/bin/true"} \} + +" The denite settings are largely stolen from spacevim +let s:denite_options = { + \ 'default' : { + \ 'winheight' : 15, + \ 'mode' : 'insert', + \ 'start_filter' : 1, + \ 'quit' : 1, + \ 'highlight_matched_char' : 'MoreMsg', + \ 'highlight_matched_range' : 'MoreMsg', + \ 'direction': 'rightbelow', + \ }} + +augroup spacevim_layer_denite + autocmd! + autocmd FileType denite call s:denite_my_settings() +augroup END + +function! s:denite_my_settings() abort + nnoremap i + \ denite#do_map('open_filter_buffer') + nnoremap ' + \ denite#do_map('toggle_select').'j' + nnoremap q + \ denite#do_map('quit') + nnoremap + \ denite#do_map('do_action', 'tabopen') + nnoremap + \ denite#do_map('do_action', 'vsplit') + nnoremap + \ denite#do_map('do_action', 'split') + nnoremap + \ denite#do_map('do_action') + nnoremap p + \ denite#do_map('do_action', 'preview') + nnoremap j + nnoremap k +endfunction + +" FIND and GREP COMMANDS +if executable('rg') + " Ripgrep command on grep source + call denite#custom#var('grep', 'command', ['rg']) + call denite#custom#var('grep', 'default_opts', + \ ['--vimgrep', '--no-heading']) + call denite#custom#var('grep', 'recursive_opts', []) + call denite#custom#var('grep', 'pattern_opt', ['--regexp']) + call denite#custom#var('grep', 'separator', ['--']) + call denite#custom#var('grep', 'final_opts', []) +endif + +let s:insert_mode_mappings = [ + \ ['jk', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ] + +let s:normal_mode_mappings = [ + \ ["'", '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['gg', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['q', '', 'noremap'], + \ ['r', '', 'noremap'], + \ ] + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" runtime keymaps.vim diff --git a/keymaps.vim b/keymaps.vim index d4a5f97..883b3e0 100644 --- a/keymaps.vim +++ b/keymaps.vim @@ -1,6 +1,10 @@ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Global settings +nnoremap :Denite file/rec +nnoremap / :Denite grep:. +nnoremap s :Denite buffer + nnoremap pumvisible() ? "\" : "\" nnoremap :NERDTreeToggle diff --git a/plugins.vim b/plugins.vim index 6c18099..5699cc5 100644 --- a/plugins.vim +++ b/plugins.vim @@ -17,8 +17,6 @@ Plug 'airblade/vim-rooter' Plug 'benknoble/vim-auto-origami' -Plug 'ctrlpvim/ctrlp.vim' - Plug 'scrooloose/nerdcommenter' Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'} @@ -46,8 +44,11 @@ Plug 'lervag/vimtex', {'for': 'tex'} if has('nvim') Plug 'Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'} + Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' } else Plug 'Shougo/deoplete.nvim' + Plug 'Shougo/denite.nvim' + Plug 'roxma/nvim-yarp' Plug 'roxma/vim-hug-neovim-rpc' endif -- 2.39.5