nvim
:Tutor
modal editor = various modes
normal,visual
normal=nav,comands
lesson 1
h=left j=down k=up l=right
u=undo K=documendation :q=close :q!=quit without saving
x=delete character under cursor
i=insert a text before cursor
A=append text after line (end) / insert after cursor
:wq= write and exit
lesson 2
dw=delete word (after cursor to space)
d$=delete to the end of line
d=delete operator with
motions w=to start of next word , e=to end of current word, $=end of line,0=start of line
pressing just motions moves cursor as specified
typing number before motion repeats it that many times
2w=move 2 word forward 3e=end of third word 0=start of word
d2w=delete 2 word
dd=delete and copy whole line
2dd= delete 2 line
u=undo last command
U=fix whole line to its original state/undo changes on line
<C-r>=redo
lesson 3
p=put previously deleted text after cursor /line below cursor (paste)
P=put text before the cursor /line above cursor
r=replace text in cursor
ce=change until end of word , delete word and put in insert mode
cw=replace from cursor
lesson 4
<C-g> show location in file and file status
G=move to bottom of file = last line
number G = move to that line number
gg=move to start of file = 1G
/ = search n= search for same phrase again N=search in opposite directioin
?=search in backwawrd direction
<C-o>=go back where you came from
<C-i> = go forward
%= find matching braces ),],or }
:s/old/new = substitute first old with new
:s/old/new/g = substitute command to replace old by new
/g = flag : globally in line
:#,#s/old/new/g = subst between lines #,# inclusive
:%s/old/new/g = whole file
:%s/old/new/gc = whole file with confirmation prompt
:! cmd = executes shell cmd1
:w filename = write to filename
v : something w filename : write selected text to file
:r filename = retrive file
:r !ls
leson 6
o= insert new line below cursor
O= same as o but ablove line
a= insert text after cursor
a,i and A all goes to same insert mode
R = replace more than one text / overwrite text
y= yank (copy) selected text
yy= copy line
p= put/paste
v=visual select
j$=end of next line
yw=yank word
:set ic = set ignorecase
:set hls is = set hlsearch and incsearch
:set noic = disable ignorecase
:set invic = invert value of setting
:set nohlsearch = remove highliting from search
/ignore\c = search with ignore case
<C-w><C-w> = jump from one window to another
:help w
:help c_CTRL-D
:e filename = load file
:saveas path/file
:x = only save if necessary
ZZ or :wq = write and quiot
:bn , :bp = next and previous buffer
<C-d> <Tab> = command line completion in : option
- *Learn Vim Progressively*:
http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/
- *Learning Vim in 2013*:
http://benmccormick.org/learning-vim-in-2014/
- *Vimcasts*:
http://vimcasts.org/
- *Vim Video-Tutorials by Derek Wyatt*:
http://derekwyatt.org/vim/tutorials/
- *Learn Vimscript the Hard Way*:
http://learnvimscriptthehardway.stevelosh.com/
- *7 Habits of Effective Text Editing*:
http://www.moolenaar.net/habits.html
- *vim-galore*:
https://github.com/mhinz/vim-galore
. = repeat last command
Ncommand= repeat command n times
100ni am fine <CR> <ESC> = writes i am fine 100 times
NG= goto line N
*,# = goto next,previous word under cursor
<start position><command><end position>
0y$ = goto start and copy to end of line
y2/foo yank to second occurance of foo
^
= go to first character on the line
g_ → go to the last character on the line
fa → go to next occurrence of the letter a on the line. , (resp. ;) will find the next (resp. previous) occurrence.
t, → go to just before the character ,.
3fa → find the 3rd occurrence of a on this line.
F and T → like f and t but backward.
dt" → remove everything until the "
visual mode
<action>a<object>
and <action>i<object>
action = d
(delete), y
(yank), v(select in visual)
object can be: w a word, W a WORD (extended word), s a sentence, p a paragraph. But also, natural character such as ", ', ), }, ].
rectangular block
0<C-v><C-d>I-- [ESC]
<C-q> if clipboard is not empty
<C-p>, <C-n> completions
:qa = record macros in register a
@@= replay lasst executed macros
qaYp<C-a>q →
qa start recording.
Yp duplicate this line.
<C-a> increment the number.
q stop recording.
<C-a> increment number
visual selection = v,V,<C-v>
J → join all the lines together.
< (resp. >) → indent to the left (resp. to the right).
= → auto indent
:split :vsplit
:help split
:split → create a split (:vsplit create a vertical split)
<C-w><dir> : where dir is any of hjkl or ←↓↑→ to change the split.
<C-w>_ (resp. <C-w>|) : maximise the size of the split (resp. vertical split)
<C-w>+ (resp. <C-w>-) : Grow (resp. shrink) split
Comments
Post a Comment