版本支持：sublime text 2,sublime text 3
系统支持： Windows,OS X,Linux
插件介绍：A Sublime Text 2/3 plugin to see git diff in gutter
A sublime text 2/3 plugin to show an icon in the gutter area indicating whether a line has been inserted, modified or deleted.
You can install via Sublime Package Control:
Or you can clone this repo into your Sublime Text x/Packages:
OSXcd ~/Library/Application Support/Sublime Text 2/Packages/ git clone git://github.com/jisaacks/GitGutter.git
Ubuntucd ~/.config/sublime-text-2/Packages git clone git://github.com/jisaacks/GitGutter.git
GitGutter assumes that the
gitcommand is available on the command line. If it's not, add the directory containing
PATHenvironment variable. Then clone the repo:cd "%APPDATA%Sublime Text 2Packages" git clone git://github.com/jisaacks/GitGutter.git
On OS X you might need to install the package SublimeFixMacPath.
It's not working!?
symbol meaning of the symbol × close the popup ⤒ jump to first change ↑ jump to previous change ↓ jump to next change ≈, ≉ enable/disable difference highlighting ⎘ copy the content of the git state ⟲ revert changes to the state in git
The diff popup appears if you hover the mouse of the gutter changes. However this functionality is only enabled in Build
3116or newer (which is currently only in the dev builds). If you are using an older Sublime Text 3 version you can also show the diff popup from the command palette or via a keybinding.
Comparing against different commits/branches/tags
By default, Git Gutter compares your working copy against the HEAD. You can change this behaviour through the ST command palette. The following options are available:
- Compare against HEAD
- Compare against particular branch
- Compare against particular tag
- Compare against specific commit
To change the compare option:
- Open the command palette (
- Start typing
- You'll see the 4 options listed above, select one with the keyboard.
- Choose the branch/tag/commit to compare against.
Jumping Between Changes
There are commands to jump between modifications. The default keybindings for these commands are:
OS X Windows / Linux Description Command+Shift+Option+k Ctrl+Shift+Alt+k Previous Command+Shift+Option+j Ctrl+Shift+Alt+j Next
Settings are accessed via the Preferences > Package Settings > GitGutter menu.
Default settings should not be modified, as they are overwritten when GitGutter updates. Instead, you should copy the relevant settings into GitGutter's user settings file.
Delays update of gutter icons by the following amount (in milliseconds). Useful for performance issues. Default 1000 (1 second).
By default, GitGutter detects changes every time the file is modified. If you experience performance issues you can set it to only run on save by setting
Hover Diff Popup
This hover feature is only available in Build 3116 and newer. GitGutter shows a diff popup, when hovering over changes in the gutter. Set
false, if you want to disable this popup. You can still open it with a keybinding and from the command panel.
Diff Popup Default Mode
The diff popup is only available in Sublime Text 3 The diff popup has two modes: The default mode to show the previous git state with code highlighting and the diff mode to highlight the differences between the git state and the editor state. You can set
"diff"to change the mode in which the popup opens.
Diff Popup Appearance
The diff popup is only available in Sublime Text 3 The popup uses the mdpopups library and the corresponding settings are global and not only for GitGutter. You can change the syntax highlighting style to the same as Sublime Text by adding
"mdpopups.use_sublime_highlighter": trueto your User settings. Other settings can be found here. In addition the popup loads the css file
gitgutter_popup.css, which can be modified by the user and is also accessible via the settings menu.
GitGutter shows icons for new files and ignored files. These icons will be on every line. You can toggle the setting
show_markers_on_untracked_fileto turn this feature off. Defaults to true (shows icons). You may need to add scopes to your color scheme (
markup.untracked.git_gutter) to color the icons.
GitGutter will show diffs in the minimap on Sublime Text 3. This can be disabled by setting
gitis not found by GitGutter you may need to set the
It is valid to use environment variables in the setting value, and they will be expanded appropriately.
In a POSIX environment you can run
which gitto find the path to git if it is in your path. On Windows, you can use
where gitto do the equivalent.
The colors come from your color scheme .tmTheme file.
Color schemes that already have support for GitGutter include:
- Baara Dark
- Brackets Color Scheme
- Dark Room
- Deep Blue See
- Desert Night
- Grandson of Obsidian
- Monokai Extended
- Neon Color Scheme
- Solarized Colour Theme
- Specials Board
- Tomorrow Theme
- Underscore Colour Theme
- Contact me if you want your color scheme listed here. Or do a pull request.
If your color scheme file does not define the appropriate colors (or you want to edit them) add an entry that looks like this:<dict> <key>name</key> <string>GitGutter deleted</string> <key>scope</key> <string>markup.deleted.git_gutter</string> <key>settings</key> <dict> <key>foreground</key> <string>#F92672</string> </dict> </dict> <dict> <key>name</key> <string>GitGutter inserted</string> <key>scope</key> <string>markup.inserted.git_gutter</string> <key>settings</key> <dict> <key>foreground</key> <string>#A6E22E</string> </dict> </dict> <dict> <key>name</key> <string>GitGutter changed</string> <key>scope</key> <string>markup.changed.git_gutter</string> <key>settings</key> <dict> <key>foreground</key> <string>#967EFB</string> </dict> </dict> <dict> <key>name</key> <string>GitGutter ignored</string> <key>scope</key> <string>markup.ignored.git_gutter</string> <key>settings</key> <dict> <key>foreground</key> <string>#565656</string> </dict> </dict> <dict> <key>name</key> <string>GitGutter untracked</string> <key>scope</key> <string>markup.untracked.git_gutter</string> <key>settings</key> <dict> <key>foreground</key> <string>#565656</string> </dict> </dict>