Closed rkiyanchuk closed 5 years ago
You can start with filter buffer enabled:
call denite#custom#option('_', {
\ 'start_filter': v:true
\ })
or just for file/rec
call denite#custom#option('file/rec', {
\ 'start_filter': v:true
\ })
Insert mode is enabled automatically after triggering Denite to immediately start matching files according to input.
Please read the above comment.
denite#custom#map()
is removed. Yes it is not backward compatibility.
You need to define own mappings.
Please read the documentation.
This is the hint
Q: I want to move the cursor in denite filter window.
A: Really? It is not recommended. >
autocmd FileType denite-filter call s:denite_filter_my_settings()
function! s:denite_filter_my_settings() abort
inoremap <silent><buffer> <C-j>
\ <Esc><C-w>p:call cursor(line('.')+1,0)<CR><C-w>pA
inoremap <silent><buffer> <C-k>
\ <Esc><C-w>p:call cursor(line('.')-1,0)<CR><C-w>pA
endfunction
Note: This is very slow in Vim8 environment.
No switching of modes is required to match and select an entry.
Hm. I don't recommend it.
@nwkj86 @Shougo Thanks for the replies!
start_filter
partly solves it and allows start typing right away after triggering Denite.
I'm not sure why switching modes is necessary now as Denite used to work just fine without it until recent changes. Switching modes requires more keystrokes, so in my opinion it makes navigation slower and less intuitive.
But it is your plugin after all, of course, thanks for your help anyway!
It may be slower navigation. But I have decided to use Vim way. You should not move the cursor in insert mode.
It means why switching mode is necessary in Vim
@Shougo I played a bit more with Denite and I now understand what you meant. Yeah, I agree — kudos for choosing the Vim way.
In case it might be useful for someone else, I ended up with the following compromise settings:
try
call denite#custom#var('file/rec', 'command', ['rg', '--files', '--glob', '!.git'])
call denite#custom#var('grep', 'command', ['rg'])
call denite#custom#var('grep', 'default_opts', ['-i', '--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', [])
call denite#custom#option('_', 'statusline', v:false)
catch
echomsg "Denite plugin missing"
endtry
function! s:denite_my_settings() abort
nnoremap <silent><buffer><expr> <CR> denite#do_map('do_action')
nnoremap <silent><buffer><expr> p denite#do_map('do_action', 'preview')
nnoremap <silent><buffer><expr> <C-c> denite#do_map('quit')
nnoremap <silent><buffer><expr> i denite#do_map('open_filter_buffer')
nnoremap <silent><buffer><expr> <Space> denite#do_map('toggle_select').'j'
endfunction
augroup DENITE
autocmd!
autocmd FileType denite call s:denite_my_settings()
augroup end
nnoremap <silent> <leader>ff :Denite file/rec -auto-resize -smartcase -start-filter<CR>
nnoremap <silent> <leader>fb :Denite buffer -auto-resize<CR>
nnoremap <silent> <leader>fg :Denite grep -auto-resize<CR>
nnoremap <silent> <leader>fr :Denite register -auto-resize<CR>
nnoremap <silent> <leader>fw :DeniteCursorWord file/rec buffer grep<CR>
Problems summary
Previously I was able to define Denite mappings using the following syntax:
This allowed me to get insert mode enabled to match keywords immediately after triggering Denite and then choose matching files with
<C-n>
/<C-p
and then<CR>
Apparently the plugin has been changed recently in a backwards incompatible manner and such setup is now broken. I couldn't figure out from the updated documentation how to replicate the setup.
Can such configuration be achieved with the updated Denite? If yes, would it be possible for you to provide hints on what actions to use, or better yet (even though that might be to much to ask :)) add an example?
Thanks for the plugin!
Expected
Insert mode is enabled automatically after triggering Denite to immediately start matching files according to input. No switching of modes is required to match and select an entry.
Environment Information (Required!)
denite version (SHA1):
4b27a6debe25f90807dfaa801f3286d139381304
OS: Arch Linux
Vim/neovim version: NVIM v0.3.7
:checkhealth
or:CheckHealth
result (neovim only):Provide a minimal init.vim with less than 50 lines
How to reproduce problems from neovim startup
\ff
in my setup).