Ⅰ. 插件描述
Script for showing current Git branch in Tmux status barⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'drmad/tmux-git'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'drmad/tmux-git'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'drmad/tmux-git'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/drmad/tmux-git
Ⅳ. 文档说明
Git branch in Tmux
tmux-git shows information about the git repo of the current directory in tmux status bar, like current branch, dirtiness, stash, etc.
Overview
There are many solutions to integrate the current Git branch on your Linux terminal
prompt (like this one and this one, from where I borrowed most parts of
this script), but I don't like to bloat my prompt.
So I was thinking where can I put that information, and then I remembered the
fabulous Tmux. tmux is a powerful and really cool client-server terminal
multiplexer, but it also provides a nice status bar.
This script scans the current bash directory for a git repo. If it's found,
then puts information about it in the status bar, like:
- Project name (actually, is the
gitrepo directory name) - Active branch
- 'Dirty' status (i.e., there are pending modifications to be committed)
- Stashed changes
Installation
Clone this project in your home directory, renaming the folder with a preceding
dot for hiding it:
git clone git://github.com/drmad/tmux-git.git ~/.tmux-git
Then, execute this line in a shell to add the script in the Bash initialization
file (usually .bashrc, replace if needed):
echo "if [[ \$TMUX ]]; then source ~/.tmux-git/tmux-git.sh; fi" >> ~/.bashrc
Run tmux, cd to a Git repo, and enjoy :)
Note for OSX users: You'll need to install coreutils:
brew install coreutils
Configurarion
The configuration is stored in the file ~/.tmux-git.conf, created at the first
run of the script with default values. Just edit it, and reload tmux.
Variables and functions
TMUX_STATUS_LOCATION: Position of the status on Tmux bar:leftorrightTMUX_OUTREPO_STATUS: Tmux status for when you're out of a repo. Set by
default to your pre-existing status line.TMUX_STATUS_DEFINITION(): This function sets theTMUX_STATUSvariable, which
is shown in thetmuxbar. You can use any variable used across the script for
creating this variable.
En español
He realizado un post en español de las instrucciones de instalación en mi blog: