mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-01-23 22:28:36 +01:00
Drop zsh support in favor of fish
Really, there is no reason to use zsh when fish exists, at least not for my use case. Maintaining one set of shell config files is easier than two, so I'm removing the zsh files. Some other changes in this commit include: - The addition of the current user and hostname to the fish prompt - The addition of some zsh functions I re-implemented in fish - The removal of the dircolors file (not needed with exa anyway) - The removal of some aliases I never used -
This commit is contained in:
parent
a24326f12c
commit
cb4278514d
@ -5,9 +5,6 @@
|
||||
# Sudo and other system aliases
|
||||
####################################################################
|
||||
|
||||
alias sudo="sudo " # Make aliases work with sudo (NOTE: Does not work with fish)
|
||||
alias pls="sudo" # A nicer way to ask for root permissions
|
||||
|
||||
alias rm="rm -i" # Always confirm before deleting things (use -f to override)
|
||||
alias mkdir="mkdir -p" # Automatically make parent directories that don't exist yet
|
||||
|
||||
@ -24,7 +21,6 @@ alias exa="exa --group-directories-first"
|
||||
alias ls="exa"
|
||||
|
||||
alias l="exa -1" # Show each output from ls on a separate line
|
||||
alias lsa="exa -a" # Show hidden files (also known as dotfiles)
|
||||
|
||||
alias where="type" # An alternative for shells that don't use the where command
|
||||
|
||||
@ -35,7 +31,6 @@ alias where="type" # An alternative for shells that don't use the where comma
|
||||
# Usage: vol 10%+ (Increase the volume by 10%), vol 10%- (Decrease by 10%)
|
||||
# vol 100% (Set the volume to 100%)
|
||||
alias vol="amixer set 'Master' "
|
||||
alias volume="vol"
|
||||
|
||||
####################################################################
|
||||
# Miscellaneous aliases
|
@ -2,24 +2,22 @@
|
||||
# Copyright (C) 2017-2018 Donovan Glover
|
||||
|
||||
set -U fish_greeting ""
|
||||
set -U fish_history ""
|
||||
set -U fish_user_paths
|
||||
|
||||
export VISUAL="nvim"
|
||||
export EDITOR="nvim"
|
||||
export BROWSER="firefox"
|
||||
|
||||
# Use rg instead of ag / ack / grep for fzf (much faster)
|
||||
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"'
|
||||
export GPG_TTY=(tty)
|
||||
|
||||
set x (ruby -e 'print Gem.user_dir')
|
||||
|
||||
export PATH="$x/bin:$PATH" # Add ruby gems to $PATH
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
export FZF_DEFAULT_OPTS='--height 40% --reverse --border --color=16'
|
||||
|
||||
# Required to make gpg-agent work in cases like git commit
|
||||
export GPG_TTY=(tty)
|
||||
|
||||
# Always use the default keybindings in fish
|
||||
fish_default_key_bindings
|
||||
|
||||
# Source our aliases
|
||||
source ~/.aliases.sh
|
||||
|
||||
# Start X at login
|
@ -3,12 +3,15 @@
|
||||
|
||||
function fish_prompt
|
||||
set pwd (basename $PWD)
|
||||
set hostname (hostname)
|
||||
|
||||
if [ $pwd = $USER ]
|
||||
set pwd "~"
|
||||
end
|
||||
|
||||
set_color magenta; echo -n "$pwd"
|
||||
set_color yellow; echo -n "$USER@$hostname"
|
||||
set_color normal; echo -n " "
|
||||
set_color magenta; echo -n "($pwd)"
|
||||
set_color normal; echo -n " "
|
||||
set_color red; echo -n "➤"
|
||||
set_color green; echo -n "➤"
|
8
dots/common/.config/fish/functions/gh.fish
Normal file
8
dots/common/.config/fish/functions/gh.fish
Normal file
@ -0,0 +1,8 @@
|
||||
# Easily cd into the "home" directory of any repository you're
|
||||
# working in. Note that this is a function instead of an alias
|
||||
# since `external calls` in aliases are not supported by zsh.
|
||||
# The current aliases file works with fish and other shells like
|
||||
# zsh.
|
||||
function gh
|
||||
cd (git rev-parse --show-toplevel)
|
||||
end
|
18
dots/common/.config/fish/functions/hub.fish
Normal file
18
dots/common/.config/fish/functions/hub.fish
Normal file
@ -0,0 +1,18 @@
|
||||
# Easily clone and cd into GitHub repositories
|
||||
# Usage: hub username/repository [upstream]
|
||||
function hub --argument-names "path" "upstream"
|
||||
if test -n "$path"
|
||||
git clone ssh://git@github.com/$path.git
|
||||
cd (basename "$path")
|
||||
|
||||
if test -n "$upstream"
|
||||
git remote add upstream \
|
||||
ssh://git@github.com/$upstream/(basename "$path").git
|
||||
else
|
||||
echo "Note: No upstream was specified."
|
||||
end
|
||||
else
|
||||
echo "No repository was specified."
|
||||
echo "Usage: hub username/repository [upstream]"
|
||||
end
|
||||
end
|
@ -1,5 +0,0 @@
|
||||
# New Start: A modern Arch workflow built with an emphasis on functionality.
|
||||
# Copyright (C) 2017 Donovan Glover
|
||||
|
||||
# Don't show background colors for mounted files
|
||||
OTHER_WRITABLE 0
|
@ -1,7 +0,0 @@
|
||||
# New Start: A modern Arch workflow built with an emphasis on functionality.
|
||||
# Copyright (C) 2017-2018 Donovan Glover
|
||||
|
||||
# Automatically start X server on login (tty1)
|
||||
if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then
|
||||
exec startx
|
||||
fi
|
@ -1,83 +0,0 @@
|
||||
# New Start: A modern Arch workflow built with an emphasis on functionality.
|
||||
# Copyright (C) 2017-2018 Donovan Glover
|
||||
|
||||
####################################################################
|
||||
# Screen resolution functions (also changes DPI, but not for the
|
||||
# programs and other software that you already have open)
|
||||
####################################################################
|
||||
|
||||
# Easily change the resolution to 1080p
|
||||
function 1080p() {
|
||||
xrandr --output VGA-1 --mode "1920x1080" # Change the resolution
|
||||
sed -i '/Xft.dpi/c\Xft.dpi: 96' ~/.Xresources # Change the dpi line to 96
|
||||
xrdb ~/.Xresources # Reload .Xresources
|
||||
}
|
||||
|
||||
# Easily change the resolution to 4k
|
||||
function 4k() {
|
||||
# Get the display type (VGA-1, etc.)
|
||||
local display=$(xrandr | grep -Eo ".{0,20} connected" | awk '{print $1}')
|
||||
|
||||
# Get the default mode name for 4k
|
||||
local mode=$(cvt 3840 2160 | grep "Modeline" | awk '{print $2}')
|
||||
|
||||
# If the 4k mode hasn't been added yet
|
||||
if [[ !(xrandr | grep -q 3840x2160) ]]; then
|
||||
|
||||
# Create the new mode with cvt settings
|
||||
xrandr --newmode $(cvt 3840 2160 | grep -o '"3840x2160.*')
|
||||
|
||||
# Add the new mode to the display with xrandr
|
||||
xrandr --addmode ${display} ${mode}
|
||||
|
||||
fi
|
||||
|
||||
xrandr --output ${display} --mode ${mode} # Change the resolution to 4k
|
||||
sed -i '/Xft.dpi/c\Xft.dpi: 180' ~/.Xresources # Change the dpi line to 180
|
||||
xrdb ~/.Xresources # Reload .Xresources
|
||||
}
|
||||
|
||||
####################################################################
|
||||
# Git functions
|
||||
####################################################################
|
||||
|
||||
# Easily clone and cd into GitHub repositories
|
||||
# Usage: hub username/repository [upstream]
|
||||
function hub() {
|
||||
git clone ssh://git@github.com/$1.git
|
||||
cd $(basename "$1")
|
||||
if [[ $2 ]]; then
|
||||
git remote add upstream ssh://git@github.com/$2/$(basename "$1").git
|
||||
fi
|
||||
}
|
||||
|
||||
# Do the same for GitLab
|
||||
function lab() {
|
||||
git clone git@gitlab.com:$1.git
|
||||
cd $(basename "$1")
|
||||
}
|
||||
|
||||
# Easily cd into the "home" directory of any repository you're working in
|
||||
# This needs to be a function instead of an alias since it relies on `external calls`
|
||||
function gh() {
|
||||
cd `git rev-parse --show-toplevel`
|
||||
}
|
||||
|
||||
####################################################################
|
||||
# Utility functions
|
||||
####################################################################
|
||||
|
||||
# Take a screenshot after a certain amount of time
|
||||
function ss() {
|
||||
(sleep $1 && shotgun) &
|
||||
}
|
||||
|
||||
# Automatically open the readme in any repository
|
||||
function readme() {
|
||||
local readme=`ls | rg README`
|
||||
if [[ $readme ]]; then
|
||||
nvim $readme
|
||||
else
|
||||
echo "No README found."
|
||||
fi
|
||||
}
|
56
fish/.zshrc
56
fish/.zshrc
@ -1,56 +0,0 @@
|
||||
# New Start: A modern Arch workflow built with an emphasis on functionality.
|
||||
# Copyright (C) 2017-2018 Donovan Glover
|
||||
|
||||
export VISUAL="nvim"
|
||||
export EDITOR="nvim"
|
||||
export BROWSER="firefox"
|
||||
|
||||
# Use rg instead of ag / ack / grep for fzf (much faster)
|
||||
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"'
|
||||
|
||||
# Required to make gpg-agent work in cases like git commit
|
||||
export GPG_TTY=$(tty)
|
||||
|
||||
# Autosuggest commands in the terminal
|
||||
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
|
||||
export PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH" # Add ruby gems to $PATH
|
||||
|
||||
# Add custom software to $PATH
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
export PATH="$HOME/bin:$PATH"
|
||||
|
||||
export FZF_DEFAULT_OPTS='--height 40% --reverse --border --color=16'
|
||||
|
||||
autoload -Uz compinit && compinit
|
||||
autoload -Uz promptinit && promptinit
|
||||
autoload -Uz vcs_info
|
||||
|
||||
# Add my own custom prompt, simple and minimal
|
||||
prompt off
|
||||
PROMPT="%F{magenta}%1~%f %B%F{red}➤%F{green}➤%F{blue}➤%f%b "
|
||||
|
||||
# Ignore cached commands (finds new ones without restarting the terminal)
|
||||
zstyle ':completion:*' rehash true
|
||||
|
||||
# Never prompt for a huge list, page it
|
||||
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
|
||||
|
||||
# Make the list a menu that you can go through
|
||||
zstyle ':completion:*:default' menu 'select=0'
|
||||
|
||||
# Color code tab completion
|
||||
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31"
|
||||
|
||||
# Source our aliases first, then our functions (some functions rely on aliases)
|
||||
source ~/.aliases.sh
|
||||
source ~/.zsh_functions.zsh
|
||||
|
||||
# Source our dircolors
|
||||
eval "$(dircolors ~/.dircolors)"
|
||||
|
||||
# Use our dircolors for the autocompletion feature of zsh so everything looks consistent
|
||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||
|
||||
# Add syntax highlighting to zsh
|
||||
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
Loading…
Reference in New Issue
Block a user