tpope / vim-rails

rails.vim: Ruby on Rails power tools
http://www.vim.org/scripts/script.php?script_id=1567
4.09k stars 381 forks source link

Call vim-rails commands in neovim using <Plug> #594

Closed dgdosen closed 1 year ago

dgdosen commented 1 year ago

Say I wanted to remap the rails-vim |gf| command in neovim, I'm thinking I should be able to call something like <Plug>(rails-vim)gf

Should that work?

tpope commented 1 year ago

No, you'll need to do what rails.vim does and invoke the <Plug><cfile> map as an argument to :find:

https://github.com/tpope/vim-rails/blob/959e94b76e6ebdf984acef61649ba7d0f62bd425/autoload/rails.vim#L4850-L4854

The <SID>: thing effectively translates 2gf into :2find <Plug><cfile>. You'll need to do something similar (or skip it, as you probably don't normally use a count anyways).