1. 38
  1. 10

    I just use https://github.com/tpope/vim-eunuch which includes a :SudoWrite in its list of goodies.

    Everything in the plugin is pretty easy to live without but in my mind the simple plugin to have everything on-hand is worth it.

    1. 3

      Same here since 2014, with the addition of this shortcut in my rc file:

      cmap w!! SudoWrite
      
      1. 1

        Nice! I’ve recently added https://github.com/lambdalisue/suda.vim for Neovim, but I may look at this instead, especially as it adds some other things

      2. 3

        Here’s part of my .vimrc:

        " :W sudo-saves a file

        command W w !sudo tee % > /dev/null

        1. 3

          This is great, really wish I thought of this earlier! Here’s a oneliner I just put into my vimrc:

          command Suwrite exec 'silent write !sudo tee "%" >/dev/null' | edit!