Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 1.11 KB

File metadata and controls

54 lines (38 loc) · 1.11 KB

.vimrc

E

Enable backup, undo, swap

  • keep a original state of a file after you open it
  • enable ability to undo even if you close a file
  • concentrate swap files
mkdir -p ~/.vim/{backup,swap,undo}

and place into .vimrc the following

" Enable Backup Files
set backup
set backupdir=~/.vim/backup//
set backupext=.bak

" Enable Swap Files (for crash recovery)
set swapfile
set directory=~/.vim/swap//

" Enable Undo Files (Persistent Undo)
set undofile
set undodir=~/.vim/undo//

R

Replace text and preserve case

Say you want to replace all occurrences of the word abc with xyz but abc also appears as ABC or Abc and you want to preserve the current case (e.g. turn ABC to XYZ and Abc to Xyz). All you need is the vim-abolish plugin.

Usage

:%S/abc/xyz/g

Caution

Note the capital S

Installation

mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/abolish.git
vim -u NONE -c "helptags abolish/doc" -c q