1

Below is my configuration for denite. When I exit from a denite buffer without selecting a file or buffer via the escape key or ctrl-o q, denite displays the contents of the file or buffer that the prompt was on last.

How can I configure denite to not to open any file or buffer upon existing without selection?

" Denite:
nnoremap <leader>f :Denite -direction=dynamicbottom -auto-preview file_rec<CR>
nnoremap <leader>b :Denite -direction=dynamicbottom -auto-preview buffer<CR>

call denite#custom#var('file/rec', 'command', ['ag', '--follow', '-g', '--nogroup', '--nocolor', '-u', ''])
call denite#custom#var('grep', 'command', ['ag'])
call denite#custom#var('grep', 'default_opts', ['-i', '--vimgrep'])
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', [])

1 Answer 1

1

I think I had the same problem. There are two issues I encountered when I exited the denite buffer without selecting an entry: when using the preview action the preview window didn't close, and when using the highlight action the cursor stayed at the position that was being highlighted (instead of going back to where I was before opening the denite buffer.

I think what's going on is that denite runs some code when exiting the buffer to "clean up" these things like the preview window and when you simply close the window like any other window, this code isn't being executed.

I was able to solve that by defining the key mapping for quitting denite via the denite#do_map function.

autocmd FileType denite call s:denite_my_settings()
function! s:denite_my_settings() abort
    nnoremap <silent><buffer><expr> <ESC> denite#do_map('quit')
endfunction

This maps the ESC key to the quit action in the denite buffer. Then the two aforementioned issues were solved for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.