Add fish config, environment variables and aliases
This commit is contained in:
parent
809bd34b89
commit
5e7eec2a36
65
.config/aliases
Normal file
65
.config/aliases
Normal file
@ -0,0 +1,65 @@
|
||||
#
|
||||
# Aliases
|
||||
#
|
||||
|
||||
abbr v 'vi'
|
||||
alias vi 'nvim'
|
||||
alias vim 'nvim'
|
||||
abbr open 'xdg-open'
|
||||
|
||||
abbr l "ls -lFh"
|
||||
alias ls 'ls --color=auto'
|
||||
abbr la "ls -lAFh"
|
||||
abbr lt 'ls -ltFh'
|
||||
abbr lS 'ls -1FSsh'
|
||||
abbr ll "ls -l"
|
||||
abbr l1 "ls -1"
|
||||
abbr sl 'ls'
|
||||
alias tree 'tree -C'
|
||||
|
||||
# Configuration files
|
||||
abbr fishrc 'vi ~/.config/fish/config.fish'
|
||||
abbr envconf 'vi ~/.config/environment'
|
||||
abbr bashrc 'vi ~/.bashrc'
|
||||
abbr nviminit 'vi ~/.config/nvim/init.vim'
|
||||
abbr alacrittyconf 'vi ~/.config/alacritty/alacritty.yml'
|
||||
abbr tmuxconf 'vi ~/.tmux.conf'
|
||||
abbr swayconf 'vi ~/.config/sway/config'
|
||||
abbr swayconfhost 'vi ~/.config/sway/(hostname)'
|
||||
abbr aliases 'vi ~/.config/aliases; source ~/.config/aliases'
|
||||
|
||||
# Git
|
||||
abbr gst "git status"
|
||||
abbr gd "git diff"
|
||||
abbr gdh "git diff HEAD"
|
||||
abbr gc "git clone $1 $2"
|
||||
abbr gcl "git clean -fdx"
|
||||
abbr gcm "git commit"
|
||||
abbr ga "git add -u ."
|
||||
abbr gaa "git add -A ."
|
||||
abbr gpo "git push origin $1"
|
||||
abbr glo "git log --oneline"
|
||||
abbr grhh "git reset --hard HEAD"
|
||||
abbr gcp "git cherry-pick $1"
|
||||
|
||||
# Pacman
|
||||
alias pacman 'pacman --color=auto'
|
||||
abbr pm 'pacman'
|
||||
abbr pms 'pacman -Ss'
|
||||
abbr pmsi 'pacman -Sii'
|
||||
abbr pmq 'pacman -Qs'
|
||||
abbr pmqi 'pacman -Qii'
|
||||
abbr pmqo 'pacman -Qo'
|
||||
abbr pmqm 'pacman -Qem' #list foreign (explicit) packages
|
||||
abbr pmi 'sudo pacman -S'
|
||||
abbr pmr 'sudo pacman -Rns'
|
||||
abbr pmu 'sudo pacman -Syu'
|
||||
abbr pmro 'sudo pacman -Rns (pacman -Qtdq) #remove orphans'
|
||||
abbr pmcc 'pacman -Qii | awk '\''/^MODIFIED/ {print $2}'\''' #list changed config files
|
||||
abbr aur 'auracle'
|
||||
|
||||
# Archives
|
||||
abbr tgz 'tar -xvzf' # extract .tar.gz
|
||||
abbr tbz 'tar -xvjf' # extract .tar.bz2
|
||||
|
||||
# EOF
|
52
.config/environment
Normal file
52
.config/environment
Normal file
@ -0,0 +1,52 @@
|
||||
#
|
||||
# Environment variables
|
||||
#
|
||||
|
||||
# General
|
||||
set -x EDITOR "nvim"
|
||||
set -x DIFFPROG "nvim -d"
|
||||
set -x TERMINAL "alacritty"
|
||||
set -x LANG de_DE.UTF-8
|
||||
set -x XKB_DEFAULT_LAYOUT eu,de
|
||||
#set -x SUDO_ASKPASS "$HOME/.bin/sway/dmenupass"
|
||||
set -x PASSWORD_STORE_DIR "$HOME/.passwords"
|
||||
|
||||
# Path: ~/.bin for user scripts
|
||||
[ -L ~/.bin ] && set -gx PATH ~/.bin $PATH
|
||||
for d in ~/.bin/*/; set -gx PATH $d $PATH; end
|
||||
|
||||
# man command with color
|
||||
set -x LESS_TERMCAP_mb (printf "\e[1;31m")
|
||||
set -x LESS_TERMCAP_md (printf "\e[1;31m")
|
||||
set -x LESS_TERMCAP_me (printf "\e[0m")
|
||||
set -x LESS_TERMCAP_se (printf "\e[0m")
|
||||
set -x LESS_TERMCAP_so (printf "\e[1;44;33m")
|
||||
set -x LESS_TERMCAP_ue (printf "\e[0m")
|
||||
set -x LESS_TERMCAP_us (printf "\e[1;32m")
|
||||
set -x PAGER "less"
|
||||
|
||||
# Set XDG Base Directories
|
||||
set -x XDG_CONFIG_HOME "$HOME/.config"
|
||||
set -x XDG_CACHE_HOME "$HOME/.cache"
|
||||
set -x XDG_DATA_HOME "$HOME/.local/share"
|
||||
set -x XDG_DESKTOP_DIR "$HOME/Schreibtisch"
|
||||
set -x XDG_DOWNLOAD_DIR "$HOME/Downloads"
|
||||
set -x XDG_TEMPLATES_DIR "$HOME/Vorlagen"
|
||||
set -x XDG_PUBLICSHARE_DIR "$HOME/Öffentlich"
|
||||
set -x XDG_DOCUMENTS_DIR "$HOME/Dokumente"
|
||||
set -x XDG_MUSIC_DIR "$HOME/Musik"
|
||||
set -x XDG_PICTURES_DIR "$HOME/Bilder"
|
||||
set -x XDG_VIDEOS_DIR "$HOME/Videos"
|
||||
set -x XDG_DATA_DIRS "/usr/local/share:/usr/share"
|
||||
set -x XDG_CONFIG_DIRS "/etc/xdg"
|
||||
|
||||
# GPG and SSH agent
|
||||
set -e SSH_AUTH_SOCK
|
||||
set -U -x SSH_AUTH_SOCK (gpgconf --list-dirs agent-ssh-socket)
|
||||
set -x GPG_TTY (tty)
|
||||
gpgconf --launch gpg-agent
|
||||
|
||||
# Clean home directory
|
||||
set -x ATOM_HOME "$XDG_DATA_HOME/atom"
|
||||
|
||||
# EOF
|
18
.config/fish/config.fish
Normal file
18
.config/fish/config.fish
Normal file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env fish
|
||||
#
|
||||
# fish configuration file
|
||||
|
||||
# load prompt theme (robbyrussell)
|
||||
source "$__fish_config_dir/theme.fish"
|
||||
|
||||
# load aliases and environment variables
|
||||
source "$HOME/.config/environment"
|
||||
source "$XDG_CONFIG_HOME/aliases"
|
||||
|
||||
# settings
|
||||
#fish_vi_key_bindings # enable vi mode
|
||||
|
||||
# If running from tty1 start sway
|
||||
if test (tty) = "/dev/tty1"
|
||||
sway-run
|
||||
end
|
102
.config/fish/prompt.fish
Normal file
102
.config/fish/prompt.fish
Normal file
@ -0,0 +1,102 @@
|
||||
#
|
||||
# Prompt
|
||||
#
|
||||
# name: Robbyrussell
|
||||
# author: Bruno Ferreira Pinto, Pawel Zubrycki, hoellen
|
||||
# source: https://github.com/fish-shell/fish-shell/blob/master/share/tools/web_config/sample_prompts/robbyrussell.fish
|
||||
#
|
||||
# To hide git information set config to repo: `git config fish.hide-status 1`
|
||||
|
||||
function fish_prompt
|
||||
set -l __last_command_exit_status $status
|
||||
|
||||
if not set -q -g __fish_robbyrussell_functions_defined
|
||||
set -g __fish_robbyrussell_functions_defined
|
||||
function _git_branch_name
|
||||
set -l branch (git symbolic-ref --quiet HEAD 2>/dev/null)
|
||||
if set -q branch[1]
|
||||
echo (string replace -r '^refs/heads/' '' $branch)
|
||||
else
|
||||
echo (git rev-parse --short HEAD 2>/dev/null)
|
||||
end
|
||||
end
|
||||
|
||||
function _is_git_dirty
|
||||
echo (git status -s --ignore-submodules=dirty 2>/dev/null)
|
||||
end
|
||||
|
||||
function _is_git_hidden
|
||||
return (git config fish.hide-status >/dev/null 2>&1)
|
||||
end
|
||||
|
||||
function _is_git_repo
|
||||
type -q git
|
||||
or return 1
|
||||
git rev-parse --git-dir >/dev/null 2>&1
|
||||
end
|
||||
|
||||
function _hg_branch_name
|
||||
echo (hg branch 2>/dev/null)
|
||||
end
|
||||
|
||||
function _is_hg_dirty
|
||||
echo (hg status -mard 2>/dev/null)
|
||||
end
|
||||
|
||||
function _is_hg_repo
|
||||
fish_print_hg_root >/dev/null
|
||||
end
|
||||
|
||||
function _repo_branch_name
|
||||
_$argv[1]_branch_name
|
||||
end
|
||||
|
||||
function _is_repo_dirty
|
||||
_is_$argv[1]_dirty
|
||||
end
|
||||
|
||||
function _repo_type
|
||||
if _is_hg_repo
|
||||
echo 'hg'
|
||||
return 0
|
||||
else if _is_git_repo; and not _is_git_hidden;
|
||||
echo 'git'
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
set -l cyan (set_color -o cyan)
|
||||
set -l yellow (set_color -o yellow)
|
||||
set -l red (set_color -o red)
|
||||
set -l green (set_color -o green)
|
||||
set -l blue (set_color -o blue)
|
||||
set -l normal (set_color normal)
|
||||
|
||||
set -l arrow_color "$green"
|
||||
if test $__last_command_exit_status != 0
|
||||
set arrow_color "$red"
|
||||
end
|
||||
|
||||
set -l arrow "$arrow_color➜ "
|
||||
if test "$USER" = 'root'
|
||||
set arrow "$arrow_color# "
|
||||
end
|
||||
|
||||
set -l cwd $cyan(basename (prompt_pwd))
|
||||
|
||||
if set -l repo_type (_repo_type)
|
||||
set -l repo_branch $red(_repo_branch_name $repo_type)
|
||||
set repo_info "$blue $repo_type:($repo_branch$blue)"
|
||||
|
||||
set -l dirty (_is_repo_dirty $repo_type)
|
||||
if test -n "$dirty"
|
||||
set -l dirty "$yellow ✗"
|
||||
set repo_info "$repo_info$dirty"
|
||||
end
|
||||
end
|
||||
|
||||
echo -n -s $arrow ' '$cwd $repo_info $normal ' '
|
||||
end
|
||||
|
39
.config/fish/theme.fish
Normal file
39
.config/fish/theme.fish
Normal file
@ -0,0 +1,39 @@
|
||||
#
|
||||
# Theme
|
||||
#
|
||||
# set fish variables and colors
|
||||
# color documentation: https://fishshell.com/docs/current/#variables-color
|
||||
#
|
||||
|
||||
set -u fish_greeting
|
||||
set -u fish_color_autosuggestion 888
|
||||
set -u fish_color_cancel normal
|
||||
set -u fish_color_command normal
|
||||
set -u fish_color_comment 990000
|
||||
set -u fish_color_cwd cyan
|
||||
set -u fish_color_cwd_root 800000
|
||||
set -u fish_color_end green
|
||||
set -u fish_color_error f00
|
||||
set -u fish_color_escape cyan
|
||||
set -u fish_color_history_current normal
|
||||
set -u fish_color_host normal
|
||||
set -u fish_color_match normal
|
||||
set -u fish_color_normal normal
|
||||
set -u fish_color_operator cyan
|
||||
set -u fish_color_param blue
|
||||
set -u fish_color_quote green
|
||||
set -u fish_color_redirection red
|
||||
set -u fish_color_search_match --background=blue
|
||||
set -u fish_color_selection c0c0c0
|
||||
set -u fish_color_user green
|
||||
set -u fish_color_valid_path ff0000
|
||||
set -u fish_key_bindings fish_default_key_bindings
|
||||
set -u fish_pager_color_completion normal
|
||||
set -u fish_pager_color_description yellow
|
||||
set -u fish_pager_color_prefix blue
|
||||
set -u fish_pager_color_progress brwhite --background=cyan
|
||||
|
||||
# load prompt
|
||||
source $__fish_config_dir/prompt.fish
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user