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: pgpu4rcptMkH9.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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux