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

44 lines
2.1 KiB
Markdown

Basics 4
- Open a line
To insert empty line below cursor and toggle insert mode type `o`
To insert empty line above cursor and toggle insert mode type `O`(capital o)
- Append command
Normally when we insert text, its inserted before the cursor so in the word say `li`. If cursor at `i`. and we press i then type q then we have `lqi` so using
`a` first cursor is moved one character right and then goes to insert mode so if after using `a` we type q, then we have `liq`.
- Replace Mode
Toggled by `R`(capital R). if it is on word say `the` and cursor is at beginning ie `T` then when we type Say then it will become `Say` not SayThe.
NOTE: Replace mode is like Insert mode, but every typed character
replaces an existing character
- Copy and paste
Highlight the text to be copied. We can do this by going to visual mode by pressing `v` and moving cursor to select text. Press Esc to escape visual mode. Press `y` to copy and `p` tp paste.
y here stands for yank
p stands for put
- Set option
To alter some settings in nvim
when searching to ignore case type `:set ic`
To turn off ignore case type `:set noic`
To toggle ignorecase setting `:set invic`
NOTE: If you want to ignore case for just one search command, use `\c`
in the phrase: `/ignore\c`
- Switch between windows
`<C-w><C-w>` means Ctrl+w 2 times
- Creating startup script
Neovim is a very configurable editor. You can customise it any way you like.
To start using more features create an "init.vim" file.
1. Start editing the "init.vim" file.
`:call mkdir(stdpath('config'),'p')`
`:exe 'edit' stdpath('config').'/init.vim'`
2. Write the file with:
`:w`
- Auto Completion
When typing any command to get the listed list of commands begining with whatever typed , press `<C-d>`. Now press `tab` to auto-complete it.
Eg: If we type `:e` then pressing Ctrl+d witll list commands starting from `e` and pressing tab will autocomplete with first result
- Switching between files
When u have opened nvim in folder and that folder contains some files then use the relative path to access them by
`:e main.c` or `:e Makefile`