125 lines
3.5 KiB
Plaintext
125 lines
3.5 KiB
Plaintext
|
[[201015-2153|Vim Kendrit Review]]
|
||
|
= Goals =
|
||
|
- check out all the vim plugins i have saved
|
||
|
- tagbar
|
||
|
- fzf / ctrlP / vim-clap / ag
|
||
|
- linting
|
||
|
- iron.vim
|
||
|
- intermediate vim
|
||
|
- buffers/tabs/sessions
|
||
|
- folds
|
||
|
- make / build integration
|
||
|
- indentation with `=`
|
||
|
- how to exit paste mode
|
||
|
- how to utilize macros better
|
||
|
- compile a vim cheat sheet
|
||
|
- learn advanced vim tricks
|
||
|
- complete vimtutor to the end
|
||
|
- learn some vimscript
|
||
|
- contribute to taskwiki
|
||
|
|
||
|
== .vimrc Configuration ==
|
||
|
- `set path+=**` When using `:find` like commands, search all subdirectories recursively
|
||
|
- `set wildmenu` Display all matching files when tab-completing
|
||
|
|
||
|
== Commands ==
|
||
|
Folding:
|
||
|
- `zf` create fold
|
||
|
- `zo` open fold
|
||
|
- `zc` close fold
|
||
|
- `za` toggle fold
|
||
|
- `zd` delete fold
|
||
|
- `zO` open all folds
|
||
|
- `zM` close all folds
|
||
|
Alternatively use the `range` command like so:
|
||
|
- `:20,101 fold`
|
||
|
|
||
|
Folding method is defined through the `foldmethod` option
|
||
|
`foldmethod` can be one of:
|
||
|
- manual - the above commands will all require a motion if set to this
|
||
|
- indent - fold based on indent
|
||
|
- syntax
|
||
|
- marker - set a marker with `{{{ }}}`
|
||
|
- expr
|
||
|
|
||
|
Viewport:
|
||
|
- `H` top
|
||
|
- `M` middle
|
||
|
- `L` bottom
|
||
|
- `zz` center viewport on cursor
|
||
|
|
||
|
Scroll:
|
||
|
- `ctrl+e` down one line
|
||
|
- `ctrl+y` up one line
|
||
|
- `ctrl+d` half page down
|
||
|
- `ctrl+u` half page up
|
||
|
- `ctrl+f` foward one page
|
||
|
- `ctrl+b` back one page
|
||
|
|
||
|
Find:
|
||
|
- `f{character}` find char
|
||
|
- `t{character}` to char
|
||
|
- `F{character}` back find char
|
||
|
- `T{character}` back to char
|
||
|
, / ; for navigating matches
|
||
|
|
||
|
Change:
|
||
|
- `c{motion}` change {motion}
|
||
|
e.g. cw is change word
|
||
|
like d{motion} followed by i
|
||
|
|
||
|
Marks:
|
||
|
- ``m` exact position to mark
|
||
|
- `'m` go to mark
|
||
|
- `:marks` list marks
|
||
|
|
||
|
Spelling:
|
||
|
- `:set spell` activate spelling
|
||
|
- `]s` Jump to next mistake
|
||
|
- `[s` Jump to previous mistake
|
||
|
- `z=` Spelling suggestions
|
||
|
- `:ab` abbreviation
|
||
|
- `zg` Adds word to regular dictionary
|
||
|
- `zG` Adds word to the current session dictionary
|
||
|
|
||
|
Modifiers: You can use modifiers to change the meaning of a noun. Some modifiers are i, which means “inner” or “inside”, and a, which means “around”.
|
||
|
|
||
|
- `ci(` change the contents inside the current pair of parentheses
|
||
|
- `ci[` change the contents inside the current pair of square brackets
|
||
|
- `da'` delete a single-quoted string, including the surrounding single quotes
|
||
|
|
||
|
Substitue: `:s` or `:%s/<find-regex>/<replace-regex>`
|
||
|
|
||
|
Macro pause: if you started recording macro with `qa` and need to pause, stop the recording with `q` and then resume with `qA`
|
||
|
|
||
|
Misc:
|
||
|
- `~` flips the case of a character
|
||
|
- `)` Takes you to the start of the next sentence
|
||
|
- `(` Takes you to the start of the previous sentence
|
||
|
- `}` Takes you to the start of the next paragraph or block of text
|
||
|
- `{` Takes you to the start of the previous paragraph or block of text
|
||
|
- `[[` Jump to function start
|
||
|
- `[{` Jump to block start
|
||
|
- `Ctrl+A`, `Ctrl+X` Increment, or decrement the first number found after the cursor.
|
||
|
- `:undolist` Show the undo *tree*
|
||
|
- `:set nopaste` disable pastemode
|
||
|
|
||
|
== external ==
|
||
|
`bindkey -v` to set vim commands in terminal (zsh only)
|
||
|
`export EDITOR=vim`
|
||
|
`echo "set editing-mode vi" > ~/.inputrc` for GNU Readline basic vim emulation
|
||
|
|
||
|
== tutorials ==
|
||
|
- https://danielmiessler.com/study/vim/
|
||
|
- https://catswhocode.com/vim-commands/
|
||
|
- https://www.freecodecamp.org/news/learn-linux-vim-basic-features-19134461ab85/#9b6b
|
||
|
- https://www.keycdn.com/blog/vim-commands
|
||
|
- https://catswhocode.com/vim-commands/
|
||
|
- https://stevelosh.com/blog/2010/09/coming-home-to-vim/
|
||
|
|
||
|
== talks ==
|
||
|
- https://www.youtube.com/watch?v=XA2WjJbmmoM
|
||
|
|
||
|
== books ==
|
||
|
https://www.vimfromscratch.com/book
|