This will ask you for the root password, then save your changes as you requested:
:w !sudo tee %
Then type (L)oad at the prompt, to re-load the file after it is saved
Related Posts:
- Where is my .vimrc file?
- How to make vim paste from (and copy to) system’s clipboard?
- How can I quickly delete a line in VIM starting at the cursor position?
- How to copy to clipboard in Vim?
- Vim Can’t Save File (E212)
- Move cursor to end of file in vim
- What is Vim recording and how can it be disabled?
- How to use vim in the terminal?
- How to use vim in the terminal?
- Backspace key not working in Vim/vi
- vim and notepad++
- How do I change tab size in Vim?
- How to go back (ctrl+z) in vi/vim
- What is the difference between MacVim and regular Vim?
- How to do case insensitive search in Vim
- What’s a quick way to comment/uncomment lines in Vim?
- Vim clear last search highlighting
- What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in Vim?
- Changing case in Vim
- :wq! command in vim
- bash: pip: command not found
- bash: pip: command not found
- How to uninstall pip on OSX?
- How do I exit the Vim editor?
- How to uninstall Anaconda completely from macOS
- ImportError: No module named pip
- ImportError: No module named pip
- How do I install pip on macOS or OS X?
- How do I install pip on macOS or OS X?
- What is newline character — ‘\n’
- Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)
- Enable OpenMP support in clang in Mac OS X (sierra & Mojave)
- Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)
- How can I run python in terminal on a mac?
- Where to place $PATH variable assertions in zsh?
- Enable OpenMP support in clang in Mac OS X (sierra & Mojave)
- ImportError: No module named pandas. Pandas installed pip
- How to get the list of all installed color schemes in Vim?
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
- No “Proceed Anyway” option on NET::ERR_CERT_INVALID in Chrome on MacOS
- Could not install packages due to a “Environment error :[error 13]: permission denied : ‘usr/local/bin/f2py'”
- Could not install packages due to an EnvironmentError:
- Xcode is not currently available from the Software Update server
- How to view / open a calculator in mac OS X?
- Xcode is not currently available from the Software Update server
- How to uninstall Python 2.7 on a Mac OS X 10.6.4?
- Please enter a commit message to explain why this merge is necessary, especially if it merges an updated upstream into a topic branch
- C++ IDE for Macs
- VirtualBox NS_ERROR_FAILURE (0x80004005) macOS
- Installing Homebrew on OS X
- Updating Python on Mac
- How do I upgrade to Python 3.6 with conda?
- You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory
- import opencv vs import cv2
- Xcode build failure “Undefined symbols for architecture x86_64”
- pip or pip3 to install packages for Python 3?
- How to set NODE_ENV to production/development in OS X
- How to write C++ on Mac?
- How to install JQ on Mac on the command line?
- How to set default vim colorscheme
- You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user)
- socket.error: [Errno 48] Address already in use
- How to change default Python version?
- SocketException: Address already in use MONGODB
- socket.error: [Errno 48] Address already in use
- Why is the apt-get function not working in the terminal on Mac OS X v10.9 (Mavericks)?
- OS X: equivalent of Linux’s wget
- Terminal error: zsh: permission denied: ./startup.sh
- Failed to attach the USB device SEGGER J-Link [0100] to the virtual machine WINDOWS 7
- You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user)
- Where do I find the bashrc file on Mac?
- ImportError: No module named sklearn (Python)
- What’s a good hex editor/viewer for the Mac?
- Where to find Application Loader app in Mac?
- bash: pip: command not found
- OS X: equivalent of Linux’s wget
- How to switch Python versions in Terminal?
- How to change default Python version?
- Kernel driver not installed (rc=-1908) Getting Errors in macOS Big Sur 11.0.1
- ImportError: No module named ‘selenium’
- MacOS Catalina(v 10.15.3): Error: “chromedriver” cannot be opened because the developer cannot be verified. Unable to launch the chrome browser
- Brew install docker does not include docker engine?
- What version of Python is on my Mac?
- ModuleNotFoundError: No module named ‘matplotlib’
- brew install mysql on macOS
- How do you update Xcode on OSX to the latest version?
- What languages are Windows, Mac OS X and Linux written in?
- Mongod complains that there is no /data/db folder
- How can I open the Atom editor from the command line in OS X?
- mysqli_real_connect(): (HY000/2002): No such file or directory
- How to uninstall Docker completely from a Mac?
- mvn command not found in OSX Mavrerick
- What does ^M character mean in Vim?
- How to easily install and uninstall docker on MacOs
- How to install wget in macOS?
- Maven Install on Mac OS X
- Xcode – How to fix ‘NSUnknownKeyException’, reason: … this class is not key value coding-compliant for the key X” error?
- Autocompletion in Vim
- dyld: Library not loaded … Reason: Image not found
- How to install Java 8 on Mac