neoclide / denite-git

Manger list of git objects with interface of denite.nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to call Actions, like open one commit in gitlog?

wyscjm opened this issue · comments

commented

Hello neoclide, Can I ask an simple question. I don't know how to call Actions's action. like below

Actions of gitlog:

open default action for open seleted commit.
preview preview seleted commit.
delete run git diff with current commit for current buffer. (just named delete)
reset run git reset with current commit.

Thanks in advance.

This answer is a general usage of Denite, not specific for denite-git.

To call any action in Denite, you should call the choose_action or do_action:{action} mappings. Denite provides no mappings for such actions in default, so you should define them at first.

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

  " choose action from prompt
  nnoremap <silent><buffer><expr> <Tab> denite#do_map('choose_action')
  " call the default action
  " for denite-git, it is the `open` action.
  nnoremap <silent><buffer><expr> <CR> denite#do_map('do_action')
  " you can specify a certain action to call.
  nnoremap <silent><buffer><expr> d denite#do_map('do_action', 'delete')
endfunction

Now you can type <CR> to call the open action, d for the delete one, and <Tab> to choose any one.

See helps below.

  • :h denite-examples
  • :h denite-map-choose_action
  • :h denite-map-do_action