vim-sandwich icon indicating copy to clipboard operation
vim-sandwich copied to clipboard

How to disable vim-sandwich inside NERDTree?

Open asgeo1 opened this issue 6 years ago • 1 comments

I commonly open files into vertically-split windows using NERDTree, which has s mapped for this purpose.

Now that I have vim-sandwich, pressing s inside NERDtree is very slow as it's waiting to see if I'm going to complete a vim-sandwich command before it opens the split.

Is there anyway to disable vim-sandwich inside windows like NERDTree? Perhaps if the buffer has modifiable set to off (which is what NERDTree windows are), then vim-sandwich could be disabled for that window?

asgeo1 avatar Jul 05 '19 00:07 asgeo1

There are several ways to achieve it but maybe the use of <nowait> option for s key-mapping would be the easiest in your case. NERDTree doesn't provide <Plug> key-mappings, so it may look a little lengthy:

augroup NERDTree-disable-sandwich
  autocmd FileType nerdtree nnoremap <buffer><nowait> s :call nerdtree#ui_glue#invokeKeyMap('s')<CR>
augroup END

Add this lines to your vimrc, then your s in nerdtree window works immediately. The augroup name is whatever you like is ok.

machakann avatar Jul 06 '19 09:07 machakann