In order to automatically trigger a mark holding the last cursor position when I left a buffer or window, I added these statements to my
for more background on why I wanted to add these commands please refer to this vi.stackexchange question.
autocmd BufLeave * :normal mB autocmd WinLeave * :normal mW
The statements are causing errors when moving out of, or closing buffers created by
netrw. e.g. when closing a
Error detected while processing function <SNR>85_NetrwBookHistHandler: line 154: E121: Undefined variable: g:netrw_bookmarklist E15: Invalid expression: g:netrw_bookmarklist[iremove - 1] line 158: E121: Undefined variable: g:netrw_bookmarklist E116: Invalid arguments for function remove line 159: E121: Undefined variable: dremove
Also NERDTree is sometimes making addiditonal copies of directories, so when I run
git status, git is showing new directories.
I suspect the cause of the error is the fact that NERDTree and netrw are creating new mappings, so that the command
:normal mB when executed in a NERDTree buffer is triggering something like
l -which in NERDTree mappings means "modify" and "list" rather than set a new mark.
Does this reasoning sound right?
If so how could I detect when focus is in a NERDTree or netrw buffer, so the mappings can be turned off. Otherwise what could the cause to this problem?