mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 17:49:57 +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
|
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
|
" quickfix list movement
|
||||||
let g:_spacevim_mappings.q = {'name' : '+Quickfix 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',
|
\ 'Jump to next quickfix list position',
|
||||||
\ 'cnext',
|
\ 'cnext',
|
||||||
\ 'Next quickfix list')
|
\ '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',
|
\ 'Jump to previous quickfix list position',
|
||||||
\ 'cprev',
|
\ 'cprev',
|
||||||
\ 'Previous quickfix list')
|
\ 'Previous quickfix list')
|
||||||
call SpaceVim#mapping#def('nnoremap', '<Leader>qq', ':cclose<CR>',
|
call SpaceVim#mapping#def('nnoremap', '<Leader>ql', ':copen<CR>',
|
||||||
\ 'Close quickfix list window',
|
\ 'Open quickfix list window',
|
||||||
\ 'cclose',
|
\ 'copen',
|
||||||
\ 'Close quickfix list window')
|
\ 'Open quickfix list window')
|
||||||
call SpaceVim#mapping#def('nnoremap <silent>', '<Leader>qr', 'q',
|
call SpaceVim#mapping#def('nnoremap <silent>', '<Leader>qr', 'q',
|
||||||
\ 'Toggle recording',
|
\ 'Toggle recording',
|
||||||
\ '',
|
\ '',
|
||||||
|
@ -67,11 +67,21 @@ function! SpaceVim#layers#checkers#config() abort
|
|||||||
\ 'clear all errors', 1)
|
\ 'clear all errors', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'h'], '', 'describe a syntax checker', 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', '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'], 'call call('
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'l'], 'lopen | wincmd w', 'toggle showing the error list', 1)
|
\ . string(s:_function('s:jump_to_next_error')) . ', [])',
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'L'], 'lopen', 'toggle showing the error list', 1)
|
\ 'next-error', 1)
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'p'], 'lprevious', 'previous-error', 1)
|
call SpaceVim#mapping#space#def('nnoremap', ['e', 'l'], 'call call('
|
||||||
call SpaceVim#mapping#space#def('nnoremap', ['e', 'N'], 'lNext', 'previous-error', 1)
|
\ . 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('
|
call SpaceVim#mapping#space#def('nnoremap', ['e', 'v'], 'call call('
|
||||||
\ . string(s:_function('s:verify_syntax_setup')) . ', [])',
|
\ . string(s:_function('s:verify_syntax_setup')) . ', [])',
|
||||||
\ 'verify syntax setup', 1)
|
\ 'verify syntax setup', 1)
|
||||||
@ -116,6 +126,54 @@ function! s:neomake_cursor_move_delay() abort
|
|||||||
\ function('s:neomake_signatures_current_error'))
|
\ function('s:neomake_signatures_current_error'))
|
||||||
endfunction
|
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 = ''
|
let s:last_echoed_error = ''
|
||||||
function! s:neomake_signatures_current_error(...) abort
|
function! s:neomake_signatures_current_error(...) abort
|
||||||
call s:neomake_signatures_clear()
|
call s:neomake_signatures_clear()
|
||||||
|
@ -6,6 +6,13 @@
|
|||||||
" License: GPLv3
|
" 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:qflist = []
|
||||||
|
|
||||||
let s:qf_title = ''
|
let s:qf_title = ''
|
||||||
|
@ -1742,7 +1742,8 @@ write
|
|||||||
|
|
||||||
### Errors handling
|
### 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):
|
Errors management mappings (start with e):
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
- Update runtime log for startup ([#2219](https://github.com/SpaceVim/SpaceVim/pull/2219))
|
- 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))
|
- 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))
|
- 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))
|
- 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
|
### Changed
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user