• StarDreamer
        link
        fedilink
        English
        23 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
          link
          fedilink
          1
          edit-2
          3 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

      • @PipedLinkBotB
        link
        English
        13 months ago

        Here is an alternative Piped link(s):

        sure it works in neovim

        Piped is a privacy-respecting open-source alternative frontend to YouTube.

        I’m open-source; check me out at GitHub.