Skip to main content

nvim tutorial/cheatsheet

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

Popular posts from this blog

sxhkd volume andbrightness config for dwm on void

xbps-install  sxhkd ------------ mkdir .config/sxhkd cd .config/sxhkd nano/vim sxhkdrc -------------------------------- XF86AudioRaiseVolume         amixer -c 1 -- sset Master 2db+ XF86AudioLowerVolume         amixer -c 1 -- sset Master 2db- XF86AudioMute         amixer -c 1 -- sset Master toggle alt + shift + Escape         pkill -USR1 -x sxhkd XF86MonBrightnessUp          xbacklight -inc 20 XF86MonBrightnessDown          xbacklight -dec 20 ------------------------------------------------------------- amixer -c card_no -- sset Interface volume run alsamixer to find card no and interface names xbps-install -S git git clone https://git.suckless.org/dwm xbps-install -S base-devel libX11-devel libXft-devel libXinerama-devel  vim config.mk # FREETYPEINC = ${X11INC}/freetype2 #comment for non-bsd make clean install   cp config.def.h config.h vim config.h xbps-install -S font-symbola #for emoji on statusbar support     void audio config xbps-i

download office 2021 and activate

get office from here  https://tb.rg-adguard.net/public.php open powershell as admin (win+x and a ) type cmd  goto insall dir 1.         cd /d %ProgramFiles(x86)%\Microsoft Office\Office16 2.           cd /d %ProgramFiles%\Microsoft Office\Office16 try 1 or 2 depending on installation  install volume license  for /f %x in ('dir /b ..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%x" activate using kms cscript ospp.vbs /setprt:1688 cscript ospp.vbs /unpkey:6F7TH >nul cscript ospp.vbs /inpkey:FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH cscript ospp.vbs /sethst:s8.uk.to cscript ospp.vbs /act Automatic script (windefender may block it) ------------------------------------------------------------------------------------------------------------------- @echo off title Activate Microsoft Office 2021 (ALL versions) for FREE - MSGuides.com&cls&echo =====================================================================================&

Hidden Wiki

Welcome to The Hidden Wiki New hidden wiki url 2015 http://zqktlwi4fecvo6ri.onion Add it to bookmarks and spread it!!! Editor's picks Bored? Pick a random page from the article index and replace one of these slots with it. The Matrix - Very nice to read. How to Exit the Matrix - Learn how to Protect yourself and your rights, online and off. Verifying PGP signatures - A short and simple how-to guide. In Praise Of Hawala - Anonymous informal value transfer system. Volunteer Here are five different things that you can help us out with. Plunder other hidden service lists for links and place them here! File the SnapBBSIndex links wherever they go. Set external links to HTTPS where available, good certificate, and same content. Care to start recording onionland's history? Check out Onionland's Museum Perform Dead Services Duties. Introduction Points Ahmia.fi - Clearnet search engine for Tor Hidden Services (allows you