Code Monkey home page Code Monkey logo

git-branch-info's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=2258

This plugin show branches information on the status line.
To install, just put this file on ~/.vim/plugins and set your status line:

:set statusline=%{GitBranchInfoString}

Of course you can append this configuration to an existing one and make all 
the customization you want on the status line, like:

:set statusline=%#ErrorMsg#%{GitBranchInfoString}%#StatusLine#

The command above will show the Git branches info on the same color as the
error messages. You can choose any color scheme you want to. Use

:help highlight-groups

to check for some other options.

There are some customization on the result string based on existing variables 
like:

let g:git_branch_status_head_current=1
This will show just the current head branch name 

let g:git_branch_status_text="text"
This will show 'text' before the branches. If not set ' Git ' (with a trailing
left space) will be displayed.

let g:git_branch_status_nogit=""
The message when there is no Git repository on the current dir

let g:git_branch_status_around=""
Characters to put around the branch strings. Need to be a pair or characters,
the first will be on the beginning of the branch string and the last on the
end.

let g:git_branch_status_ignore_remotes=1
Ignore the remote branches. If you don't want information about them, this can
make things works faster.

If you want to make your own customizations, you can use the GitBranchInfoTokens()
function. It returns an array with the current branch as the first element and
another array with the other branches as the second element, like:

:set statusline=%#ErrorMsg#%{GitBranchInfoTokens()[0]}%#StatusLine#

or

:set statusline=%#StatusLineNC#\ Git\ %#ErrorMsg#\ %{GitBranchInfoTokens()[0]}\ %#StatusLine#

will give you a nice custom formatted string.

This will show you the current branch only. No prefix text, no characters
around it. You can also make another functions to use the returned array.

Get the latest code on http://github.com/taq/vim-git-branch-info

git-branch-info's People

Contributors

howiefh avatar taq avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.