GithubHelp home page GithubHelp logo

sdasd12312wasdasd / vim-fugitive Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tpope/vim-fugitive

0.0 1.0 0.0 2.21 MB

fugitive.vim: A Git wrapper so awesome, it should be illegal

Home Page: https://www.vim.org/scripts/script.php?script_id=2975

Vim Script 100.00%

vim-fugitive's Introduction

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:

  • The default behavior is to directly echo the command's output. Quiet commands like :Git add avoid the dreaded "Press ENTER or type command to continue" prompt.
  • :Git commit, :Git rebase -i, and other commands that invoke an editor do their editing in the current Vim instance.
  • :Git diff, :Git log, and other verbose, paginated commands have their output loaded into a temporary buffer. Force this behavior for any command with :Git --paginate or :Git -p.
  • :Git blame uses a temporary buffer with maps for additional triage. Press enter on a line to view the commit where the line changed, or g? to see other available maps. Omit the filename argument and the currently edited file will be blamed in a vertical, scroll-bound split.
  • :Git mergetool and :Git difftool load their changesets into the quickfix list.
  • Called with no arguments, :Git opens a summary window with dirty files and unpushed and unpulled commits. Press g? to bring up a list of maps for numerous operations including diffing, staging, committing, rebasing, and stashing. (This is the successor to the old :Gstatus.)
  • This command (along with all other commands) always uses the current buffer's repository, so you don't need to worry about the current working directory.

Additional commands are provided for higher level operations:

  • View any blob, tree, commit, or tag in the repository with :Gedit (and :Gsplit, etc.). For example, :Gedit HEAD~3:% loads the current file as it existed 3 commits ago.
  • :Gdiffsplit brings up the staged version of the file side by side with the working tree version. Use Vim's diff handling capabilities to apply changes to the staged version, and write that buffer to stage the changes. You can also give an arbitrary :Gedit argument to diff against older versions of the file.
  • :Gread is a variant of git checkout -- filename that operates on the buffer rather than the file itself. This means you can use u to undo it and you never get any warnings about the file changing outside Vim.
  • :Gwrite writes to both the work tree and index versions of a file, making it like git add when called from a work tree file and like git checkout when called from the index or a blob in history.
  • :Ggrep is :grep for git grep. :Glgrep is :lgrep for the same.
  • :GMove does a git mv on the current file and changes the buffer name to match. :GRename does the same with a destination filename relative to the current file's directory.
  • :GDelete does a git rm on the current file and simultaneously deletes the buffer. :GRemove does the same but leaves the (now empty) buffer open.
  • :GBrowse to open the current file on the web front-end of your favorite hosting provider, with optional line range (try it in visual mode). Plugins are available for popular providers such as GitHub, GitLab, Bitbucket, Gitee, Pagure, Phabricator, Azure DevOps, and sourcehut.

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 :Dispatch git push for effectively the same behavior, or provide your own asynchronous :Gpush and :Gfetch by adding the following to your vimrc:

command! -bang -bar -nargs=* Gpush execute 'Dispatch<bang> -dir=' .
      \ fnameescape(FugitiveGitDir()) 'git push' <q-args>
command! -bang -bar -nargs=* Gfetch execute 'Dispatch<bang> -dir=' .
      \ fnameescape(FugitiveGitDir()) 'git fetch' <q-args>

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's People

Contributors

blueyed avatar bobrippling avatar cedarbaum avatar elyscape avatar flatcap avatar guns avatar jsit avatar linuxsuren avatar living180 avatar mah avatar manicmaniac avatar mbudde avatar mcepl avatar mikl avatar natebosch avatar odnoletkov avatar osandov avatar patrickdavey avatar pavoljuhas avatar qstrahl avatar rbong avatar runiq avatar ryosusami avatar scrooloose avatar srasku avatar teoljungberg avatar tmhedberg avatar tommcdo avatar tpope avatar tranquility avatar

Watchers

 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.