diff options
author | Vladimir Marovic <vladimir@marovic.me> | 2016-09-26 16:55:26 +0200 |
---|---|---|
committer | Vladimir Marovic <vladimir@marovic.me> | 2016-09-26 16:55:26 +0200 |
commit | 41c3ba17f8e1bcadc1d40039b1ce01e791666602 (patch) | |
tree | db742bcbc1b14ac7fa990a37fde59101ecb27192 | |
parent | 937e9792708bf173aab53bdc7134f47f4db9e603 (diff) | |
download | ale-41c3ba17f8e1bcadc1d40039b1ce01e791666602.zip |
Add option to always show left gutter
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | plugin/ale/sign.vim | 13 | ||||
-rw-r--r-- | plugin/ale/zmain.vim | 2 |
3 files changed, 23 insertions, 0 deletions
@@ -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 999e3a65..ee23eafb 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 2229c34c..8ec1c955 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 |