Use suda.vim for automatically dealing with such cases. Works with neovim as well.
neovim
I'll also recommend adding the following to your init.lua or some config file because suda doesn't play nicely with nvim -d or vimdiff.
init.lua
suda
nvim -d
vimdiff
-- Disable Suda in diff views if not vim.api.nvim_win_get_option(0, 'diff') then vim.g.suda_smart_edit = 1 end
The vimscript version of the same would be:
vimscript
" Disable Suda in diff views if ! &diff let g:suda_smart_edit = 1 endif
I use Arch btw
Sister communities:
Community rules
Please report posts and comments that break these rules!
Use suda.vim for automatically dealing with such cases. Works with
neovim
as well.I'll also recommend adding the following to your
init.lua
or some config file becausesuda
doesn't play nicely withnvim -d
orvimdiff
.The
vimscript
version of the same would be: