Thanks for both the "less" guidance and the EDITOR tip!|
Assigning the EDITOR to vim fixes the "git commit" issue (Gentoo assigns EDITOR by default).
I think I've got "less" figured out -- Gentoo exports LESS='-R -M --shift 5' (which overrides Git's value/default value). I'd gotten far enough to see that this variable affected git's paging in Gentoo before posting, but when I tried it on Fedora mistakenly set it without exporting it, so it didn't carry through to git's invocation of less (colleague of mine laughed and said he likes to ask that as an interview question -- "what's the difference between a shell variable and an envirnoment variable?").
Your mentioning of Fedora's Git version (which is much newer than Ubuntu's 220.127.116.11) reminds me that I'm pining for either Fedora's being at 18.104.22.168 (like Gentoo is) or Git's on git.repo to update their repodata so I can use theirs instead.
Also, only marginally related: tracking this down, I noticed that /usr/share/doc/git-<version>/config.txt is fontified in Vim when using Gentoo but not when using Fedora. Something else to figure out... (Who knew distributions could be so markedly different? ;) )
On 05/29/2009 11:55 AM, Todd Zullinger wrote:
Brian Ericson wrote:Anyone know how to get git working properly with less and vim? Specifically: * less does not "clear" (revert) the screen properly after commands like "git log" and "git diff"[...]Both of these work properly in Gentoo (and vim -- but not less -- works properly in Ubuntu), but it's not obvious to me what's different between the distros to account for the differing behavior...The difference is likely that Fedora is shipping a more recent version of git than Ubuntu and upstream git has seen a few changes regarding the pager handling. Check out the core.pager setting in the git-config manpage. You can set this a number of ways, using the LESS or GIT_PAGER environment variables, or the core.pager config setting. By default, git pass the options FSRX to less. The -X option is what prevents less from clearing the screen, but using -F also causes this in my testing (which I found confusing...). If it were me, I'd set the LESS variable and exclude FX, e.g: export LESS="-RS" (See the less man page for the options you might want to set. If you use GIT_PAGER or the core.pager setting, you will have to use slightly odd syntax to override the LESS environment var that git will set, e.g.: export GIT_PAGER='less -+$LESS -RS' or git config --global core.pager 'less -+$LESS -RS' This is described in the git-config manpage.* vim isn't using the git extensions/file types for commands like "git commit"On F-10, this should "Just Work" as vim-7.2 has the needed syntax files included. Is your EDITOR var set to vim?