Skip to content

Instantly share code, notes, and snippets.

View alienlebarge's full-sized avatar
💾
:wq

Cédric Aellen alienlebarge

💾
:wq
View GitHub Profile

List of all registers

  • The unnamed register ""
  • Ten numbered registers "0 to "9
  • The small delete register "-
  • Twenty-six named registers "a to "z or "A to "Z
  • Four read-only registers ":, "., "% and "#
  • The expression register "=
  • The selection and drop registers " * , "+ and "~
  • The black hole register "_
@font-face {
font-family: "Open Sans";
src: url("/pathTo/myFont.woff2") format("woff2"),
url("/pathTo/myFont.woff") format("woff");
font-display: swap;
}
:[range] s[ubstitute]/pattern/string/[flags] [count]

Everything enclosed between [] in this command is optional.

range

Range can be:

  • 28 - line 28

How to define a range

line 28

:28s/bad/good/g

first line

@alienlebarge
alienlebarge / vim: substitution of all occurences in a file.vim
Last active October 3, 2018 20:19
Replace `old` with `new` in the entire file
:%s/old/new/g
@alienlebarge
alienlebarge / vim: substitution of all occurences between two lines.vim
Last active October 3, 2018 20:20
`#,#` are the two lines where the substitution has to be done
:#,#s/ancien/nouveau/g
@alienlebarge
alienlebarge / vim: substitution of all occurences on a line.vim
Last active October 3, 2018 20:20
Replace `old` with `new` on the current line
:s/old/new/g
@alienlebarge
alienlebarge / vim: substitution first occurence.vim
Last active October 3, 2018 20:20
Remplacer ancien par nouveau.
:s/ancien/nouveau
# View abbreviated SHA, description, and history graph of the latest 20 commits
git log --pretty=oneline -n 20 --graph --abbrev-commit
#
git log --pretty=oneline --graph --abbrev-commit
#
git log --graph --abbrev-commit --decorate --date=relative --all