Skip to content

Instantly share code, notes, and snippets.

@BruceZu
Last active January 18, 2017 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BruceZu/5d342909328b1cfde63b075ed16c54d8 to your computer and use it in GitHub Desktop.
Save BruceZu/5d342909328b1cfde63b075ed16c54d8 to your computer and use it in GitHub Desktop.
hotkey-vim
hotkey shorcut vim
@BruceZu
Copy link
Author

BruceZu commented Dec 9, 2016

//change the background color
:highlight Normal ctermfg=black ctermbg=white
// delete from the current cursor position to the end of the current line
D
// or
d$
// delete from the current cursor position to the beginning of the next word character
dw

// show line number
:set number

// move current line to end of file
:m $

//go to line 4
:4

//to to end of this line
$

// delete all
:1,$d

//find each 'sonarqube-1' and replace it with 'gitlab' in all lines
:%s/sonarqube-1/gitlab /g

// need confirm: c
:%s/sonarqube-1/gitlab /gc

// only from current line: no %
:s/sonarqube-1/gitlab /g

//case insensitive: i
:s/sonarqube-1/gitlab /gi

//case sensitive: I
:s/sonarqube-1/gitlab /gI

//go to end line's head
G

//go to fist line's head
gg

// undo
u

//redo
ctrl + R

//go end of file and add
GA

//go end of line and add
Ctrl+O then Shift+I

// find a word
/image
// next
n

//delete to end of file
:.,$d

//delete current character
x
//delete current word
dw
//delete current line
dd
//delete five lines
5dd
//delete to end of line
d$
//delete to beginning of line
d0
//delete to beginning of file
:1,.d
// jump to end of current word
w
// moves you to the last letter of the word
e
// move line, block to
// move current line to after line 12
:m 12
// move current line to before first line
:m 0
// move current line to after last line
:m $
// move current line to after line with mark a (see using marks)
:m 'a
// move current line to before line with mark a
:m 'a-1
// move current line to the end of the current paragraph
:m '}-1
// For clarity, a space is shown after the :m commands above, but that space is not required.

// move lines 5, 6 and 7 to after line 21
:5,7m 21

// move 5 lines starting at current line to after line 21
:.,.+4m 21
// same (. for current line is assumed)
:,+4m14

copy paste
// yy
// P
// p
// 3, 5 co 8
http://alvinalexander.com/linux/vi-vim-copy-paste-command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment