• StarDreamer@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      2
      ·
      9 months ago

      Iirc the specific reason behind this is

      • sudo by default requires a tty to run
      • vim’s bang spawns a tty to execute commands
      • nvim’s bang executes the command directly, then pipes the output to nvim

      As a result, sudo (without args) can’t work in nvim as it doesn’t have a tty to prompt the user for passwords. Nvim also used to do what vim did, but they found out spawning the tty was causing other issues (still present in vim) so they changed it.

      • dream_weasel@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        9 months ago

        There must be more to this. I just launched a terminal and created a file to test with nvim on arch and it works perfectly fine.

        Take a file, sudo chown root:root filename, sudo chmod 700 filename, edit with nvim and save with :w !sudo tee % then reload. Works fine.

        I’m on arch with suckless st.

        Edit:

        Made a demo vid - https://youtu.be/YKZuAvoSW5g