joplin-notes/joplin notion extension/Web Development/Neovim/Basics2.md
2026-11-04 00:33:23 +05:30

2.7 KiB

Basics2

  • To delete a word type dw

  • deleting from left to right(end of line) type d$

  • Many commands that change text are made from an operator and a motion.
    The format for a delete command with the d delete operator is as follows:

    d motion

    Where:
    d - is the delete operator.
    motion - is what the operator will operate on (listed below).

    A short list of motions:

    w - until the start of the next word, EXCLUDING its first character.
    e - to the end of the current word, INCLUDING the last character.
    $ - to the end of the line, INCLUDING the last character.
    
  • Number itself can be used to move cursor
    2w can be used to move cursor 2 words forward and at start of the 2nd word next to it
    2e like 2w but instead of first character it moves to last character of the word
    0 works like home button ie to move to beginning of line
    Eg:
    Before using 2w cursor is on
    ==L==orem ipsum try it After using it Lorem ipsum ==t==ry it   Before using 2e cursor is on
    ==L==orem ipsum try it After using it Lorem ipsum tr==y== it

  • Now using operator number motion syntax d2w : will delete 2 words ie current word and next word with syntax number operator motion dd: will delete the whole current line 2dd : will delete 2 lines ie current and next one

  • Undo command Loprem ipsum try it Some changes like Loorem ipsum try it u : to undo previous change Loprem ipsum try it Some more changes like Looooorem ipsi bipsy try it So many changes r there U : to undo all changes for current line and bring back to its original state Loprem ipsum try it Redo : <C-r> Ctrl+R  

  • Put command For example if u delete a line using dd than that line will be stored in neovim register then we can put the line below the cursor using p Before using dd for a a. 1st line b. 2nd line After using it b. 2nd line then on moving cursor to line b and using p b. 2nd line a. 1st line Note: p is used to put down/next to but P is used to put it up/before to it

  • Replace command r will used for replacing a character Eg : Lor==a==m Now pressing r then e => Lor==e==m

  • Change Like using insert or i but with a variation ie before going to insert word it will delete the corrent word. , type ce Its a combination de and i c is like d actually with diffrence that it will put into insert mode after deletion so c2w is d2w+i.