Closed Feuda closed 5 years ago
Check :verb cmap <Plug><cfile>
.
@tpope ouput as
c <Plug><cfile> &@rails#cfile() Last set from ~/.vim/bundle/vim-rails/autoload/rails.vim Press ENTER or type command to continue
after running:verb cmap <Plug><cfile>
That's correct. Can you check :verb nmap gf
? Edit: And :verb nmap <Plug>RailsFind
.
Also go ahead and report your exact Vim version.
:verb nmap gf
outputs
:verb nmap <Plug>RailsFind
outputs
vim --version
outputs
I'm running out of ideas. Can you check what <C-R><C-F>
does on the :
command line? It should insert user.rb
, but if it fails like gf
it will insert <Plug>User.find_by_email
. Go ahead and check :cmap <C-R><C-F>
while you're at it.
I have same problem. I check what you ask from @Feuda and my output same as him. But i did not understand your last request, @tpope. Forgive me, it just have been 1 weeks using vim.
I did try this command but :<C-R><C-F>
it gaves an error: E488: Trailing characters
:cmap <C-R><C-F>
outputs:
c <C-R><C-F> @<Plug><cfile>
Press CTRL-R CTRL-F on the command line.
@tpope
The maps all look fine, so I think it's just an issue with the actual logic to determine the the filename. Can you try again on the latest? I've fixed a lot of bugs in that area. You can also check :echo rails#ruby_cfile()
to make sure that matches up with the destination file.
@tpope
Okay, that <Plug>
in there is definitely something different happening. Can you report on these again?
verbose cmap <Plug><cfile>
verbose nmap gf
@tpope
Okay, I said "something different" but after re-reading your original issue it is the same thing. What's supposed to happen is gf
expands to :find <Plug><cfile>
and <Plug><cfile>
expands to the return value of rails#ruby_cfile()
. But that second expansion isn't happening, and instead :find
substitutes the raw filename under the cursor for <cfile>
, hence <Plug>Account.account_types
.
Since something is going horribly wrong with map expansion, I'm inclined to have you check these related options:
:verbose set timeout? timeoutlen? ttimeout? ttimeoutlen?
@tpope
Those are fine. I'm out of easy things to check. Try stripping your config down to a minimal vimrc and rails.vim only, and see if you can still reproduce the problem.
Hello, I had the same problem as in this ticket and try all the steps until I started stripping my config down. I finally got "gf" to work after I removed "set paste".
:set paste
is designed to be temporarily switched on before pasting something in your terminal. It disables a ton of Vim features, including auto-indenting and all insert mode and command line mode maps. Never, ever, ever, ever, ever, ever set it in your vimrc.
Thanks for sharing the results of your investigation. I wouldn't have thought to check for that otherwise.
Thanks for your explanation, I had no idea :set paste
was this dangerous.
user = User.find_by_email(email) #rails code
'gf' on the word 'User', it occured
E345 can't find file "<Plug>User.find_by_email" in path
Any ideas?