Compare commits
No commits in common. "c91da48135e02d5af1b4310f4f8a9127b169fe99" and "65e386acacdfd26b829d33ab191bf7c24d231836" have entirely different histories.
c91da48135
...
65e386acac
115
.alias
Normal file
115
.alias
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# ~/.alias
|
||||||
|
#
|
||||||
|
# Maintainer:
|
||||||
|
# TheFlyingFool - tff@theflyingfool.com
|
||||||
|
# http://theflyingfool.com
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Credits:
|
||||||
|
# Package Management Section
|
||||||
|
# https://gist.github.com/rroblak/8137276
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
alias vi="vim" #Insure vim
|
||||||
|
alias tmux='tmux attach || tmux'
|
||||||
|
#Coloration of core utils
|
||||||
|
alias grep="grep -n --color=auto" #grep
|
||||||
|
alias egrep='egrep --color=auto'
|
||||||
|
alias fgrep='fgrep --color=auto'
|
||||||
|
alias ls="ls --color=auto" #ls
|
||||||
|
#ZFS Related #zfs, and zpool both set to NOPASSWD via sudoers file
|
||||||
|
alias zfs="sudo zfs"
|
||||||
|
alias zpool="sudo zpool"
|
||||||
|
alias scrub="sudo zpool scrub" #preforms scrub
|
||||||
|
#Mingw
|
||||||
|
alias winmake="/usr/bin/i686-w64-mingw32-gcc"
|
||||||
|
alias winmake64="/usr/bin/x86_64-w64-mingw32-gcc"
|
||||||
|
|
||||||
|
#VimLess
|
||||||
|
alias less="/usr/share/vim/vim80/macros/less.sh"
|
||||||
|
|
||||||
|
if [ -e "/usr/bin/apt-get" ] ; then # Apt-based distros (Debian, Ubuntu, etc.)
|
||||||
|
aptget="/usr/bin/apt-get" # I currently do not use any apt-based distros
|
||||||
|
sudoaptget="sudo $aptget"
|
||||||
|
aptcache="/usr/bin/apt-cache"
|
||||||
|
dpkg="/usr/bin/dpkg"
|
||||||
|
alias S="$sudoaptget install"
|
||||||
|
alias Syu="$sudoaptget update"
|
||||||
|
alias Ss="$aptcache search"
|
||||||
|
alias Si="$aptcache show"
|
||||||
|
# alias pacinstalled="$aptcache policy"
|
||||||
|
# alias paca="$dpkg --get-selections"
|
||||||
|
# alias pacfiles="$dpkg -L"
|
||||||
|
#elif [ -e "/usr/bin/pacman" -a "/usr/bin/cower" ] ; then
|
||||||
|
# alias XxX="echo 'pacman + cower'"
|
||||||
|
elif [ -e "/usr/bin/pacman" ] ; then # Arch Linux
|
||||||
|
pacman="/usr/bin/pacman --color=auto"
|
||||||
|
sudopacman="sudo $pacman --color=auto"
|
||||||
|
alias S="$sudopacman -S"
|
||||||
|
alias Syy="$sudopacman -Syy"
|
||||||
|
alias Syu="$sudopacman -Syu"
|
||||||
|
alias Rns="$sudopacman -Rns"
|
||||||
|
alias Ss="$pacman -Ss"
|
||||||
|
alias Si="$pacman -Si"
|
||||||
|
alias Q="$pacman -Q"
|
||||||
|
# alias paclo="$pacman -Qdt"
|
||||||
|
# alias pacdnc="$sudopacman -Scc"
|
||||||
|
# alias pacfiles="$pacman -Ql"
|
||||||
|
# alias pacexpl="$pacman -D --asexp"
|
||||||
|
# alias pacimpl="$pacman -D --asdep"
|
||||||
|
elif [ -e "/usr/bin/yum" ] ; then # RPM-based distros
|
||||||
|
yum="/usr/bin/yum"
|
||||||
|
sudoyum="sudo $yum"
|
||||||
|
repoquery="/usr/bin/repoquery"
|
||||||
|
alias paci="$sudoyum install"
|
||||||
|
alias pacu="$sudoyum update"
|
||||||
|
alias pacr="$sudoyum remove"
|
||||||
|
alias pacs="$yum search"
|
||||||
|
alias pacfiles="$repoquery -lq --installed"
|
||||||
|
alias pacwhoownsit="$yum whatprovides"
|
||||||
|
alias pacinfo="$yum info"
|
||||||
|
alias paclfc="$yum -qc"
|
||||||
|
alias paccheckforupdates="$sudoyum list updates"
|
||||||
|
#elif [ -e "/usr/local/bin/brew" ] ; then # homebrew
|
||||||
|
# brew="/usr/local/bin/brew"
|
||||||
|
# alias paci="$brew install"
|
||||||
|
# alias pacu="$brew update"
|
||||||
|
# alias pacup="$brew upgrade"
|
||||||
|
# alias pacs="$brew search"
|
||||||
|
# alias pacr="$brew uninstall"
|
||||||
|
elif [ -e "/usr/bin/zypper" ] ; then
|
||||||
|
zypper="/usr/bin/zypper"
|
||||||
|
suzyp="sudo $zypper"
|
||||||
|
alias Syu="$suzyp refresh && $suzyp update"
|
||||||
|
alias Ss="$zypper se"
|
||||||
|
alias S="$suzyp in"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Cygwin
|
||||||
|
# quickly get to my owncloud dir
|
||||||
|
alias cdoc="cd /cygdrive/c/Users/Nicholas/ownCloud"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#AUR Related
|
||||||
|
## Looking at incorperating this into above P-man section
|
||||||
|
##Needs to be moved to arch specific zsh / only sourced if cower is installed
|
||||||
|
alias aSyu="cd ~/aur && echo $PWD && cower -uvddf --color" #AUR Update
|
||||||
|
alias aSs="cd ~/aur && cower -s --color" #Search AUR
|
||||||
|
alias aS="cd ~/aur && cower -dd --color" #Download PKGBUILD and depends
|
||||||
|
|
||||||
|
|
||||||
|
alias dot="git --git-dir=$HOME/.dot/ --work-tree=$HOME"
|
||||||
|
|
||||||
|
##Convenience
|
||||||
|
alias 'mkdir=mkdir -p'
|
||||||
|
|
||||||
|
#list empty dirs
|
||||||
|
alias le="find . -type d -empty"
|
75
.bashrc
Normal file
75
.bashrc
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# ~/.bashrc
|
||||||
|
#
|
||||||
|
# https://git.theflyingfool.com/theflyingfool/dot/blob/master/bash/bashrc
|
||||||
|
#
|
||||||
|
# Maintainer:
|
||||||
|
# TheFlyingFool - tff@theflyingfool.com
|
||||||
|
# http://theflyingfool.com
|
||||||
|
#
|
||||||
|
# Version:
|
||||||
|
# 21/02/2015 23:03
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# If not running interactively, don't do anything
|
||||||
|
[[ $- != *i* ]] && return
|
||||||
|
|
||||||
|
## Add color support to man pages
|
||||||
|
man() {
|
||||||
|
env LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||||
|
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||||
|
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||||
|
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||||
|
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||||
|
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||||
|
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||||
|
man "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
#better color support for ls
|
||||||
|
eval $(dircolors -b)
|
||||||
|
|
||||||
|
#alias
|
||||||
|
|
||||||
|
source ~/.alias
|
||||||
|
|
||||||
|
#less highlighting
|
||||||
|
export LESSOPEN="| /usr/bin/source-highlight-esc.sh %s"
|
||||||
|
export LESS=' -R '
|
||||||
|
|
||||||
|
## Typing a dir without cd will change directories anyway
|
||||||
|
shopt -s autocd
|
||||||
|
|
||||||
|
## Allows for tab completion using sudo / man
|
||||||
|
complete -cf sudo
|
||||||
|
complete -cf man
|
||||||
|
|
||||||
|
|
||||||
|
shopt -s checkwinsize
|
||||||
|
|
||||||
|
shopt -s histappend
|
||||||
|
|
||||||
|
[[ "$PS1" ]] && /usr/bin/fortune
|
||||||
|
|
||||||
|
PS1="\[\033[0;37m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[0;31m\]\h'; else echo '\[\033[0;33m\]\u\[\033[0;37m\]@\[\033[0;96m\]\h'; fi)\[\033[0;37m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;37m\]]\n\[\033[0;37m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]"
|
||||||
|
#PS1='[\u@\h \W]\$ '
|
||||||
|
PS2='> '
|
||||||
|
PS3='> '
|
||||||
|
PS4='+ '
|
||||||
|
|
||||||
|
case ${TERM} in
|
||||||
|
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
|
||||||
|
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
|
||||||
|
|
||||||
|
;;
|
||||||
|
screen)
|
||||||
|
PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
|
||||||
|
|
||||||
|
|
||||||
|
|
84
.tmux.conf
Normal file
84
.tmux.conf
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#Switch to screen prefix
|
||||||
|
unbind C-b
|
||||||
|
set -g prefix C-a
|
||||||
|
bind-key b send-prefix
|
||||||
|
|
||||||
|
#Double cntl-a goes to last window
|
||||||
|
bind-key C-a last-window
|
||||||
|
|
||||||
|
#Cntl-a Backspace goes to previous window
|
||||||
|
unbind BSpace
|
||||||
|
bind BSpace previous-window
|
||||||
|
|
||||||
|
#Splitting to current $PWD
|
||||||
|
bind % split-window -c "#{pane_current_path}" -h
|
||||||
|
bind '"' split-window -c "#{pane_current_path}" -v
|
||||||
|
bind c new-window -c "#{pane_current_path}"
|
||||||
|
|
||||||
|
|
||||||
|
#kill window/server with confirm
|
||||||
|
bind-key k confirm kill-window
|
||||||
|
bind-key K confirm kill-server
|
||||||
|
|
||||||
|
#Status bar
|
||||||
|
set -g status-bg cyan
|
||||||
|
set-option -g status-justify centre
|
||||||
|
|
||||||
|
#Left
|
||||||
|
set -g status-left-length 30
|
||||||
|
set -g status-left '#[fg=blue]%H:%M %d-%b-%y'
|
||||||
|
|
||||||
|
|
||||||
|
set -g status-right '#[fg=blue]#h #[fg=yellow]#(acpi -i)'
|
||||||
|
|
||||||
|
#change numbering to start from 1
|
||||||
|
set -g base-index 1
|
||||||
|
|
||||||
|
|
||||||
|
# Bind function keys to windows
|
||||||
|
bind -n F1 select-window -t 1
|
||||||
|
bind -n F2 select-window -t 2
|
||||||
|
bind -n F3 select-window -t 3
|
||||||
|
bind -n F4 select-window -t 4
|
||||||
|
bind -n F5 select-window -t 5
|
||||||
|
bind -n F6 select-window -t 6
|
||||||
|
bind -n F7 select-window -t 7
|
||||||
|
bind -n F8 select-window -t 8
|
||||||
|
bind -n F9 select-window -t 9
|
||||||
|
bind -n F10 select-window -t 10
|
||||||
|
|
||||||
|
#start programs
|
||||||
|
new -s mysession -n "sys-mon" glances
|
||||||
|
neww -n "Log" "journalctl -f"
|
||||||
|
neww
|
||||||
|
#neww -n "Music" ncmpcpp
|
||||||
|
#neww -n "Deluge" deluge-console
|
||||||
|
|
||||||
|
#reload tmux config
|
||||||
|
bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
|
||||||
|
|
||||||
|
#vi keybindings
|
||||||
|
set -g mode-keys vi
|
||||||
|
|
||||||
|
#send actual f keys
|
||||||
|
bind F1 send-keys F1
|
||||||
|
bind F2 send-keys F2
|
||||||
|
bind F3 send-keys F3
|
||||||
|
bind F4 send-keys F4
|
||||||
|
bind F5 send-keys F5
|
||||||
|
bind F6 send-keys F6
|
||||||
|
bind F7 send-keys F7
|
||||||
|
bind F8 send-keys F8
|
||||||
|
bind F9 send-keys F9
|
||||||
|
bind F10 send-keys F10
|
||||||
|
bind F11 send-keys F11
|
||||||
|
bind F12 send-keys F12
|
||||||
|
|
||||||
|
# renumber windows after closing one
|
||||||
|
set -g renumber-windows on
|
||||||
|
|
||||||
|
|
||||||
|
#In order to use this file you can either
|
||||||
|
#####1. Put it in your home folder named .tmux.conf
|
||||||
|
##2. Add an alias in your bashrc (or the equivilent file for your shell) for tmux doing tmux -f /location/of/this/file
|
||||||
|
##3. Put this file in /etc/ named tmux.conf
|
73
.vimrc
Normal file
73
.vimrc
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
"
|
||||||
|
" ~/.vimrc
|
||||||
|
"
|
||||||
|
" https://git.theflyingfool.com/theflyingfool/dot/blob/master/vim/vimrc
|
||||||
|
"
|
||||||
|
" Maintainer:
|
||||||
|
" TheFlyingFool - tff@theflyingfool.com
|
||||||
|
" http://theflyingfool.com
|
||||||
|
"
|
||||||
|
" Version:
|
||||||
|
" Mon Mar 16 19:37:55 CDT 2015
|
||||||
|
"
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" Visual Settings
|
||||||
|
set ruler
|
||||||
|
" Show Line Number
|
||||||
|
set nu
|
||||||
|
" make :w!! do a sudo save
|
||||||
|
cmap w!! w !sudo tee > /dev/null %
|
||||||
|
|
||||||
|
" Search settings
|
||||||
|
" Searches as you type
|
||||||
|
" Ignores case while searching
|
||||||
|
" If case specified only search that
|
||||||
|
" Highlight search results
|
||||||
|
" Forces VIM instead of Vi
|
||||||
|
set incsearch
|
||||||
|
set ignorecase
|
||||||
|
set smartcase
|
||||||
|
set hlsearch
|
||||||
|
set nocompatible
|
||||||
|
filetype off
|
||||||
|
|
||||||
|
|
||||||
|
" Load Vundle
|
||||||
|
"set rtp+=~/.vim/bundle/Vundle.vim
|
||||||
|
"call vundle#begin()
|
||||||
|
"Plugin 'VundleVim/Vundle.vim'
|
||||||
|
|
||||||
|
" Plugin 'Valloric/YouCompleteMe'
|
||||||
|
|
||||||
|
" Plugins must be loaded before following two lines
|
||||||
|
"call vundle#end()
|
||||||
|
filetype plugin indent on
|
||||||
|
|
||||||
|
" Syntax Highlighting
|
||||||
|
" Forces .md files to load as Markdown
|
||||||
|
syntax on
|
||||||
|
au BufRead,BufNewFile *.md set filetype=markdown
|
||||||
|
|
||||||
|
"Turns on Spell Check
|
||||||
|
:setlocal spell spelllang=en_us
|
||||||
|
|
||||||
|
|
||||||
|
" Normal mode
|
||||||
|
nnoremap <C-j> :m .+1<CR>==
|
||||||
|
nnoremap <C-k> :m .-2<CR>==
|
||||||
|
|
||||||
|
" Insert mode
|
||||||
|
inoremap <C-j> <ESC>:m .+1<CR>==gi
|
||||||
|
inoremap <C-k> <ESC>:m .-2<CR>==gi
|
||||||
|
|
||||||
|
" Visual mode
|
||||||
|
vnoremap <C-j> :m '>+1<CR>gv=gv
|
||||||
|
vnoremap <C-k> :m '<-2<CR>gv=gv
|
||||||
|
|
||||||
|
" fix some common typos
|
||||||
|
iabbrev waht what
|
||||||
|
iabbrev tehn then
|
||||||
|
|
||||||
|
set modeline
|
183
.zshrc
Normal file
183
.zshrc
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# ~/.zshrc
|
||||||
|
#
|
||||||
|
# Dot file git:
|
||||||
|
# https://
|
||||||
|
#
|
||||||
|
# Maintainer:
|
||||||
|
# TheFlyingFool - tff@theflyingfool.com
|
||||||
|
# http://theflyingfool.com
|
||||||
|
#
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
# Skip erything for non-interactive shell
|
||||||
|
[[ -z "$PS1" ]] && return
|
||||||
|
|
||||||
|
##History
|
||||||
|
HISTFILE=~/.zsh_history
|
||||||
|
HISTSIZE=25000
|
||||||
|
SAVEHIST=12500
|
||||||
|
setopt INC_APPEND_HISTORY
|
||||||
|
setopt incappendhistory
|
||||||
|
setopt sharehistory
|
||||||
|
setopt HIST_REDUCE_BLANKS
|
||||||
|
setopt HIST_IGNORE_ALL_DUPS
|
||||||
|
# make history searchable with ctrl-r
|
||||||
|
bindkey "^r" history-incremental-search-backward
|
||||||
|
|
||||||
|
##Variables
|
||||||
|
export EDITOR="vim"
|
||||||
|
export USE_EDITOR=$EDITOR
|
||||||
|
export VISUAL=$EDITOR
|
||||||
|
export BROWSWER="vivaldi"
|
||||||
|
# fixes issue with atom
|
||||||
|
export ELECTRON_TRASH="kioclient5 atom"
|
||||||
|
|
||||||
|
|
||||||
|
##Alias
|
||||||
|
source ~/.alias
|
||||||
|
|
||||||
|
setopt appendhistory autocd beep nomatch correct noclobber
|
||||||
|
unsetopt extendedglob notify
|
||||||
|
bindkey -v
|
||||||
|
|
||||||
|
zstyle :compinstall filename '/home/nick/.zshrc'
|
||||||
|
|
||||||
|
autoload -U compinit
|
||||||
|
compinit
|
||||||
|
|
||||||
|
|
||||||
|
zstyle ':completion:*' rehash true
|
||||||
|
##Colored man pages
|
||||||
|
|
||||||
|
man() {
|
||||||
|
env \
|
||||||
|
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||||
|
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||||
|
LESS_TERMCAP_me=$(printf "\e[0m") \
|
||||||
|
LESS_TERMCAP_se=$(printf "\e[0m") \
|
||||||
|
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
||||||
|
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
||||||
|
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
||||||
|
man "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##Command not found
|
||||||
|
##Requires extra/pkgfile -- Arch Linux
|
||||||
|
if [ -f "/usr/share/doc/pkgfile/command-not-found.zsh" ]; then
|
||||||
|
source /usr/share/doc/pkgfile/command-not-found.zsh
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#eval 'keychain --eval id_ed25519'
|
||||||
|
if [[ -f /usr/bin/keychain ]] then
|
||||||
|
keychain --agents gpg,ssh id_ed25519 31936033 github_rsa
|
||||||
|
[ -z "$HOSTNAME" ] && HOSTNAME=`uname -n`
|
||||||
|
[ -f $HOME/.keychian/$HOSTNAME-sh ]
|
||||||
|
source $HOME/.keychain/$HOSTNAME-sh ]
|
||||||
|
[ -f $HOME/.keychain/$HOSTNAME-sh-gpg ]
|
||||||
|
source $HOME/.keychain/$HOSTNAME-sh-gpg
|
||||||
|
fi
|
||||||
|
|
||||||
|
##Prompt
|
||||||
|
|
||||||
|
#Load Colors for Prompt
|
||||||
|
autoload -U colors && colors
|
||||||
|
#Enables a quick prompt switch, can be used with
|
||||||
|
# %prompt -l #Lists Prompts
|
||||||
|
# %prompt name #Selects Prompt
|
||||||
|
|
||||||
|
if [[ -n $SSH_CLIENT ]]; then
|
||||||
|
PROMPT="[%{$fg[yellow]%}%n%{$reset_color%}@%B%{$fg[red]%}%M%{$reset_color%}]%{$reset_color%}-%{$reset_color%}[%{$fg[green]%}%~%{$reset_color%}]
|
||||||
|
%#"
|
||||||
|
else
|
||||||
|
PROMPT="[%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[cyan]%}%M%{$reset_color%}]%{$reset_color%}-%{$reset_color%}[%{$fg[green]%}%~%{$reset_color%}]
|
||||||
|
%#"
|
||||||
|
fi
|
||||||
|
|
||||||
|
###Alias
|
||||||
|
#alias aurup="cd ~/AUR && echo $PWD && cower -ubddf --color" #AUR Update
|
||||||
|
#alias aurSs="cd ~/AUR && cower -s --color" #Search AUR
|
||||||
|
#alias aurS="cd ~/AUR && cower -dd --color" #Download PKGBUILD and depends
|
||||||
|
#ZFS Related #zfs, and zpool both set to NOPASSWD via sudoers file
|
||||||
|
#alias zfs="sudo zfs"
|
||||||
|
#alias zpool="sudo zpool"
|
||||||
|
#alias scrub="sudo zpool scrub" #preforms scrub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Adapted from code found at <https://gist.github.com/1712320>.
|
||||||
|
|
||||||
|
setopt prompt_subst
|
||||||
|
# Modify the colors and symbols in these variables as desired.
|
||||||
|
#GIT_PROMPT_SYMBOL="%{$fg[blue]%}±"
|
||||||
|
GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$reset_color%}"
|
||||||
|
GIT_PROMPT_SUFFIX="%{$fg[green]%}]%{$reset_color%}"
|
||||||
|
GIT_PROMPT_AHEAD="%{$fg[red]%}ANUM%{$reset_color%}"
|
||||||
|
GIT_PROMPT_BEHIND="%{$fg[cyan]%}BNUM%{$reset_color%}"
|
||||||
|
GIT_PROMPT_MERGING="%{$fg_bold[magenta]%}⚡︎%{$reset_color%}"
|
||||||
|
GIT_PROMPT_UNTRACKED="%{$fg_bold[red]%}●%{$reset_color%}"
|
||||||
|
GIT_PROMPT_MODIFIED="%{$fg_bold[yellow]%}●%{$reset_color%}"
|
||||||
|
GIT_PROMPT_STAGED="%{$fg_bold[green]%}●%{$reset_color%}"
|
||||||
|
|
||||||
|
# Show Git branch/tag, or name-rev if on detached head
|
||||||
|
parse_git_branch() {
|
||||||
|
(git symbolic-ref -q HEAD || git name-rev --name-only --no-undefined --always HEAD) 2> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Show different symbols as appropriate for various Git repository states
|
||||||
|
parse_git_state() {
|
||||||
|
|
||||||
|
# Compose this value via multiple conditional appends.
|
||||||
|
local GIT_STATE=""
|
||||||
|
|
||||||
|
local NUM_AHEAD="$(git log --oneline @{u}.. 2> /dev/null | wc -l | tr -d ' ')"
|
||||||
|
if [ "$NUM_AHEAD" -gt 0 ]; then
|
||||||
|
GIT_STATE=$GIT_STATE${GIT_PROMPT_AHEAD//NUM/$NUM_AHEAD}
|
||||||
|
fi
|
||||||
|
|
||||||
|
local NUM_BEHIND="$(git log --oneline ..@{u} 2> /dev/null | wc -l | tr -d ' ')"
|
||||||
|
if [ "$NUM_BEHIND" -gt 0 ]; then
|
||||||
|
GIT_STATE=$GIT_STATE${GIT_PROMPT_BEHIND//NUM/$NUM_BEHIND}
|
||||||
|
fi
|
||||||
|
|
||||||
|
local GIT_DIR="$(git rev-parse --git-dir 2> /dev/null)"
|
||||||
|
if [ -n $GIT_DIR ] && test -r $GIT_DIR/MERGE_HEAD; then
|
||||||
|
GIT_STATE=$GIT_STATE$GIT_PROMPT_MERGING
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
|
||||||
|
GIT_STATE=$GIT_STATE$GIT_PROMPT_UNTRACKED
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git diff --quiet 2> /dev/null; then
|
||||||
|
GIT_STATE=$GIT_STATE$GIT_PROMPT_MODIFIED
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git diff --cached --quiet 2> /dev/null; then
|
||||||
|
GIT_STATE=$GIT_STATE$GIT_PROMPT_STAGED
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $GIT_STATE ]]; then
|
||||||
|
echo "$GIT_PROMPT_PREFIX$GIT_STATE$GIT_PROMPT_SUFFIX"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# If inside a Git repository, print its branch and state
|
||||||
|
git_prompt_string() {
|
||||||
|
local git_where="$(parse_git_branch)"
|
||||||
|
[ -n "$git_where" ] && echo "$(parse_git_state)$GIT_PROMPT_PREFIX%{$fg[yellow]%}${git_where#(refs/heads/|tags/)}$GIT_PROMPT_SUFFIX"
|
||||||
|
}
|
||||||
|
|
||||||
|
## alt-s inserts "sudo" at start of line
|
||||||
|
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
|
||||||
|
zle -N insert-sudo insert_sudo
|
||||||
|
bindkey "^[s" insert-sudo
|
||||||
|
|
||||||
|
|
||||||
|
# Set the right-hand prompt
|
||||||
|
RPS1='$(git_prompt_string)'
|
@ -9,7 +9,7 @@ My dotfiles for both Arch Linux and Windows
|
|||||||
```sh
|
```sh
|
||||||
git clone --bare gitea@git.theflyingfool.com:theflyingfool/dotfiles.git $HOME/.dot
|
git clone --bare gitea@git.theflyingfool.com:theflyingfool/dotfiles.git $HOME/.dot
|
||||||
alias dot='/usr/bin/git --git-dir="$HOME/.dot/" --work-tree="$HOME"'
|
alias dot='/usr/bin/git --git-dir="$HOME/.dot/" --work-tree="$HOME"'
|
||||||
dot checkout -b Linux
|
dot checkout
|
||||||
dot config --local status.showUntrackedFiles no
|
dot config --local status.showUntrackedFiles no
|
||||||
source ~/.zshrc
|
source ~/.zshrc
|
||||||
```
|
```
|
||||||
@ -46,7 +46,7 @@ if (!(Test-Path -Path $PROFILE)) {
|
|||||||
}
|
}
|
||||||
"`nfunction dot { & git --git-dir=`"$HOME/.dot/`" --work-tree=`"$HOME`" @args }" | Out-File -Append $PROFILE
|
"`nfunction dot { & git --git-dir=`"$HOME/.dot/`" --work-tree=`"$HOME`" @args }" | Out-File -Append $PROFILE
|
||||||
. $PROFILE
|
. $PROFILE
|
||||||
dot checkout -b Windows
|
dot checkout
|
||||||
dot config --local status.showUntrackedFiles no
|
dot config --local status.showUntrackedFiles no
|
||||||
"`n. `"$HOME/windows/Microsoft.PowerShell_profile.ps1`"" | Out-File -Append $PROFILE
|
"`n. `"$HOME/windows/Microsoft.PowerShell_profile.ps1`"" | Out-File -Append $PROFILE
|
||||||
```
|
```
|
||||||
|
15
windows/Microsoft.PowerShell_profile.ps1
Normal file
15
windows/Microsoft.PowerShell_profile.ps1
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
|
||||||
|
param($wordToComplete, $commandAst, $cursorPosition)
|
||||||
|
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
|
||||||
|
$Local:word = $wordToComplete.Replace('"', '""')
|
||||||
|
$Local:ast = $commandAst.ToString().Replace('"', '""')
|
||||||
|
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
|
||||||
|
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function dot { & git --git-dir="$HOME/.dot/" --work-tree="$HOME" @args }
|
||||||
|
|
||||||
|
# Source the aliases.ps1 file
|
||||||
|
. "$PSScriptRoot/aliases.ps1"
|
9
windows/Microsoft.VSCode_profile.ps1
Normal file
9
windows/Microsoft.VSCode_profile.ps1
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
|
||||||
|
param($wordToComplete, $commandAst, $cursorPosition)
|
||||||
|
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
|
||||||
|
$Local:word = $wordToComplete.Replace('"', '""')
|
||||||
|
$Local:ast = $commandAst.ToString().Replace('"', '""')
|
||||||
|
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
|
||||||
|
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
|
||||||
|
}
|
||||||
|
}
|
7
windows/aliases.ps1
Normal file
7
windows/aliases.ps1
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
function Upgrade-All { winget upgrade --all }
|
||||||
|
|
||||||
|
Set-Alias -Name Syu -Value Upgrade-All
|
||||||
|
|
||||||
|
function touch($file) {
|
||||||
|
"" | Out-File $file -Encoding ASCII
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user