samhh / dotfiles

Configuring the universe with Nix.
51 stars 2 forks source link

Write as root in nvim #259

Closed samhh closed 2 years ago

samhh commented 2 years ago

Since the change to doas (https://github.com/samhh/dotfiles/commit/6cacd4ae51228cb8cb70c6d0b5e3a9e8a029d338), I no longer have a sudoedit utility, and there's no vetted and widely-used alternative. I can doas nvim file, but I've no user config. There is no support in suda.vim.

Thus I'd like to be able edit normally and then write with something like :w !doas tee % > /dev/null. This would actually be a usability win over sudoedit as I needn't remember to use a different command until I write, so forgetting isn't a PITA.

However this currently isn't possible in nvim, see: https://github.com/neovim/neovim/issues/1496 (and https://github.com/neovim/neovim/issues/1716)

samhh commented 2 years ago

With NixOS there's not really any reason to need to edit as root. All the relevant Nix configs are managed in dotfiles and symlinked in.