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?

  • 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 '18 at 18:53
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.

  • Bahhah, that’s beautifully evil. Excellent! – ELLIOTTCABLE Dec 19 '18 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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