mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Abort functions at first error.
This commit is contained in:
@@ -2,7 +2,7 @@ let s:nomodeline = (v:version > 703 || (v:version == 703 && has('patch442'))) ?
|
||||
|
||||
" Primary functions {{{
|
||||
|
||||
function! gitgutter#all()
|
||||
function! gitgutter#all() abort
|
||||
for buffer_id in tabpagebuflist()
|
||||
let file = expand('#' . buffer_id . ':p')
|
||||
if !empty(file)
|
||||
@@ -13,7 +13,7 @@ endfunction
|
||||
|
||||
" bufnr: (integer) the buffer to process.
|
||||
" realtime: (boolean) when truthy, do a realtime diff; otherwise do a disk-based diff.
|
||||
function! gitgutter#process_buffer(bufnr, realtime)
|
||||
function! gitgutter#process_buffer(bufnr, realtime) abort
|
||||
call gitgutter#utility#set_buffer(a:bufnr)
|
||||
if gitgutter#utility#is_active()
|
||||
if g:gitgutter_sign_column_always
|
||||
@@ -37,7 +37,7 @@ function! gitgutter#process_buffer(bufnr, realtime)
|
||||
endfunction
|
||||
|
||||
|
||||
function! gitgutter#handle_diff(diff)
|
||||
function! gitgutter#handle_diff(diff) abort
|
||||
call gitgutter#debug#log(a:diff)
|
||||
|
||||
call setbufvar(gitgutter#utility#bufnr(), 'gitgutter_tracked', 1)
|
||||
@@ -58,7 +58,7 @@ function! gitgutter#handle_diff(diff)
|
||||
call gitgutter#utility#save_last_seen_change()
|
||||
endfunction
|
||||
|
||||
function! gitgutter#disable()
|
||||
function! gitgutter#disable() abort
|
||||
" get list of all buffers (across all tabs)
|
||||
let buflist = []
|
||||
for i in range(tabpagenr('$'))
|
||||
@@ -78,12 +78,12 @@ function! gitgutter#disable()
|
||||
let g:gitgutter_enabled = 0
|
||||
endfunction
|
||||
|
||||
function! gitgutter#enable()
|
||||
function! gitgutter#enable() abort
|
||||
let g:gitgutter_enabled = 1
|
||||
call gitgutter#all()
|
||||
endfunction
|
||||
|
||||
function! gitgutter#toggle()
|
||||
function! gitgutter#toggle() abort
|
||||
if g:gitgutter_enabled
|
||||
call gitgutter#disable()
|
||||
else
|
||||
@@ -95,7 +95,7 @@ endfunction
|
||||
|
||||
" Line highlights {{{
|
||||
|
||||
function! gitgutter#line_highlights_disable()
|
||||
function! gitgutter#line_highlights_disable() abort
|
||||
let g:gitgutter_highlight_lines = 0
|
||||
call gitgutter#highlight#define_sign_line_highlights()
|
||||
|
||||
@@ -107,7 +107,7 @@ function! gitgutter#line_highlights_disable()
|
||||
redraw!
|
||||
endfunction
|
||||
|
||||
function! gitgutter#line_highlights_enable()
|
||||
function! gitgutter#line_highlights_enable() abort
|
||||
let old_highlight_lines = g:gitgutter_highlight_lines
|
||||
|
||||
let g:gitgutter_highlight_lines = 1
|
||||
@@ -120,7 +120,7 @@ function! gitgutter#line_highlights_enable()
|
||||
redraw!
|
||||
endfunction
|
||||
|
||||
function! gitgutter#line_highlights_toggle()
|
||||
function! gitgutter#line_highlights_toggle() abort
|
||||
if g:gitgutter_highlight_lines
|
||||
call gitgutter#line_highlights_disable()
|
||||
else
|
||||
@@ -132,7 +132,7 @@ endfunction
|
||||
|
||||
" Signs {{{
|
||||
|
||||
function! gitgutter#signs_enable()
|
||||
function! gitgutter#signs_enable() abort
|
||||
let old_signs = g:gitgutter_signs
|
||||
|
||||
let g:gitgutter_signs = 1
|
||||
@@ -143,7 +143,7 @@ function! gitgutter#signs_enable()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! gitgutter#signs_disable()
|
||||
function! gitgutter#signs_disable() abort
|
||||
let g:gitgutter_signs = 0
|
||||
call gitgutter#highlight#define_sign_text_highlights()
|
||||
|
||||
@@ -153,7 +153,7 @@ function! gitgutter#signs_disable()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! gitgutter#signs_toggle()
|
||||
function! gitgutter#signs_toggle() abort
|
||||
if g:gitgutter_signs
|
||||
call gitgutter#signs_disable()
|
||||
else
|
||||
@@ -165,7 +165,7 @@ endfunction
|
||||
|
||||
" Hunks {{{
|
||||
|
||||
function! gitgutter#stage_hunk()
|
||||
function! gitgutter#stage_hunk() abort
|
||||
if gitgutter#utility#is_active()
|
||||
" Ensure the working copy of the file is up to date.
|
||||
" It doesn't make sense to stage a hunk otherwise.
|
||||
@@ -187,7 +187,7 @@ function! gitgutter#stage_hunk()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! gitgutter#undo_hunk()
|
||||
function! gitgutter#undo_hunk() abort
|
||||
if gitgutter#utility#is_active()
|
||||
" Ensure the working copy of the file is up to date.
|
||||
" It doesn't make sense to stage a hunk otherwise.
|
||||
@@ -209,7 +209,7 @@ function! gitgutter#undo_hunk()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! gitgutter#preview_hunk()
|
||||
function! gitgutter#preview_hunk() abort
|
||||
if gitgutter#utility#is_active()
|
||||
" Ensure the working copy of the file is up to date.
|
||||
" It doesn't make sense to stage a hunk otherwise.
|
||||
|
||||
Reference in New Issue
Block a user