diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..7fe90ed --- /dev/null +++ b/.bashrc @@ -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 + + + diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..cb2090a --- /dev/null +++ b/.tmux.conf @@ -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 diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..0e5e6b7 --- /dev/null +++ b/.vimrc @@ -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 :m .+1== +nnoremap :m .-2== + +" Insert mode +inoremap :m .+1==gi +inoremap :m .-2==gi + +" Visual mode +vnoremap :m '>+1gv=gv +vnoremap :m '<-2gv=gv + +" fix some common typos +iabbrev waht what +iabbrev tehn then + +set modeline diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..921f2f1 --- /dev/null +++ b/.zshrc @@ -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 . + +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)' diff --git a/windows/Microsoft.PowerShell_profile.ps1 b/windows/Microsoft.PowerShell_profile.ps1 new file mode 100644 index 0000000..9e8d80b --- /dev/null +++ b/windows/Microsoft.PowerShell_profile.ps1 @@ -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" diff --git a/windows/aliases.ps1 b/windows/aliases.ps1 new file mode 100644 index 0000000..8030e1f --- /dev/null +++ b/windows/aliases.ps1 @@ -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 +} \ No newline at end of file