Terminal Config
Table of contents
dot-files
The config I use is split among several repos.
The main config resides in the dot-files repo.
It references the scripts repo which in
turn references the python-tools, golang-tools
and rust-tools repos.
bash script & source-me collection
This repo contains the following in the root of the repository:
- general scripts that will be referenced directly (not on the PATH): An example would be the
i3cat-audio-device-helper.sh
for my i3 config. - scripts for use in PATH in the
bin/
folder - files in the
source-me/
folder that are meant to be used withsource <file>
: completion config, functions rather than executables, aliases and global variables - kubernetes plugins (etc) in
kubernetes/
bin
Scripts used as wrappers (e.g. git wrapper) or additional executables.
The bin/
folder contains additional folders for
executables that might not want to be used on every system.
It distinguishes between Mac OS and Linux.
golang-tools
Tools where I care about speed are not written in bash or python. I instead tried go, zig and rust. For most of them I stuck to go. I never considered c++ as I am not a fan and abstained from c as it is harder to port between systems than aforementioned languages.
Use in tmux
Pane-border now displays the current git branch and whether it is in sync with the upstream branch (based on the last git fetch
).
Statusbar-right is used to display the current kubernetes cluster and openstack project.
python-tools
As I am intimately familiar with python it is my go to programming language. If the tasks cannot be accomplished in a scripting language easily and I do not care about speed or I need it now, I will write it in python.
extend kubectl bash completions
Kubectl does not provide functionality to add completions for
krew plugings or hand-rolled plugins (kubectl-x_y_z
executable files).
This is my remedy.
miscellaneous
Here is a list of several things I needed or wanted to have:
- display ics calender files in plaintext
- convert latex editor Gummi snippets to Gedit snippets
- read toml setting
- urldecode/-encode
- regex substitution
rust-tools
So far I only wrote a bash helper. It displays the current PATH and active .venv.
It then colors and shortens them so they are still readable if there are several tmux panes.
After trying go and zig I decided to see if rust would be even faster for the task.
I am sticking to it for now.
I override the PROMPT_COMMAND here.
Thus, anytime you hit Enter the PROMPT_COMMAND will use the _ps1 function to set the PS1
variable.
This variable is used by bash to display information on every prompt e.g. the current path.
vimscript
Please refer to projects in vimscript.
My vim config: repo
git
Git functionality extensions
I decided to stick to plain git config for most functionality instead of writing separate bash helpers.
The ones I use most often are git find-commits-changed-file
, git resubmit
, git get-upstream
: link to aliases
git resubmit
git add
the files you specified as parameters to the staging area- run
git commit --amend --no-edit
- run
git push --force-with-lease
, if you require--force
usegit resubmit-force
Note that git redo
is also available, it does the same thing but stops short of pushing to the repo.
git get-upstream
- Runs
git update
, which moves tomaster
andgit pull
s it. Should this fail it runs agit fetch origin/master
only. - It moves back to the previous branch
- It runs
git rebase master
TL;DR: Rebases current branch onto origin/master
Rarely used but gems if you need them
git list-all-files-ever-tracked
andgit reflog-list-all-files-ever-tracked
: sometimes you are looking for an old file and you half-remember its path...git content-grep
andgit log-grep
: look for part of a file across the history of the entire repo. Or for a certain commit message...
Fast access to various repos
For faster access to the numerous git repos I use for my config I set up bash functions to operate on them from any path.
These jump to these repos/files directly: general, linux only
All of these use custom completion rules
(if you hit tab bash will provide a list of files
in the actual repo, not the current directory).
This is an example
of how these completions are set up.
Examples are:
edit-script
log-script
commit-script
reset-script
diff-script
status-script
edit-go
log-go
commit-go
reset-go
diff-go
status-go