pull/1/head
earnest ma 2021-11-04 23:18:36 -04:00
commit bcec804f1a
Signed by: earnest ma
GPG Key ID: A343F43342EB6E2A
20 changed files with 729 additions and 0 deletions

20
LICENSE Normal file
View File

@ -0,0 +1,20 @@
Copyright (c) 2021 earnest ma <me@earne.link>
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:
Be Gay, Do Crimes
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.

21
README Normal file
View File

@ -0,0 +1,21 @@
# Dotfiles
Hopefully this is the last time I start over! These dotfiles are managed using
Stow and I use them on my system running Fedora 34.
## Usage
Clone the repository and run the script to bootstrap and stow files.
```shell
git clone https://git.sr.ht/~earnestma/dotfiles
cd dotfiles
./bootstrap.sh
```
Or, use `stow */ -[D]v` to set up/ remove all the links.
## Thanks
- https://git.sr.ht/~seirdy/dotfiles
- and various others! <3

1
aerc/.config/aerc/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
accounts.conf

200
aerc/.config/aerc/aerc.conf Normal file
View File

@ -0,0 +1,200 @@
#
# aerc main configuration
[ui]
#
# Describes the format for each row in a mailbox view. This field is compatible
# with mutt's printf-like syntax.
#
# Default: %D %-17.17n %Z %s
index-format=%D %-17.17n %Z %s
#
# See time.Time#Format at https://godoc.org/time#Time.Format
#
# Default: 2006-01-02 03:04 PM (ISO 8601 + 12 hour time)
timestamp-format=2006-01-02 03:04 PM
#
# Width of the sidebar, including the border.
#
# Default: 20
sidebar-width=20
#
# Message to display when viewing an empty folder.
#
# Default: (no messages)
empty-message=(no messages)
# Message to display when no folders exists or are all filtered
#
# Default: (no folders)
empty-dirlist=(no folders)
# Enable mouse events in the ui, e.g. clicking and scrolling with the mousewheel
#
# Default: false
mouse-enabled=true
#
# Ring the bell when new messages are received
#
# Default: true
new-message-bell=true
# Marker to show before a pinned tab's name.
#
# Default: `
pinned-tab-marker='`'
# Describes the format string to use for the directory list
#
# Default: %n %>r
dirlist-format=%n %>r
# List of space-separated criteria to sort the messages by, see *sort*
# command in *aerc*(1) for reference. Prefixing a criterion with "-r "
# reverses that criterion.
#
# Example: "from -r date"
#
# Default: ""
sort=
# Moves to next message when the current message is deleted
#
# Default: true
next-message-on-delete=true
# The directories where the stylesets are stored. It takes a colon-separated
# list of directories.
#
# default: /usr/local/share/aerc/stylesets/
stylesets-dirs=/usr/share/aerc/stylesets/
# Sets the styleset to use for the aerc ui elements.
#
# Default: default
styleset-name=default
[viewer]
#
# Specifies the pager to use when displaying emails. Note that some filters
# may add ANSI codes to add color to rendered emails, so you may want to use a
# pager which supports ANSI codes.
#
# Default: less -R
pager=less -x 2 -Fir
#
# If an email offers several versions (multipart), you can configure which
# mimetype to prefer. For example, this can be used to prefer plaintext over
# html emails.
#
# Default: text/plain,text/html
alternatives=text/plain,text/html
#
# Default setting to determine whether to show full headers or only parsed
# ones in message viewer.
#
# Default: false
show-headers=false
#
# Layout of headers when viewing a message. To display multiple headers in the
# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if
# none of their specified headers are present in the message.
#
# Default: From|To,Cc|Bcc,Date,Subject
header-layout=From|To,Cc|Bcc,Date,Subject
# Whether to always show the mimetype of an email, even when it is just a single part
#
# Default: false
always-show-mime=false
# How long to wait after the last input before auto-completion is triggered.
#
# Default: 250ms
completion-delay=250ms
#
# Global switch for completion popovers
#
# Default: true
completion-popovers=true
[compose]
#
# Specifies the command to run the editor with. It will be shown in an embedded
# terminal, though it may also launch a graphical window if the environment
# supports it. Defaults to $EDITOR, or vi.
editor=nvim
#
# Default header fields to display when composing a message. To display
# multiple headers in the same row, separate them with a pipe, e.g. "To|From".
#
# Default: To|From,Subject
header-layout=To|From,Subject,Cc|Bcc
#
# Specifies the command to be used to tab-complete email addresses. Any
# occurrence of "%s" in the address-book-cmd will be replaced with what the
# user has typed so far.
#
# The command must output the completions to standard output, one completion
# per line. Each line must be tab-delimited, with an email address occurring as
# the first field. Only the email address field is required. The second field,
# if present, will be treated as the contact name. Additional fields are
# ignored.
address-book-cmd=khard email --parsable --search-in-source-files --remove-first-line %s
[filters]
#
# Filters allow you to pipe an email body through a shell command to render
# certain emails differently, e.g. highlighting them with ANSI escape codes.
#
# The first filter which matches the email's mimetype will be used, so order
# them from most to least specific.
#
# You can also match on non-mimetypes, by prefixing with the header to match
# against (non-case-sensitive) and a comma, e.g. subject,text will match a
# subject which contains "text". Use header,~regex to match against a regex.
subject,~^\[PATCH=awk -f /usr/share/aerc/filters/hldiff
text/html=/usr/share/aerc/filters/html
text/*=awk -f /usr/share/aerc/filters/plaintext
#image/*=catimg -w $(tput cols) -
[triggers]
#
# Triggers specify commands to execute when certain events occur.
#
# Example:
# new-email=exec notify-send "New email from %n" "%s"
#
# Executed when a new email arrives in the selected folder
new-email=exec notify-send "aerc: you have a new email"
[templates]
# Templates are used to populate email bodies automatically.
#
# The directories where the templates are stored. It takes a colon-separated
# list of directories.
#
# default: /usr/local/share/aerc/templates/
template-dirs=/home/earne/.config/aerc/templates:/usr/share/aerc/templates/
# The template to be used for quoted replies.
#
# default: quoted_reply
quoted-reply=quoted_reply
# The template to be used for forward as body.
#
# default: forward_as_body
forwards=forward_as_body

View File

@ -0,0 +1,130 @@
# Binds are of the form <key sequence> = <command to run>
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>
<C-t> = :term<Enter>
[messages]
q = :quit<Enter>
Q = :exec mbsync -a<Enter>
j = :next<Enter>
<Down> = :next<Enter>
<C-d> = :next 50%<Enter>
<C-f> = :next 100%<Enter>
<PgDn> = :next -s 100%<Enter>
k = :prev<Enter>
<Up> = :prev<Enter>
<C-u> = :prev 50%<Enter>
<C-b> = :prev 100%<Enter>
<PgUp> = :prev -s 100%<Enter>
g = :select 0<Enter>
G = :select -1<Enter>
J = :next-folder<Enter>
K = :prev-folder<Enter>
v = :mark -t<Enter>
V = :mark -v<Enter>
<Enter> = :view<Enter>
D = :delete<Enter>
dt = :mv<space>Trash<Enter>
dg = :mv<space>[Gmail]/Trash<Enter>
dd = :mv<space>Deleted<Enter>
A = :archive flat<Enter>
a = :archive year<Enter>
#C = :compose<Enter>
C = :compose -Tnew<Enter>
rr = :reply -a<Enter>
rq = :reply -aq<Enter>
Rr = :reply<Enter>
Rq = :reply -q<Enter>
rt = :reply -a -Tthanks<Enter>
Rt = :reply -qa -Tquoted_thanks<Enter>
rp = :reply -a -Ttop-posting<Enter>
Rp = :reply -Ttop-posting<Enter>
c = :cf<space>
$ = :term<space>
! = :term<space>
| = :pipe<space>
/ = :search<space>
\ = :filter<space>
n = :next-result<Enter>
N = :prev-result<Enter>
[view]
q = :close<Enter>
| = :pipe<space>
D = :delete<Enter>
dt = :mv<space>Trash<Enter>
dg = :mv<space>[Gmail]/Trash<Enter>
dd = :mv<space>Deleted<Enter>
S = :save<space>
A = :archive flat<Enter>
a = :archive year<Enter>
f = :forward<Enter>
rr = :reply -a<Enter>
rq = :reply -aq<Enter>
Rr = :reply<Enter>
Rq = :reply -q<Enter>
rt = :reply -a -Tthanks<Enter>
Rt = :reply -qa -Tquoted_thanks<Enter>
rp = :reply -a -Ttop-posting<Enter>
Rp = :reply -Ttop-posting<Enter>
H = :toggle-headers<Enter>
<C-k> = :prev-part<Enter>
<C-j> = :next-part<Enter>
J = :next<Enter>
K = :prev<Enter>
O = :open<Enter>
[compose]
# Keybindings used when the embedded terminal is not selected in the compose
# view
$ex = <C-x>
<C-k> = :prev-field<Enter>
<C-j> = :next-field<Enter>
<tab> = :next-field<Enter>
[compose::editor]
# Keybindings used when the embedded terminal is selected in the compose view
$noinherit = true
$ex = <C-x>
<C-k> = :prev-field<Enter>
<C-j> = :next-field<Enter>
<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>
[compose::review]
# Keybindings used when reviewing a message to be sent
y = :send<Enter>
n = :abort<Enter>
p = :postpone<Enter>
q = :abort<Enter>
e = :edit<Enter>
a = :attach<space>
# In-Reply-To header:
r = :header -f In-Reply-To
# set patch headers for sourcehut
pp = :header -f X-Sourcehut-Patchset-Update PROPOSED<Enter>
pn = :header -f X-Sourcehut-Patchset-Update NEEDS_REVISION<Enter>
pr = :header -f X-Sourcehut-Patchset-Update APPROVED<Enter>
pa = :header -f X-Sourcehut-Patchset-Update APPLIED<Enter>
px = :header -f X-Sourcehut-Patchset-Update REJECTED<Enter>
[terminal]
$noinherit = true
$ex = <C-x>
<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>

View File

@ -0,0 +1,5 @@
X-Mailer: aerc {{version}}
Forwarded message from {{(index .OriginalFrom 0).Name}} on {{dateFormat .OriginalDate "Mon Jan 2, 2006 at 3:04 PM"}}:
{{wrapText .OriginalText 72}}

View File

@ -0,0 +1,3 @@
X-Mailer: aerc {{version}}

View File

@ -0,0 +1,7 @@
REMOTE_URL=$(git remote get-url --push origin)
COMMITS=$(git reflog -2 $(git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)) --pretty=format:%h | xargs printf '%s <- %s')
CURRENT_BRANCH=$(git branch --show-current)
UPSTREAM_BRANCH=$(git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD) | sed 's#^[^/]*/##g')
echo "On $REMOTE_URL:
$COMMITS ($CURRENT_BRANCH -> $UPSTREAM_BRANCH)"

View File

@ -0,0 +1,5 @@
X-Mailer: aerc {{version}}
Op {{ dateFormat (.OriginalDate | toLocal) "2006-01-02 om 15:04 MST" }}, schreef {{ (index .OriginalFrom 0).Name }}:
{{ wrapText .OriginalText 72 | quote }}

View File

@ -0,0 +1,8 @@
X-Mailer: aerc {{version}}
X-Sourcehut-Patchset-Update: APPLIED
Thanks!
{{ exec "~/.config/aerc/templates/patch.sh" "" }}
Op {{ dateFormat (.OriginalDate | toLocal) "2006-01-02 om 15:04 MST" }}, schreef {{ (index .OriginalFrom 0).Name }}:
{{ wrapText .OriginalText 72 | quote }}

View File

@ -0,0 +1,6 @@
X-Mailer: aerc {{version}}
X-Sourcehut-Patchset-Update: APPLIED
Thanks!
{{ exec "~/.config/aerc/templates/patch.sh" "" }}

1
git/.config/git/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
secret

78
git/.config/git/config Normal file
View File

@ -0,0 +1,78 @@
[include]
path = ~/.config/git/secret
# include something like this in the above file:
#[sendemail]
# smtpserver = mail.example.com
# smtpuser =
# smtpencryption = tls
# smtpserverport = 587
# annotate = yes
[user]
email = me@earne.link
name = earnest ma
signingkey = BF66E5C8A1416E2A857C774CA343F43342EB6E2A
[core]
autocrlf = false
quotepath = false
commitGraph = true
longpaths = true
editor = nvim
hooksPath = ~/.config/git/hooks
[diff]
tool = bat
[init]
defaultBranch = main
[commit]
gpgsign = true
verbose = true
[fetch]
prune = true
[pull]
ff = only
[push]
default = current
[status]
submodulesummary = true
[help]
autocorrect = 20
[gc]
writeCommitGraph = true
[color]
ui = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[alias]
checkup = !git log -1 && (git fetch --all 2>/dev/null || true) && git status
fuckit = reset --hard
setup = !git init && git commit --allow-empty -m \"Initial commit\"
e = commit --allow-empty-message -m ''
br = branch
co = checkout
ca = commit --amend
cd = commit -eF .git/draft
ce = commit --allow-empty-message -m ''
cm = commit
di = diff
lg = log
mg = merge
pu = push
pl = pull
st = status

View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
COMMIT_INFO=$(git log -1 HEAD --format=reference)
notify-send 'Git commit: ' "$COMMIT_INFO" -u low

View File

@ -0,0 +1,28 @@
# From https://mastodon.xyz/@CarlCravens/105758509287927276
alias clear='clear; tput cup $LINES 0'
alias camoff='sudo modprobe -r uvcvideo' # sudo rmmod -f uvcvideo
alias camon='sudo modprobe uvcvideo'
alias clip="xclip -sel clip"
ahbh(){
git rev-list --left-right --count \
"$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')"..."$(git branch --show-current)"
}
alias pu='git push'
alias st='git st'
foldersize(){
du -sh "$@"
}
tmm(){
if [ -z "$1" ]; then
tmux attach-session -t 0 || tmux
else
tmux attach-session -t "$1" || tmux new-session -t "$1" || tmux
fi
}

View File

@ -0,0 +1,77 @@
# May not be loaded on older versions of tmux
set -g default-terminal "tmux-256color"
# status powerline-like theme, no dependencies.
set -g status on
set -g status-bg '#232629'
set -g status-fg colour7
set -g status-left '#[fg=colour235,bg=colour4,bold] #S #[fg=colour4,bg=colour235,nobold]'
set -g window-status-format "#[default] #I #[fg=colour240] #[default]#W "
set -g window-status-bell-style "bold"
set -g window-status-current-format "#[fg=colour235,bg=colour6]#[fg=colour235,bg=colour6,bold] #I  #[fg=colour235]#W #[fg=colour6,bg=colour235,nobold]"
set -g status-right '#{prefix_highlight}#[fg=colour6,bg=colour235]#[fg=colour235,bg=colour6] #{=21:pane_title} #[fg=colour4,bg=colour6,nobold]#[fg=colour235,bg=colour4] %H:%M '
set -g @prefix_highlight_output_prefix "#[fg=colour4]#[bg=colour235]#[bg=colour4]#[fg=colour235]"
set -g @prefix_highlight_output_suffix ""
set -g @prefix_highlight_prefix_prompt " "
# No delay between hitting <ESC>
set-option -s escape-time 0
# Mouse support
set-option -g mouse on
# Start with 1 instead of 0
set -g base-index 1
set -g pane-base-index 1
# Panes
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Windows
bind c new-window -c "#{pane_current_path}"
bind -n M-S-Right select-window -n
bind -n M-S-Left select-window -p
# set-option -g allow-rename off # Don't autorename windows
set -g renumber-windows on
# Show menu of URLs to open from the visible pane - needs `urlview'
bind u capture-pane \;\
save-buffer /tmp/tmux-buffer \;\
split-window -l 10 "urlscan /tmp/tmux-buffer"
# Allow programs with their own scrollback to scroll properly
bind-key -n WheelUpPane \
if-shell -Ft= "#{?pane_active,0,1}" "select-pane -t=" \; \
if-shell -Ft= "#{pane_in_mode}" \
"send-keys -M ; send-keys -M ; send-keys -M" \
"if-shell -Ft= \"#{mouse_any_flag}\" \
\"send-keys -M\" \
\"if-shell -Ft= '#{alternate_on}' \
'send-keys Up Up Up' \
'copy-mode -e'\""
bind-key -n WheelDownPane \
if-shell -Ft= "#{?pane_active,0,1}" "select-pane -t=" \; \
if-shell -Ft= "#{pane_in_mode}" \
"send-keys -M ; send-keys -M ; send-keys -M" \
"if-shell -Ft= \"#{mouse_any_flag}\" \
\"send-keys -M\" \
\"if-shell -Ft= '#{alternate_on}' \
'send-keys Down Down Down'\""
# source `.tmux.conf` file - as suggested in `man tmux`
bind-key R run-shell ' \
tmux source-file $XDG_CONFIG_HOME/tmux/tmux.conf > /dev/null; \
tmux display-message "sourced tmux.conf"'

View File

@ -0,0 +1,9 @@
{
"extensionsGallery": {
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
"itemUrl": "https://marketplace.visualstudio.com/items",
"controlUrl": "",
"recommendationsUrl": ""
}
}

29
zsh/.zprofile Normal file
View File

@ -0,0 +1,29 @@
# If you make changes to this, it's probably a good idea to log out.
[ -f $HOME/.nix-profile/etc/profile.d/nix.sh ] && source \
$HOME/.nix-profile/etc/profile.d/nix.sh
pathadd_head() {
if [ -d "$1" ] && ! echo "$PATH" | grep -q "$1" >/dev/null; then
PATH="$1${PATH:+":$PATH"}"
fi
}
pathadd_tail() {
if [ -d "$1" ] && ! echo "$PATH" | grep -q "$1" >/dev/null; then
PATH="${PATH:+"$PATH:"}$1"
fi
}
export EDITOR=nvim
#export PAGER=bat
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
pathadd_tail '/envs/bin'
pathadd_head "$HOME/.local/bin"
pathadd_head '/tmp/bin'
# Preferences
export CALIBRE_USE_SYSTEM_THEME=1
export PATH

9
zsh/.zshenv Normal file
View File

@ -0,0 +1,9 @@
# `.zshenv' is sourced on all invocations of the shell, unless the -f
# option is set. It should contain commands to set the command search
# path, plus other important environment variables.
# `.zshenv' should not contain commands that produce output or assume
# the shell is attached to a tty.
# These functions add a directory to $PATH if it exists and it isn't already
# there.

88
zsh/.zshrc Normal file
View File

@ -0,0 +1,88 @@
# `.zshrc' is sourced in interactive shells. It should contain
# commands to set up aliases, functions, options, key bindings, etc.
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
autoload -U colors && colors
autoload -Uz promptinit && promptinit
autoload -U compinit && compinit
# Init plugin handling
[ -f $HOME/.local/share/miniplug.zsh ] && curl \
-sL --create-dirs \
https://git.sr.ht/~yerinalexey/miniplug/blob/master/miniplug.zsh \
-o $HOME/.local/share/miniplug.zsh
source "$HOME/.local/share/miniplug.zsh"
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey -s '^L' '^Uclear^M' # clear using alias
autoload edit-command-line; zle -N edit-command-line
bindkey '^k' edit-command-line
# History
HISTORY_IGNORE="(ls|cd|pwd|exit|sudo reboot|history|cd -|cd ..)"
HISTFILE="$HOME/.zsh_history"
HISTSIZE=99999
SAVEHIST=90000
setopt extended_history # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # Don't add duplicate entries
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt inc_append_history # add commands to HISTFILE in order of execution
setopt share_history # share command history data
setopt hist_find_no_dups # don't display duplicates in reverse search
setopt hist_reduce_blanks # remove superfluous blanks
setopt interactivecomments # Comments in the interactive shell
setopt auto_continue # Send CONT signal automatically when disowning jobs
# pushd
setopt pushd_ignore_dups
export DIRSTACKSIZE=20
setopt auto_pushd
# Load aliases
source "$HOME/.config/shell_common/aliases.sh"
# zsh-specific aliases
# clear zsh history: Adapted from Novimatrem: https://gitlab.com/Novimatrem/clear-bash-history
alias czh="echo 'Fully clearing history, then exiting...' && cat /dev/null > $XDG_CACHE_HOME/zshhistory && history -p && exit"
# Completion
_comp_options+=(globdots) # include hidden files
# reload the zsh session. From OMZ:plugins/zsh_reload
zreload() {
local cache="$ZSH_CACHE_DIR"
autoload -U compinit zrecompile
compinit -i -d "$cache/zcomp-$HOST"
for f in ${ZDOTDIR:-~}/.zshrc "$cache/zcomp-$HOST"; do
zrecompile -p $f && command rm -f $f.zwc.old
done
# Use $SHELL if available; remove leading dash if login shell
[[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
}
# PLUGINS!
# `miniplug update`
miniplug plugin 'zsh-users/zsh-syntax-highlighting'
miniplug plugin 'hlissner/zsh-autopair'
miniplug theme 'tjquillan/pastel'
miniplug load
# auto cd must be set later
setopt AUTO_CD
# Hooks
eval "$(direnv hook zsh)"