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

Duplicate buffers with smart edit

Open spapanik opened this issue 3 years ago • 4 comments

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.

spapanik avatar Sep 15 '22 10:09 spapanik

Please provide a minimal vimrc and minimal reproduction steps

lambdalisue avatar Oct 05 '22 09:10 lambdalisue

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.

spapanik avatar Oct 11 '22 09:10 spapanik

Got it. Well, it's kinda bug thanks 👍

lambdalisue avatar Oct 14 '22 18:10 lambdalisue

https://github.com/lambdalisue/suda.vim/blob/6bffe36862faa601d2de7e54f6e85c1435e832d0/autoload/suda.vim#L236

It seems the previous buffer is removed... Hum...

lambdalisue avatar Oct 14 '22 18:10 lambdalisue