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
- ImportError: No module named pip
- ImportError: No module named pip
- 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)
- How can I run python in terminal on a mac?
- Enable OpenMP support in clang in Mac OS X (sierra & Mojave)
- How to get the list of all installed color schemes in Vim?
- Xcode is not currently available from the Software Update server
- How to view / open a calculator in mac OS X?
- How to uninstall Python 2.7 on a Mac OS X 10.6.4?
- VirtualBox NS_ERROR_FAILURE (0x80004005) macOS
- You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory
- pip or pip3 to install packages for Python 3?
- You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user)
- Failed to attach the USB device SEGGER J-Link [0100] to the virtual machine WINDOWS 7
- 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?
- 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?
- What version of Python is on my Mac?
- brew install mysql on macOS
- Mongod complains that there is no /data/db folder
- How to install wget in macOS?
- Maven Install on Mac OS X
- dyld: Library not loaded … Reason: Image not found
- How to install Java 8 on Mac
- editing PATH variable on mac
- What are the difference between macOS and iOS?
- C++ on mac : linker command failed with exit code 1 (use -v to see invocation)
- keep getting “? Something is already running on port 3000” when I do npm start on react app
- Upgrade Node.js to the latest version on Mac OS
- Change default title in mac terminal window
- How do I update the password for Git?
- How to set or change the default Java (JDK) version on macOS?
- mysqli_real_connect(): (HY000/2002): No such file or directory
- How would I get a cron job to run every 30 minutes?
- Why does using from __future__ import print_function breaks Python2-style print?
- Shared folder between MacOSX and Windows on Virtual Box
- VirtualBox: mount.vboxsf: mounting failed with the error: No such device
- Installing GCC on macOS Catalina
- gdb fails with “Unable to find Mach task port for process-id” error
- How to set JAVA_HOME environment variable on Mac OS X 10.9?
- Copy all the lines to clipboard
- How do I edit $PATH (.bash_profile) on OS X?
- OS X cp command in Terminal – No such file or directory
- tar: Unrecognized archive format error when trying to unpack flower_photos.tgz, TF tutorials on OSX
- Unknown ending signal when using debugger gdb
- Can’t connect to MySQL server on ‘127.0.0.1’ (61) on Mac
- boto3 python 2.7 ImportError: No module named boto3 USER_BASE USER_SITE site packages doesn’t exist
- vi/vim editor, copy a block (not usual action)
- Python: source code string cannot contain null bytes
- Reset MySQL root password using ALTER USER statement after install on Mac
- Mac install and open mysql using terminal
- Updating php version on mac
- How to install pip for Python 3 on Mac OS X?
- Installing ADB on macOS [duplicate]
- What is `S_ISREG()`, and what does it do?
- Reading syslog output on a Mac
- Convert .cer to .p12
- What is the best/safest way to reinstall Homebrew?
- Pipe to/from the clipboard in a Bash script
- How can I install the Beautiful Soup module on the Mac?
- SQL Client for Mac OS X that works with MS SQL Server
- How do you stop MySQL on a Mac OS install?
- Vim: No write since last change, even though I changed the file
- How can I display the current branch and folder path in terminal?
- How to navigate to to different directories in the terminal (mac)?
- Where to find extensions installed folder for Google Chrome on Mac?
- Pip install on Mac OS gets error: command ‘/usr/bin/clang’ failed with exit code 1
- How do I install pip on macOS or OS X?
- How to restart a node.js server
- Alert”Developer tools access needs to take control of another process for debugging to continue.Type your password to allow this.”
- Mongod: Command Not Found (OS X)
- Unable to access MySQL after it automatically generated a temporary password
- No module named ipykernel_launcher