rc git: Add more completions (diff/show/log)#5449
Conversation
I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
rc/tools/git.kak
Outdated
| git for-each-ref --format='%(refname:short)' --sort=-comitterdate | head -n10 | ||
| # Commits, using name to match instead of hash (in the absence of having subject | ||
| # as a comment for completion). | ||
| git log -100 --format='@^{/%s} # %s' |
There was a problem hiding this comment.
@^{/%s} is pretty neat. If we take this, we might want to regex-escape the %s in future
There was a problem hiding this comment.
Oops for the left-in # %s which doesn't work but was just a test.
Figuring out which (ir)regular expression git uses is a bit of a dive, but I think I found it, get_oid_oneline calls regcomp(®ex, prefix, REG_EXTENDED), and only does PCRE for git grep. Who knows if that works on Windows, maybe I'll test it if I remember by the time I get to a WIndows computer.
Added quoting, it seems to work for e.g this very commit which uses parentheses.
There was a problem hiding this comment.
Also yes @^{/%s} is neat but it doesn't work for e.g. reflog (which often has the same commit messages due to rebasing) -- if we could have comments for completion (e.g. \0 to the next \n maybe or something similar) that would be less of a workaround
In particular `git diff --cached` is something I use frequently, but also added some others that might be useful from the editor.
b40a7df to
06b7b12
Compare
|
That |
In particular
git diff --cachedis something I use frequently, but also added some others that might be useful from the editor.