I am trying to debug the vim-fugitive
plugin, to dig into how it works.
When I develop a piece of vim script, I am used to testing a function with the debug
command. Here it does not work because the function I try to access is not in the current scope.
debug execute <SID>StageDiff('Gdiff')
But there is a mapping that call this function inside the plugin:
nnoremap <buffer> <silent> D :<C-U>execute <SID>StageDiff('Gdiff')<CR>
So I tried
debug norm! D
But I get the following error (after a step
):
E21: Cannot make changes, 'modifiable' is off
I guess it's because the context of the D
is the debugger's window, so it's not modifiable.
My question is:
- Do you know a way to debug an external function?
How can the(see comments need to usedebug norm! ...
keep the focus on the current file, instead of jumping to the debug window?norm
)
:norm! D
you prevent the mapping to be triggered. Just usenorm D
norm
(and I guess every other command) is the file, and not the debug window ?d$
.:h :normal