zhuang@linux:~/reading/practical-vim/07-open-files-and-save-to-disk/$ less
Open Files and Save Them to Disk
This post extracts some knowledge from Chapter 7 – Open Files and Save Them to Disk.
| Ex Command | Shorthand | Effect |
|---|---|---|
:edit . | :e. | Open file explorer for current working directory |
:Explore | :E | Open file explorer for the directory of the active buffer |
Think of each window as a playing card. One side of the card shows the contents of a file, and the other side shows the file explorer. After summoning the file explorer view, if we decide that we want to switch back to the buffer we were already editing, we can do so using the <C-^> command.
vim
:w !sudo tee % > /dev/nullWe can set keymap at vimrc config file with :W:
vim
command! W execute 'silent w !sudo tee % > /dev/null' | edit!
zhuang@linux:~/reading/practical-vim/07-open-files-and-save-to-disk/$ comments