0

So Fugitive defines :Glog. This is, apparently, aliased to a call to the script-local s:Log() function (according to :command Glog.)

My muscle-memory has been using glog at the command-line, for years, to invoke my custom git-log TUI; and I'd really like to remap the :Glog command to a different tool (Gitv, specifically); but I'd like to retain Fugitive's available quickfix-list-based-log-navigation for special circumstances.

Is there any way for me to remap a call to a script-local function, like that? Or am I doomed to overwrite Fugitive's pre-defined :Glog and never have access to it, if I want it back?

1
  • Overwriting the command should be feasible; retaining the old behavior, much less so imo. Frankly i’d set up a dedicated mapping for invoking gitv, perhaps using <leader>, and adjust by using it. Muscle memory is awesome, but surprisingly adaptable.
    – D. Ben Knoble
    Dec 19, 2018 at 18:53

1 Answer 1

3

I don't believe it's possible to redefine :Glog without losing access to the script-local function.

However, bearing in mind your muscle memory is for glog, not Glog, I propose another approach:

cnoreabbrev <expr> glog (getcmdtype() == ':' && getcmdpos() == 5) ? 'Gitv' : 'glog'

This abbreviation will convert your :glog commands into :Gitv commands, leaving :Glog intact for when you need it.

1
  • Bahhah, that’s beautifully evil. Excellent! Dec 19, 2018 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.