Skip to content

Commit

Permalink
style: formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
  • Loading branch information
vladdoster committed Jul 18, 2022
1 parent 7cfc859 commit b04b4ea
Show file tree
Hide file tree
Showing 14 changed files with 313 additions and 323 deletions.
7 changes: 5 additions & 2 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ brew "pandoc"
brew "ripgrep"
brew "rust"
brew "shellcheck"
brew "subversion"
brew "shfmt"
brew "stow"
brew "subversion"
Expand All @@ -55,8 +56,10 @@ brew "unzip"
brew "wget"
brew "xz"
brew "zsh"
cask "1password-beta"
cask "1password-cli-beta"
cask "1password"
cask "1password-cli"
cask "docker"
cask "font-ibm-plex-mono"
cask "hammerspoon"
cask "kitty"
cask "vivaldi-snapshot"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ neovim: destination:=$$HOME/.config/nvim

.SILENT: neovim
$(CONFIGS): ## Clone a program's configuration repository
sh -c "[ -d $(destination) ] || git clone $(GH_URL)/$@-configuration $(destination)"
sh -c "[ ! -d $(destination) ] && git clone $(GH_URL)/$@-configuration $(destination)"

install: | clean ## Deploy dotfiles via GNU install
find * -maxdepth 0 -mindepth 0 -type d -exec stow --verbose 1 --stow --target $$HOME {} \;
Expand Down Expand Up @@ -68,7 +68,7 @@ python/prog: ## Install useful Python programs
@python3 -m pip install --upgrade pip
@python3 -m pip install --upgrade --trusted-host pypi.org --trusted-host files.pythonhosted.org --no-compile \
autopep8 \
black bpytop \
beautysh black bpytop \
flake8 \
isort \
mdformat mdformat-config mdformat-gfm mdformat-shfmt mdformat-tables mdformat-toc \
Expand Down
1 change: 1 addition & 0 deletions bash/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ export PATH=/Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
source /Users/null/perl5/perlbrew/etc/bashrc
9 changes: 6 additions & 3 deletions bin/.local/bin/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

ZSH := $(shell command -v zsh 2> /dev/null)
.DEFAULT_SHELL := $(ZSH)
.ONESHELL:
Expand All @@ -7,7 +8,7 @@ ZSH := $(shell command -v zsh 2> /dev/null)
zwc:
$(or $(ZSH),:) -fc 'for f in *.zsh; do zcompile -R -- $$f.zwc $$f || exit; done'

GITL=https://api.github.com/repos
GIT=https://api.github.com/repos
GNU=http://ftpmirror.gnu.org/gnu

PROGS := \
Expand Down Expand Up @@ -86,7 +87,7 @@ mpfr: URL:=$(GNU)/mpfr
ncurses: URL:=$(GNU)/ncurses
ninja: URL:=$(GIT)/ninja-build/ninja
node: URL:=https://nodejs.org/dist/v15.17.6/node-v14.17.6.tar.gz
nvim: URL:=$(GIT)/neovim/neovim CMAKE_BUILD_TYPE=RelWithDebInfo
nvim: URL:=$(GIT)/neovim/neovim

openjdk: URL:=$(GIT)/openjdk/jdk
openssh-hpn: URL:=https://github.com/vladdoster/openssh-portable/archive/refs/tags/hpn-8_8_P1.tar.gz
Expand Down Expand Up @@ -118,14 +119,16 @@ wget: URL:=$(GNU)/wget
yasm: URL:=$(GIT)/yasm/yasm
zlib: URL:=$(GIT)/madler/zlib

.PHONY: zsh
zsh: URL:=$(GIT)/zsh-users/zsh

install : $(PROGS)
go-install : $(GO_PROGS)
py-install : $(PY_PROGS)

$(PROGS):
$(ZSH) $${PWD}/installer $(@) $(GNU)/$(@)/$(shell curl $(GNU)/$(@)/ | grep -oE "$(@)-([0-9\-]+\.){0,3}(\*|[0-9\.]+)\.tar\.gz" | sort -V -t. -r -k1,1 -k2,2 -k3,3 | head -1) $(OPTS)
url:=$(eval$(if $(filter-out "gnu", $(processed_input)), $(GNU)/$(@)/$(shell curl $(GNU)/$(@)/ | grep -oE "$(@)-([0-9\-]+\.){0,3}(\*|[0-9\.]+)\.tar\.gz" | sort -V -t. -r -k1,1 -k2,2 -k3,3 | head -1), $(URL)/tarball))
$(ZSH) $${PWD}/installer $(@) $(url)

$(PY_PROGS):
python3 -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org $(@)
10 changes: 2 additions & 8 deletions git/.config/git/config
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
hunk-header-line-number-style = "#067a00"
hunk-header-style = file line-number syntax
[homebrew]
analyticsmessage = true
caskanalyticsmessage = true
analyticsmessage = true
caskanalyticsmessage = true
[http]
sslVerify = false
[https]
Expand Down Expand Up @@ -164,9 +164,3 @@
unrelease = !sh -c 'git tag -d v$1 && git pso :v$1' -
w = show
# vim:ft=toml:sw=2:sts=2
[fsck]
zeroPaddedFilemode = ignore
[fetch "fsck"]
zeroPaddedFilemode = ignore
[receive "fsck"]
zeroPaddedFilemode = ignore
1 change: 0 additions & 1 deletion zsh/.config/zsh/.zlogin
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
9 changes: 5 additions & 4 deletions zsh/.config/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ zmodload zsh/complist
# for f in "$files[@]"; do
# . "${ZDOTDIR:-$HOME/.config/zsh}/${f}".zsh
# done
export HOMEBREW_CURL_PATH=/home/linuxbrew/.linuxbrew/Cellar/curl/7.84.0/bin/curl
source $HOME/.config/zsh/aliases.zsh
source $HOME/.config/zsh/fzf.zsh
source $HOME/.config/zsh/util.sh
Expand Down Expand Up @@ -78,9 +77,8 @@ setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt share_history # share command history data

setopt no_beep # do not beep on error
setopt auto_cd # If you type foo, and it is not a command, and it is a directory in your cdpath, go there
setopt multios # perform implicit tees or cats when multiple redirections are attempted
setopt no_beep
setopt multios
setopt prompt_subst # enable parameter expansion, command substitution, and arithmetic expansion in the prompt
setopt interactive_comments # Allow comments even in interactive shells (especially for Muness)
setopt pushd_ignore_dups # don't push multiple copies of the same directory onto the directory stack
Expand Down Expand Up @@ -115,3 +113,6 @@ zstyle ':completion:*:descriptions' format '[%d]'
zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec))'
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'

# vim: ft=zsh:
### End of Zinit's installer chunk
35 changes: 19 additions & 16 deletions zsh/.config/zsh/aliases.zsh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# #!/usr/bin/env zsh
if echo "$-" | grep i >/dev/null; then export IS_TTY="${IS_TTY:=false}"; fi
if echo "$-" | grep i > /dev/null; then export IS_TTY="${IS_TTY:=false}"; fi
LOG_LEVEL="error"
_log() {
if $IS_TTY; then
Expand All @@ -16,16 +16,19 @@ _info() { _log $1; }
# +────────────────+
_clone_if_absent() { [[ ! -d $1 ]] && git clone "$1" "$2/$(basename "$1" .git)"; }
_edit() { ${EDITOR:-nvim} "$1"; }
_export() { [[ -d $1 ]] && export PATH="${1}${PATH+:$PATH}"; return $?; }
_goto() { [[ -e "$1" ]] && cd "$1" && $(which exa) --all --long || ls -lGo; }
_mkfile() { echo "#!/usr/bin/env ${2}" >"${3}.${1}" && chmod +x "${3}.${1}"; }
_export() {
[[ -d $1 ]] && export PATH="${1}${PATH+:$PATH}"
return $?
}
_goto() { [[ -e $1 ]] && cd "$1" && $(which exa) --all --long || ls -lGo; }
_mkfile() { echo "#!/usr/bin/env ${2}" > "${3}.${1}" && chmod +x "${3}.${1}"; }
_sys_update() { "$1" update && "$1" upgrade; }
has() { command -v "$1" 1>/dev/null 2>&1; }
has() { command -v "$1" 1> /dev/null 2>&1; }
# +────────────────+
# │ CODE DIRECTORY │
# +────────────────+
CODE_DIR="${HOME:-~}/code"
! [[ -d "$CODE_DIR" ]] && mkdir -p "${CODE_DIR}"
! [[ -d $CODE_DIR ]] && mkdir -p "${CODE_DIR}"
# +─────────────────+
# │ SYSTEM SPECIFIC │
# +─────────────────+
Expand Down Expand Up @@ -61,22 +64,22 @@ fi
# +──────────────────+
cfg_alias() { alias ${1}="_edit ${XDG_CONFIG_HOME}/${2}"; }
cfg_alias 'ealiases' 'zsh/aliases.zsh'
cfg_alias 'gignore' 'git/ignore'
cfg_alias 'gcfg' 'git/config'
cfg_alias 'kittyrc' 'kitty/kitty.conf'
cfg_alias 'nvplg' "nvim/lua/plugins.lua"
cfg_alias 'skhdrc' 'skhd/skhdrc'
cfg_alias 'tmuxrc' 'tmux/tmux.conf'
cfg_alias 'zic' 'zsh/zinit.zsh'
cfg_alias 'zsc' 'zsh/.zshrc'
cfg_alias 'gignore' 'git/ignore'
cfg_alias 'gcfg' 'git/config'
cfg_alias 'kittyrc' 'kitty/kitty.conf'
cfg_alias 'nvplg' "nvim/lua/plugins.lua"
cfg_alias 'skhdrc' 'skhd/skhdrc'
cfg_alias 'tmuxrc' 'tmux/tmux.conf'
cfg_alias 'zic' 'zsh/zinit.zsh'
cfg_alias 'zsc' 'zsh/.zshrc'
alias zinstall='_edit $ZINIT[BIN_DIR]/zinit-install.zsh'
# +────────────────+
# │ HOME SHORTCUTS │
# +────────────────+
home_alias() { alias ${1}="_edit ${HOME}/${2}"; }
home_alias 'hscfg' '.hammerspoon/init.lua'
home_alias 'sshrc' '.ssh/config'
home_alias 'zec' '.zshenv'
home_alias 'zec' '.zshenv'
# +─────────────────+
# │ RELOAD COMMANDS │
# +─────────────────+
Expand Down Expand Up @@ -149,7 +152,7 @@ alias mkpy='_mkfile py "python3"'
alias mksh='_mkfile sh "bash"'
alias mktxt='{ F_NAME="$(cat -).txt"; touch "$F_NAME"; _info "created: $F_NAME"; }<<<'
alias mkzsh='_mkfile zsh "zsh"'
mkcd() { mkdir -p -- "$1" && cd -P -- "$1" ;}
mkcd() { mkdir -p -- "$1" && cd -P -- "$1"; }
# +─────────────────+
# │ FILE FORMATTING │
# +─────────────────+
Expand Down
44 changes: 23 additions & 21 deletions zsh/.config/zsh/fzf.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,46 @@ fzfp() { #fzf with preview options
|| highlight --style base16/nord -O ansi -l {} \
|| cat {} 2> /dev/null | head -500' \
--reverse \
--tabstop=1 \
--tabstop=1

}

}
gli() {
local filter
if [ -n "$@" ] && [ -f "$@" ]; then
filter="-- $@"
fi
git log \
--graph --color=always --abbrev=7 --format='%C(auto)%h %an %C(blue)%s %C(yellow)%cr' "$@" |
fzf \
--ansi --no-sort --reverse --tiebreak=index --height 80% --preview-window=right:60% \
--preview "f() { set -- \$(echo -- \$@ | grep -o '[a-f0-9]\{7\}'); [ \$# -eq 0 ] || git show --color=always \$1 $filter; }; f {}" \
--bind "j:down,k:up,alt-j:preview-down,alt-k:preview-up,ctrl-f:preview-page-down,ctrl-b:preview-page-up,q:abort,ctrl-m:execute:
--graph --color=always --abbrev=7 --format='%C(auto)%h %an %C(blue)%s %C(yellow)%cr' "$@" \
| fzf \
--ansi --no-sort --reverse --tiebreak=index --height 80% --preview-window=right:60% \
--preview "f() { set -- \$(echo -- \$@ | grep -o '[a-f0-9]\{7\}'); [ \$# -eq 0 ] || git show --color=always \$1 $filter; }; f {}" \
--bind "j:down,k:up,alt-j:preview-down,alt-k:preview-up,ctrl-f:preview-page-down,ctrl-b:preview-page-up,q:abort,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" \
FZF-EOF"

}
fgco() { # checkout git branch (including remote branches) with FZF
local branches=$(
git branch --all | grep -v HEAD) \
&& local branch=$(echo "$branches" | fzf-tmux -d $((2 + $(wc -l <<<"$branches"))) +m) \
&& git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##"
)
git branch --all | grep -v HEAD
) \
&& local branch=$(echo "$branches" | fzf-tmux -d $((2 + $(wc -l <<< "$branches"))) +m) \
&& git checkout $(
echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##"
)
}
fglog() { # git log browser with FZF
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" \
| fzf \
--ansi \
--bind=ctrl-s:toggle-sort \
--no-sort \
--reverse \
--tiebreak=index \
--bind "ctrl-m:execute:\
--ansi \
--bind=ctrl-s:toggle-sort \
--no-sort \
--reverse \
--tiebreak=index \
--bind "ctrl-m:execute:\
(grep -o '[a-f0-9]\{7\}' \
| head -1 \
| xargs -I % sh -c 'git show --color=always % \
Expand All @@ -70,11 +72,11 @@ fglog() { # git log browser with FZF
fstash() {
local out q k sha
while out=$(
git stash list --pretty="%C(yellow)%h %>(14)%Cgreen%cr %C(blue)%gs" |
fzf --ansi --no-sort --query="$q" --print-query \
git stash list --pretty="%C(yellow)%h %>(14)%Cgreen%cr %C(blue)%gs" \
| fzf --ansi --no-sort --query="$q" --print-query \
--expect=ctrl-d,ctrl-b
); do
mapfile -t out <<<"$out"
mapfile -t out <<< "$out"
q="${out[0]}"
k="${out[1]}"
sha="${out[-1]}"
Expand Down
48 changes: 24 additions & 24 deletions zsh/.config/zsh/git-fzf.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Git related FZF functions

is_in_git_repo() {
git rev-parse HEAD >/dev/null 2>&1
git rev-parse HEAD > /dev/null 2>&1
}

fzf-down() {
Expand All @@ -12,47 +12,47 @@ fzf-down() {

_gf() {
is_in_git_repo || return
git -c color.status=always status --short |
fzf-down -m --ansi --nth 2..,.. \
--preview '(git diff --color=always -- {-1} | sed 1,4d; cat {-1})' |
cut -c4- | sed 's/.* -> //'
git -c color.status=always status --short \
| fzf-down -m --ansi --nth 2..,.. \
--preview '(git diff --color=always -- {-1} | sed 1,4d; cat {-1})' \
| cut -c4- | sed 's/.* -> //'
}

_gb() {
is_in_git_repo || return
git branch -a --color=always | grep -v '/HEAD\s' | sort |
fzf-down --ansi --multi --tac --preview-window right:70% \
--preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1)' |
sed 's/^..//' | cut -d' ' -f1 |
sed 's#^remotes/##'
git branch -a --color=always | grep -v '/HEAD\s' | sort \
| fzf-down --ansi --multi --tac --preview-window right:70% \
--preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1)' \
| sed 's/^..//' | cut -d' ' -f1 \
| sed 's#^remotes/##'
}

_gt() {
is_in_git_repo || return
git tag --sort -version:refname |
fzf-down --multi --preview-window right:70% \
--preview 'git show --color=always {}'
git tag --sort -version:refname \
| fzf-down --multi --preview-window right:70% \
--preview 'git show --color=always {}'
}

_gh() {
is_in_git_repo || return
git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always |
fzf-down --ansi --no-sort --reverse --multi --bind 'ctrl-s:toggle-sort' \
--header 'Press CTRL-S to toggle sort' \
--preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always' |
grep -o "[a-f0-9]\{7,\}"
git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always \
| fzf-down --ansi --no-sort --reverse --multi --bind 'ctrl-s:toggle-sort' \
--header 'Press CTRL-S to toggle sort' \
--preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always' \
| grep -o "[a-f0-9]\{7,\}"
}

_gr() {
is_in_git_repo || return
git remote -v | awk '{print $1 "\t" $2}' | uniq |
fzf-down --tac \
--preview 'git log --oneline --graph --date=short --pretty="format:%C(auto)%cd %h%d %s" {1}' |
cut -d$'\t' -f1
git remote -v | awk '{print $1 "\t" $2}' | uniq \
| fzf-down --tac \
--preview 'git log --oneline --graph --date=short --pretty="format:%C(auto)%cd %h%d %s" {1}' \
| cut -d$'\t' -f1
}

_gs() {
is_in_git_repo || return
git stash list | fzf-down --reverse -d: --preview 'git show --color=always {1}' |
cut -d: -f1
git stash list | fzf-down --reverse -d: --preview 'git show --color=always {1}' \
| cut -d: -f1
}
Loading

0 comments on commit b04b4ea

Please sign in to comment.