diff --git a/README.md b/README.md index 415b3e1..d247863 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/plugin/ale/sign.vim b/plugin/ale/sign.vim index 999e3a6..ee23eaf 100644 --- a/plugin/ale/sign.vim +++ b/plugin/ale/sign.vim @@ -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 + diff --git a/plugin/ale/zmain.vim b/plugin/ale/zmain.vim index 2229c34..8ec1c95 100644 --- a/plugin/ale/zmain.vim +++ b/plugin/ale/zmain.vim @@ -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