neovim
Neovim⚑
Install⚑
To install the latest stable release, do:
curl -sSL "https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz" | \
tar -C "${HOME}/.local" -xz --strip-components=1 -f -
Usage⚑
Shortcuts⚑
- Open the previous buffer:
<C-^>(or<C-6>in some keyboards).
Edit remote files with SSH⚑
Just run:
nvim scp://user@host//tmp/file
Notice the extra /. You can also specify just a directory to browse it interactively.
Plugins⚑
vim-surround⚑
Shortcuts⚑
ysiw": Surround the word under the cursor with double quotes.csiw"': Change the quotes surrounding the word under the cursor from double quotes to single quotes.ds': Delete the single quotes surrounding the word under the cursor.ysi)": Surround the text inside parentheses with double quotes.cs)]: Change the parentheses surrounding the text inside parentheses to square brackets.
vim-fugitive⚑
tpope/vim-fugitive: fugitive.vim: A Git wrapper so awesome, it should be illegal
Cherry pick lines⚑
- Open the git summary with :Git (or :G).
- Expand the file which contains the lines you want to stage with
>(or=to toggle). This will only show the changed chunks plus some extra lines of context above and below the changed lines. Vto start visual mode and select the lines you want to stage withhjkl.sto stage the visual selection (or-to toggle)- Repeat 2-4 as needed
ccto commit
Mappings⚑
Search for visual selection⚑
vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
// to search for the next occurrence of the selected text. Marks⚑
A mark allows you to record your current position so you can return to it later.
Usage:
:marks: show existing marks.ma: set markain current position of current file, accessible only from the current file.mA: set markAin current position of current file, accessible from anywhere.'a: Go to marka.]': jump to next line with a lowercase mark.
sed⚑
Replace with newline⚑
When replacing some match with a newline, if you try to put \n you will see that a null character is inserted. You should use \r (carriage return) instead of \n.
Without RegEx⚑
Use :sno instead of :s to disable magic.