Re: git & less/vim

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some of the narrowest minds are found in the fattest heads.
    -- Anonymous

Attachment: pgpWmj4pp3xKv.pgp
Description: PGP signature

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux