The plugin can browse through the full repository history using :Agit or a single file history using :AgitFile Agit exampleĪgit example An mkaz conundrum. The Agit plugin displays repository information using a tabpage with multiple windows. Running :GitMessenger with a message displayed enters that message buffer allowing you to navigate back to older commits by typing o key. Activate the plugin using the :GitMessenger function to display the last commit message that modified the line. It will display the info in a Scratch window, or pop-up window if supporteed. The git-messenger plugin provides blame information on a per-line basis. Use :GitGutterStageHunk for selective staging of hunks.Use :GitGutterPreviewHunk to see hunk changes.Here are the top ones that I use frequently: Often when working on a project in git, you may want to be able to quickly see made the code addition that youre working on. The plugin also provides features beyond just visual cues. I setup the following two maps to navigate to next and previous hunks: For example, suppose you look at git blame 's output. Since Git 1.8.4, git log has -L to view the evolution of a range of lines. The vim-gitgutter plugin also provides functions to navigate to changed hunks of code. 12 Answers Sorted by: 809 See also Git: discover which commits ever touched a range of lines. View Git Changesįor viewing changes in a single-file, the gitgutter plugin adds visual cues for additions, subtractions, and modifications in the gutter left of the line numbers. However, there are still a few plugins that I use to make things easier. This Vim plugin was inspired by kazuho's tiny script. It's like git-blame, but git-blame shows which line is modified by which commit. script karma, Rating 65/20, Downloaded by 2454, Comments, bugs, improvements. ghpr-blame.vim is a Vim plugin to investigate which line is modified by which pull request. I prefer to do my gitting on the command-line, so I know exactly what is happening. vim : See Git Blame information in the status bar for the currently selected line. There are a wide range of plugins and features to choose from, so your setup will depend on what you want to do. Once you start using it, make sure to read its help page ( :h fugitive), because it has a very rich functionality so you can find multiple ways to enhance your Git experience.By default, Vim provides no integration with git, all functionality is provided by plugins. I’ve only started to scratch its surface because I only needed a more handy way to interact with git-blame This updates the contents of the buffer with the previous version of the file.īoth commands keep the blame tab open and refreshes the information therein, so you can continue to investigate the commits that resulted in the selected version.įugitive.vim is a powerful Git wrapper. By pressing P you can reblame the file on the parent of the selected commit. Reblame at parentĪnother useful feature is to be able to see the evolution of a given line over time. You can do just that by hitting - after you’ve selected a commit on the blame window. Supposing that you saw a suspicious line in the blame information, and you would like to see a version of the file where that change was committed. Vim: Show current git branch in lightline status line without fugitive. Add a comment 1 Answer Sorted by: Reset to default 1 I dont remember ever. But there are more reasons to use it: you can easily dive deep into the history. Do you want git blame or git log romainl. So it’s convenient, especially if you already have a Vim open. Alternatively, running :Gblame again closes this window. Simply press q to dismiss the revision information panel.If you are stuck, press g? to open Gblame’s help page directly.However, you can return to the file by pressing Ctrl+^. I think it’s a bit less useful because it navigates away from the current file. Alternatively, if you hit on a commit, it will open it in the current window.It will open a horizontal split with the changes and the commit message. To investigate a commit hit o on a given line.You can navigate in the blame panel as if it were a normal text file to select a commit.Looking at the other changes and the commit message it’s quite easy to get the context. You can simply jump to the commit that contains the changes for a given line. It shows the revision information right next to the file in question in a panel that’s linked to the source file. If you dont have a preferred installation method, I. Luckily, fugitive.vim provides the Gblame command that makes life a bit easier. See Git Blame information in the status bar for the currently selected line. Dive into history with fugitive.vim’s Gblame You might want fugitives :Git blame combined with tpope/vim-rhubarb. Another problem is that if you’d like to dive into a commit, you have to type or paste its ID for the next command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |