This commit is contained in:
Sage Vaillancourt 2022-02-03 00:04:58 -05:00
commit fb1bc46e23
11 changed files with 1145 additions and 157 deletions

View File

@ -4,4 +4,4 @@
[[ -f ~/.bashrc ]] && . ~/.bashrc [[ -f ~/.bashrc ]] && . ~/.bashrc
export PATH="$HOME/.cargo/bin:$PATH" . "$HOME/.cargo/env"

104
.bashrc
View File

@ -5,42 +5,42 @@
[[ $- != *i* ]] && return [[ $- != *i* ]] && return
colors() { colors() {
local fgc bgc vals seq0 local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m' printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n" printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n" printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n" printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
# foreground colors # foreground colors
for fgc in {30..37}; do for fgc in {30..37}; do
# background colors # background colors
for bgc in {40..47}; do for bgc in {40..47}; do
fgc=${fgc#37} # white fgc=${fgc#37} # white
bgc=${bgc#40} # black bgc=${bgc#40} # black
vals="${fgc:+$fgc;}${bgc}" vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;} vals=${vals%%;}
seq0="${vals:+\e[${vals}m}" seq0="${vals:+\e[${vals}m}"
printf " %-9s" "${seq0:-(default)}" printf " %-9s" "${seq0:-(default)}"
printf " ${seq0}TEXT\e[m" printf " ${seq0}TEXT\e[m"
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m" printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
done done
echo; echo echo; echo
done done
} }
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion [ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
# Change the window title of X terminals # Change the window title of X terminals
case ${TERM} in case ${TERM} in
xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*) xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"' PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
;; ;;
screen*) screen*)
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"' PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
;; ;;
esac esac
use_color=true use_color=true
@ -55,37 +55,37 @@ match_lhs=""
[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)" [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \ [[ -z ${match_lhs} ]] \
&& type -P dircolors >/dev/null \ && type -P dircolors >/dev/null \
&& match_lhs=$(dircolors --print-database) && match_lhs=$(dircolors --print-database)
[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
if ${use_color} ; then if ${use_color} ; then
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489 # Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors) eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS) eval $(dircolors -b /etc/DIR_COLORS)
fi fi
fi fi
if [[ ${EUID} == 0 ]] ; then if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] ' PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] '
else else
PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] ' PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] '
fi fi
alias ls='ls --color=auto' alias ls='ls --color=auto'
alias grep='grep --colour=auto' alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto' alias egrep='egrep --colour=auto'
alias fgrep='fgrep --colour=auto' alias fgrep='fgrep --colour=auto'
else else
if [[ ${EUID} == 0 ]] ; then if [[ ${EUID} == 0 ]] ; then
# show root@ when we don't have colors # show root@ when we don't have colors
PS1='\u@\h \W \$ ' PS1='\u@\h \W \$ '
else else
PS1='\u@\h \w \$ ' PS1='\u@\h \w \$ '
fi fi
fi fi
unset use_color safe_term match_lhs sh unset use_color safe_term match_lhs sh
@ -137,3 +137,5 @@ ex ()
echo "'$1' is not a valid file" echo "'$1' is not a valid file"
fi fi
} }
source ~/.shell_aliases

80
.config/starship.toml Normal file
View File

@ -0,0 +1,80 @@
add_newline = false
format = """
[\\[sage\\]](bold red) \
$username\
$hostname\
$shlvl\
$kubernetes\
$directory\
$vcsh\
$java\
$nodejs\
$dart\
$deno\
$dotnet\
$elixir\
$elm\
$erlang\
$golang\
$helm\
$julia\
$kotlin\
$nim\
$ocaml\
$perl\
$php\
$purescript\
$python\
$red\
$ruby\
$rust\
$scala\
$swift\
$terraform\
$vlang\
$vagrant\
$zig\
$git_branch\
$git_commit\
$git_state\
$git_metrics\
$git_status\
$hg_branch\
$docker_context\
$cmake\
$nix_shell\
$conda\
$memory_usage\
$aws\
$gcloud\
$openstack\
$env_var\
$crystal\
$custom\
$line_break\
$lua\
$jobs\
$battery\
$time\
$status\
$shell\
$character"""
[character]
success_symbol = "[\\$](bold white)"
error_symbol = "[✗](bold red)"
[directory]
style = "green bold"
truncate_to_repo = false
truncation_length = 0
[nodejs]
format = "$symbol"
[java]
format = "$symbol"
[time]
disabled = true
use_12hr = true

View File

@ -1,7 +1,24 @@
[user] [user]
name = Sage Vaillancourt name = Sage Vaillancourt
email = sagev9000@tutanota.com
[core] [core]
autocrlf = input autocrlf = input
excludesfile = ~/.gitignore
[credential] [credential]
helper = store helper = store
[push]
default = current
followTags = true
[help]
autocorrect = 1
[include]
path = ~/.gitlocal
[init]
defaultBranch = main
[commit]
verbose = true

48
.shell_aliases Normal file → Executable file
View File

@ -4,6 +4,45 @@ function fin {
find -iname "*$@*" find -iname "*$@*"
} }
function wf {
if [[ "$@" != "" ]]; then
local fzf_args="-q $@"
fi
echo ~/wiki/"$(rg --with-filename --no-heading . ~/wiki | sed 's@/home/sage/wiki/@@' | fzf -i $fzf_args -1 --preview='bat ~/wiki/$(echo {} | sed "s/:.*//")' | sed 's/:.*//')"
}
function ws {
local filename="$(wf $@)"
if [[ "$filename" != "" ]]; then
vim $filename
fi
}
function ww {
ws $(rg --no-line-number --no-filename . ~/wiki | sed 's/[^a-zA-Z0-9]\+/\n/g' | grep -v "^$" | sort -f | uniq -ci | sort -hr | fzf -i | cut -c 9-)
}
alias cat="bat"
export FZF_DEFAULT_COMMAND='fd --type f'
alias fzf="fzf --preview 'bat --style=numbers --color=always {}'"
function vo {
if [[ "$1" == "" ]]; then
local f="$(fzf --preview "bat --style=numbers --color=always {}")"
if [[ "$f" != "" ]]; then
print -s "vim $f"
vim $f
fi
else
local f="$(fzf -1 -q $@ | head -n 1)"
if [[ "$f" != "" ]]; then
print -s "vim $f"
vim $f
fi
fi
echo $f
}
# Mkdir should remind you to use git # Mkdir should remind you to use git
alias mkdir="echo 'Maybe use git init if this is a new project' && mkdir" alias mkdir="echo 'Maybe use git init if this is a new project' && mkdir"
@ -31,7 +70,8 @@ alias termrc='vim ~/.config/xfce4/terminal/terminalrc'
# Use `grepr` for a recursive, case-insensitive, and filtered grep # Use `grepr` for a recursive, case-insensitive, and filtered grep
# alias grepr="grep -RInsi --color=auto --exclude-dir=.git --exclude=tags" # alias grepr="grep -RInsi --color=auto --exclude-dir=.git --exclude=tags"
# alias grepr='grep -RInsi --color=auto --exclude-dir=.git --exclude-dir=banana_pi_kernel --exclude-dir={bpi_build_scripts, storm_dox, sam_dox} --exclude=tags --exclude=\*.{ko, o}' # alias grepr='grep -RInsi --color=auto --exclude-dir=.git --exclude-dir=banana_pi_kernel --exclude-dir={bpi_build_scripts, storm_dox, sam_dox} --exclude=tags --exclude=\*.{ko, o}'
alias grepr='grep -RInsi --color=auto --exclude-dir=.git --exclude=tags' alias grepr='grep -RIns --color=auto --exclude-dir=.git --exclude-dir=venv --exclude-dir=node_modules --exclude=tags --exclude-dir=build'
alias grepi='grepr -i'
alias apt="sudo apt" alias apt="sudo apt"
alias apt-get="sudo apt-get" alias apt-get="sudo apt-get"
@ -62,4 +102,8 @@ alias ls='ls --color=auto -F -w 80'
# Using du automatically finds the total # Using du automatically finds the total
alias du='du -sh' alias du='du -sh'
alias tags='ctags -f newtags -R . && mv newtags tags' alias tags='ctags --exclude=node_modules -f newtags -R . && mv newtags tags'
if [[ "$@" != "" ]]; then
$@
fi

36
.tmux.conf Normal file
View File

@ -0,0 +1,36 @@
# set -g default-terminal "screen-255color"
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
set -g default-shell /usr/bin/zsh
set-option -g default-terminal "screen-256color"
set -g status-right "# %A, %d %b %Y - %I:%M %p "
set -g status-bg blue
set -g status-fg black
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
setw -g window-status-current-style fg=blue,bg=black
setw -g window-status-current-format ' #I #{s|/home/sagevaillancourt|~|:pane_current_path} #W#F '
setw -g window-status-format ' #I #{s|/home/sagevaillancourt|~|:pane_current_path} #W#F '

763
.vim/colors/jellybeans.vim Normal file
View File

@ -0,0 +1,763 @@
" Vim color file
"
" " __ _ _ _ "
" " \ \ ___| | |_ _| |__ ___ __ _ _ __ ___ "
" " \ \/ _ \ | | | | | _ \ / _ \/ _ | _ \/ __| "
" " /\_/ / __/ | | |_| | |_| | __/ |_| | | | \__ \ "
" " \___/ \___|_|_|\__ |____/ \___|\____|_| |_|___/ "
" " \___/ "
"
" "A colorful, dark color scheme for Vim."
"
" File: jellybeans.vim
" URL: github.com/nanotech/jellybeans.vim
" Scripts URL: vim.org/scripts/script.php?script_id=2555
" Maintainer: NanoTech (nanotech.nanotechcorp.net)
" Version: 1.7
" Last Change: June 21st, 2019
" License: MIT
" Contributors: Andrew Wong (w0ng)
" Benjamin R. Haskell (benizi)
" Brian Marshall (bmars)
" Daniel Herbert (pocketninja)
" David Liang <bmdavll at gmail dot com>
" Filipe Silva (ninrod)
" Henry So, Jr. <henryso@panix.com>
" Ihor Kalnytskyi (ikalnytskyi)
" Joe Doherty (docapotamus)
" Karl Litterfeldt (Litterfeldt)
" Keith Pitt (keithpitt)
" Mike Schreifels (schreifels)
" Philipp Rustemeier (12foo)
" Rafael Bicalho (rbika)
" Rich Healey (richo)
" Siwen Yu (yusiwen)
" Tim Willis (willist)
" Tom McLaughlin (tmcoma)
"
" Copyright (c) 2009-2019 NanoTech
"
" Permission is hereby granted, free of charge, to any per
" son obtaining a copy of this software and associated doc
" umentation files (the “Software”), to deal in the Soft
" ware without restriction, including without limitation
" the rights to use, copy, modify, merge, publish, distrib
" ute, sublicense, and/or sell copies of the Software, and
" to permit persons to whom the Software is furnished to do
" so, subject to the following conditions:
"
" The above copyright notice and this permission notice
" shall be included in all copies or substantial portions
" of the Software.
"
" THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY
" KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
" THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICU
" LAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CON
" TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON
" NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
" THE SOFTWARE.
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "jellybeans"
if has("gui_running") || (has('termguicolors') && &termguicolors)
let s:true_color = 1
else
let s:true_color = 0
endif
if s:true_color || &t_Co >= 88
let s:low_color = 0
else
let s:low_color = 1
endif
" Configuration Variables:
" - g:jellybeans_overrides (default = {})
" - g:jellybeans_use_lowcolor_black (default = 0)
" - g:jellybeans_use_gui_italics (default = 1)
" - g:jellybeans_use_term_italics (default = 0)
let s:background_color = "151515"
if exists("g:jellybeans_overrides")
let s:overrides = g:jellybeans_overrides
else
let s:overrides = {}
endif
" Backwards compatibility
if exists("g:jellybeans_background_color")
\ || exists("g:jellybeans_background_color_256")
\ || exists("g:jellybeans_use_term_background_color")
let s:overrides = deepcopy(s:overrides)
if !has_key(s:overrides, "background")
let s:overrides["background"] = {}
endif
if exists("g:jellybeans_background_color")
let s:overrides["background"]["guibg"] = g:jellybeans_background_color
endif
if exists("g:jellybeans_background_color_256")
let s:overrides["background"]["256ctermbg"] = g:jellybeans_background_color_256
endif
if exists("g:jellybeans_use_term_background_color")
\ && g:jellybeans_use_term_background_color
let s:overrides["background"]["ctermbg"] = "NONE"
let s:overrides["background"]["256ctermbg"] = "NONE"
endif
endif
if exists("g:jellybeans_use_lowcolor_black") && g:jellybeans_use_lowcolor_black
let s:termBlack = "Black"
else
let s:termBlack = "Grey"
endif
" When `termguicolors` is set, Vim[^1] ignores `hi Normal guibg=NONE`
" after Normal's `guibg` is already set to a color. See:
"
" - https://github.com/vim/vim/issues/981
" - https://github.com/nanotech/jellybeans.vim/issues/64
"
" To work around this, ensure we don't set the default background
" color before an override changes it to `NONE` by ensuring that the
" background color isn't set to a value different from its override.
"
" [^1]: Tested on 8.0.567. Does not apply to Neovim.
"
if has_key(s:overrides, "background") && has_key(s:overrides["background"], "guibg")
let s:background_color = s:overrides["background"]["guibg"]
endif
" Color approximation functions by Henry So, Jr. and David Liang {{{
" Added to jellybeans.vim by Daniel Herbert
if &t_Co == 88
" returns an approximate grey index for the given grey level
fun! s:grey_number(x)
if a:x < 23
return 0
elseif a:x < 69
return 1
elseif a:x < 103
return 2
elseif a:x < 127
return 3
elseif a:x < 150
return 4
elseif a:x < 173
return 5
elseif a:x < 196
return 6
elseif a:x < 219
return 7
elseif a:x < 243
return 8
else
return 9
endif
endfun
" returns the actual grey level represented by the grey index
fun! s:grey_level(n)
if a:n == 0
return 0
elseif a:n == 1
return 46
elseif a:n == 2
return 92
elseif a:n == 3
return 115
elseif a:n == 4
return 139
elseif a:n == 5
return 162
elseif a:n == 6
return 185
elseif a:n == 7
return 208
elseif a:n == 8
return 231
else
return 255
endif
endfun
" returns the palette index for the given grey index
fun! s:grey_color(n)
if a:n == 0
return 16
elseif a:n == 9
return 79
else
return 79 + a:n
endif
endfun
" returns an approximate color index for the given color level
fun! s:rgb_number(x)
if a:x < 69
return 0
elseif a:x < 172
return 1
elseif a:x < 230
return 2
else
return 3
endif
endfun
" returns the actual color level for the given color index
fun! s:rgb_level(n)
if a:n == 0
return 0
elseif a:n == 1
return 139
elseif a:n == 2
return 205
else
return 255
endif
endfun
" returns the palette index for the given R/G/B color indices
fun! s:rgb_color(x, y, z)
return 16 + (a:x * 16) + (a:y * 4) + a:z
endfun
else " assuming &t_Co == 256
" returns an approximate grey index for the given grey level
fun! s:grey_number(x)
if a:x < 14
return 0
else
let l:n = (a:x - 8) / 10
let l:m = (a:x - 8) % 10
if l:m < 5
return l:n
else
return l:n + 1
endif
endif
endfun
" returns the actual grey level represented by the grey index
fun! s:grey_level(n)
if a:n == 0
return 0
else
return 8 + (a:n * 10)
endif
endfun
" returns the palette index for the given grey index
fun! s:grey_color(n)
if a:n == 0
return 16
elseif a:n == 25
return 231
else
return 231 + a:n
endif
endfun
" returns an approximate color index for the given color level
fun! s:rgb_number(x)
if a:x < 75
return 0
else
let l:n = (a:x - 55) / 40
let l:m = (a:x - 55) % 40
if l:m < 20
return l:n
else
return l:n + 1
endif
endif
endfun
" returns the actual color level for the given color index
fun! s:rgb_level(n)
if a:n == 0
return 0
else
return 55 + (a:n * 40)
endif
endfun
" returns the palette index for the given R/G/B color indices
fun! s:rgb_color(x, y, z)
return 16 + (a:x * 36) + (a:y * 6) + a:z
endfun
endif
" returns the palette index to approximate the given R/G/B color levels
fun! s:color(r, g, b)
" map greys directly (see xterm's 256colres.pl)
if &t_Co == 256 && a:r == a:g && a:g == a:b && a:r > 3 && a:r < 243
return (a:r - 8) / 10 + 232
endif
" get the closest grey
let l:gx = s:grey_number(a:r)
let l:gy = s:grey_number(a:g)
let l:gz = s:grey_number(a:b)
" get the closest color
let l:x = s:rgb_number(a:r)
let l:y = s:rgb_number(a:g)
let l:z = s:rgb_number(a:b)
if l:gx == l:gy && l:gy == l:gz
" there are two possibilities
let l:dgr = s:grey_level(l:gx) - a:r
let l:dgg = s:grey_level(l:gy) - a:g
let l:dgb = s:grey_level(l:gz) - a:b
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
let l:dr = s:rgb_level(l:gx) - a:r
let l:dg = s:rgb_level(l:gy) - a:g
let l:db = s:rgb_level(l:gz) - a:b
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
if l:dgrey < l:drgb
" use the grey
return s:grey_color(l:gx)
else
" use the color
return s:rgb_color(l:x, l:y, l:z)
endif
else
" only one possibility
return s:rgb_color(l:x, l:y, l:z)
endif
endfun
fun! s:is_empty_or_none(str)
return empty(a:str) || a:str ==? "NONE"
endfun
" returns the palette index to approximate the 'rrggbb' hex string
fun! s:rgb(rgb)
if s:is_empty_or_none(a:rgb)
return "NONE"
endif
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
return s:color(l:r, l:g, l:b)
endfun
fun! s:prefix_highlight_value_with(prefix, color)
if s:is_empty_or_none(a:color)
return "NONE"
else
return a:prefix . a:color
endif
endfun
fun! s:remove_italic_attr(attr)
let l:attr = join(filter(split(a:attr, ","), "v:val !=? 'italic'"), ",")
if empty(l:attr)
let l:attr = "NONE"
endif
return l:attr
endfun
" sets the highlighting for the given group
fun! s:X(group, fg, bg, attr, lcfg, lcbg)
if s:low_color
let l:cmd = "hi ".a:group.
\ " ctermfg=".s:prefix_highlight_value_with("", a:lcfg).
\ " ctermbg=".s:prefix_highlight_value_with("", a:lcbg)
else
let l:cmd = "hi ".a:group.
\ " guifg=".s:prefix_highlight_value_with("#", a:fg).
\ " guibg=".s:prefix_highlight_value_with("#", a:bg)
if !s:true_color
let l:cmd = l:cmd.
\ " ctermfg=".s:rgb(a:fg).
\ " ctermbg=".s:rgb(a:bg)
endif
endif
let l:attr = s:prefix_highlight_value_with("", a:attr)
if exists("g:jellybeans_use_term_italics") && g:jellybeans_use_term_italics
let l:cterm_attr = l:attr
else
let l:cterm_attr = s:remove_italic_attr(l:attr)
endif
if !exists("g:jellybeans_use_gui_italics") || g:jellybeans_use_gui_italics
let l:gui_attr = l:attr
else
let l:gui_attr = s:remove_italic_attr(l:attr)
endif
let l:cmd = l:cmd." gui=".l:gui_attr." cterm=".l:cterm_attr
exec l:cmd
endfun
" }}}
call s:X("Normal","e8e8d3",s:background_color,"","White","")
set background=dark
call s:X("CursorLine","","1c1c1c","","",s:termBlack)
call s:X("CursorColumn","","1c1c1c","","",s:termBlack)
" Some of Terminal.app's default themes have a cursor color
" too close to Jellybeans' preferred MatchParen background
" color to be easily distinguishable. Other terminals tend
" to use a brighter cursor color.
"
" Use a more distinct color in Terminal.app, and also in
" low-color terminals if the preferred background color is
" not available.
if !has('gui_running') && $TERM_PROGRAM == "Apple_Terminal"
let s:matchParenGuiFg = "dd0093"
let s:matchParenGuiBg = "000000"
else
let s:matchParenGuiFg = "ffffff"
let s:matchParenGuiBg = "556779"
endif
if s:termBlack != "Black"
let s:matchParenTermFg = "Magenta"
let s:matchParenTermBg = ""
else
let s:matchParenTermFg = ""
let s:matchParenTermBg = s:termBlack
endif
call s:X("MatchParen",s:matchParenGuiFg,s:matchParenGuiBg,"bold",
\ s:matchParenTermFg,s:matchParenTermBg)
call s:X("TabLine","000000","b0b8c0","italic","",s:termBlack)
call s:X("TabLineFill","9098a0","","","",s:termBlack)
call s:X("TabLineSel","000000","f0f0f0","italic,bold",s:termBlack,"White")
" Auto-completion
call s:X("Pmenu","ffffff","606060","","White",s:termBlack)
call s:X("PmenuSel","101010","eeeeee","",s:termBlack,"White")
call s:X("Visual","","404040","","",s:termBlack)
call s:X("Cursor",s:background_color,"b0d0f0","","","")
call s:X("CocErrorFloat", s:background_color,"", "", "", "")
call s:X("LineNr","605958",s:background_color,"NONE",s:termBlack,"")
call s:X("CursorLineNr","ccc5c4","","NONE","White","")
call s:X("Comment","888888","","italic","Grey","")
call s:X("Todo","c7c7c7","","bold","White",s:termBlack)
call s:X("StatusLine","000000","dddddd","italic","","White")
call s:X("StatusLineNC","ffffff","403c41","italic","White","Black")
call s:X("VertSplit","777777","403c41","",s:termBlack,s:termBlack)
call s:X("WildMenu","f0a0c0","302028","","Magenta","")
call s:X("Folded","a0a8b0","384048","italic",s:termBlack,"")
call s:X("FoldColumn","535D66","1f1f1f","","",s:termBlack)
call s:X("SignColumn","777777","333333","","",s:termBlack)
call s:X("ColorColumn","","000000","","",s:termBlack)
call s:X("Title","70b950","","bold","Green","")
call s:X("Constant","cf6a4c","","","Red","")
call s:X("Special","799d6a","","","Green","")
call s:X("Delimiter","668799","","","Grey","")
call s:X("String","99ad6a","","","Green","")
call s:X("StringDelimiter","556633","","","DarkGreen","")
call s:X("Identifier","c6b6ee","","","LightCyan","")
call s:X("Structure","8fbfdc","","","LightCyan","")
call s:X("Function","fad07a","","","Yellow","")
call s:X("Statement","8197bf","","","DarkBlue","")
call s:X("PreProc","8fbfdc","","","LightBlue","")
hi! link Operator Structure
hi! link Conceal Operator
call s:X("Type","ffb964","","","Yellow","")
call s:X("NonText","606060",s:background_color,"",s:termBlack,"")
call s:X("SpecialKey","444444","1c1c1c","",s:termBlack,"")
call s:X("Search","f0a0c0","302028","underline","Magenta","")
call s:X("Directory","dad085","","","Yellow","")
call s:X("ErrorMsg","","902020","","","DarkRed")
hi! link Error ErrorMsg
hi! link MoreMsg Special
call s:X("Question","65C254","","","Green","")
if exists('*term_setansicolors')
let g:terminal_ansi_colors = repeat([0], 16)
let g:terminal_ansi_colors[0] = "#" . s:background_color
let g:terminal_ansi_colors[8] = "#e8e8d3"
let g:terminal_ansi_colors[1] = "#cf6a4c"
let g:terminal_ansi_colors[9] = "#902020"
let g:terminal_ansi_colors[2] = "#65C254"
let g:terminal_ansi_colors[10] = "#70b950"
let g:terminal_ansi_colors[3] = "#ffb964"
let g:terminal_ansi_colors[11] = "#fad07a"
let g:terminal_ansi_colors[4] = "#8197bf"
let g:terminal_ansi_colors[12] = "DarkBlue"
let g:terminal_ansi_colors[5] = "#c6b6ee"
" Guessed
let g:terminal_ansi_colors[13] = "#a78fe4"
let g:terminal_ansi_colors[6] = "#8fbfdc"
" Guessed
let g:terminal_ansi_colors[14] = "#89cfec"
let g:terminal_ansi_colors[7] = "#ffffff"
let g:terminal_ansi_colors[15] = "#ff0000"
endif
" Spell Checking
call s:X("SpellBad","","902020","underline","","DarkRed")
call s:X("SpellCap","","0000df","underline","","Blue")
call s:X("SpellRare","","540063","underline","","DarkMagenta")
call s:X("SpellLocal","","2D7067","underline","","Green")
" Diff
hi! link diffRemoved Constant
hi! link diffAdded String
" VimDiff
call s:X("DiffAdd","D2EBBE","437019","","White","DarkGreen")
call s:X("DiffDelete","40000A","700009","","DarkRed","DarkRed")
call s:X("DiffChange","","2B5B77","","White","DarkBlue")
call s:X("DiffText","8fbfdc","000000","reverse","Yellow","")
" PHP
hi! link phpFunctions Function
call s:X("StorageClass","c59f6f","","","Red","")
hi! link phpSuperglobal Identifier
hi! link phpQuoteSingle StringDelimiter
hi! link phpQuoteDouble StringDelimiter
hi! link phpBoolean Constant
hi! link phpNull Constant
hi! link phpArrayPair Operator
hi! link phpOperator Normal
hi! link phpRelation Normal
hi! link phpVarSelector Identifier
" Python
hi! link pythonOperator Statement
" Ruby
hi! link rubySharpBang Comment
call s:X("rubyClass","447799","","","DarkBlue","")
call s:X("rubyIdentifier","c6b6fe","","","Cyan","")
hi! link rubyConstant Type
hi! link rubyFunction Function
call s:X("rubyInstanceVariable","c6b6fe","","","Cyan","")
call s:X("rubySymbol","7697d6","","","Blue","")
hi! link rubyGlobalVariable rubyInstanceVariable
hi! link rubyModule rubyClass
call s:X("rubyControl","7597c6","","","Blue","")
hi! link rubyString String
hi! link rubyStringDelimiter StringDelimiter
hi! link rubyInterpolationDelimiter Identifier
call s:X("rubyRegexpDelimiter","540063","","","Magenta","")
call s:X("rubyRegexp","dd0093","","","DarkMagenta","")
call s:X("rubyRegexpSpecial","a40073","","","Magenta","")
call s:X("rubyPredefinedIdentifier","de5577","","","Red","")
" Erlang
hi! link erlangAtom rubySymbol
hi! link erlangBIF rubyPredefinedIdentifier
hi! link erlangFunction rubyPredefinedIdentifier
hi! link erlangDirective Statement
hi! link erlangNode Identifier
" Elixir
hi! link elixirAtom rubySymbol
" JavaScript
hi! link javaScriptValue Constant
hi! link javaScriptRegexpString rubyRegexp
hi! link javaScriptTemplateVar StringDelim
hi! link javaScriptTemplateDelim Identifier
hi! link javaScriptTemplateString String
" CoffeeScript
hi! link coffeeRegExp javaScriptRegexpString
" Lua
hi! link luaOperator Conditional
" C
hi! link cFormat Identifier
hi! link cOperator Constant
" Objective-C/Cocoa
hi! link objcClass Type
hi! link cocoaClass objcClass
hi! link objcSubclass objcClass
hi! link objcSuperclass objcClass
hi! link objcDirective rubyClass
hi! link objcStatement Constant
hi! link cocoaFunction Function
hi! link objcMethodName Identifier
hi! link objcMethodArg Normal
hi! link objcMessageName Identifier
" Vimscript
hi! link vimOper Normal
" HTML
hi! link htmlTag Statement
hi! link htmlEndTag htmlTag
hi! link htmlTagName htmlTag
" XML
hi! link xmlTag Statement
hi! link xmlEndTag xmlTag
hi! link xmlTagName xmlTag
hi! link xmlEqual xmlTag
hi! link xmlEntity Special
hi! link xmlEntityPunct xmlEntity
hi! link xmlDocTypeDecl PreProc
hi! link xmlDocTypeKeyword PreProc
hi! link xmlProcessingDelim xmlAttrib
" Debugger.vim
call s:X("DbgCurrent","DEEBFE","345FA8","","White","DarkBlue")
call s:X("DbgBreakPt","","4F0037","","","DarkMagenta")
" vim-indent-guides
if !exists("g:indent_guides_auto_colors")
let g:indent_guides_auto_colors = 0
endif
call s:X("IndentGuidesOdd","","232323","","","")
call s:X("IndentGuidesEven","","1b1b1b","","","")
" Plugins, etc.
hi! link TagListFileName Directory
call s:X("PreciseJumpTarget","B9ED67","405026","","White","Green")
" Manual overrides for 256-color terminals. Dark colors auto-map badly.
if !s:low_color
hi StatusLineNC ctermbg=235
hi Folded ctermbg=236
hi DiffText ctermfg=81
hi DbgBreakPt ctermbg=53
hi IndentGuidesOdd ctermbg=235
hi IndentGuidesEven ctermbg=234
endif
if !empty("s:overrides")
fun! s:current_attr(group)
let l:synid = synIDtrans(hlID(a:group))
let l:attrs = []
for l:attr in ["bold", "italic", "reverse", "standout", "underline", "undercurl"]
if synIDattr(l:synid, l:attr, "gui") == 1
call add(l:attrs, l:attr)
endif
endfor
return join(l:attrs, ",")
endfun
fun! s:current_color(group, what, mode)
let l:color = synIDattr(synIDtrans(hlID(a:group)), a:what, a:mode)
if l:color == -1
return ""
else
return substitute(l:color, "^#", "", "")
endif
endfun
fun! s:load_color_def(group, def)
call s:X(a:group, get(a:def, "guifg", s:current_color(a:group, "fg", "gui")),
\ get(a:def, "guibg", s:current_color(a:group, "bg", "gui")),
\ get(a:def, "attr", s:current_attr(a:group)),
\ get(a:def, "ctermfg", s:current_color(a:group, "fg", "cterm")),
\ get(a:def, "ctermbg", s:current_color(a:group, "bg", "cterm")))
if !s:low_color
for l:prop in ["ctermfg", "ctermbg"]
let l:override_key = "256".l:prop
if has_key(a:def, l:override_key)
exec "hi ".a:group." ".l:prop."=".a:def[l:override_key]
endif
endfor
endif
endfun
fun! s:load_colors(defs)
for [l:group, l:def] in items(a:defs)
if l:group == "background"
call s:load_color_def("LineNr", l:def)
call s:load_color_def("NonText", l:def)
call s:load_color_def("Normal", l:def)
else
call s:load_color_def(l:group, l:def)
endif
unlet l:group
unlet l:def
endfor
endfun
call s:load_colors(s:overrides)
delf s:load_colors
delf s:load_color_def
delf s:current_color
delf s:current_attr
endif
" delete functions {{{
delf s:X
delf s:remove_italic_attr
delf s:prefix_highlight_value_with
delf s:rgb
delf s:is_empty_or_none
delf s:color
delf s:rgb_color
delf s:rgb_level
delf s:rgb_number
delf s:grey_color
delf s:grey_level
delf s:grey_number
" }}}

93
.vimrc
View File

@ -1,29 +1,58 @@
"""""""""""""""""""""" " \ / o _ _
" __ _____ __ __ " " \/ | | | |
" \ \ / /_ _| \/ | "
" \ V / | || |\/| | "
" \_/ |___|_| |_| "
" "
""""""""""""""""""""""
set nocp set nocp
set shell=/usr/bin/zsh
so ~/.vim/user/files.vim
colorscheme desert
syntax enable
set tsr+=~/.vim/thesaurus/thesaurus-vim-en set tsr+=~/.vim/thesaurus/thesaurus-vim-en
set dict+=/usr/share/dict/words set dict+=/usr/share/dict/words
set foldmethod=syntax set tags=./tags;/ " Search up to / for tags file
set foldlevelstart=5 set updatetime=100
set clipboard=unnamedplus " Use system clipboard
if empty($DISPLAY)
colorscheme elflord
else
set termguicolors
let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
syntax enable
colorscheme jellybeans
endif
let mapleader=" "
"nnoremap <Leader>w yiwq:PIe `~/.shell_aliases ws <Esc>
"nnoremap <Leader>w yiw:let srr_back = &srr <BAR> set srr=><CR>q:PIr! /home/sage/.shell_aliases wf <Esc>
" TODO Check if file needs saving
" TODO Set and unset srr from within map
set srr=>
nnoremap <Leader>w yiw:w<CR>q:PIr! /home/sage/.shell_aliases wf <CR>yyuq:PIe <ESC><CR>
nnoremap <Leader>s yiw:w<CR>q:PIr! /home/sage/.shell_aliases wf <CR>yyuq:PIvsp <ESC><CR>
" " Auto open NERDTree but focus editing window
" autocmd VimEnter * NERDTree
" autocmd BufEnter * NERDTreeMirror
" autocmd VimEnter * wincmd w
" autocmd VimEnter * NERDTreeFind
" autocmd VimEnter * wincmd w
" " Auto close NERDTree
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" autocmd VimEnter COMMIT_EDITMSG NERDTreeClose
set mouse=a
set backspace=indent,eol,start set backspace=indent,eol,start
set splitbelow set splitbelow
set splitright set splitright
nnoremap :W<CR> :w<CR> set foldmethod=syntax
set foldlevelstart=99
" Leave some room when scrolling
set scrolloff=3
set conceallevel=0 set conceallevel=0
@ -33,13 +62,9 @@ set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
" Except for makefiles " Except for makefiles
autocmd FileType make setlocal noexpandtab autocmd FileType make setlocal noexpandtab
" Search up to / for tags file
set tags=./tags;/
" *** BINDINGS *** " *** BINDINGS ***
" Beautful escapes " Beautful escapes
inoremap fd <Esc>l
inoremap jj <Esc>l inoremap jj <Esc>l
inoremap jk <Esc>l inoremap jk <Esc>l
inoremap kj <Esc>l inoremap kj <Esc>l
@ -55,7 +80,6 @@ set number relativenumber
set ignorecase smartcase set ignorecase smartcase
set autoindent smartindent set autoindent smartindent
"Yank to clipboard "Yank to clipboard
nnoremap <C-C> "+yy nnoremap <C-C> "+yy
vnoremap <C-C> "+y vnoremap <C-C> "+y
@ -81,7 +105,9 @@ tnoremap <C-K> <C-W><C-K>
tnoremap <C-L> <C-W><C-L> tnoremap <C-L> <C-W><C-L>
tnoremap <C-H> <C-W><C-H> tnoremap <C-H> <C-W><C-H>
nnoremap ! :! " Jump to next/prev uppercase/underscore
nnoremap f<cr> /[A-Z_]<cr>
nnoremap F<cr> ?[A-Z_]<cr>
" Map directions to end/beginning of lines " Map directions to end/beginning of lines
nnoremap yl y$ nnoremap yl y$
@ -96,14 +122,6 @@ nnoremap <C-P> m`v$hp``y$
nnoremap <Leader>PP :ha > ~/.vim.ps<CR>:!xdg-open ~/.vim.ps<CR> nnoremap <Leader>PP :ha > ~/.vim.ps<CR>:!xdg-open ~/.vim.ps<CR>
vnoremap <Leader>PP :ha > ~/.vim.ps<CR>:!xdg-open ~/.vim.ps<CR> vnoremap <Leader>PP :ha > ~/.vim.ps<CR>:!xdg-open ~/.vim.ps<CR>
" Return spelling corrections
iab ruetn return
iab reteun return
iab reutner return
nnoremap cw ciw
nnoremap ciw cw
" Swap current word with next " Swap current word with next
nnoremap gs "xdiwdwep"xp nnoremap gs "xdiwdwep"xp
" Inverted " Inverted
@ -124,9 +142,11 @@ nnoremap <Leader>gu :!git add -u<CR>
nnoremap <Leader>ga :!git add %<CR> nnoremap <Leader>ga :!git add %<CR>
nnoremap <Leader>r :source ~/.vimrc<CR> nnoremap <Leader>r :source ~/.vimrc<CR>
nnoremap <Leader>v :tabedit~/.vimrc<CR>
nnoremap <Leader>n :tabedit~/.notes<CR> nnoremap <Leader>n :tabedit~/.notes<CR>
nnoremap <Leader>v :vert term ++cols=80<CR>
nnoremap <Leader>t :term ++rows=20<CR>
autocmd BufNewFile,BufRead * if expand('%:t') !~ '\.' | setl spell | endif autocmd BufNewFile,BufRead * if expand('%:t') !~ '\.' | setl spell | endif
" Expand %% to the current files dir " Expand %% to the current files dir
@ -146,3 +166,16 @@ if has ("autocmd")
autocmd BufNewFile makefile 0r ~/.vim/templates/makefile autocmd BufNewFile makefile 0r ~/.vim/templates/makefile
augroup END augroup END
endif endif
nnoremap <RightMouse> p
inoremap <RightMouse> <Esc>p
" Spelling corrections
iab ruetn return
iab reteun return
iab reutner return
" Keep same gutter color when errored
highlight! link SignColumn LineNr
so ~/.vim/user/files.vim

View File

@ -1,2 +1 @@
export PATH="$HOME/.cargo/bin:$PATH"

89
.zshrc
View File

@ -1,5 +1,5 @@
source ~/.zsh_local source ~/.zsh_local
source ~/.shell_aliases source /usr/share/doc/fzf/examples/completion.zsh
HISTFILE=~/.histfile HISTFILE=~/.histfile
HISTSIZE=10000 HISTSIZE=10000
@ -23,52 +23,40 @@ export EDITOR="vim"
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' matcher-list '+' '+m:{[:lower:]}={[:upper:]}' '+m:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+r:|[._-]=** r:|=** l:|=*' zstyle ':completion:*' matcher-list '+' '+m:{[:lower:]}={[:upper:]}' '+m:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+r:|[._-]=** r:|=** l:|=*'
zstyle :compinstall filename '~/.zshrc' zstyle :compinstall filename '~/.zshrc'
zstyle ':completion:*' ignored-patterns '*.class'
autoload -Uz compinit autoload -Uz compinit
compinit compinit
autoload -Uz vcs_info
precmd() { vcs_info }
zstyle ':vcs_info:git:*' formats ' [%b]'
_COMP_COLOR=${COMP_COLOR:-"{white}"}
_USER_COLOR=${USER_COLOR:-"{blue}"}
setopt PROMPT_SUBST
PROMPT="[%(!.%B%F{red}.%B%F$_USER_COLOR)%n%b%F{white}@%B%F$_COMP_COLOR%m%b%f] %b%F{green}%~%B%F{yellow}${vcs_info_msg_0_} %B%f$%b%f "
# enable color support of ls and also add handy aliases # enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto' alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto' alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto' alias egrep='egrep --color=auto'
fi fi
export PATH=./:$PATH export PATH=./:~/.bin:/usr/local/go/bin:$PATH
fignore=(o) fignore=(o)
function SetTtyColors() { function SetTtyColors() {
echo -en "\e]P0191e1f" #black 1 echo -en "\e]P0""292e2f" #black 1
echo -en "\e]P1dc4848" #darkgrey 2 echo -en "\e]P1""dc4848" #darkgrey 2
echo -en "\e]P200aa00" #darkred 3 echo -en "\e]P2""00aa00" #darkred 3
echo -en "\e]P3d99f4e" #red 4 echo -en "\e]P3""d99f4e" #red 4
echo -en "\e]P44444aa" #darkgreen 5 echo -en "\e]P4""4444aa" #darkgreen 5
echo -en "\e]P5c436b9" #green 6 echo -en "\e]P5""c436b9" #green 6
echo -en "\e]P600aaaa" #brown 7 echo -en "\e]P6""00aaaa" #brown 7
echo -en "\e]P7d7d7d7" #yellow 8 echo -en "\e]P7""d7d7d7" #yellow 8
echo -en "\e]P87b7b7b" #darkblue 9 echo -en "\e]P8""7b7b7b" #darkblue 9
echo -en "\e]P9ff6f6f" #blue 10 echo -en "\e]P9""6f6fff" #blue 10
echo -en "\e]PA55ff55" #darkmagenta11 echo -en "\e]PA""55ff55" #darkmagenta11
echo -en "\e]PBffed8b" #magenta 12 echo -en "\e]PB""ffed8b" #magenta 12
echo -en "\e]PC5555ff" #darkcyan 13 echo -en "\e]PC""5555ff" #darkcyan 13
echo -en "\e]PDff6eff" #cyan 14 echo -en "\e]PD""ff6eff" #cyan 14
echo -en "\e]PE55ffff" #lightgray 15 echo -en "\e]PE""55ffff" #lightgray 15
echo -en "\e]PFaaaaaa" #white 16 echo -en "\e]PF""aaaaaa" #white 16
clear clear
} }
@ -76,43 +64,12 @@ if [ "$TERM" = "linux" ]; then
SetTtyColors SetTtyColors
fi fi
function _open2(){
var=$(fc -ln -1);
if [[ $var != *"grep"* ]]; then;
return;
fi;
var=$(sed "s/grepr/grepr -l/" <<< $var);
vim -p `zsh -c "$var" | grep $1`
}
# After running grepr, `open` plus a match will
# search history for the most recent grepr,
# and open the first file matching the text
# in Vim, at the first matching line number
function _open(){
command=$(fc -ln -1);
count=1;
while [[ $command != *"grepr"* ]]; do
((count++))
command=$(fc -ln -$count | head -n 1);
done;
# echo '$@'
line=$(zsh -c "$command" | grep $1 | sed "s/^[^:]*://g" | sed "s/:.*//" | head -n 1);
echo $line;
file=$(zsh -c "$command" | grep $1 | sed "s/:.*//" | head -n 1);
echo $file;
vim +$line -p `echo $file`;
}
function pushdot { function pushdot {
cd ~/.dotfiles && cd ~/.dotfiles &&
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
git commit -a && git push -u origin master git commit -a && git push -u origin master &
else else
git commit -a -m "$1" && git push -u origin master git commit -a -m "$1" && git push -u origin master | /dev/null &
fi fi
cd - cd -
} }
@ -123,4 +80,6 @@ function getdot {
cd - cd -
} }
export fsu="vaillanc@linprog.cs.fsu.edu" eval "$(starship init zsh)"
source ~/.cargo/env
source ~/.shell_aliases

61
copy.sh
View File

@ -1,6 +1,61 @@
#!/bin/bash #!/bin/bash
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" moving_files="$(find $SCRIPT_DIR -mindepth 1 -maxdepth 1 -type f -not -name "copy.sh" -not -name "*.git*")"
moving_files=$(echo -e "$moving_files\n$(find $SCRIPT_DIR/.vim/colors/ -mindepth 1)")
moving_files=$(echo -e "$moving_files\n$(find $SCRIPT_DIR/.config/ -mindepth 1)")
ln -sf $SCRIPT_DIR/.* ~/ home_files=""
yes | rm -r ~/.git for f in $moving_files; do
home_file="$HOME$(echo $f | sed "s@$SCRIPT_DIR@@")"
if test -f "$home_file" && ! diff $home_file $f &>/dev/null; then
home_files="$home_files\n $home_file"
fi
done
if [[ "$home_files" != "" ]]; then
echo -n "Warning! This will overwrite all of the following files:"
echo -e $home_files
read -r -p "Are you sure you want to continue? [y/N] " response
response=${response,,} # tolower
if ! [[ "$response" =~ ^(yes|y)$ ]]; then
exit 1
fi
fi
for f in $moving_files; do
echo "$f => ~/"
ln -sf $f ~/
done
mkdir -p ~/.vim/colors
ln -sf $SCRIPT_DIR/.vim/colors/* ~/.vim/colors/
mkdir -p ~/.config/
ln -sf $SCRIPT_DIR/.config/* ~/.config/
touch ~/.zsh_local
if ! test -f ~/.gitlocal; then
echo "[user]" > ~/.gitlocal
echo " email = sagev9000@tutanota.com" >> ~/.gitlocal
fi
# Install required packages
if [[ "$1" == "--install" ]]; then
echo -n "Rust is "
if ! command -v cargo; then
echo "not installed. Installing..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
else
echo "installed."
fi
. "$HOME/.cargo/env"
if command -v cargo; then
cargo install bat
fi
sh -c "$(curl -fsSL https://starship.rs/install.sh)"
echo "Starship requires an NFont: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip"
echo "You may wish to install fzf"
fi