mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 12:50:04 +08:00
Improve error key bindings (#2336)
* Add qflist plugin * Change errors mappings * Update wiki
This commit is contained in:
parent
1bc9f23114
commit
fc4bf82201
@ -167,35 +167,20 @@ function! SpaceVim#default#keyBindings() abort
|
||||
endif
|
||||
|
||||
|
||||
" Location list movement
|
||||
let g:_spacevim_mappings.l = {'name' : '+Location movement'}
|
||||
call SpaceVim#mapping#def('nnoremap', '<Leader>lj', ':lnext<CR>',
|
||||
\ 'Jump to next location list position',
|
||||
\ 'lnext',
|
||||
\ 'Next location list')
|
||||
call SpaceVim#mapping#def('nnoremap', '<Leader>lk', ':lprev<CR>',
|
||||
\ 'Jump to previous location list position',
|
||||
\ 'lprev',
|
||||
\ 'Previous location list')
|
||||
call SpaceVim#mapping#def('nnoremap', '<Leader>lq', ':lclose<CR>',
|
||||
\ 'Close the window showing the location list',
|
||||
\ 'lclose',
|
||||
\ 'Close location list window')
|
||||
|
||||
" quickfix list movement
|
||||
let g:_spacevim_mappings.q = {'name' : '+Quickfix movement'}
|
||||
call SpaceVim#mapping#def('nnoremap', '<Leader>qj', ':cnext<CR>',
|
||||
call SpaceVim#mapping#def('nnoremap', '<Leader>qn', ':cnext<CR>',
|
||||
\ 'Jump to next quickfix list position',
|
||||
\ 'cnext',
|
||||
\ 'Next quickfix list')
|
||||
call SpaceVim#mapping#def('nnoremap', '<Leader>qk', ':cprev<CR>',
|
||||
call SpaceVim#mapping#def('nnoremap', '<Leader>qp', ':cprev<CR>',
|
||||
\ 'Jump to previous quickfix list position',
|
||||
\ 'cprev',
|
||||
\ 'Previous quickfix list')
|
||||
call SpaceVim#mapping#def('nnoremap', '<Leader>qq', ':cclose<CR>',
|
||||
\ 'Close quickfix list window',
|
||||
\ 'cclose',
|
||||
\ 'Close quickfix list window')
|
||||
call SpaceVim#mapping#def('nnoremap', '<Leader>ql', ':copen<CR>',
|
||||
\ 'Open quickfix list window',
|
||||
\ 'copen',
|
||||
\ 'Open quickfix list window')
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', '<Leader>qr', 'q',
|
||||
\ 'Toggle recording',
|
||||
\ '',
|
||||
|
@ -67,11 +67,21 @@ function! SpaceVim#layers#checkers#config() abort
|
||||
\ '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', 'l'], 'lopen | wincmd w', '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', 'N'], 'lNext', 'previous-error', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'n'], 'call call('
|
||||
\ . string(s:_function('s:jump_to_next_error')) . ', [])',
|
||||
\ 'next-error', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'l'], 'call call('
|
||||
\ . string(s:_function('s:toggle_show_error')) . ', [0])',
|
||||
\ 'toggle showing the error list', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'L'], 'call call('
|
||||
\ . string(s:_function('s:toggle_show_error')) . ', [1])',
|
||||
\ 'toggle showing the error list', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'p'], 'call call('
|
||||
\ . string(s:_function('s:jump_to_previous_error')) . ', [])',
|
||||
\ 'previous-error', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'N'], 'call call('
|
||||
\ . string(s:_function('s:jump_to_previous_error')) . ', [])',
|
||||
\ 'previous-error', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'v'], 'call call('
|
||||
\ . string(s:_function('s:verify_syntax_setup')) . ', [])',
|
||||
\ 'verify syntax setup', 1)
|
||||
@ -116,6 +126,54 @@ function! s:neomake_cursor_move_delay() abort
|
||||
\ function('s:neomake_signatures_current_error'))
|
||||
endfunction
|
||||
|
||||
function! s:toggle_show_error(...) abort
|
||||
try
|
||||
botright lopen
|
||||
catch
|
||||
try
|
||||
if len(getqflist()) == 0
|
||||
echohl WarningMsg
|
||||
echon 'There is no errors!'
|
||||
echohl None
|
||||
else
|
||||
botright copen
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
endtry
|
||||
if a:1 == 1
|
||||
wincmd w
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:jump_to_next_error() abort
|
||||
try
|
||||
lnext
|
||||
catch
|
||||
try
|
||||
cnext
|
||||
catch
|
||||
echohl WarningMsg
|
||||
echon 'There is no errors!'
|
||||
echohl None
|
||||
endtry
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:jump_to_previous_error() abort
|
||||
try
|
||||
lprevious
|
||||
catch
|
||||
try
|
||||
cprevious
|
||||
catch
|
||||
echohl WarningMsg
|
||||
echon 'There is no errors!'
|
||||
echohl None
|
||||
endtry
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
let s:last_echoed_error = ''
|
||||
function! s:neomake_signatures_current_error(...) abort
|
||||
call s:neomake_signatures_clear()
|
||||
|
@ -6,6 +6,13 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
" this is a build-in quickfix list and location list plugin for SpaceVim, and
|
||||
" it should works well for both quickfix list and location list. The public
|
||||
" key bindings is:
|
||||
" 1. jump to next position in qflist
|
||||
" 2. jump to previous position in qflist
|
||||
" 3. open qflist if it is available
|
||||
|
||||
let s:qflist = []
|
||||
|
||||
let s:qf_title = ''
|
||||
|
@ -1742,7 +1742,8 @@ 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.
|
||||
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):
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
- Update runtime log for startup ([#2219](https://github.com/SpaceVim/SpaceVim/pull/2219))
|
||||
- Add doc for how run run spacevim in docker ([#2238](https://github.com/SpaceVim/SpaceVim/pull/2238))
|
||||
- Improve error key bindings ([#2336](https://github.com/SpaceVim/SpaceVim/pull/2336))
|
||||
|
||||
### 非兼容性变动
|
||||
|
||||
|
@ -16,6 +16,7 @@ The next release is v1.0.0.
|
||||
|
||||
- Update runtime log for startup ([#2219](https://github.com/SpaceVim/SpaceVim/pull/2219))
|
||||
- Add doc for how run run spacevim in docker ([#2238](https://github.com/SpaceVim/SpaceVim/pull/2238))
|
||||
- Improve error key bindings ([#2336](https://github.com/SpaceVim/SpaceVim/pull/2336))
|
||||
|
||||
### Changed
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user