<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Thanks for both the "less" guidance and the EDITOR tip!<br>
<br>
Assigning the EDITOR to vim fixes the "git commit" issue (Gentoo
assigns EDITOR by default).<br>
<br>
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 -- "<font size="3"><font color="#000000">what's the
difference between a shell variable and an envirnoment variable?").<br>
<br>
Your mentioning of Fedora's Git version (which is much newer than
Ubuntu's 1.6.0.4) reminds me that I'm pining for either Fedora's being
at 1.6.3.1 (like Gentoo is) or Git's on git.repo to update their
repodata so I can use theirs instead.<br>
<br>
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? ;) )<br>
</font></font><br>
On 05/29/2009 11:55 AM, Todd Zullinger wrote:
<blockquote cite="mid:20090529165515.GI4433@inocybe.localdomain"
 type="cite">
  <pre wrap="">Brian Ericson wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">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"
    </pre>
  </blockquote>
  <pre wrap=""><!---->[...]
  </pre>
  <blockquote type="cite">
    <pre wrap="">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...
    </pre>
  </blockquote>
  <pre wrap=""><!---->
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.

  </pre>
  <blockquote type="cite">
    <pre wrap="">* vim isn't using the git extensions/file types for commands like "git
commit"
    </pre>
  </blockquote>
  <pre wrap=""><!---->
On F-10, this should "Just Work" as vim-7.2 has the needed syntax
files included.  Is your EDITOR var set to vim?

  </pre>
</blockquote>
</body>
</html>