Add option to always show left gutter

This commit is contained in:
Vladimir Marovic 2016-09-26 16:55:26 +02:00
parent 937e979270
commit 41c3ba17f8
3 changed files with 23 additions and 0 deletions

View File

@ -82,6 +82,14 @@ This plugin will look for linters in the [`ale_linters`](ale_linters) directory.
Each directory within corresponds to a particular filetype in Vim, and each file
in each directory corresponds to the name of a particular linter.
### Always showing gutter
To prevent left gutter to disappear when there is no errors set
```vim
let g:ale_sign_column_always = 1
```
## Installation
To install this plugin, you should use one of the following methods.

View File

@ -4,6 +4,8 @@ endif
let g:loaded_ale_sign = 1
let g:ale_sign_column_always = 0
if !hlexists('ALEErrorSign')
highlight link ALErrorSign error
endif
@ -50,6 +52,8 @@ function! ale#sign#SetSigns(buffer, loclist)
endif
endfor
call ale#sign#InsertDummy(len(signlist))
for i in range(0, len(signlist) - 1)
let obj = signlist[i]
let name = obj['type'] ==# 'W' ? 'ALEWarningSign' : 'ALEErrorSign'
@ -62,3 +66,12 @@ function! ale#sign#SetSigns(buffer, loclist)
exec sign_line
endfor
endfunction
" Show signd gutter if there is no signs and g:ale_sign_column_alwas is set to 1
function! ale#sign#InsertDummy(no_signs)
if g:ale_sign_column_always == 1 && a:no_signs == 0
sign define ale_keep_open_dummy
execute 'sign place 9999 line=1 name=ale_keep_open_dummy buffer=' . bufnr('')
endif
endfunction

View File

@ -297,6 +297,8 @@ function! ALELint(delay)
if a:delay > 0
let s:lint_timer = timer_start(a:delay, function('s:TimerHandler'))
else
" Show empty gutter if g:ale_sign_column_always = 1
call ale#sign#InsertDummy(0)
call s:TimerHandler()
endif
endfunction