Major refactor to the modularity between shells

This commit:

- Moves aliases to .aliases.sh. Aliases can now be used with
  both zsh and fish.
- Adds the ability to automatically create an upstream remote
  with the hub function.
- Finalizes the fish prompt to be consistent with zsh.
This commit is contained in:
Donovan Glover 2018-02-26 19:28:58 -05:00
parent 8f5ac166e5
commit ce70ea53e9
No known key found for this signature in database
GPG Key ID: 8FC5F7D90A5D8F4D
5 changed files with 35 additions and 114 deletions

View File

@ -1,22 +1,5 @@
################################################################################## # New Start: A modern Arch workflow built with an emphasis on functionality.
# # Copyright (C) 2017-2018 Donovan Glover
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017 Donovan Glover
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
##################################################################################
#################################################################### ####################################################################
# Sudo and other system aliases # Sudo and other system aliases
@ -42,7 +25,6 @@ alias ls="exa"
alias l="exa -1" # Show each output from ls on a separate line 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 lsa="exa -a" # Show hidden files (also known as dotfiles)
alias type="type -a" # Easily see what the command you want to run points to
#################################################################### ####################################################################
# Volume aliases # Volume aliases

View File

@ -1,25 +1,14 @@
#set -U fish_greeting "" # New Start: A modern Arch workflow built with an emphasis on functionality.
#set -U fish_history "" # Copyright (C) 2017-2018 Donovan Glover
#set -U fish_user_paths
#set -x BROWSER "waterfox"
fish_vi_key_bindings set -U fish_greeting ""
set -U fish_history ""
set -U fish_user_paths
set -x BROWSER "waterfox"
alias c="clear" fish_default_key_bindings
alias cf="tput reset"
alias pls="sudo"
alias rm="rm -i"
alias mkdir="mkdir -p"
alias exa="exa --group-directories-first" source ~/.aliases.sh
alias ls="exa"
alias l="ls -l"
alias lsa="ls -a"
alias tree="exa --long --tree"
alias t="tree -L 1"
alias todo="rg TODO"
alias pwd="pwd | sed -e 's!$HOME!~!g'"
# Start X at login # Start X at login
if status --is-login if status --is-login

View File

@ -1,37 +1,17 @@
set __fish_git_prompt_showdirtystate 'yes' # New Start: A modern Arch workflow built with an emphasis on functionality.
set __fish_git_prompt_showstashstate 'yes' # Copyright (C) 2017-2018 Donovan Glover
set __fish_git_prompt_showupstream 'yes'
set __fish_git_prompt_color_branch magenta
set __fish_git_prompt_char_dirtystate '! '
set __fish_git_prompt_char_stagedstate '→ '
set __fish_git_prompt_char_stashstate '↩ '
set __fish_git_prompt_char_upstream_ahead '↑ '
set __fish_git_prompt_char_upstream_behind '↓ '
function fish_prompt function fish_prompt
set -l color_cwd
set -l suffix
set host (prompt_hostname)
set pwd (basename $PWD) set pwd (basename $PWD)
if [ $pwd = $USER ] if [ $pwd = $USER ]
set pwd "~" set pwd "~"
end end
switch "$USER"
case root toor
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
case '*'
set color_cwd $fish_color_cwd
set suffix ""
end
set git (__fish_git_prompt) set_color magenta; echo -n "$pwd"
# $USER@$host set_color white; echo -n " "
echo -n "$pwd$git ➤➤➤ " set_color red; echo -n "➤"
# printf '%s@%s %s%s%s%s> ' (whoami) (hostname) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (__fish_git_prompt) set_color green; echo -n "➤"
set_color blue; echo -n "➤"
set_color white; echo -n " "
end end

View File

@ -1,22 +1,5 @@
################################################################################## # New Start: A modern Arch workflow built with an emphasis on functionality.
# # Copyright (C) 2017-2018 Donovan Glover
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017 Donovan Glover
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
##################################################################################
#################################################################### ####################################################################
# Screen resolution functions (also changes DPI, but not for the # Screen resolution functions (also changes DPI, but not for the
@ -36,8 +19,8 @@ function 4k() {
local display=$(xrandr | grep -Eo ".{0,20} connected" | awk '{print $1}') local display=$(xrandr | grep -Eo ".{0,20} connected" | awk '{print $1}')
# Get the default mode name for 4k # Get the default mode name for 4k
local mode=$(cvt 3840 2160 | grep "Modeline" | awk '{print $2}') local mode=$(cvt 3840 2160 | grep "Modeline" | awk '{print $2}')
# If the 4k mode hasn't been added yet # If the 4k mode hasn't been added yet
if [[ !(xrandr | grep -q 3840x2160) ]]; then if [[ !(xrandr | grep -q 3840x2160) ]]; then
@ -47,7 +30,7 @@ function 4k() {
# Add the new mode to the display with xrandr # Add the new mode to the display with xrandr
xrandr --addmode ${display} ${mode} xrandr --addmode ${display} ${mode}
fi fi
xrandr --output ${display} --mode ${mode} # Change the resolution to 4k 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 sed -i '/Xft.dpi/c\Xft.dpi: 180' ~/.Xresources # Change the dpi line to 180
@ -58,10 +41,14 @@ function 4k() {
# Git functions # Git functions
#################################################################### ####################################################################
# Easily clone and cd into GitHub repositories # Easily clone and cd into GitHub repositories
# Usage: hub username/repository [upstream]
function hub() { function hub() {
git clone ssh://git@github.com/$1.git git clone ssh://git@github.com/$1.git
cd $(basename "$1") cd $(basename "$1")
if [[ $2 ]]; then
git remote add upstream ssh://git@github.com/$2/$(basename "$1").git
fi
} }
# Do the same for GitLab # Do the same for GitLab

View File

@ -1,22 +1,5 @@
################################################################################## # New Start: A modern Arch workflow built with an emphasis on functionality.
# # Copyright (C) 2017-2018 Donovan Glover
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017 Donovan Glover
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
##################################################################################
export VISUAL="nvim" export VISUAL="nvim"
export EDITOR="nvim" export EDITOR="nvim"
@ -35,7 +18,7 @@ export PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH" # Add ruby gems to $PATH
# Add custom software to $PATH # Add custom software to $PATH
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/Home/new-start/bin:$PATH" export PATH="$HOME/bin:$PATH"
export FZF_DEFAULT_OPTS='--height 40% --reverse --border --color=16' export FZF_DEFAULT_OPTS='--height 40% --reverse --border --color=16'
@ -60,14 +43,14 @@ zstyle ':completion:*:default' menu 'select=0'
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31" zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31"
# Source our aliases first, then our functions (some functions rely on aliases) # Source our aliases first, then our functions (some functions rely on aliases)
source ~/.zsh/aliases.zsh source ~/.aliases.sh
source ~/.zsh/functions.zsh source ~/.zsh_functions.zsh
# Source our dircolors # Source our dircolors
eval "$(dircolors ~/.dircolors)" eval "$(dircolors ~/.dircolors)"
# Use our dircolors for the autocompletion feature of zsh so everything looks consistent # Use our dircolors for the autocompletion feature of zsh so everything looks consistent
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# Add syntax highlighting to zsh # Add syntax highlighting to zsh
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh