]> git.sthu.org Git - vimconf.git/commitdiff
plugni: Switch from ctrlp to denite
authorStefan Huber <shuber@sthu.org>
Wed, 23 Dec 2020 08:02:35 +0000 (09:02 +0100)
committerStefan Huber <shuber@sthu.org>
Wed, 23 Dec 2020 08:02:35 +0000 (09:02 +0100)
init.vim
keymaps.vim
plugins.vim

index d5ad8eb35da2dd34a5830ff217202f285db3b164..e7c0dac9f752fff1c31356882f671351b03e2840 100644 (file)
--- 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 <silent><buffer><expr> i
+        \ denite#do_map('open_filter_buffer')
+  nnoremap <silent><buffer><expr> '
+        \ denite#do_map('toggle_select').'j'
+  nnoremap <silent><buffer><expr> q
+        \ denite#do_map('quit')
+  nnoremap <silent><buffer><expr> <C-t>
+        \ denite#do_map('do_action', 'tabopen')
+  nnoremap <silent><buffer><expr> <C-v>
+        \ denite#do_map('do_action', 'vsplit')
+  nnoremap <silent><buffer><expr> <C-s>
+        \ denite#do_map('do_action', 'split')
+  nnoremap <silent><buffer><expr> <CR>
+        \ denite#do_map('do_action')
+  nnoremap <silent><buffer><expr> p
+        \ denite#do_map('do_action', 'preview')
+  nnoremap <silent><buffer><Tab> j
+  nnoremap <silent><buffer><S-Tab> 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', '<denite:enter_mode:normal>', 'noremap'],
+      \ ['<Tab>', '<denite:move_to_next_line>', 'noremap'],
+      \ ['<C-j>', '<denite:move_to_next_line>', 'noremap'],
+      \ ['<S-tab>', '<denite:move_to_previous_line>', 'noremap'],
+      \ ['<C-k>', '<denite:move_to_previous_line>', 'noremap'],
+      \ ['<C-t>', '<denite:do_action:tabopen>', 'noremap'],
+      \ ['<C-v>', '<denite:do_action:vsplit>', 'noremap'],
+      \ ['<C-s>', '<denite:do_action:split>', '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 s:normal_mode_mappings = [
+      \ ["'", '<denite:toggle_select_down>', 'noremap'],
+      \ ['<C-n>', '<denite:jump_to_next_source>', 'noremap'],
+      \ ['<C-p>', '<denite:jump_to_previous_source>', 'noremap'],
+      \ ['<Tab>', '<denite:move_to_next_line>', 'noremap'],
+      \ ['<C-j>', '<denite:move_to_next_line>', 'noremap'],
+      \ ['<S-tab>', '<denite:move_to_previous_line>', 'noremap'],
+      \ ['<C-k>', '<denite:move_to_previous_line>', 'noremap'],
+      \ ['gg', '<denite:move_to_first_line>', 'noremap'],
+      \ ['<C-t>', '<denite:do_action:tabopen>', 'noremap'],
+      \ ['<C-v>', '<denite:do_action:vsplit>', 'noremap'],
+      \ ['<C-s>', '<denite:do_action:split>', 'noremap'],
+      \ ['q', '<denite:quit>', 'noremap'],
+      \ ['r', '<denite:redraw>', 'noremap'],
+      \ ]
+
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 
 runtime keymaps.vim
index d4a5f979053141fac75d19d750e33da517595744..883b3e00eac93e837ba1a748edc13dc61c7fdee3 100644 (file)
@@ -1,6 +1,10 @@
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 " Global settings
 
+nnoremap <C-p> :Denite file/rec<cr>
+nnoremap <space>/ :Denite grep:.<cr>
+nnoremap <space>s :Denite buffer<cr>
+
 nnoremap <C-space> pumvisible() ? "\<c-n>" : "\<tab>"
 
 nnoremap <F2> :NERDTreeToggle<cr>
index 6c18099299035b12efeb18b639be8b82a273fd2e..5699cc5bf9a0e6d04e1adae2710b8662459a38bb 100644 (file)
@@ -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