this post was submitted on 24 Mar 2024
355 points (95.6% liked)

linuxmemes

20880 readers
9 users here now

I use Arch btw


Sister communities:

Community rules

  1. Follow the site-wide rules and code of conduct
  2. Be civil
  3. Post Linux-related content
  4. No recent reposts

Please report posts and comments that break these rules!

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 15 points 8 months ago (8 children)

Is there an editor that can request root privileges without restarting it? That would be quite useful.

[–] [email protected] 11 points 8 months ago (1 children)

In vim, in normal mode you can do: :w !sudo tee %

[–] [email protected] 2 points 8 months ago (1 children)

Apparently that doesn't work in NeoVim, so recently I installed the suda plugin.

Personally, I just doas nvim and then the file name that needs root access, but it's a handy plugin in case I forget.

[–] [email protected] 1 points 8 months ago

??? I used this in neovim twice today

:w !sudo tee % then reload when it asks.

[–] [email protected] 9 points 8 months ago
[–] [email protected] 5 points 8 months ago

It's a simple trick in Vim:

https://stackoverflow.com/a/7078429

For the lazy: :w !sudo tee > /dev/null %

[–] [email protected] 4 points 8 months ago* (last edited 8 months ago)

Yeah, in emacs you use tramp to open the file with /sudo::

[–] [email protected] 4 points 8 months ago* (last edited 8 months ago)

micro ftw, no need to even memorize a command, it'll just ask if you want to use sudo

[–] [email protected] 4 points 8 months ago
[–] [email protected] 4 points 8 months ago

kate does this in KDE, but it's not cli.