various important improvements

This commit is contained in:
Peter Kingswell 2021-08-26 17:15:53 -04:00
commit 597092aa83
6 changed files with 274 additions and 37 deletions

View file

@ -1 +0,0 @@
../.tmux.conf

217
.tmux.conf Normal file
View file

@ -0,0 +1,217 @@
##########################
### from internets
##########################
# From https://github.com/eduncan911/dotfiles/blob/master/.tmux.conf
bind-key -n M-0 select-window -t 0
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
# macOS fix for clipboard, vim/nvim, tmux and iterm2 (yikes)
if-shell "uname | grep -q Darwin" "set -g default-shell $SHELL"
if-shell "uname | grep -q Darwin" "set -g default-command \"reattach-to-user-namespace -l ${SHELL}\""
# From https://superuser.com/a/552493/393361
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
# From https://superuser.com/questions/813661/how-to-configure-tmux-iterm-to-display-session-name-as-title-in-terminal-tab
set-option -g set-titles on
# from https://github.com/tmux-plugins/tmux-continuum/issues/30
# set -g set-titles-string '#h ❐ #S ● #I #W'
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
# disable status bar - PSK - it's handy actually to tell if you're in tmux
# or not.
# set -g status off
# nifty way to hide pane and bring it back
bind-key ! break-pane -d -n _hidden_pane
bind-key @ join-pane -s $.1
##########################
### from https://github.com/thoughtbot/dotfiles/blob/master/tmux.conf
##########################
set -g default-terminal 'screen-256color'
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# soften status bar color from harsh green to light gray
set -g status-style bg='#262626',fg='#a1cfd1'
# remove administrative debris (session name, hostname, time) in status bar
#set -g status-left ''
#set -g status-right ''
# increase scrollback lines
set -g history-limit 10000
# Local config
if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'
##########################
# From https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/zsh-navigation-tools
##########################
bind h run-shell -b "~/.oh-my-zsh/plugins/zsh-navigation-tools/znt-tmux.zsh"
##########################
### From https://pragprog.com/titles/bhtmux2/tmux-2/
##########################
# Our .tmux.conf file
# Setting the prefix from C-b to C-a
set -g prefix C-s
# Free the original Ctrl-b prefix keybinding
unbind C-b
#setting the delay between prefix and command
set -s escape-time 1
# Ensure that we can send Ctrl-S to other apps
bind C-s send-prefix
# Set the base index for windows to 1 instead of 0
set -g base-index 1
# Set the base index for panes to 1 instead of 0
setw -g pane-base-index 1
##########################
# From https://www.hamvocke.com/blog/a-guide-to-customizing-your-tmux-conf/
##########################
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# moving between panes with Prefix h,j,k,l
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"
# trying to stop tmux (tmux) being overwritten/corrupted
# commented out cos gives 'no current session'.
# set allow-rename off
# https://tmuxcheatsheet.com/tmux-plugins-tools/?full_name=tmux-plugins%2Ftmux-prefix-highlight
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold' # default is 'fg=default,bg=yellow'
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_sync_mode_attr 'fg=black,bg=green' # default is 'fg=default,bg=yellow'
# Center the window list in the status line
set -g status-justify centre
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
set-option -g mouse on
setw -g automatic-rename on # rename window to reflect current program
# renumber windows when a window is closed
set -g renumber-windows on
######################
### DESIGN CHANGES ###
######################
# loud or quiet?
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
setw -g monitor-activity off
set -g bell-action none
# modes
setw -g clock-mode-colour colour5
setw -g mode-style 'fg=colour1 bg=colour18 bold'
# panes
set -g pane-border-style 'fg=colour19 bg=colour0'
set -g pane-active-border-style 'bg=colour0 fg=colour9'
# ——————— Continuum ———————
# https://github.com/tmux-plugins/tmux-continuum
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'iterm'
# From https://github.com/tmux-plugins/tmux-continuum/issues/30
set -g @continuum-save-interval '1'
set -g @continuum-boot-options 'iterm,fullscreen'
run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
# https://github.com/tmux-plugins/tmux-resurrect
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# From https://github.com/tmux-plugins/tmux-continuum/blob/master/docs/automatic_start.md
set -g @plugin 'tmux-plugins/tmux-sidebar'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-open'
# ——————— Continuum ———————
# statusbar
set -g status-position bottom
set -g status-justify left
# Status line right side - 31-Oct 13:37
set -g status-right "#[fg=cyan]%d %b %R"
set -g status-right-length 50
setw -g window-status-current-style 'fg=colour1 bg=colour19 bold'
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
setw -g window-status-style 'fg=colour9 bg=colour18'
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
# setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'
# Status line left side to show Session:window:pane
set -g status-left-length 40
set -g status-left "#{prefix_highlight} #[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
# Update the status line every sixty seconds
set -g status-interval 5
# messages
# set -g message-style 'fg=colour232 bg=colour16 bold'
##########################
# PLUGINS
# From https://github.com/tmux-plugins/tpm
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
##########################

View file

@ -10,3 +10,34 @@ function ts-variables-show-version() {
alias tsunami-resolve-host="ts-resolve-host"
alias tsunami-variables-show="ts-variables-show"
alias tsunami-variables-show-version="ts-variables-show-version"
# to avoid slow shells, we do it manually
function kubectl() {
if ! type __start_kubectl >/dev/null 2>&1; then
source <(command kubectl completion zsh)
fi
command kubectl "$@"
}
function kube-ctx-show() {
echo "`kube ctx -c` • `kc ns -c`"
}
alias show-kube-ctx="kube-ctx-show"
alias kc-current-ctx="kube-ctx-show"
function kube-list-local-contexts() {
grep '^- name: ' ~/.kube/config | awk '{print $3}'
}
alias kc-list-local-contexts="kube-list-local-contexts"
function kube-list-prod-contexts() {
gcloud container clusters list --project=gke-xpn-1 --filter="resourceLabels[env]=production" --format="value(name)"
}
alias kc-list-prod-contexts="kube-list-prod-contexts"
alias kc="kubectl"
alias mk="minikube"
alias kube-list-contexts="kubectl config get-contexts"

View file

@ -294,14 +294,6 @@ function heroic-repo-configure() {
mkdir logs
}
function kube-list-local-contexts() {
grep '^- name: ' ~/.kube/config | awk '{print $3}'
}
function kube-list-prod-contexts() {
gcloud container clusters list --project=gke-xpn-1 --filter="resourceLabels[env]=production" --format="value(name)"
}
# function h() {
# NUM_LINES = ${1:-1000}
# history | tail -n $NUM_LINES
@ -359,14 +351,6 @@ function dir-sizes() {
du -sh ./* | sort -h
}
# to avoid slow shells, we do it manually
function kubectl() {
if ! type __start_kubectl >/dev/null 2>&1; then
source <(command kubectl completion zsh)
fi
command kubectl "$@"
}
function ssh-ds718() {
ssh -p 658 pskadmin@192.168.2.7
@ -382,12 +366,18 @@ function git-show-branch() {
git branch -vv | grep `git branch --show-current`
}
function git-show-all-stashes() {
echo "Hit 'q' to go to next file"
echo ""
git stash list | awk -F: '{ print "\n\n\n\n"; print $0; print "\n\n"; system("git stash show -p " $1); }'
}
# kill most recent container instance
alias docker-kill-latest='docker ps -l --format='{{.Names}}' | xargs docker kill'
# stop all containers
docker-stop-all () {
docker container stop -t 2 $(docker container ls -q) 2>/dev/null
docker-stop-all-containers () {
docker container stop -t 2 $(docker container ls -q) 2>/dev/null
}
function find-gig-files() {
@ -413,17 +403,12 @@ function start-cloud-storage() {
) &
}
function tree() {
/usr/local/homebrew/bin/tree -a $1 | colorize_less "$@"
}
# function open-all-edge-apps() {
# EDGE_APP_DIR='/Users/peter/Dropbox (Personal)/_Settings/Edge Apps.localized/'
# for APP in ${EDGE_APP_DIR}/*.app; do
# echo "Opening $APP ..."
# nohup open -a "$APP" &
# done
# }
function tree() {
DIR=$1 ;
shift # pops $1 off
/usr/local/homebrew/bin/tree -a $DIR | colorize_less "$@"
}
function _open-all-chrome-apps() {
for APP in "${1}"/*.app; do
@ -439,7 +424,10 @@ function open-all-chrome-apps() {
_open-all-chrome-apps "$CHROME_APP_DIR"
}
alias start-all-edge-apps="open-all-edge-apps"
function post-boot-tasks() {
open-all-chrome-apps
docker-stop-all
}
function kill-cloud-storage() {
# TODO investigate pkill as alternative

View file

@ -25,7 +25,15 @@ alias helios='helios -z http://localhost:5801'
fpath=($ZSH/functions $ZSH/completions $fpath)
# Load all stock functions (from $fpath files) called below.
autoload -U compaudit compinit
# Only check daily from https://carlosbecker.com/posts/speeding-up-zsh/
# autoload -U compinit && compinit -u
# autoload -U compaudit compinit
autoload -Uz compinit
if [ $(date +'%j') != $(stat -f '%Sm' -t '%j' ~/.zcompdump) ]; then
compinit
else
compinit -C
fi
# Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/

1
themes/lambda-mod.zsh-theme Symbolic link
View file

@ -0,0 +1 @@
../custom/themes/lambda-mod-zsh-theme/lambda-mod.zsh-theme

View file

@ -1,7 +0,0 @@
alias kube="kubectl"
alias kc="kubectl"
alias mk="minikube"
alias kube-list-contexts="kubectl config get-contexts"
alias docker-suicide="killall com.docker.hyperkit"
alias docker-die="killall com.docker.hyperkit"
alias mk="minikube"