1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:10:04 +08:00

Improve checker layer doc

This commit is contained in:
wsdjeg 2017-05-15 23:22:54 +08:00
parent 973116b6fc
commit a14ef64149
4 changed files with 44 additions and 6 deletions

View File

@ -18,6 +18,9 @@ endfunction
function! SpaceVim#layers#checkers#config() abort function! SpaceVim#layers#checkers#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['e', '.'], 'lopen', 'error-transient-state', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', '.'], 'lopen', 'error-transient-state', 1)
call SpaceVim#mapping#space#def('nnoremap', ['e', 'c'], '', 'clear all errors', 1)
call SpaceVim#mapping#space#def('nnoremap', ['e', 'h'], '', 'describe a syntax checker', 1)
call SpaceVim#mapping#space#def('nnoremap', ['e', 'v'], '', 'verify syntax checker setup', 1)
call SpaceVim#mapping#space#def('nnoremap', ['e', 'n'], 'lnext', 'next-error', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'n'], 'lnext', 'next-error', 1)
call SpaceVim#mapping#space#def('nnoremap', ['e', 'l'], 'lopen', 'toggle showing the error list', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'l'], 'lopen', 'toggle showing the error list', 1)
call SpaceVim#mapping#space#def('nnoremap', ['e', 'p'], 'lprevious', 'previous-error', 1) call SpaceVim#mapping#space#def('nnoremap', ['e', 'p'], 'lprevious', 'previous-error', 1)

View File

@ -59,6 +59,9 @@ function! SpaceVim#layers#ui#config() abort
call SpaceVim#mapping#space#def('nnoremap', ['T', '~'], 'call call(' call SpaceVim#mapping#space#def('nnoremap', ['T', '~'], 'call call('
\ . string(s:_function('s:toggle_end_of_buffer')) . ', [])', \ . string(s:_function('s:toggle_end_of_buffer')) . ', [])',
\ 'display ~ in the fringe on empty lines', 1) \ 'display ~ in the fringe on empty lines', 1)
call SpaceVim#mapping#space#def('nnoremap', ['t', 's'], 'call call('
\ . string(s:_function('s:toggle_syntax_checker')) . ', [])',
\ 'toggle syntax checker', 1)
endfunction endfunction
" function() wrapper " function() wrapper
if v:version > 703 || v:version == 703 && has('patch1170') if v:version > 703 || v:version == 703 && has('patch1170')
@ -110,7 +113,7 @@ endfunction
let s:fcflag = 0 let s:fcflag = 0
function! s:toggle_fill_column() abort function! s:toggle_fill_column() abort
if !s:fcflag if !s:fcflag
let &colorcolumn=join(range(80,999),",") let &colorcolumn=join(range(80,999),',')
let s:fcflag = 1 let s:fcflag = 1
else else
set cc= set cc=
@ -173,3 +176,7 @@ function! s:toggle_win_fringe() abort
let s:tfflag = 0 let s:tfflag = 0
endif endif
endfunction endfunction
function! s:toggle_syntax_checker() abort
let g:_spacevim_toggle_syntax_flag = g:_spacevim_toggle_syntax_flag * -1
endfunction

View File

@ -1,18 +1,23 @@
if get(g:, 'spacevim_lint_on_save', 0) if get(g:, 'spacevim_lint_on_save', 0)
augroup Neomake_on_save augroup Neomake_on_save
au! au!
autocmd! BufWritePost * Neomake autocmd! BufWritePost * call s:neomake()
augroup END augroup END
endif endif
if empty(maparg('<leader>ck', '',0,1))
nnoremap <silent> <Leader>ck :Neomake<CR> let g:_spacevim_toggle_syntax_flag = 1
endif
function! s:neomake() abort
if g:_spacevim_toggle_syntax_flag == 1
Neomake
endif
endfunction
if get(g:, 'spacevim_lint_on_the_fly', 0) if get(g:, 'spacevim_lint_on_the_fly', 0)
let g:neomake_tempfile_enabled = 1 let g:neomake_tempfile_enabled = 1
let g:neomake_open_list = 0 let g:neomake_open_list = 0
augroup Neomake_on_the_fly augroup Neomake_on_the_fly
au! au!
autocmd! TextChangedI * Neomake autocmd! TextChangedI * call s:neomake()
augroup END augroup END
endif endif

View File

@ -48,6 +48,7 @@ title: "Documentation"
* [Searching](#searching) * [Searching](#searching)
* [Editing](#editing) * [Editing](#editing)
* [Multi-Encodings](#multi-encodings) * [Multi-Encodings](#multi-encodings)
* [Errors handling](#errors-handling)
* [Features](#features) * [Features](#features)
* [Awesome ui](#awesome-ui-1) * [Awesome ui](#awesome-ui-1)
* [Mnemonic key bindings](#mnemonic-key-bindings) * [Mnemonic key bindings](#mnemonic-key-bindings)
@ -461,9 +462,31 @@ set enc=utf-8
write write
``` ```
### Errors handling
SpaceVim uses [neomake](https://github.com/neomake/neomake) to gives error feedback on the fly. The checks are only performed at save time by default.
Errors management mappings (start with e):
Mappings | Description
-------- | -----------
`SPC t s` | toggle syntax checker
`SPC e c` | clear all errors
`SPC e h` | describe a syntax checker
`SPC e l` | toggle the display of the list of errors/warnings
`SPC e n` | go to the next error
`SPC e p` | go to the previous error
`SPC e v` | verify syntax checker setup (useful to debug 3rd party tools configuration)
`SPC e .` | error transient state
The next/previous error mappings and the error transient state can be used to browse errors from syntax checkers as well as errors from location list buffers, and indeed anything that supports vim's location list. This includes for example search results that have been saved to a location list buffer.
Custom sign symbol:
Symbol | Description | Custom option
------ | ----------- | -------------
`✖` | Error | `g:spacevim_error_symbol`
`➤` | warning | `g:spacevim_warning_symbol`
## Features ## Features