Fish config refactor

Move things into sub-files and sub-directories
Add ensure_path function to make sure stuff doesn't get spammed multiple
times into the PATH
This commit is contained in:
Tim McCarthy
2020-03-31 12:42:50 -07:00
parent a8e6dd2c75
commit 3ccf865b99
12 changed files with 51 additions and 49 deletions

View File

@@ -2,68 +2,29 @@
# Basics, etc…
# ============
# Default browser
# Default editor
set -g -x EDITOR "emacsclient"
set -g -x ALTERNATE_EDITOR "vim"
# Add ~/bin to PATH
set -g -x PATH ~/bin $PATH
# Setup PATH
ensure_path ~/bin
ensure_path ~/.emacs.d/bin
# Disable Fish greeting banner
set --universal fish_greeting
# iTerm2 integration
source ~/.config/fish/fish_startup.in
# Configuration for apps
for app in ~/.config/fish/apps/*.fish
source $app
end
# OS-specific configuration
switch (uname)
case Linux
source ~/.config/fish/linux.fish
case Darwin
source ~/.config/fish/osx.fish
case '*'
echo 'Unknown OS. No specifc config'
end
source ~/.config/fish/os/os.fish
# Machine-local config
if test -e ~/.config/fish/local.fish
source ~/.config/fish/local.fish
end
# =======
# Vi Mode
# =======
function hybrid_bindings --description "Vi-style bindings that inherit emacs-style bindings in all modes"
for mode in default insert visual
fish_default_key_bindings -M $mode
end
fish_vi_key_bindings --no-erase
end
# Hybrid Vi Mode
set -g fish_key_bindings hybrid_bindings
# ========
# Autojump
# https://github.com/wting/autojump
# ========
[ -f /usr/local/share/autojump/autojump.fish ]; and . /usr/local/share/autojump/autojump.fish
[ -f /usr/share/autojump/autojump.fish ]; and . /usr/share/autojump/autojump.fish
# =========
# Functions
# =========
function ec
emacsclient -n --alternate-editor=emacs $argv
end
# IP addresses
function ip
curl icanhazip.com
end
# reload your Fish config
function src
source ~/.config/fish/config.fish; and clear
end