TEst overriding the mappings
This commit is contained in:
parent
675a68c601
commit
ba83a59e88
3 changed files with 18 additions and 7 deletions
|
|
@ -138,7 +138,10 @@ function! s:MatchKey( key, candidates ) abort
|
|||
let mapped = ''
|
||||
for candidate in a:candidates
|
||||
try
|
||||
" Try and expand the key code
|
||||
" Try and expand the key code. Note this won't work for non-special keys
|
||||
" and it won't work for multple keys, which is kinda shitty.
|
||||
"
|
||||
" There's no vim api to run expand_keycodes() i don't think.
|
||||
execute 'let mapped = "\' . candidate . '"'
|
||||
if mapped ==# a:key
|
||||
return v:true
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
import vim
|
||||
import builtins
|
||||
from vimspector import utils
|
||||
from collections.abc import Mapping
|
||||
|
||||
DEFAULTS = {
|
||||
# UI
|
||||
|
|
@ -85,9 +84,7 @@ if hasattr( vim, 'Dictionary' ):
|
|||
|
||||
def Dict( option ):
|
||||
return _UpdateDict( DICT_TYPE( DEFAULTS.get( option, {} ) ),
|
||||
utils.GetVimValue( vim.vars,
|
||||
f'vimspector_{ option }',
|
||||
{} ) )
|
||||
vim.vars.get( f'vimspector_{ option }', DICT_TYPE() ) )
|
||||
|
||||
|
||||
def _UpdateDict( target, override ):
|
||||
|
|
@ -118,9 +115,9 @@ def _UpdateDict( target, override ):
|
|||
|
||||
for key, value in override.items():
|
||||
current_value = target.get( key )
|
||||
if not isinstance( current_value, Mapping ):
|
||||
if not isinstance( current_value, DICT_TYPE ):
|
||||
target[ key ] = value
|
||||
elif isinstance( value, Mapping ):
|
||||
elif isinstance( value, DICT_TYPE ):
|
||||
target[ key ] = _UpdateDict( current_value, value )
|
||||
else:
|
||||
target[ key ] = value
|
||||
|
|
|
|||
|
|
@ -142,4 +142,15 @@ augroup END
|
|||
|
||||
" }}}
|
||||
|
||||
" Custom mappings for special buffers {{{
|
||||
|
||||
let g:vimspector_mappings = {
|
||||
\ 'stack_trace': {},
|
||||
\ 'variables': {
|
||||
\ 'set_value': [ '<Tab>', '<C-CR>' ],
|
||||
\ },
|
||||
\ }
|
||||
|
||||
" }}}
|
||||
|
||||
" vim: foldmethod=marker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue