diff options
author | w0rp <devw0rp@gmail.com> | 2017-02-16 21:33:44 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-02-16 21:33:44 +0000 |
commit | ca17b5aebdd9bb2e31d01ae16e18047bae375c3c (patch) | |
tree | 9c71ffb6e95acca17f4eddaebe79dab87beb256e | |
parent | 3a2286a1b8d8b2004b0a10656192b6823a89f690 (diff) | |
download | ale-ca17b5aebdd9bb2e31d01ae16e18047bae375c3c.zip |
Add an option for completely disabling command history, and add documentation
-rw-r--r-- | autoload/ale/engine.vim | 6 | ||||
-rw-r--r-- | doc/ale.txt | 26 | ||||
-rw-r--r-- | plugin/ale.vim | 3 | ||||
-rw-r--r-- | test/test_history_saving.vader | 11 |
4 files changed, 45 insertions, 1 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index ae31c8c8..d072d459 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -458,7 +458,11 @@ function! s:RunJob(options) abort \} endif - call ale#history#Add(l:buffer, l:status, l:job_id, l:command) + if g:ale_history_enabled + call ale#history#Add(l:buffer, l:status, l:job_id, l:command) + else + let g:ale_buffer_info[l:buffer].history = [] + endif endfunction " Determine which commands to run for a link in a command chain, or diff --git a/doc/ale.txt b/doc/ale.txt index 8b14cfdd..0922abc5 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -186,6 +186,19 @@ g:ale_enabled *g:ale_enabled* the |ALEToggle| command, which changes this option. +g:ale_history_enabled *g:ale_history_enabled* + + Type: |Number| + Default: `1` + + When set to `1`, ALE will remember the last few commands which were run + for every buffer which is open. This information can be viewed with the + |ALEInfo| command. The size of the buffer can be controlled with the + |g:ale_max_buffer_history_size| option. + + This option can be disabled if storing a command history is not desired. + + g:ale_keep_list_window_open *g:ale_keep_list_window_open* Type: |Number| @@ -311,6 +324,19 @@ g:ale_linters *g:ale_linters* let g:ale_linters = {'c': 'all'} < +g:ale_max_buffer_history_size *g:ale_max_buffer_history_size* + + Type: |Number| + Default: `20` + + This setting controls the maximum number of commands which will be stored in + the command history used for |ALEInfo|. Command history will be rotated in + a FIFO manner. If set to a number <= 0, then the history will be + continuously set to an empty |List|. + + History can be disabled completely with |g:ale_history_enabled|. + + g:ale_open_list *g:ale_open_list* Type: |Number| diff --git a/plugin/ale.vim b/plugin/ale.vim index b9f28d51..321bff89 100644 --- a/plugin/ale.vim +++ b/plugin/ale.vim @@ -134,6 +134,9 @@ let g:ale_warn_about_trailing_whitespace = " A flag for controlling the maximum size of the command history to store. let g:ale_max_buffer_history_size = get(g:, 'ale_max_buffer_history_size', 20) +" A flag for enabling or disabling the command history. +let g:ale_history_enabled = get(g:, 'ale_history_enabled', 1) + function! s:ALEInitAuGroups() abort augroup ALERunOnTextChangedGroup autocmd! diff --git a/test/test_history_saving.vader b/test/test_history_saving.vader index d30534b7..b3afdca2 100644 --- a/test/test_history_saving.vader +++ b/test/test_history_saving.vader @@ -16,6 +16,7 @@ Before: \}) After: + let g:ale_history_enabled = 1 unlet g:history let g:ale_buffer_info = {} let g:ale_max_buffer_history_size = 20 @@ -40,6 +41,16 @@ Execute(History should be set when commands are run): " The Job ID will change each time, but we can check the type. AssertEqual type(1), type(g:history[0].job_id) +Execute(History should be not set when disabled): + AssertEqual 'foobar', &filetype + + let g:ale_history_enabled = 0 + + call ale#Lint() + call ale#engine#WaitForJobs(2000) + + AssertEqual 0, len(g:ale_buffer_info[bufnr('%')].history) + Execute(History items should be popped after going over the max): let g:ale_buffer_info[1] = { \ 'history': map(range(20), '{''status'': ''started'', ''job_id'': v:val, ''command'': ''foobar''}'), |