Search code examples
unixvimsudo

how to open another file from within vim as a different user (sudoedit | vim )


so I've recently learned about sudoedit and how I can edit a file more safely than the standard "sudo vim".

the problem is now, when I'm in vim and "vsplit" or "tabnew" I open it as my user account (no root privileges)


Solution

  • Maybe you just want a option to save file as sudo.

    You can find mapings for write file as sudo or use tpope enuch plugin.

    You will get :SudoWrite and :SudoEdit commands and couple more.

    vim-enuch