Terminal/shell tricks
Useful terminal shortcuts
Shortcut | What it does? |
---|---|
C-x C-e | Edits the current line in the $EDITOR program, or vi if undefined. |
C-x C-r | Read in the contents of the inputrc file, and incorporate any bindings or variable assignments found there. |
C-x C-u | Incremental undo, separately remembered for each line. |
C-x C-v | Display version information about the current instance of bash. |
In zsh switch to line vi mode (equivalent to bindkey -v )? Exit with Ctrl-c |
|
C-x C-x | Alternates the cursor with its old position. (C-x, because x has a crossing shape). |
C-x * | Inline shell expansion |
Alacritty specific
Shortcut | What it does? |
---|---|
Ctl-Shift-SPC | Enter vi mode. Press again to leave. |
Ctl-Shift-C | Copy selection |
Ctl-Shift-V | Paste clipboard content |
Regex hints
- Recognizing URLs and executing open command. Put this into
~/.config/alacritty/alacritty.yml
:Now you can presshints: enabled: - regex: "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\ [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+" command: xdg-open post_processing: true mouse: enabled: true mods: None binding: key: U mods: Control|Shift
Ctrl-Shift-U
to get hints overlay (a letter for each recognized URL on the terminal). Press the letter to executexdg-open
over the matched content (URL).
Color schemes with dynamic change
Nice color schemes can be found in eendroroy/alacritty-theme repo.
git clone https://github.com/eendroroy/alacritty-theme.git ~/.alacritty-colorscheme
Link to default location:
ln -s ~/.alacritty-colorscheme/themes ~/.config/alacritty/colors
Color scheme can be applied either statically inside alacritty config:
import:
- ~/.alacritty-colorscheme/themes/{scheme_name}.yaml
or dynamically using alacritty-colorscheme:
pip install --user alacritty-colorscheme
List schemes by:
alacritty-colorscheme list
See current scheme by:
alacritty-colorscheme status
Toggle by:
alacritty-colorscheme -V toggle wombat.yaml papercolor_light.yaml
Make keybinding in ~/.config/alacritty/alacritty.yml
:
key_bindings:
- { key: F12, command: { program: "alacritty-colorscheme", args: ["-V", "toggle", "wombat.yaml", "papercolor_light.yaml"] } }
Spawn a new instance in the same directory
Add to ~/.config/alacritty/alacritty.yml
:
key_bindings:
- { key: Return, mods: Control|Shift, action: SpawnNewInstance }
Tricks with zsh and oh-my-zsh
Go up to the root of Git repo :oh-my-zsh:
Put this in .zshrc
:
plugins+=(git)
This adds alias grc
that cd to the root of the repo. For other aliases see here.