vim-fugitive README

The project's README from github.com/tpope/vim-fugitive. As one markdown file: README.md.

fugitive.vim

Fugitive is the premier Vim plugin for Git. Or maybe it's the premier Git plugin for Vim? Either way, it's "so awesome, it should be illegal". That's why it's called Fugitive.

The crown jewel of Fugitive is :Git (or just :G), which calls any arbitrary Git command. If you know how to use Git at the command line, you know how to use :Git. It's vaguely akin to :!git but with numerous improvements:

Additional commands are provided for higher level operations:

Add %{FugitiveStatusline()} to 'statusline' to get an indicator with the current branch in your statusline.

For more information, see :help fugitive.

Screencasts

Installation

Install using your favorite package manager, or use Vim's built-in package support:

mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/fugitive.git
vim -u NONE -c "helptags fugitive/doc" -c q

FAQ

What happened to the dispatch.vim backed asynchronous :Gpush and :Gfetch?

This behavior was divisive, confusing, and complicated inputting passwords, so it was removed. Use :Git! push to use Fugitive's own asynchronous execution, or retroactively make :Git push asynchronous by pressing CTRL-D.

Why am I getting core.worktree is required when using an external Git dir?

Git generally sets core.worktree for you automatically when necessary, but if you're doing something weird, or using a third-party tool that does something weird, you may need to set it manually:

git config core.worktree "$PWD"

This may be necessary even when simple git commands seem to work fine without it.

So I have a symlink and...

Stop. Just stop. If Git won't deal with your symlink, then Fugitive won't either. Consider using a plugin that resolves symlinks, or even better, using fewer symlinks.

Self-Promotion

Like fugitive.vim? Follow the repository on GitHub and vote for it on vim.org. And if you're feeling especially charitable, follow tpope on Twitter and GitHub.

License

Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. See :help license.

vim-fugitive (tpope/vim-fugitive)

Searching Database…

这是什么?Fugitive 是一个 living 在 Vim 里的 Git 封装工具——README 称它为“最好的 Vim Git 插件”。名字来自它自己的宣传语:一个“好用到应该被定为非法”的 Git 封装工具。
那它是装在我 Vim 里的插件,还是 alongside Git 单独运行的工具?它是一个用 Vim Script 编写的插件,加载到你的编辑器里并添加 :Git 这样的 : 命令——没有单独的可执行文件或服务。它始终作用于你当前 buffer 所在的仓库。
除了 Vim 我还需要什么吗?只需要 Vim 和一个 Git 仓库——Vim 能跑的地方它就能用,而且始终针对当前 buffer 的仓库。由于 :Git 仿照 git 命令行工具,会用命令行 Git 才是真正的先决条件。
Git 的所有功能都能通过它用,还是有缺失?有几点:Git 自己都不支持的符号链接(symlink)它也不支持;另外旧的基于 dispatch.vim 的异步 :Gpush/:Gfetch 已被移除——改用 :Git! push 或按 CTRL-D 就能实现异步。
它是免费的吗,许可上有什么坑?它是免费的——按照与 Vim 本身相同的条款分发,版权归 Tim Pope 所有。该仓库自 2009 年起就在 GitHub 上,目前大约有 21.8k 颗星。
装好之后它到底能做什么?核心是 :Git(或简写 :G),可以运行任何 Git 命令——只要你会在命令行用 Git,你就会用它。直接运行 :Git 会弹出一个摘要窗口,显示有改动的文件以及未推送和未拉取的提交(即 :Gstatus 的后继者);:Git commit 和 :Git rebase -i 会直接在你当前的 Vim 里进行编辑,而 :Git diff 或 :Git log 这类详细输出会加载到临时 buffer 里。
在它里面怎么暂存和比较差异?:Gwrite 会暂存当前文件——它同时写入工作树和索引,相当于 git add。:Gread 是一个可撤销的 checkout 到 buffer 的操作,而 :Gdiffsplit 会并排打开暂存版本和工作树版本,让你可以编辑暂存 buffer 并写入以完成暂存。:GMove 和 :GDelete 分别封装了对当前文件执行 git mv 和 git rm 的操作。
:Git blame 是怎么回事?它会打开一个带有快捷键映射的临时 buffer 方便查看:在某一行按 Enter 可以查看该行发生变更的提交,或按 g? 查看其他映射。如果不带文件名,它会以垂直、滚动同步的分屏方式对当前编辑的文件执行 blame。另外,:Gedit HEAD~3:% 可以加载当前文件三个提交前的版本。
它能打开 GitHub 或 GitLab 上的文件吗?可以——:GBrowse 会在你托管服务商的网页端打开当前文件,还可以限定在可视模式选中的行范围内。通过 rhubarb.vim 和 fugitive-gitlab.vim 等配套插件,支持 GitHub、GitLab、Bitbucket、Gitee、Pagure、Phabricator、Azure DevOps 和 sourcehut。
Creator
tpope
Size
2.6 MB
Stars
21.8K
Updated
CommitMar 07
Age
17y
Commits · 90 Days