Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e2caa321de | |||
| b4a4d90ac8 |
@@ -1,23 +0,0 @@
|
|||||||
# dotfiles
|
|
||||||
|
|
||||||
Designed around [GNU stow][gnu stow manual].
|
|
||||||
For `zsh` or `bash` (or both). Include `shell/` always.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone <repo> ~/.dotfiles
|
|
||||||
cd ~/.dotfiles
|
|
||||||
stow shell zsh # or: stow shell bash
|
|
||||||
```
|
|
||||||
|
|
||||||
## Update
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd ~/.dotfiles
|
|
||||||
git pull
|
|
||||||
stow -R shell zsh # restow this host's packages
|
|
||||||
```
|
|
||||||
|
|
||||||
[gnu stow manual]: https://www.gnu.org/software/stow/manual/stow.html
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Bash login shell. Everything a non-login shell gets lives in ~/.bashrc, so
|
|
||||||
# source it, then add login-only bits.
|
|
||||||
[ -r ~/.bashrc ] && . ~/.bashrc
|
|
||||||
|
|
||||||
# pyenv shims dir (login only); PYENV_ROOT comes from ~/.config/shell/exports.
|
|
||||||
command -v pyenv >/dev/null 2>&1 && eval "$(pyenv init --path)"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Loaded by every interactive bash, and by login bash via ~/.bash_profile.
|
|
||||||
# Source env first (idempotent — covers non-login interactive shells that bash
|
|
||||||
# would otherwise start without it), then the real interactive config.
|
|
||||||
[ -r ~/.profile ] && . ~/.profile
|
|
||||||
[ -r ~/.config/bash/rc ] && . ~/.config/bash/rc
|
|
||||||
@@ -1,17 +1,13 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Mostly copied from: https://github.com/mathiasbynens/dotfiles/
|
# Mostly copied from: https://github.com/mathiasbynens/dotfiles/
|
||||||
|
|
||||||
# Shared interactive config (aliases, functions, pyenv shims):
|
|
||||||
[ -r ~/.config/shell/interactive ] && source ~/.config/shell/interactive
|
|
||||||
|
|
||||||
# Bash-specific:
|
# Bash-specific:
|
||||||
[ -f ~/.config/bash/prompt ] && source ~/.config/bash/prompt
|
[ -f ~/.config/bash/prompt ] && source ~/.config/bash/prompt
|
||||||
|
|
||||||
# Case-insensitive globbing (used in pathname expansion)
|
# Case-insensitive globbing (used in pathname expansion)
|
||||||
shopt -s nocaseglob;
|
shopt -s nocaseglob;
|
||||||
|
|
||||||
# Append to the Bash history file, rather than overwriting it.
|
# Append to the Bash history file, rather than overwriting it
|
||||||
# (HISTFILE/HISTSIZE/HISTFILESIZE/HISTCONTROL come from ~/.config/shell/exports.)
|
|
||||||
shopt -s histappend;
|
shopt -s histappend;
|
||||||
|
|
||||||
# Autocorrect typos in path names when using `cd`
|
# Autocorrect typos in path names when using `cd`
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
# Readline config (bash line editing + any readline program: python, psql...).
|
|
||||||
# Set via $INPUTRC; see shell/exports. zsh ignores this (uses ZLE); its
|
|
||||||
# equivalent prefix-search bindings live in zsh/.zshrc.
|
|
||||||
#
|
|
||||||
# Pull in distro defaults; a custom INPUTRC otherwise replaces them entirely.
|
|
||||||
$include /etc/inputrc
|
|
||||||
|
|
||||||
# zsh-style prefix history search: type a prefix, Up/Down walk matching
|
|
||||||
# history entries. Empty prefix = previous/next.
|
|
||||||
#
|
|
||||||
# Bind arrows straight to the search functions. Do NOT wrap in a macro that
|
|
||||||
# appends end-of-line (\C-e) to mimic zsh's cursor-at-end: \C-e moves point to
|
|
||||||
# the line end, and history-search-* takes its prefix from start-of-line to
|
|
||||||
# point -- so the next press searches for the whole recalled line, finds
|
|
||||||
# nothing, and Up/Down go dead. Pure readline has no history-search-end widget;
|
|
||||||
# cursor lands at the prefix boundary, which is readline's intended behavior.
|
|
||||||
"\e[A": history-search-backward
|
|
||||||
"\e[B": history-search-forward
|
|
||||||
"\eOA": history-search-backward
|
|
||||||
"\eOB": history-search-forward
|
|
||||||
@@ -7,14 +7,8 @@ export XDG_CACHE_HOME="$HOME/.cache"
|
|||||||
# Default editor
|
# Default editor
|
||||||
export EDITOR='vim'
|
export EDITOR='vim'
|
||||||
|
|
||||||
# Shell history (env vars both shells read; each ignores the other's by name —
|
# Shell history file
|
||||||
# zsh uses SAVEHIST, bash uses HISTFILESIZE/HISTCONTROL. zsh dedup is a setopt,
|
|
||||||
# not an env var, so it stays in .zshrc).
|
|
||||||
export HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/shell/history"
|
export HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/shell/history"
|
||||||
export HISTSIZE=1000000 # commands kept in memory (both shells)
|
|
||||||
export SAVEHIST=1000000 # zsh: lines written to $HISTFILE
|
|
||||||
export HISTFILESIZE=1000000 # bash: lines written to $HISTFILE
|
|
||||||
export HISTCONTROL=ignoreboth # bash: drop dups + space-prefixed
|
|
||||||
|
|
||||||
# Global git config file
|
# Global git config file
|
||||||
export GIT_CONFIG_GLOBAL="${XDG_CONFIG_HOME:-$HOME/.config}/git/config"
|
export GIT_CONFIG_GLOBAL="${XDG_CONFIG_HOME:-$HOME/.config}/git/config"
|
||||||
@@ -30,17 +24,8 @@ export PYTHONSTARTUP="${XDG_CONFIG_HOME:-$HOME/.config}/python/startup"
|
|||||||
# Custom Python history file
|
# Custom Python history file
|
||||||
export PYTHON_HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/python/history"
|
export PYTHON_HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/python/history"
|
||||||
|
|
||||||
# Pyenv root:
|
|
||||||
[ -x "$(command -v pyenv)" ] && export PYENV_ROOT="$HOME/.pyenv"
|
|
||||||
|
|
||||||
# PostgreSQL config file
|
# PostgreSQL config file
|
||||||
[ -x "$(command -v psql)" ] && export PSQLRC="${XDG_CONFIG_HOME:-$HOME/.config}/psql/rc"
|
export PSQLRC="${XDG_CONFIG_HOME:-$HOME/.config}/psql/rc"
|
||||||
|
|
||||||
# Wget config file
|
# Wget config file
|
||||||
export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/rc"
|
export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/rc"
|
||||||
|
|
||||||
# Readline config file (bash line editing + any readline program)
|
|
||||||
export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/readline/inputrc"
|
|
||||||
|
|
||||||
# NOTE: ZDOTDIR lives in ~/.zshenv, not here. It must be set before zsh reads
|
|
||||||
# any rc file, and this file is sourced too late for that.
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Shared interactive shell config. Sourced by both zsh ($ZDOTDIR/.zshrc) and
|
|
||||||
# bash (~/.config/bash/rc). Only ever loaded by zsh/bash, so brace expansion is
|
|
||||||
# fine here (unlike the POSIX `profile`).
|
|
||||||
for _file in "${XDG_CONFIG_HOME:-$HOME/.config}"/shell/{aliases,functions,extra}; do
|
|
||||||
[ -r "$_file" ] && . "$_file"
|
|
||||||
done
|
|
||||||
unset _file
|
|
||||||
|
|
||||||
# Ensure the history dir exists; neither shell mkdir's it, so without this
|
|
||||||
# $HISTFILE writes fail silently on a fresh host.
|
|
||||||
[ -n "$HISTFILE" ] && mkdir -p "$(dirname "$HISTFILE")"
|
|
||||||
|
|
||||||
# pyenv interactive shims (pyenv init - autodetects the running shell):
|
|
||||||
command -v pyenv >/dev/null 2>&1 && eval "$(pyenv init -)"
|
|
||||||
@@ -1,8 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Prepend ~/.local/bin to $PATH (POSIX, idempotent — safe to source twice).
|
# Adds `~/.local/bin` to $PATH
|
||||||
case ":$PATH:" in
|
export PATH="$PATH:${$(find ~/.local/bin -type d -printf %p:)%%:}"
|
||||||
*":$HOME/.local/bin:"*) ;;
|
|
||||||
*) [ -d "$HOME/.local/bin" ] && PATH="$HOME/.local/bin:$PATH" ;;
|
|
||||||
esac
|
|
||||||
export PATH
|
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# POSIX login environment. Sourced directly by a /bin/sh login (display
|
# Load the shell dotfiles, and then some:
|
||||||
# managers, plain sh) and indirectly by bash via ~/.bashrc. Env only — no
|
# * ~/.path can be used to extend `$PATH`.
|
||||||
# brace expansion (dash doesn't expand it), no shell-specific rc.
|
# * ~/.extra can be used for other settings you don’t want to commit.
|
||||||
#
|
for file in ~/.config/shell/{path,exports,aliases,functions,extra}; do
|
||||||
# Interactive config (aliases, functions, prompt) is loaded by each shell's
|
[ -r "$file" ] && [ -f "$file" ] && source "$file";
|
||||||
# own rc via ~/.config/shell/interactive, not here.
|
done;
|
||||||
for _name in path exports; do
|
unset file;
|
||||||
_file="${XDG_CONFIG_HOME:-$HOME/.config}/shell/$_name"
|
|
||||||
[ -r "$_file" ] && . "$_file"
|
source ~/.config/bash/rc
|
||||||
done
|
|
||||||
unset _name _file
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# zsh login shell only. PATH-level init that belongs to login (pyenv shims dir).
|
|
||||||
# PYENV_ROOT is exported earlier in ~/.config/shell/exports.
|
|
||||||
command -v pyenv >/dev/null 2>&1 && eval "$(pyenv init --path)"
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
# Luke's config for the Zoomer Shell
|
|
||||||
# Source (mainly): https://github.com/LukeSmithxyz/voidrice/
|
|
||||||
|
|
||||||
# Shared interactive config (aliases, functions, pyenv shims):
|
|
||||||
[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/shell/interactive" ] && \
|
|
||||||
. "${XDG_CONFIG_HOME:-$HOME/.config}/shell/interactive"
|
|
||||||
|
|
||||||
# Enable colors and change prompt:
|
|
||||||
autoload -U colors && colors # Load colors
|
|
||||||
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
|
|
||||||
setopt autocd # Automatically cd into typed directory.
|
|
||||||
stty stop undef # Disable ctrl-s to freeze terminal.
|
|
||||||
setopt interactive_comments
|
|
||||||
|
|
||||||
# HISTFILE/HISTSIZE/SAVEHIST come from ~/.config/shell/exports (shared).
|
|
||||||
# Dedup is a setopt, not an env var (bash's HISTCONTROL=ignoreboth equivalent):
|
|
||||||
setopt hist_ignore_all_dups hist_ignore_space
|
|
||||||
|
|
||||||
# Basic auto/tab complete:
|
|
||||||
autoload -U compinit
|
|
||||||
zstyle ':completion:*' menu select
|
|
||||||
zmodload zsh/complist
|
|
||||||
compinit
|
|
||||||
_comp_options+=(globdots) # Include hidden files.
|
|
||||||
|
|
||||||
# vi mode
|
|
||||||
bindkey -v
|
|
||||||
export KEYTIMEOUT=1
|
|
||||||
|
|
||||||
# Use vim keys in tab complete menu:
|
|
||||||
bindkey -M menuselect 'h' vi-backward-char
|
|
||||||
bindkey -M menuselect 'k' vi-up-line-or-history
|
|
||||||
bindkey -M menuselect 'l' vi-forward-char
|
|
||||||
bindkey -M menuselect 'j' vi-down-line-or-history
|
|
||||||
bindkey -v '^?' backward-delete-char
|
|
||||||
|
|
||||||
# Change cursor shape for different vi modes.
|
|
||||||
function zle-keymap-select () {
|
|
||||||
case $KEYMAP in
|
|
||||||
vicmd) echo -ne '\e[1 q';; # block
|
|
||||||
viins|main) echo -ne '\e[5 q';; # beam
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
zle -N zle-keymap-select
|
|
||||||
zle-line-init() {
|
|
||||||
zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
|
|
||||||
echo -ne "\e[5 q"
|
|
||||||
}
|
|
||||||
zle -N zle-line-init
|
|
||||||
echo -ne '\e[5 q' # Use beam shape cursor on startup.
|
|
||||||
preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
|
|
||||||
|
|
||||||
bindkey -s '^a' 'bc -lq\n'
|
|
||||||
|
|
||||||
bindkey -s '^f' 'cd "$(dirname "$(fzf)")"\n'
|
|
||||||
|
|
||||||
bindkey '^[[P' delete-char
|
|
||||||
|
|
||||||
# Edit line in vim with ctrl-e:
|
|
||||||
autoload edit-command-line; zle -N edit-command-line
|
|
||||||
bindkey '^e' edit-command-line
|
|
||||||
|
|
||||||
|
|
||||||
# Custom
|
|
||||||
# Activate history search based upon what has already been entered at the prompt,
|
|
||||||
# and always put cursor at the end of the line:
|
|
||||||
autoload -U history-search-end
|
|
||||||
zle -N history-beginning-search-backward-end history-search-end
|
|
||||||
zle -N history-beginning-search-forward-end history-search-end
|
|
||||||
bindkey "^[[A" history-beginning-search-backward-end
|
|
||||||
bindkey "^[[B" history-beginning-search-forward-end
|
|
||||||
|
|
||||||
|
|
||||||
# Load syntax highlighting; should be last.
|
|
||||||
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null
|
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Read first by zsh for EVERY shell (login or not), so this is the only place
|
|
||||||
# ZDOTDIR can be set early enough to redirect where zsh looks for its rc files.
|
|
||||||
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
|
||||||
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
|
|
||||||
|
|
||||||
# Shared POSIX environment (idempotent):
|
|
||||||
for _name in path exports; do
|
|
||||||
_file="$XDG_CONFIG_HOME/shell/$_name"
|
|
||||||
[ -r "$_file" ] && . "$_file"
|
|
||||||
done
|
|
||||||
unset _name _file
|
|
||||||
Reference in New Issue
Block a user