Make gf
mapping work with SpaceVim
#558
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SpaceVim includes a
nnoremap gf gf
, in order to clobber a mapping it installs for theg
prefix, which displays a "guide" for the commands starting withg
. (They do the same for the mappings with thez
prefix.)This ends up preventing vim-rails from installing a
gf
mapping of itself, since it uses a mapcheck() to only install a mapping when either none exists or a mapping it knowingly wants to override is present. But the mapping to itself from SpaceVim prevents that check from succeeding, which in turn prevents vim-rails from installing its owngf
mapping.This affects
gf
, but not<C-W>f
or<C-W>gf
which work as expected.In order to work around this problem, update the pattern used by the mapcheck() checking for the
gf
mapping to also succeed when the mapped expression matchesgf
exactly.Tested on
Pos*t.first
, confirmed that it works same as<C-W>f
would work. Also checked output of:map gf
on SpaceVim with vim-rails, which matches the expected:This issue was originally raised on StackExchange: How to get tpope/vim-rails gf command to work with SpaceVim?
And about the weird mapping of SpaceVim: Why would you use
nnoremap gf gf
as SpaceVim does?