dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 8a2dc8be841b9fd5e37e957cfd030c8ebc79b611
parent 0473645a76e005adc0540ed489ff088c07575a73
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Sun, 22 Sep 2019 13:43:16 -0400

shell: cleaned up zsh config

Former-commit-id: 17c81c8a7ec27c83ff4c91b8c2d4f1a9b9bcb025
Diffstat:
Mshell/commonprofile | 10----------
Mshell/zshrc | 149++++++++++++++++++++++++-------------------------------------------------------
2 files changed, 45 insertions(+), 114 deletions(-)

diff --git a/shell/commonprofile b/shell/commonprofile @@ -205,16 +205,6 @@ current_wifi_password() { security find-generic-password -ga "$1" | grep password } -# Remove aliases & replace with original files -unlink() { - for i in "$@"; do - local p=$(realpath -w "$i") - rm "$i" - mv "$p" . - unset p - done -} - # }}} # Applescript functions {{{ diff --git a/shell/zshrc b/shell/zshrc @@ -1,111 +1,10 @@ #!/usr/bin/env zsh -# If you come from bash you might have to change your $PATH. -# export PATH=$HOME/bin:/usr/local/bin:$PATH - -# Path to your oh-my-zsh installation. -export ZSH="$HOME"/.oh-my-zsh - -# Set name of the theme to load. Optionally, if you set this to "random" -# it'll load a random theme each time that oh-my-zsh is loaded. -# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes -ZSH_THEME="powerlevel10k/powerlevel10k" - -# Set list of themes to load -# Setting this variable when ZSH_THEME=random -# cause zsh load theme from this variable instead of -# looking in ~/.oh-my-zsh/themes/ -# An empty array have no effect -# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) - -# Uncomment the following line to use case-sensitive completion. -# CASE_SENSITIVE="true" - -# Uncomment the following line to use hyphen-insensitive completion. Case -# sensitive completion must be off. _ and - will be interchangeable. -# HYPHEN_INSENSITIVE="true" - -# Uncomment the following line to disable bi-weekly auto-update checks. -# DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_ZSH_DAYS=13 - -# Uncomment the following line to disable colors in ls. -# DISABLE_LS_COLORS="true" - -# Uncomment the following line to disable auto-setting terminal title. -# DISABLE_AUTO_TITLE="true" - -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" - -# Uncomment the following line to display red dots whilst waiting for completion. -# COMPLETION_WAITING_DOTS="true" - -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -# DISABLE_UNTRACKED_FILES_DIRTY="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# HIST_STAMPS="mm/dd/yyyy" - -# Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder - -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=( - git - gitignore - sudo -) - -source $ZSH/oh-my-zsh.sh - -# User configuration - -# export MANPATH="/usr/local/man:$MANPATH" - -# You may need to manually set your language environment +# ZSH config {{{ export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 -# Preferred editor for local and remote sessions -# if [[ -n $SSH_CONNECTION ]]; then -# export EDITOR='vim' -# else -# export EDITOR='mvim' -# fi - -# Compilation flags -# export ARCHFLAGS="-arch x86_64" - -# ssh -# export SSH_KEY_PATH="~/.ssh/rsa_id" - -# Set personal aliases, overriding those provided by oh-my-zsh libs, -# plugins, and themes. Aliases can be placed here, though oh-my-zsh -# users are encouraged to define aliases within the ZSH_CUSTOM folder. -# For a full list of active aliases, run `alias`. -# -# Example aliases -# alias zshconfig="mate ~/.zshrc" -# alias ohmyzsh="mate ~/.oh-my-zsh" - -#POWERLEVEL9K -POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(user dir virtualenv vcs) -POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history ram time battery) - # Aliases source $HOME/.commonprofile -if [ -f ~/.config/exercism/exercism_completion.zsh ]; then - source ~/.config/exercism/exercism_completion.zsh -fi # Z initialization if ! command -v z &> /dev/null; then @@ -126,10 +25,9 @@ if command -v jenv &> /dev/null; then export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home" fi -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" +# Keybinds insert-arg-of-prev-cmd() { : ${NUMERIC:-1} (( NUMERIC++ )) @@ -147,3 +45,46 @@ bindkey '\e#' pound-insert # readline-style searching bindkey '^]' vi-find-next-char bindkey '^\e]' vi-find-prev-char + +# Use lf to switch directories and bind it to ctrl-o +lfcd () { + if ! command -v lf &>/dev/null; then echo "lf not installed." && return; fi + tmp="$(mktemp)" + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi +} +bindkey -s '^o' 'lfcd\n' +# }}} +# oh-my-zsh {{{ +# Path to your oh-my-zsh installation. +export ZSH="$HOME"/.oh-my-zsh + +# Set name of the theme to load. Optionally, if you set this to "random" +# it'll load a random theme each time that oh-my-zsh is loaded. +# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes +ZSH_THEME="powerlevel10k/powerlevel10k" + +# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=( + git + sudo + zsh-syntax-highlighting +) + +#POWERLEVEL9K +POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(user dir virtualenv vcs) +POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history ram time battery) + +source $ZSH/oh-my-zsh.sh +# }}} +# FZF +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +# vim: foldmethod=marker foldlevel=0