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 = ''
|
let mapped = ''
|
||||||
for candidate in a:candidates
|
for candidate in a:candidates
|
||||||
try
|
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 . '"'
|
execute 'let mapped = "\' . candidate . '"'
|
||||||
if mapped ==# a:key
|
if mapped ==# a:key
|
||||||
return v:true
|
return v:true
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
import vim
|
import vim
|
||||||
import builtins
|
import builtins
|
||||||
from vimspector import utils
|
from vimspector import utils
|
||||||
from collections.abc import Mapping
|
|
||||||
|
|
||||||
DEFAULTS = {
|
DEFAULTS = {
|
||||||
# UI
|
# UI
|
||||||
|
|
@ -85,9 +84,7 @@ if hasattr( vim, 'Dictionary' ):
|
||||||
|
|
||||||
def Dict( option ):
|
def Dict( option ):
|
||||||
return _UpdateDict( DICT_TYPE( DEFAULTS.get( option, {} ) ),
|
return _UpdateDict( DICT_TYPE( DEFAULTS.get( option, {} ) ),
|
||||||
utils.GetVimValue( vim.vars,
|
vim.vars.get( f'vimspector_{ option }', DICT_TYPE() ) )
|
||||||
f'vimspector_{ option }',
|
|
||||||
{} ) )
|
|
||||||
|
|
||||||
|
|
||||||
def _UpdateDict( target, override ):
|
def _UpdateDict( target, override ):
|
||||||
|
|
@ -118,9 +115,9 @@ def _UpdateDict( target, override ):
|
||||||
|
|
||||||
for key, value in override.items():
|
for key, value in override.items():
|
||||||
current_value = target.get( key )
|
current_value = target.get( key )
|
||||||
if not isinstance( current_value, Mapping ):
|
if not isinstance( current_value, DICT_TYPE ):
|
||||||
target[ key ] = value
|
target[ key ] = value
|
||||||
elif isinstance( value, Mapping ):
|
elif isinstance( value, DICT_TYPE ):
|
||||||
target[ key ] = _UpdateDict( current_value, value )
|
target[ key ] = _UpdateDict( current_value, value )
|
||||||
else:
|
else:
|
||||||
target[ key ] = value
|
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
|
" vim: foldmethod=marker
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue