mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated vim plugins
This commit is contained in:
@ -427,6 +427,58 @@ Let's say, for example, you want to remove trailing whitespace from all changed
|
||||
```
|
||||
|
||||
|
||||
#### Cycle through hunks in all buffers
|
||||
|
||||
`]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.
|
||||
|
||||
```viml
|
||||
function! NextHunkAllBuffers()
|
||||
let line = line('.')
|
||||
GitGutterNextHunk
|
||||
if line('.') != line
|
||||
return
|
||||
endif
|
||||
|
||||
let bufnr = bufnr('')
|
||||
while 1
|
||||
bnext
|
||||
if bufnr('') == bufnr
|
||||
return
|
||||
endif
|
||||
if !empty(GitGutterGetHunks())
|
||||
normal! 1G
|
||||
GitGutterNextHunk
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! PrevHunkAllBuffers()
|
||||
let line = line('.')
|
||||
GitGutterPrevHunk
|
||||
if line('.') != line
|
||||
return
|
||||
endif
|
||||
|
||||
let bufnr = bufnr('')
|
||||
while 1
|
||||
bprevious
|
||||
if bufnr('') == bufnr
|
||||
return
|
||||
endif
|
||||
if !empty(GitGutterGetHunks())
|
||||
normal! G
|
||||
GitGutterPrevHunk
|
||||
return
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
nmap <silent> ]c :call NextHunkAllBuffers()<CR>
|
||||
nmap <silent> [c :call PrevHunkAllBuffers()<CR>
|
||||
```
|
||||
|
||||
|
||||
### FAQ
|
||||
|
||||
> Why can't I unstage staged changes?
|
||||
|
Reference in New Issue
Block a user