Dotfiles Pt. I - o/dotfiles-part-I
- Context aware prompt - display context of current directory (e.g. git status, executable versions, virtual environments, etc.)
Install by adding the following line to
~/.zshrc
-zplugin light romkatv/powerlevel10k
- Syntax highlighting - highlight your commands as you type them
Install by adding the following lines to
~/.zshrc
:zplugin ice wait lucid atinit"ZPLGM[COMPINIT_OPTS]=-C; zpcompinit; zpcdreplay" zplugin light zdharma/fast-syntax-highlighting
- History autocompletions - suggest previous commands from history as you type
Install by adding the following lines to
~/.zshrc
:zplugin ice wait lucid atload'_zsh_autosuggest_start' zplugin light zsh-users/zsh-autosuggestions
This plugin benefits from configuring a few shortcuts:
# Ctrl-e accepts until end of line (same as right arrow) bindkey '^e' autosuggest-accept # Ctrl-Space accepts until end of line and immediately execute bindkey '^ ' autosuggest-execute # Ctrl-w accepts next word bindkey '^w' forward-word # count only alphanumeric characters as part of a word WORDCHARS=
- History substring search - trigger reverse search based on currently typed substring
- Sync zsh & system clipboard - allow zle actions (vi mode) to copy to/paste from the system clipboard
I have my own copy without the backward-delete-char
because it didn't play well with my keymapping and I didn't find it necessary but YMMV.
Use (n)vi(m)
in your shell! Add the following line to ~/.zshrc
:
bindkey -v
My keymap adds additional surround/inner motions and a few opinionated keybindings.
The keybindings section (same link as section header here) specifies the possible options to configure along with their default keybindings out of the box. Here's some additional tips. To view all possible options the README suggests man fzf
.
Here's my config.
Previews allow you to run arbitrary shell commands on each item in the list and display the output.
Here is a simple example:
# {} is replaced to the single-quoted string of the focused line
fzf --preview 'cat {}'
Displaying the preview is synchronous so ideally preview commands should not be too expensive.
See this article for more advanced usage. I've incorporated the given commands into my own config with the functions here and the widget binding here.
I'll quickly demo some usage and can potentially discuss in more depth if people are interested.
Install fzf.vim
extension via instructions in the README.
fasd
- quickly access files and folders based on frequency and recency of accesstldr
- a cliff-notes man pagetmux
- a terminal multiplexer to replace endless terminal tabstrash
- replacement forrm
that moves files to the trash so you can recover them
Install all of these tools in a single command - brew install fasd tldr tmux trash
π¨ fasd
Quickly access files and folders from anywhere on your machine based on frequency and recency of access ("frecency").
v def conf => vim /some/awkward/path/to/type/default.conf
j abc => cd /hell/of/a/awkward/path/to/get/to/abcdef
m movie => mplayer /whatever/whatever/whatever/awesome_movie.mp4
o eng paper => xdg-open /you/dont/remember/where/english_paper.pdf
vim `f rc lo` => vim /etc/rc.local
vim `f rc conf` => vim /etc/rc.conf
See the repo for more details including setup instructions! Note: the README doesn't mention using Homebrew but it's there - brew install fasd
π tldr
A cliff notes man
page. Provides quick high-level documentation of a tool with some examples.
Run on tar
:
π trash
A replacement for rm
. Files deleted with trash
are moved to the system Trash folder so you can easily recover them if you accidentally delete something. Bonus, it works on files and directories (no need to ever type -r
again).
π€Ή tmux
Ripped shamelessly from the tmux
README:
tmux is a terminal multiplexer.
It enables a number of terminals to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached.
See any of these guides for a great primer on why you might want to use it and how to get started!
πβ shellcheck
An awesome static analysis tool for shell scripts to help you avoid shooting yourself in the foot! Brian has taken the initiative to add this to the code repo and is progressively applying it to all bash scripts there.
See the shellcheck
FAQ for more details.