Commit 573b186a authored by hadret's avatar hadret

feat: initial commit.

parents
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
vim/bundle
vim/view
vim/.vim/autoload
zsh/.antigen/
MIT License
Copyright (c) 2019 hadret
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, 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 PARTICULAR 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 CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# dotfiles
dotfiles are now being handled by [GNU
Stow](https://www.gnu.org/software/stow/). Rolling them out for the first time
is as easy as going through the folder structure from the inside of the
dotfiles repo directory and running `stow smth`. For example:
```bash
cd ~/.dotfiles
stow fish
```
# colors for exa
set -x EXA_COLORS "uu=38;5;249:un=38;5;241:gu=38;5;245:gn=38;5;241:da=38;5;245:sn=38;5;7:sb=38;5;7:ur=38;5;3;1:uw=38;5;5;1:ux=38;5;1;1:ue=38;5;1;1:gr=38;5;249:gw=38;5;249:gx=38;5;249:tr=38;5;249:tw=38;5;249:tx=38;5;249:fi=38;5;248:di=38;5;253:ex=38;5;1:xa=38;5;12:*.png=38;5;4:*.jpg=38;5;4:*.gif=38;5;4"
# GPG setup
set -x GPG_TTY "(tty)"
set -x SSH_AUTH_SOCK "$HOME/.gnupg/S.gpg-agent.ssh"
gpgconf --launch gpg-agent
# setup locale
set -x LANG "en_US.UTF-8"
set -x LC_COLLATE "en_US.UTF-8"
set -x LC_CTYPE "en_US.UTF-8"
set -x LC_MESSAGES "en_US.UTF-8"
set -x LC_MONETARY "en_US.UTF-8"
set -x LC_NUMERIC "en_US.UTF-8"
set -x LC_TIME "en_US.UTF-8"
set -x LC_ALL "en_US.UTF-8"
# setup fzf
set -x FZF_DEFAULT_OPTS '--color=bg+:#635196,fg:#b4b4b9,pointer:#ffb07b,marker:#ff761a,prompt:#34bfa4,info:#ffd392'
set -x FZF_DEFAULT_COMMAND "fd -t f -E Library -E Pictures -E Music"
set -x FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND"
set -x FZF_CTRL_T_OPTS "--ansi --preview '(highlight -O ansi -l {} || cat {}) 2> /dev/null | head -100' --height 50%"
set -x FZF_ALT_C_COMMAND "fd -t d -E Library"
set -x FZF_FIND_FILE_COMMAND "$FZF_DEFAULT_COMMAND"
set -x FZF_FIND_FILE_OPTS "$FZF_CTRL_T_OPTS"
set -x FZF_CD_COMMAND "$FZF_ALT_C_COMMAND"
set -x FZF_CD_WITH_HIDDEN_COMMAND "fd --hidden -t d -E Library -E .git"
# set -x FZF_ENABLE_OPEN_PREVIEW 1
# setup default EDITOR
set -x EDITOR vim
# setup asdf
source ~/.asdf/asdf.fish
# load iTerm2 integration scripts
# source ~/.iterm2_shell_integration.fish
# load virtualfish integration
# eval (python -m virtualfish auto_activation update_python)
set -g VIRTUALFISH_VERSION 1.0.6
set -g VIRTUALFISH_PYTHON_EXEC /Users/hadret/.asdf/installs/python/3.7.4/bin/python
source /Users/hadret/.asdf/installs/python/3.7.4/lib/python3.7/site-packages/virtualfish/virtual.fish
source /Users/hadret/.asdf/installs/python/3.7.4/lib/python3.7/site-packages/virtualfish/auto_activation.fish
source /Users/hadret/.asdf/installs/python/3.7.4/lib/python3.7/site-packages/virtualfish/update_python.fish
emit virtualfish_did_setup_plugins
jethrokuan/z
patrickf3139/Colored-Man-Pages
jethrokuan/fzf
evanlucas/fish-kubectl-completions
oh-my-fish/plugin-bang-bang
function buba --description 'brew cu -a'
brew cu -a
end
function bubaf --description 'brew cu -af'
brew cu -af
end
function bubu --description 'port bubu to fish'
brew update
brew outdated
brew upgrade
brew cleanup
end
function cask -d 'provide brew cask functionality'
brew cask $argv
end
function cat --description 'use bat instead'
bat $argv
end
function certcheck --description 'check SSL certificate for a website'
curl --insecure -v "$argv" ^&1 | awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ { if (cert) print }';
end
function fbr -d "Fuzzy-find and checkout a branch"
set -l IFS ''
set -l branches (git branch --all | grep -v HEAD | sed "s/.* //" | sed "s#remotes/[^/]*/##" | sort -u | awk '{print "\x1b[32;1mbranch\x1b[m\t" $1}')
set -l target (echo $branches | fzf --no-hscroll --ansi +m -d "\t" -n 2)
git checkout (echo "$target" | awk '{print $2}')
end
function fco -d "Fuzzy-find and checkout git tag or branch."
set -l IFS ''
set -l tags (git tag | awk '{print "\x1b[36;1mtag\x1b[m\t" $1}')
set -l branches (git branch --all | grep -v HEAD | sed "s/.* //" | sed "s#remotes/[^/]*/##" | sort -u | awk '{print "\x1b[32;1mbranch\x1b[m\t" $1}')
if test -z $tags
set targets (echo $branches)
else
set targets (echo $branches; echo $tags)
end
set -l target (echo $targets | fzf --no-hscroll --ansi +m -d "\t" -n 2)
git checkout (echo "$target" | awk '{print $2}')
end
function fish_prompt
set -l exit_code $status
test $SSH_TTY
and printf (set_color brred)$USER(set_color brwhite)'@'(set_color bryellow)(prompt_hostname)' '
test "$USER" = 'root'
and echo (set_color brred)"#"
# Main
if test $exit_code -ne 0
echo -n (set_color brcyan)(prompt_pwd) (set_color brred)'❯'(set_color brred)'❯'(set_color brred)'❯ '
else
echo -n (set_color brcyan)(prompt_pwd) (set_color brred)'❯'(set_color bryellow)'❯'(set_color brgreen)'❯ '
end
end
function fish_right_prompt -d "Write out the right prompt"
set_color normal
set -g __fish_git_prompt_showdirtystate 1
set -g __fish_git_prompt_showcolorhints
set -g __fish_git_prompt_showstashstate 1
set -g __fish_git_prompt_showuntrackedfiles 1
set -g __fish_git_prompt_showupstream informative
set -g __fish_git_prompt_color_branch brgreen
set -g __fish_git_prompt_color_dirtystate brmagenta
set -g __fish_git_prompt_color_stagedstate bryellow
set -g __fish_git_prompt_color_invalidstate brred
set -g __fish_git_prompt_color_untrackedfiles brcyan
set -g __fish_git_prompt_color_prefix brblack
set -g __fish_git_prompt_color_suffix brblack
if set -q VIRTUAL_ENV
echo -n -s (set_color brblack) "(" (set_color magenta) (basename "$VIRTUAL_ENV") (set_color brblack) ")"
end
printf '%s ' (__fish_git_prompt)
set_color normal
end
function fishrc --description 'edit config.fish file'
vim ~/.config/fish/config.fish
end
function fs --description 'Switch tmux session'
if test $TMUX
tmux list-sessions -F "#{session_name}" | fzf | read -l result; and tmux switch-client -t "$result"
else
tmux attach-session -t "local"
end
end
function fshow -d "fzf-based git commit preview."
# if no arguments passed, use current branch
if not count $argv > /dev/null
set argv (git branch | grep "^\*" | string trim -c "\* ")
end
git log --graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$argv" | fzf --ansi --no-sort --reverse --tiebreak=index --bind=ctrl-s:toggle-sort --bind "ctrl-m:execute: (grep -o '[a-f0-9]\{7\}' | head -1 | xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' {}
FZF-EOF"
end
function ft --description 'start default tmux session'
mux start local
end
function gcomp --description 'Chose GCloud compute instance to work with'
set gcompcache ~/.config/gcloud/gcomp-(gproj current | awk '{ print $1}').cache
if not test -s $gcompcache
gcloud compute instances list > $gcompcache
end
# if no arguments passed, print current project
if not count $argv > /dev/null
set argv list
end
# print & switch all the things!
switch $argv
case cc clear-cache
rm $gcompcache
echo "Cache cleared!"
case uc update-cache
gcloud compute instances list > $gcompcache
echo "Cache updated!"
case l ls list
cat -p $gcompcache
case d describe
gcloud compute instances describe (cat -p $gcompcache | awk 'NR>1 { print $1}' | fzf) | less
case s ssh
gcloud compute ssh (cat -p $gcompcache | awk 'NR>1 { print $1}' | fzf)
case f firewall
gcloud compute firewall-rules list
case '*'
echo Wrong usage you bastardo\!
end
end
function gen_ssh --description 'concat config files for ssh'
cat ~/.ssh/config.d/*.conf > ~/.ssh/config
end
set -x GPG_TTY "(tty)"
set -x SSH_AUTH_SOCK "$HOME/.gnupg/S.gpg-agent.ssh"
gpgconf --launch gpg-agent
function gproj --description 'Chose GCloud project to work with'
set gprojcache ~/.config/gcloud/gproj.cache
if not test -s $gprojcache
gcloud projects list > $gprojcache
end
# if no arguments passed, print current project
if not count $argv > /dev/null
set argv current
end
# print & switch all the things!
switch $argv
case cc clear-cache
rm $gprojcache
echo "Cache cleared!"
case uc update-cache
gcloud projects list > $gprojcache
echo "Cache updated!"
case l ls list
cat -p $gprojcache
case s set
cat -p $gprojcache | sed 1d | fzf | awk '{print $1}' | xargs gcloud config set project
case c current
grep (awk -F'= ' '/project/ { print $2}' ~/.config/gcloud/configurations/config_default) $gprojcache
case '*'
echo Wrong usage you bastardo\!
end
end
function l --description 'ls -l'
exa -l --group-directories-first --git --header $argv
end
alias ll l
function l1 --description 'list in single column'
exa -1 --group-directories-first --git $argv
end
function l1a --description 'list in single column including hidden'
exa -Fa1 --group-directories-first --git $argv
end
function la --description 'list with hidden stuff'
exa -Fa --group-directories-first --git --header $argv
end
function lla --description 'long list with hidden'
exa -la --group-directories-first --git --header $argv
end
function lle
exa -lbBghHimS --group-directories-first --git --header $argv
end
function ls --description 'list'
exa --group-directories-first --git --header $argv
end
function ltree
exa -hTl $argv
end
function mkcd --description 'create folder and cd to it'
set -l folder $argv
mkdir -p $folder
cd $folder
end
function mutt --description 'neomutt'
neomutt $argv
end
function mux --description 'be shorted when using tmuxinator'
tmuxinator $argv
end
function myip --description 'show my IP address'
curl -s https://api.ipify.org
end
function ncdu --description 'ncdu with colors etc.'
command ncdu --color dark -rr -x --exclude .git --exclude node_modules $argv
end
function path --description 'show currect PATH'
echo $PATH | xargs -n1
end
function ping --description 'prettyping'
prettyping $argv
end
function rangerc --description 'edit ranger config file'
vim ~/.dotfiles/ranger/.config/ranger/rc.conf
end
function rr
set -x tempfile (mktemp -t tmp.XXXXXX)
ranger --choosedir="$tempfile" $argv
if test -f $tempfile
cd (cat $tempfile)
end
set -e tempfile
rm -f -- $tempfile
end
alias rcd rr
function ssh --description 'generate ssh config file, export TERM, connect'
env TERM=xterm-256color ssh $argv
end
function vimrc --description 'edit vim config files'
vim ~/.dotfiles/vim/.vimrc ~/.dotfiles/vim/.vimrc.plug
end
function yoink
open -a Yoink $argv
end
[alias]
# View abbreviated SHA, description, and history graph of the latest 20
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View even nicer log
ll = log --oneline --decorate --color --graph
# View the current working tree status using the short format
s = status -s
# View the current working tree status
st = status
# Sign the commit with your GPG key:
sign = !"git commit -S -m"
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with- stat"
# `git di $number` shows the diff between the state `$number` revisions ago
# and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# Make use of gdsf if available:
dsf = "!f() { [ -z \"$GIT_PREFIX\" ] || cd \"$GIT_PREFIX\" && git diff --color \"$@\" | diff-so-fancy | less --tabs=4 -RFX; }; f"
# Pull in remote changes for the current repository and all its submodules
p = !"git pull; git submodule foreach git pull origin master"
# Clone a repository including all submodules
c = clone --recursive
# Commit all changes
ca = !git add -A && git commit -av
# Commit all changes and write commit message
cam = !git commit -a -m
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# Amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEAD
# Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
# Interactive rebase with the given number of latest commits
reb = "!r() { git rebase -i HEAD~$1; }; r"
# Remove the old tag with this name and tag the latest commit with it
retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1;}; r"
# Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f"
# Find tags containing commit
ft = "!f() { git describe --always --contains $1; }; f"
# Find commits by source code
fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
# Find commits by commit message
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
# Remove branches that have already been merged with master
# a.k.a. ‘delete merged’
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
# List contributors with number of commits
contributors = shortlog --summary --numbered
[apply]
whitespace = fix
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold # line info
old = red # deletions
new = green # additions
[color "status"]
added = yellow
changed = green
untracked = cyan
[core]
# Treat spaces before tabs and all kinds of trailing whitespace as an error
# [default] trailing-space: looks for spaces at the end of a line
# [default] space-before-tab: looks for spaces before tabs at the beginning
# of a line
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
# Make `git rebase` safer on macOS
# More info: http://www.git-tower.com/blog/make-git-rebase-safe-on-osx
trustctime = false
# Prevent showing files whose names contain non-ASCII symbols as unversioned.
# http://michael-kuehnel.de/git/2014/11/21/git-mac-osx-and-german-umlaute.html
precomposeunicode = false
# Exclude files for every single git repo from one global file
excludesfile = ~/.global_ignore
[diff]
# Detect copies as well as renames
renames = copies
# Enable an experimental heuristic that shifts the hunk boundary in an
# attempt to make the resulting patch easier to read
indentHeuristic = true
[diff "bin"]
# Use `hexdump` to diff binary files
textconv = hexdump -v -C
[merge]
# Include summaries of merged commits in newly created merge commit messages
log = true
[push]
default = simple
[credential]
helper = cache --timeout 3600
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[user]
# Set in ~/.gitconfig_local
[gpg]
# Set in ~/.gitconfig_local
[commit]
# Set in ~/.gitconfig_local
[include]
path = ~/.gitconfig_local
tags
site.retry
.vault
roles/external/*
*
!gpg.conf
!gpg-agent.conf
!.gitignore
enable-ssh-support
pinentry-program /usr/local/bin/pinentry-mac
default-cache-ttl 60480000
max-cache-ttl 60480000
write-env-file
use-standard-socket
use-agent
personal-cipher-preferences AES256 AES192 AES CAST5
personal-digest-preferences SHA512 SHA384 SHA256 SHA224
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
cert-digest-algo SHA512
s2k-digest-algo SHA512
s2k-cipher-algo AES256
charset utf-8
fixed-list-mode
no-comments
no-emit-version
keyid-format 0xlong
list-options show-uid-validity
verify-options show-uid-validity
with-fingerprint
*
!colorschemes
!colorschemes/falcon.py
!plugins
!plugins/devicons_linemode.py
!commands.py
!rc.conf
!.gitignore
!devicons.py
# Falcon ranger colorscheme.
from __future__ import (absolute_import, division, print_function)
from ranger.gui.colorscheme import ColorScheme
from ranger.gui.color import (
cyan, magenta, red, white, default,
normal, bold, reverse,
default_colors,
)
class Solarized(ColorScheme):
progress_bar_color = 3
def use(self, context): # pylint: disable=too-many-branches,too-many-statements
fg, bg, attr = default_colors
if context.reset:
return default_colors
elif context.in_browser:
fg = 7
# selected means under cursor
if context.selected:
attr = reverse
fg = 15
else:
attr = normal
if context.empty or context.error:
fg = 235
bg = 160
if context.border:
fg = default
if context.media:
if context.image:
fg = 5
else:
fg = 5
if context.container:
fg = 61
if context.directory:
fg = 253
elif context.executable and not \
any((context.media, context.container,
context.fifo, context.socket)):
fg = 1
attr |= bold
if context.socket:
fg = 136
bg = 230
attr |= bold
if context.fifo:
fg = 136
bg = 230
attr |= bold
if context.device:
fg = 244
bg = 230
attr |= bold
if context.link:
fg = 37 if context.good else 160
attr |= bold
if context.bad:
bg = 235
if context.tag_marker and not context.selected:
attr |= bold
if fg in (red, magenta):
fg = white
else:
fg = red
if not context.selected and (context.cut or context.copied):
fg = 234
attr |= bold
if context.main_column:
if context.selected:
attr |= bold
if context.marked:
attr |= bold
bg = 3
fg = 8
if context.badinfo:
if attr & reverse:
bg = magenta
else:
fg = magenta
if context.inactive_pane:
fg = 3
elif context.in_titlebar:
attr |= bold
if context.hostname:
fg = 16 if context.bad else 249
if context.bad:
bg = 166
elif context.directory:
fg = 253
elif context.tab:
fg = 0 if context.good else 7
bg = 5 if context.good else 237
elif context.link:
fg = cyan
elif context.in_statusbar:
if context.permissions:
if context.good:
fg = 3
elif context.bad:
fg = 160
bg = 235
if context.marked:
attr |= bold | reverse
fg = 2
bg = 15
if context.message:
if context.bad:
attr |= bold
fg = 160
bg = 235
if context.loaded:
bg = self.progress_bar_color
if context.text:
if context.highlight:
attr |= reverse
if context.in_taskview:
if context.title:
fg = 93
if context.selected:
attr |= reverse
if context.loaded: