lambdalisue / vim-gina

👣 Asynchronously control git repositories in Neovim/Vim 8
http://www.vim.org/scripts/script.php?script_id=5531
MIT License
689 stars 27 forks source link

What's the proper way to bind new custom actions? #295

Open rafi opened 2 years ago

rafi commented 2 years ago

Hi. What's the proper way for creating & binding new actions that could be called with gina#action#call() and receive the current/marked candidate(s)?

function! s:my_action(candidates) abort
  " do something...
endfunction

" How can I bind 'my_action' to `my-action` in a command?

call gina#custom#mapping#nmap('status', 'p', ":<C-u>call gina#action#call('my-action')<CR>", {'noremap': 1})
lambdalisue commented 2 years ago

Ah... actions in gina are a bit difficult and not designed for users to define their original actions.

You can read and follow https://github.com/lambdalisue/gina.vim/blob/master/autoload/gina/action/ls.vim or whatever but the methods are not really for users.