rickhowe / spotdiff.vim

A range and area selectable diffthis to compare partially
http://www.vim.org/scripts/script.php?script_id=5509
MIT License
41 stars 5 forks source link

Suggestion: Mapping #4

Open vds2212 opened 5 months ago

vds2212 commented 5 months ago

The mapping creates a number of default mappings:

These default mapping can conflict with user mappings. It would be good if the plugin had an option to not create the default mappings

e.g.:

vim-maximizer has:

let g:maximizer_set_default_mapping = 0

is.vim has:

let g:is#do_default_mappings = 0

context has:

let g:context_add_mappings = 0

bufexplorer has:

let g:bufExplorerDisableDefaultKeyMapping = 1

ferret has:

let g:FerretMap = 0

fern has:

let g:fern#disable_default_mappings = 1

nerd commenter has:

let g:NERDCreateDefaultMappings = 0

vimspector has:

let g:vimspector_enable_mappings = 'VISUAL_STUDIO'

Currently I have the following section in my vimrc:

  augroup spotfiff
    autocmd! VimEnter * nunmap <leader>t
    autocmd! VimEnter * nunmap <leader>T
    autocmd! VimEnter * nunmap <leader>o
    autocmd! VimEnter * nunmap <leader>O
    autocmd! VimEnter * nunmap <leader>u
  augroup END
rickhowe commented 5 months ago

The plugin does not map those keys if already mapped. And, not documented but g:VDiffDoMapping can be 0 to disable those key mapping.

vds2212 commented 5 months ago

Thanks for the answer :-) I'll use the flag in my config :-)

gh-liu commented 3 weeks ago

@rickhowe If I understand correctly, the [b ]b [e ]e mappings are only valid for a period of time when diffing. Maybe use the OptionSet event for the diff option: when diff is on, map the keys; when diff is off, unmap the keys.

rickhowe commented 2 weeks ago

Thank you for asking. User can anytime map his/her favorite keys to plugin operations and unmap them. It might cause a conflict and an accident so I am afraid to handle the mappings.