Changes

Vim Tips

878 bytes added, 11:45, 9 August 2020
/* vim write with sudo trick */
The following lines were added (+) and removed (-):
When using vim as a HEX Editor remember to run the filter (:%!xxd to convert to hex, :%!xxd -r to convert back) and to convert back from hex before saving.  ===vim write with sudo trick===Oops!  I opened a file in vim and made a bunch of edits not realizing that I do not have write permission to the file.  [https://stackoverflow.com/questions/33366352/write-to-file-using-vim-when-sudo-privileges-needed Write to file using vim when sudo privileges needed] :w !sudo tee %The !sudo tee part calls tee with administrator privileges.  You can add this to your .vimrc to make this trick easy-to-use: just type :w!!. " Allow saving of files as sudo when I forgot to start vim using sudo. cmap w!! w !sudo tee > /dev/null %ref: [https://stackoverflow.com/questions/2600783/how-does-the-vim-write-with-sudo-trick-work How does the vim “write with sudo” trick work?]
Administrator
663
edits