1
0
mirror of https://github.com/amix/vimrc synced 2025-06-23 06:35:01 +08:00

Updated plugins

This commit is contained in:
amix
2019-11-30 13:06:56 +01:00
parent 57ba28a9a2
commit 9c54d954f6
21 changed files with 201 additions and 65 deletions

View File

@ -18,7 +18,7 @@ Features:
* Diffs against index (default) or any commit.
* Allows folding all unchanged text.
* Provides fold text showing whether folded lines have been changed.
* Can load all hunk locations into quickfix list.
* Can load all hunk locations into quickfix list or the current window's location list.
* Handles line endings correctly, even with repos that do CRLF conversion.
* Optional line highlighting.
* Optional line number highlighting. (Only available in Neovim 0.3.2 or higher)
@ -147,7 +147,7 @@ nmap ]h <Plug>(GitGutterNextHunk)
nmap [h <Plug>(GitGutterPrevHunk)
```
You can load all your hunks into the quickfix list with `:GitGutterQuickFix`. Note this ignores any unsaved changes in your buffers.
You can load all your hunks into the quickfix list with `:GitGutterQuickFix`. Note this ignores any unsaved changes in your buffers. If the option `g:gitgutter_use_location_list` is set, this command will load hunks into the current window's location list instead.
You can stage or undo an individual hunk when your cursor is in it:
@ -254,6 +254,7 @@ You can customise:
* Whether to clobber or preserve non-gitgutter signs
* The priority of gitgutter's signs.
* Whether to use a floating/popup window for hunk previews
* Whether to populate the quickfix list or a location list with all hunks
Please note that vim-gitgutter won't override any colours or highlights you've set in your colorscheme.
@ -452,7 +453,12 @@ let g:gitgutter_async = 0
#### To use floating/popup windows for hunk previews
Add `let g:gitgutter_preview_win_floating = 1` to your vimrc. Note that on Vim this prevents you staging (partial) hunks via the preview window.
Add `let g:gitgutter_preview_win_floating = 1` to your `~/.vimrc`. Note that on Vim this prevents you staging (partial) hunks via the preview window.
#### To load all hunks into the current window's location list instead of the quickfix list
Add `let g:gitgutter_use_location_list = 1` to your `~/.vimrc`.
### Extensions
@ -513,9 +519,25 @@ Let's say, for example, you want to remove trailing whitespace from all changed
```
#### Cycle through hunks in current buffer
This is like `:GitGutterNextHunk` but when it gets to the last hunk in the buffer it cycles around to the first.
```viml
function! GitGutterNextHunkCycle()
let line = line('.')
silent! GitGutterNextHunk
if line('.') == line
1
GitGutterNextHunk
endif
endfunction
```
#### Cycle through hunks in all buffers
You can use `:GitGutterQuickFix` to load all hunks into the quickfix list.
You can use `:GitGutterQuickFix` to load all hunks into the quickfix list or the current window's location list.
Alternatively, given that`]c` and `[c` jump from one hunk to the next in the current buffer, you can use this code to jump to the next hunk no matter which buffer it's in.
@ -534,7 +556,7 @@ function! NextHunkAllBuffers()
return
endif
if !empty(GitGutterGetHunks())
normal! 1G
1
GitGutterNextHunk
return
endif

View File

@ -207,5 +207,9 @@ function! gitgutter#quickfix()
let lnum = 0
endif
endfor
call setqflist(locations)
if !g:gitgutter_use_location_list
call setqflist(locations)
else
call setloclist(0, locations)
endif
endfunction

View File

@ -140,7 +140,9 @@ Commands for jumping between hunks:~
*gitgutter-:GitGutterQuickFix*
:GitGutterQuickFix Load all hunks into the |quickfix| list. Note this
ignores any unsaved changes in your buffers.
ignores any unsaved changes in your buffers. The
|g:gitgutter_use_location_list| option can be set to
populate the location list of the current window instead
Commands for operating on a hunk:~
@ -294,6 +296,7 @@ General:~
|g:gitgutter_map_keys|
|g:gitgutter_async|
|g:gitgutter_log|
|g:gitgutter_use_location_list|
*g:gitgutter_preview_win_location*
@ -473,7 +476,7 @@ Controls whether or not the plugin is on at startup.
*g:gitgutter_map_keys*
Default: 1
Controls whether or not the plugin provides mappings. See |gitgutter-mapppings|.
Controls whether or not the plugin provides mappings. See |gitgutter-mappings|.
*g:gitgutter_async*
Default: 1
@ -487,6 +490,12 @@ Default: 0
When switched on, the plugin logs to gitgutter.log in the directory where it is
installed. Additionally it logs channel activity to channel.log.
*g:gitgutter_use_location_list*
Default: 0
When switched on, the :GitGutterQuickFix command populates the location list
of the current window instead of the global quickfix list.
===============================================================================
HIGHLIGHTS *gitgutter-highlights*

View File

@ -61,6 +61,7 @@ call s:set('g:gitgutter_map_keys', 1)
call s:set('g:gitgutter_terminal_reports_focus', 1)
call s:set('g:gitgutter_async', 1)
call s:set('g:gitgutter_log', 0)
call s:set('g:gitgutter_use_location_list', 0)
call s:set('g:gitgutter_git_executable', 'git')
if !executable(g:gitgutter_git_executable)