vim-suda
vim-suda copied to clipboard
Duplicate buffers with smart edit
Adding
let g:suda_smart_edit = 1
has a strange behaviour: Editing a file that I have no write access, eg /etc/hosts from an open nvim (ie with :e /etc/hosts) works fine, but from outside (ie with nvim /etc/hosts from the terminal) leads to two open buffers, the suda and the non-suda one.
Please provide a minimal vimrc and minimal reproduction steps
After cleaning up my plugins, the minimal init.vim is:
set nocompatible
call plug#begin()
Plug 'bogado/file-line'
Plug 'lambdalisue/suda.vim'
call plug#end()
let g:suda_smart_edit = 1
opening a file that requires sudo to write to it, eg by nvim /etc/hosts will open two buffers as can be seen by :ls:
:ls
2 #h "suda:///etc/hosts" line 1
3 %a= "/etc/hosts" line 1
instead of just one, and the active buffer is the ReadOnly one.
Got it. Well, it's kinda bug thanks 👍
https://github.com/lambdalisue/suda.vim/blob/6bffe36862faa601d2de7e54f6e85c1435e832d0/autoload/suda.vim#L236
It seems the previous buffer is removed... Hum...