Vim

This blog contains notes for neovim commands for myself. And also helpful to you if you wanna see how things work in vim.

Create a file and open vim

nvim [filename]

eg.

nvim main.py

To write

Press i that is insert mode and you can start typing. To save changes press esc and then write :w. And to exit from the vim write :q.

Copy and paste from clipboard

In vim you can store copied text in multiple registers ie. all the keyboard characters. And the content you want to copy/paste outside vim should be stored in + operator.

To copy esc then change to visual mode by pressing v and then select the line that you want to copy and then type "+y to copy into + operator.

To paste from outside vim, first move curser where you want to paste, then change to visual mode by hitting esc key and v then type "+p.

Copy line: Move curser to that line and hit yy. and to paste it hit p.

To copy word: change to visual mode, press v, and then move curser to select and then hit y. To paste p.

Delete line: dd

Delete word: change to visual mode v then select a word and press d.

Split the screen

To vertically split the screen write :vsplit.

To move windows hit ctrl+ww.

To open directory/files: :edit . and then select file or change directory and hit enter.

Search

To search a word /[word to search] then to go to next word press n and to go to previous press N.

To go back to deselect the searched word :noh

To select and search, change to visual mode v then select word and then press #.