Last active
November 2, 2021 10:20
-
-
Save abitrolly/417168b9c359bec4bed15cf57f9aa5e1 to your computer and use it in GitHub Desktop.
Notes from Vim masterclass by @vitaly-zdanevich @ Minsk Hackerspace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Modes -- | |
i # | |
v # visual selection mode | |
Ctrl+v # visual block selection | |
ESC | |
Ctrl+o # in insert mode - run one command in normal mode | |
-- Open / Navigate -- | |
:vsplit ~/path/to/file | |
Ctrl+ww # switch windows | |
:read scp://host/path | |
:read README.md # insert external file into place | |
:r README.md | |
$ vim scp://host/path | |
$ vim -b file.bin | |
-- Work with multiple files: Buffers -- | |
:ls # opened buffers (including files) | |
:e path/to/file # open file in buffers | |
:e path/to/dir # open file browser | |
:bd # close buffer | |
-- Editing -- | |
u # undo | |
Ctrl+r # redo | |
-- Helpers -- | |
:set spell | |
set number | |
set relativenumber | |
set nonumber | |
plugins: | |
vim-gitgutter | |
:GitGutterPreviewHunk | |
:GitGutterUndoHunk | |
vim-fugitive | |
:Gblame | |
vim-airline | |
-- Vim Registers -- | |
:reg | |
8yy # copy (yank) 8 lines | |
p # paste after current line | |
-- Working with external programs -- | |
!git commit -p | |
:set wrap | |
:!python3 -m json.tool -h # run command | |
:%!python3 -m json.tool # filter current contents with external command | |
:w !wl-copy # send current file contents to wayland clipboard | |
:!go fmt % # run command with path of current file | |
vjjj:!echo # select three lines visually, run echo with content in stdin and replace selection with stdout | |
-- Working with code -- | |
shift* # jump forward to current word | |
shift# # jump backward to current word | |
@: # repeat last command | |
. # repeat last command too | |
Ctrl+x+Ctrl+o # omni-complete | |
Ctrl+x+Crtl+f # complete filename | |
Shift+F5 # jump to pair | |
ci( # change everything in () | |
di' # remove everything in '' | |
dis # remove sentence | |
vis # select inner sentence | |
/something # search | |
/something\c # search case-insensitive | |
"test object" | |
"buffer" | |
"window" | |
"tab" | |
"location" (lnext) | |
??? (cnext) | |
8zf # | |
[I # where word is mentioned | |
[i # ??? | |
Ctrl+a # increment int under cursor | |
Ctrl+x # decrement int | |
%s/blablabla/gc | |
shift*v:s//replacement/g # replace selected word in selected block | |
:Ctrl+r+Ctrl+w # insert word under cursor | |
q: # list previous command, edit and run it | |
Shift+j | |
-- Things for future -- | |
[ ] ??? how to visual select a block and then remove all such blocks? | |
Unix as IDE | |
+ ag | |
+ fd | |
[ ] onscreen keyboard for tutorials | |
[ ] follow the leader joint vim session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setting up LSP for Terraform.