A list of things to remember about my tools.
- Delete all buffers but current one
-
%bd|e#|bd#
- Filter elements in quickfix list
-
(auto completion works)
:packadd cfilter :Cfilter /pattern/
- Keep the ones that do not match the pattern
-
:Cfilter! /pattern/
- Run all commands contained in file
-
vim -s file
- Run asciidoctor after saving the buffer (or any shell command)
-
autocmd BufWritePost <file> silent! !asciidoctor %
- Format current file with prettier
-
%!bun x prettier --stdin-filepath file.<extension>
- Format current file with prettier (if file is on disk)
-
!bun x prettier -w '%'
- Delete the blank, even lines
:g/^/ if line('.') % 2 == 0 | d | endif
-
R
-
g_
-
} jump to the next paragraph
-
Ctrl + h - delete the character before the cursor during insert mode
-
Ctrl + w - delete word before the cursor during insert mode
-
Ctrl + j - add a line break at the cursor position during insert mode
-
Smart usage of the
]<letter>
motion + some plugins (e.g.]q
) -
:w ++p
: creates parent directory if does not exist (:h ++p
) -
use
nvim -d file1 file2 …
to open neovim in diff mode -
gqq (kinda?) undo J
-
:center
center lines between 0 and textwidth -
:h auto-format
-
%s//\=@a/
search the last \*-ed string and replace it with the content of the register a -
https://learnvimscriptthehardway.stevelosh.com/chapters/44.html
-
Delete all buffers except current one: %bd|e#|bd#
-
C-o
: rotate panes -
o
: move to pane -
(
: move to previous session -
)
: move to next session -
L
: move to last session -
tmux attach-session -d
: -d detached all other clients attached to this session. Useful when errors happen and you kill the terminal -
tmux attach-session -x
: same as -d but additionally send SIGHUP to kill the parent process of the other client -
tmux new-session -A
: makes new-session behave like attach-session, if the session name passed with -s already exists -
remain-on-exit
: pane option, better set it when needed -
make 2>&1|tmux splitw -dI &
: pipe makeÔÇÖs command stdout in a new split window in tmux
-
Revert
git add --intent-to-add
: usegit reset --
(was git reset --mixed) -
How to revert part of a commit (link got lost when converting)
-
How to use --update-refs when rebasing
- Grep commit contents
-
git log --pickaxe-regex -p --color-words -S "<grep-content>"
- List only files with conflicts
-
git diff --name-only --diff-filter=U
- Split a commit in mulptiple commits
Best use of Git town is:
-
town append
when creating new branches -
town switch
for visualizing stacked branches and easily switching among them -
town rename-branch
- Use tectonic ensuring the correct biber/biblatex version
tectonic -Z search-path=$(dirname $(kpsewhich biblatex.sty)) report.tex
-
fc
open an editor and edit your last command -
r foo=bar
run the previous command replacing foo with bar -
:t
modifier in folders to show only the last folder in the path -
:u
modifier that transforms to uppercase -
:l
modifier that transforms to lowercase -
:s/find/replace
modifier that replaces ÔÇ£findÔÇØ with ÔÇ£replaceÔÇØ
- How to prompt the user for multiple selections
-
In bash, the select bultin shall be used. For instance:
select FILE in *; do echo $FILE $REPLY; break; done
Will show a numbered list of all the items inside the current working directory and display the
PS3
prompt for choosing one element.Read more in the docs.