From 0b6a04b7df6bc84d3b6263ed498aeb490e7ac562 Mon Sep 17 00:00:00 2001 From: Mitch Tishmack Date: Sun, 6 Sep 2020 10:03:37 -0500 Subject: [PATCH] Cleanup org-babel whitespace on non emacs files --- bin.org | 152 +++++++++++++++-------------- dotprofile.org | 116 +++++++++++----------- git.org | 260 ++++++++++++++++++++++++------------------------- nix.org | 176 ++++++++++++++++----------------- tmux.org | 239 ++++++++++++++++++++++----------------------- zsh.org | 2 +- 6 files changed, 473 insertions(+), 472 deletions(-) diff --git a/bin.org b/bin.org index ea4211e..a94c63b 100644 --- a/bin.org +++ b/bin.org @@ -652,25 +652,25 @@ Mostly because I use iso8601 timestamps and its nice to use them generally without depending on gnu date. #+BEGIN_SRC perl :padline no :tangle tmp/bin/iso8601 - #!/usr/bin/env perl - #-*-mode: Perl; coding: utf-8;-*- - use strict; - use warnings; - use POSIX qw(strftime); - use Getopt::Long; - - my $short = 0; - GetOptions('short' => \$short, - 's' => \$short - ); +#!/usr/bin/env perl +#-*-mode: Perl; coding: utf-8;-*- +use strict; +use warnings; +use POSIX qw(strftime); +use Getopt::Long; - my $now = time; - if ($short) { - print strftime('%Y%m%dT%H%M%SZ', (gmtime $now)) . "\n"; - } else { - print strftime('%Y-%m-%dT%H:%M:%SZ', (gmtime $now)) . "\n"; - } - exit 0; +my $short = 0; +GetOptions('short' => \$short, + 's' => \$short + ); + +my $now = time; +if ($short) { + print strftime('%Y%m%dT%H%M%SZ', (gmtime $now)) . "\n"; +} else { + print strftime('%Y-%m-%dT%H:%M:%SZ', (gmtime $now)) . "\n"; +} +exit 0; #+END_SRC * ~/bin/whoson @@ -1004,49 +1004,51 @@ foreach my $input (@ARGV){ * ~/bin/nix-update +FIXME: still needed? + More for nix on macos, but just merges NixOS/nipkgs origin/master to the current branch in a tmux window and watches it. #+BEGIN_SRC sh :padline no :tangle (tangle/file "bin/nix-update" (bound-and-true-p nix-p)) :mkdirp t - #!/usr/bin/env sh - #-*-mode: Shell-script; coding: utf-8;-*- - # File: tmux-nix.sh - # Copyright: 2017 Mitch Tishmack - # Description: instantiate tmux nix session - export script=$(basename "$0") - export dir=$(cd "$(dirname "$0")"; pwd) - export iam=${dir}/${script} - set -e - - session=nix - PKGS=${PKGS:-nixpkgs} - - if "${PKGS}" != "nixpkgs"; then - cd ~/src/github.com/NixOS/nixpkgs/${PKGS} - else - cd ~/src/github.com/NixOS/nixpkgs - fi - - if ! tmux has-session -t ${session}; then - tmux new-session -d -s ${session} -n nix - tmux send-keys -t ${session}:0 'sleep 30 - while true; do - blah=$(nix-env -f "<${PKGS}>" -iA --dry-run stdboth default | grep /nix); echo "${blah}" | head -n $(echo "$LINES - 2" | bc); echo "${blah}" | grep -c /nix | ts - echo "${blah}" | grep /nix > /dev/null 2>&1 - if [ $? -eq 0 ]; then - sleep 60 - clear - else - exit 0 - fi - done - ' C-m - tmux split-window -v -t ${session}:0 - tmux send-keys -t ${session}:0.1 'git fetch --all && git short HEAD > last-$(iso8601) && git rebase --autostash origin/staging && - time nix-env -f "<${PKGS}>" -iA default && nix-env -f "<${PKGS}>" -u --leq && exit 0 - ' C-m - tmux select-window -t ${session}:0 - fi - tmux attach -t ${session} +#!/usr/bin/env sh +#-*-mode: Shell-script; coding: utf-8;-*- +# File: tmux-nix.sh +# Copyright: 2017 Mitch Tishmack +# Description: instantiate tmux nix session +export script=$(basename "$0") +export dir=$(cd "$(dirname "$0")"; pwd) +export iam=${dir}/${script} +set -e + +session=nix +PKGS=${PKGS:-nixpkgs} + +if "${PKGS}" != "nixpkgs"; then + cd ~/src/github.com/NixOS/nixpkgs/${PKGS} +else + cd ~/src/github.com/NixOS/nixpkgs +fi + +if ! tmux has-session -t ${session}; then + tmux new-session -d -s ${session} -n nix + tmux send-keys -t ${session}:0 'sleep 30 +while true; do +blah=$(nix-env -f "<${PKGS}>" -iA --dry-run stdboth default | grep /nix); echo "${blah}" | head -n $(echo "$LINES - 2" | bc); echo "${blah}" | grep -c /nix | ts +echo "${blah}" | grep /nix > /dev/null 2>&1 +if [ $? -eq 0 ]; then + sleep 60 + clear +else + exit 0 +fi +done +' C-m + tmux split-window -v -t ${session}:0 + tmux send-keys -t ${session}:0.1 'git fetch --all && git short HEAD > last-$(iso8601) && git rebase --autostash origin/staging && +time nix-env -f "<${PKGS}>" -iA default && nix-env -f "<${PKGS}>" -u --leq && exit 0 +' C-m + tmux select-window -t ${session}:0 +fi +tmux attach -t ${session} #+END_SRC * ~/bin/notify @@ -1077,24 +1079,24 @@ Stupid ruby script I wrote to highlight the week/day in a calendar. I don't reme TODO: why the hell is :mkdirp yes needed here but nowhere else? #+BEGIN_SRC ruby :padline no :tangle tmp/bin/today :mkdirp t - #!/usr/bin/env ruby - cal, today, week_color, day_color, reset = %x(cal).split(%r(\n)), Time.now.day, %x(tput sgr0;tput setab 4;tput setaf 7), %x(tput sgr0; tput setab 0;tput setaf 7;tput bold), %x(tput sgr0) - done=false - cal.each do |line| - if done then - puts line - next - end - if(line =~ /^(.*\s+?)#{today}(\s+?.*)$/ or - line =~ /^(.*\s+?)#{today}$/ or - line =~ /^()#{today}(\s+?.*)$/ or - line =~ /^#{today}$/ ) then - puts "#{week_color}#{$1}#{day_color}#{today}#{week_color}#{$2}#{reset}" - done=true - else - puts line - end +#!/usr/bin/env ruby +cal, today, week_color, day_color, reset = %x(cal).split(%r(\n)), Time.now.day, %x(tput sgr0;tput setab 4;tput setaf 7), %x(tput sgr0; tput setab 0;tput setaf 7;tput bold), %x(tput sgr0) +done=false +cal.each do |line| + if done then + puts line + next + end + if(line =~ /^(.*\s+?)#{today}(\s+?.*)$/ or + line =~ /^(.*\s+?)#{today}$/ or + line =~ /^()#{today}(\s+?.*)$/ or + line =~ /^#{today}$/ ) then + puts "#{week_color}#{$1}#{day_color}#{today}#{week_color}#{$2}#{reset}" + done=true + else + puts line end +end #+END_SRC * ~/bin/close diff --git a/dotprofile.org b/dotprofile.org index 57149b7..0955a46 100644 --- a/dotprofile.org +++ b/dotprofile.org @@ -15,14 +15,14 @@ * PS1 #+BEGIN_SRC sh - # -*- mode: Shell-script; -*- - # Common .profile - # - # DO NOT EDIT, managed by org mode - _uname=$(uname) - _uname_n=$(uname -n) - _hostname=$(hostname) - export _uname _uname_n _hostname +# -*- mode: Shell-script; -*- +# Common .profile +# +# DO NOT EDIT, managed by org mode +_uname=$(uname) +_uname_n=$(uname -n) +_hostname=$(hostname) +export _uname _uname_n _hostname #+END_SRC OSX uses hostname -s for getting hostname @@ -221,63 +221,63 @@ try_git git://example.tld/some/random/path.git checks out to ~/src/example.tld/some/random/path #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p git-p)) - try_git() - { - # assume https if input doesn't contain a protocol - proto=https - destination=${HOME}/src - branch="${2:-master}" - - echo "${1}" | grep '://' > /dev/null 2>&1 - [ $? = 0 ] && proto=$(echo "${1}" | sed -e 's|[:]\/\/.*||g') - git_dir=$(echo "${1}" | sed -e 's|.*[:]\/\/||g') - rrepo="${proto}://${git_dir}" - - # strip user@, :NNN, and .git from input uri's - repo="${destination}/"$(echo "${git_dir}" | - sed -e 's/\.git$//g' | - sed -e 's|.*\@||g' | - sed -e 's|\:[[:digit:]]\{1,\}\/|/|g' | - tr -d '~') - - if [ ! -d "${repo}" ]; then - if git ls-remote "${rrepo}" > /dev/null 2>&1; then - mkdir -p "${repo}" - echo "git clone ${rrepo} ${repo}" - git clone --recursive "${rrepo}" "${repo}" - else - echo "${rrepo} doesn't look to be a git repository" - fi +try_git() +{ + # assume https if input doesn't contain a protocol + proto=https + destination=${HOME}/src + branch="${2:-master}" + + echo "${1}" | grep '://' > /dev/null 2>&1 + [ $? = 0 ] && proto=$(echo "${1}" | sed -e 's|[:]\/\/.*||g') + git_dir=$(echo "${1}" | sed -e 's|.*[:]\/\/||g') + rrepo="${proto}://${git_dir}" + + # strip user@, :NNN, and .git from input uri's + repo="${destination}/"$(echo "${git_dir}" | + sed -e 's/\.git$//g' | + sed -e 's|.*\@||g' | + sed -e 's|\:[[:digit:]]\{1,\}\/|/|g' | + tr -d '~') + + if [ ! -d "${repo}" ]; then + if git ls-remote "${rrepo}" > /dev/null 2>&1; then + mkdir -p "${repo}" + echo "git clone ${rrepo} ${repo}" + git clone --recursive "${rrepo}" "${repo}" + else + echo "${rrepo} doesn't look to be a git repository" fi + fi - if [ "${branch}" != "master" ]; then - wtdir="${repo}@${branch}" - if [ -d "${wtdir}" ]; then - cd "${wtdir}" - else - if git branch -r --list 'origin/*' | grep -E "^\s+origin/${branch}$" > /dev/null 2>&1; then - git worktree add ${repo}@${branch} ${branch} && cd "${wtdir}" - fi - fi + if [ "${branch}" != "master" ]; then + wtdir="${repo}@${branch}" + if [ -d "${wtdir}" ]; then + cd "${wtdir}" else - [ -d "${repo}" ] && cd "${repo}" + if git branch -r --list 'origin/*' | grep -E "^\s+origin/${branch}$" > /dev/null 2>&1; then + git worktree add ${repo}@${branch} ${branch} && cd "${wtdir}" + fi fi - } + else + [ -d "${repo}" ] && cd "${repo}" + fi +} - mt() - { - try_git "ssh://gitea@git.functionalidiot.com:2222/${1}" "${2:-master}" - } +mt() +{ + try_git "ssh://gitea@git.functionalidiot.com:2222/${1}" "${2:-master}" +} - gh() - { - try_git "https://github.com/${1}" "${2:-master}" - } +gh() +{ + try_git "https://github.com/${1}" "${2:-master}" +} - bb() - { - try_git "https://bitbucket.org/${1}" "${2:-master}" - } +bb() +{ + try_git "https://bitbucket.org/${1}" "${2:-master}" +} #+END_SRC ** haskell #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p haskell-p)) diff --git a/git.org b/git.org index 343fbf5..879441c 100644 --- a/git.org +++ b/git.org @@ -17,129 +17,129 @@ General git configuration split out into sections mostly. All pager, all the time, always use color with it too. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [pager] - color = true +[pager] + color = true #+END_SRC ** color #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [color] - status = auto - diff = auto - branch = auto - [color "status"] - added = green - changed = blue - untracked = red - [color "branch"] - current = green - local = blue - remote = red - [color "diff"] - meta = blue bold - frag = black reverse - old = red reverse - new = green reverse +[color] + status = auto + diff = auto + branch = auto +[color "status"] + added = green + changed = blue + untracked = red +[color "branch"] + current = green + local = blue + remote = red +[color "diff"] + meta = blue bold + frag = black reverse + old = red reverse + new = green reverse #+END_SRC ** alias Aliases so I can be lay zee. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [alias] - begin = !git init && git commit --allow-empty -m 'Initial empty commit' - up = !git pull --rebase && git push - wsd = diff --color-words --ignore-space-at-eol --ignore-space-change --ignore-all-space - wd = diff --color-words - fa = fetch --all - ci = commit - cia = commit --all - co = checkout - ds = diff --stat - ba = branch --all - b = branch - st = status --short --branch - s = status --short --branch --untracked-files=no - unstage = reset HEAD - tlog = log --graph --color=always --abbrev-commit --date=relative --pretty=oneline - hist = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative - slog = log --oneline --decorate - fixup = commit --fixup - squash = commit --squash - ri = rebase --interactive --autosquash - ra = rebase --abort - effit = reset --hard - bn = rev-parse --abbrev-ref HEAD - cp = log --no-merges --cherry --graph --oneline - short = rev-parse --short - # git clone with submodules - sc = !git clone --recursive $1 - # git update with submodule update - sup = !git pull --rebase && git submodule update --init --recursive - wtl = worktree list - wtp = worktree prune - wta = worktree add - wtr = "!git worktree list --porcelain | grep -B2 \"branch refs/heads/$1\" | head -n1 | sed -e 's|worktree ||' #" - nwt = "!git worktree add $(git gr)@$1 $1 #" - bwt = "!git branch $1 ${2:-HEAD} && git nwt $1 #" - gr = "!git rev-parse --absolute-git-dir | sed -e 's|/[.]git.*||' #" - # Pull all the commits missed from a git pull --depth N clone - unshallow = pull --unshallow - # Set the origin to not allow pushing, to be on the safe side. - nopush = remote set-url --push origin no_push - # default remote, note depends on the repo having been git cloned - defremote = !git branch -rvv | egrep 'HEAD' | awk '{print $1}' | sed -e 's|/HEAD||g' - # push branch while setting the upstream to the default remote - pbr = !git push --set-upstream $(git defremote) $(git bn) - # ^ but forcefully - fpbr = !git push --set-upstream --force $(git defremote) $(git bn) - # what files are getting updated a lot descending output - churn = !git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort -r | awk 'BEGIN {print "count,file"} {print $1 "," $2}' | grep -Ev '^\\s+$' - # My defremote hack depends on $remote/HEAD to point to somewhere - # which it may not if the git repo wasn't cloned - fixhead = !sh -c "rem=${0:-origin} && branch=${1:-master} && git symbolic-ref refs/remotes/$rem/HEAD refs/remotes/$rem/${branch}" +[alias] + begin = !git init && git commit --allow-empty -m 'Initial empty commit' + up = !git pull --rebase && git push + wsd = diff --color-words --ignore-space-at-eol --ignore-space-change --ignore-all-space + wd = diff --color-words + fa = fetch --all + ci = commit + cia = commit --all + co = checkout + ds = diff --stat + ba = branch --all + b = branch + st = status --short --branch + s = status --short --branch --untracked-files=no + unstage = reset HEAD + tlog = log --graph --color=always --abbrev-commit --date=relative --pretty=oneline + hist = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative + slog = log --oneline --decorate + fixup = commit --fixup + squash = commit --squash + ri = rebase --interactive --autosquash + ra = rebase --abort + effit = reset --hard + bn = rev-parse --abbrev-ref HEAD + cp = log --no-merges --cherry --graph --oneline + short = rev-parse --short + # git clone with submodules + sc = !git clone --recursive $1 + # git update with submodule update + sup = !git pull --rebase && git submodule update --init --recursive + wtl = worktree list + wtp = worktree prune + wta = worktree add + wtr = "!git worktree list --porcelain | grep -B2 \"branch refs/heads/$1\" | head -n1 | sed -e 's|worktree ||' #" + nwt = "!git worktree add $(git gr)@$1 $1 #" + bwt = "!git branch $1 ${2:-HEAD} && git nwt $1 #" + gr = "!git rev-parse --absolute-git-dir | sed -e 's|/[.]git.*||' #" + # Pull all the commits missed from a git pull --depth N clone + unshallow = pull --unshallow + # Set the origin to not allow pushing, to be on the safe side. + nopush = remote set-url --push origin no_push + # default remote, note depends on the repo having been git cloned + defremote = !git branch -rvv | egrep 'HEAD' | awk '{print $1}' | sed -e 's|/HEAD||g' + # push branch while setting the upstream to the default remote + pbr = !git push --set-upstream $(git defremote) $(git bn) + # ^ but forcefully + fpbr = !git push --set-upstream --force $(git defremote) $(git bn) + # what files are getting updated a lot descending output + churn = !git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort -r | awk 'BEGIN {print "count,file"} {print $1 "," $2}' | grep -Ev '^\\s+$' + # My defremote hack depends on $remote/HEAD to point to somewhere + # which it may not if the git repo wasn't cloned + fixhead = !sh -c "rem=${0:-origin} && branch=${1:-master} && git symbolic-ref refs/remotes/$rem/HEAD refs/remotes/$rem/${branch}" #+END_SRC Some aliases to help with determining which commit(s) are(n't) present in the left/right hand branch. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [alias] - cpd = log --no-merges --left-right --graph --cherry-pick --oneline - cmd = log --no-merges --left-right --graph --cherry-mark --oneline - bcs = log --pretty="%H" --first-parent --no-merges +[alias] + cpd = log --no-merges --left-right --graph --cherry-pick --oneline + cmd = log --no-merges --left-right --graph --cherry-mark --oneline + bcs = log --pretty="%H" --first-parent --no-merges #+END_SRC Some helpers for pruning a git repo or maintentance of things that has come in handy over the years. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [alias] - # kinda/sorta git pull -r without the git pull nonsense - # cleanmerged = !sh -c "git branch --merged | grep -Ev '^(. master|\*)' | xargs -n1 git branch -d" - # help the gc a bit and get a bit more space back for a local clone - trim = !git reflog expire --expire=now --all && git gc --prune=now - prune = !sh -c 'git cleanmerged; git fetch -p; git trim' - # I don't remember what I used these for tbh, future mitch figure it out. - find-merge = !sh -c "commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 | uniq -f1 -d | sort -n | tail -1 | cut -f2" - show-merge = !sh -c "merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge" +[alias] + # kinda/sorta git pull -r without the git pull nonsense + # cleanmerged = !sh -c "git branch --merged | grep -Ev '^(. master|\*)' | xargs -n1 git branch -d" + # help the gc a bit and get a bit more space back for a local clone + trim = !git reflog expire --expire=now --all && git gc --prune=now + prune = !sh -c 'git cleanmerged; git fetch -p; git trim' + # I don't remember what I used these for tbh, future mitch figure it out. + find-merge = !sh -c "commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 | uniq -f1 -d | sort -n | tail -1 | cut -f2" + show-merge = !sh -c "merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge" #+END_SRC #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [alias] - # create a pull request branch based off a pull request, lets you git diff - # even if someone rebases a pull request. - p = !sh -c 'git branch ${1:-$(git defremote)}pr$0@$(iso8601 -s) $(git ls-remote -q ${1:-$(git defremote)} | grep refs/pull-requests/$0/from | cut -c1-8)' - rvers = !sh -c 'commitish=${0:-HEAD} && git describe --first-parent --tags --long --match="cray-*" $commitish | sed -e "s/^cray-//" -e "s/-/./" -e "s/-g.*//"' +[alias] + # create a pull request branch based off a pull request, lets you git diff + # even if someone rebases a pull request. + p = !sh -c 'git branch ${1:-$(git defremote)}pr$0@$(iso8601 -s) $(git ls-remote -q ${1:-$(git defremote)} | grep refs/pull-requests/$0/from | cut -c1-8)' + rvers = !sh -c 'commitish=${0:-HEAD} && git describe --first-parent --tags --long --match="cray-*" $commitish | sed -e "s/^cray-//" -e "s/-/./" -e "s/-g.*//"' #+END_SRC #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [alias] - rembranch = !sh -xc "remote=${1:-origin} && git ls-remote --symref -q $remote HEAD | head -n1 | awk '{print $2}' | sed -e 's|refs/heads/||'" - merged-remote = !sh -c 'remote=${0:-origin} && git branch --all --merged remotes/$remote/master | grep remotes/$remote | grep -E --invert-match \"(master|HEAD)\" | cut -d \"/\" -f 3-' - merged-local = !sh -c 'git branch --all --merged master | grep -E --invert-match \"(master|HEAD|remotes/)\" | cut -b 3-' - merged = !sh -c "remote=${0:-origin}; printf 'remote branches: %s\n' $remote >&2; git merged-remote $remote; printf 'local branches\n' >&2 && git merged-local" +[alias] + rembranch = !sh -xc "remote=${1:-origin} && git ls-remote --symref -q $remote HEAD | head -n1 | awk '{print $2}' | sed -e 's|refs/heads/||'" + merged-remote = !sh -c 'remote=${0:-origin} && git branch --all --merged remotes/$remote/master | grep remotes/$remote | grep -E --invert-match \"(master|HEAD)\" | cut -d \"/\" -f 3-' + merged-local = !sh -c 'git branch --all --merged master | grep -E --invert-match \"(master|HEAD|remotes/)\" | cut -b 3-' + merged = !sh -c "remote=${0:-origin}; printf 'remote branches: %s\n' $remote >&2; git merged-remote $remote; printf 'local branches\n' >&2 && git merged-local" #+END_SRC ** github @@ -147,8 +147,8 @@ handy over the years. My username for github. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [github] - user = mitchty +[github] + user = mitchty #+END_SRC ** credential @@ -156,8 +156,8 @@ My username for github. Use a gpg encrypted .netrc file. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [credential] - helper = netrc -v -f ~/.netrc.gpg -f ~/.netrc +[credential] + helper = netrc -v -f ~/.netrc.gpg -f ~/.netrc #+END_SRC ** advice @@ -165,8 +165,8 @@ Use a gpg encrypted .netrc file. Shut up already, I don't need hints. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [advice] - statushints = false +[advice] + statushints = false #+END_SRC ** gui @@ -174,9 +174,9 @@ Shut up already, I don't need hints. If I ever use the stupid gui, make it a little less derp. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [gui] - fontui = -family Monaco -size 8 -weight normal -slant roman -underline 0 -overstrike 0 - fontdiff = -family Monaco -size 8 -weight normal -slant roman -underline 0 -overstrike 0 +[gui] + fontui = -family Monaco -size 8 -weight normal -slant roman -underline 0 -overstrike 0 + fontdiff = -family Monaco -size 8 -weight normal -slant roman -underline 0 -overstrike 0 #+END_SRC ** http @@ -184,8 +184,8 @@ If I ever use the stupid gui, make it a little less derp. Make large git repos work better by increasing the post buffer. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [http] - postBuffer = 209715200 +[http] + postBuffer = 209715200 #+END_SRC ** push @@ -193,8 +193,8 @@ Make large git repos work better by increasing the post buffer. Forgot why this was here, some version git changed the default push behavior. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [push] - default = simple +[push] + default = simple #+END_SRC ** lfs @@ -202,11 +202,11 @@ Forgot why this was here, some version git changed the default push behavior. So much junk is using it, so... just make it a default bit of the gitconfig. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [filter "lfs"] - clean = git-lfs clean -- %f - smudge = git-lfs smudge -- %f - process = git-lfs filter-process - required = true +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true #+END_SRC ** url rewrites @@ -214,8 +214,8 @@ So much junk is using it, so... just make it a default bit of the gitconfig. Don't use git:// (ssh) to connect to github. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [url "https://github.com/"] - insteadOf = git://github.com/ +[url "https://github.com/"] + insteadOf = git://github.com/ #+END_SRC ** username/email @@ -230,9 +230,9 @@ related stuff. TODO: Switch to my domain from google garbage for email. #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) - [user] - name = Mitch Tishmack - email = mitch.tishmack@gmail.com +[user] + name = Mitch Tishmack + email = mitch.tishmack@gmail.com #+END_SRC This silly text is here to make git merges easier for private branches. I got @@ -251,17 +251,17 @@ END HUNK PADDING Common crap/build artifacts that git should always ignore. #+BEGIN_SRC conf :tangle (tangle/file ".gitignore" (bound-and-true-p git-p)) - .*~ - ,*~ - .\#* - \#* - \#*\# - .\#*\# - .DS_Store - ,*.pyc - ,*.rbc - ,*.elc - ,*.swp - ,*.[oa] - ,*.hi +.*~ +,*~ +.\#* +\#* +\#*\# +.\#*\# +.DS_Store +,*.pyc +,*.rbc +,*.elc +,*.swp +,*.[oa] +,*.hi #+END_SRC diff --git a/nix.org b/nix.org index 9244c48..eb6f58c 100644 --- a/nix.org +++ b/nix.org @@ -12,94 +12,94 @@ Nix user config.nix setup. #+BEGIN_SRC conf :padline no :mkdirp yes :tangle (tangle/file ".nixpkgs/config.nix" (bound-and-true-p nix-p)) - { - packageOverrides = pkgs: with pkgs; - let in rec { - custom-pinentry = pinentry.override { gtk2 = null; ncurses = null; }; - custom-youtube-dl = python27Packages.youtube-dl.override { pandoc = null; }; +{ + packageOverrides = pkgs: with pkgs; + let in rec { + # custom-pinentry = pinentry.override { gtk2 = null; ncurses = null; }; + custom-youtube-dl = python27Packages.youtube-dl.override { pandoc = null; }; - default = buildEnv { - name = "default"; - ignoreCollisions = true; - paths = [ - aria - aspell - aspellDicts.en - cacert - clang - cloc - cscope - ctags - curl - custom-pinentry - custom-youtube-dl - diffutils - docbook5 - emacs - entr - gist - gitAndTools.git-extras - gitAndTools.gitFull - gmp - gnumake - gnutar - gnutls - googler - graphviz-nox - haskellPackages.ShellCheck - haskellPackages.pandoc - htop - imagemagick - iperf - jq - keychain - less - llvm - mercurial - moreutils - mosh - mr - ncdu - openssl - p7zip - patchutils - pbzip2 - pkg-config - ponysay - pv - python27Packages.flake8 - python27Packages.howdoi - python27Packages.pip - python27Packages.pyflakes - python27Packages.pylint - python27Packages.virtualenv - restic - ripgrep - rlwrap - rsync - rtags - shfmt - silver-searcher - sloccount - sshpass - texlive.combined.scheme-basic - tmux - transcrypt - tree - unzip - upx - wakelan - watch - wget - xz - yq - # If I ever come up with some linux only stuff or figure out xhyve - # ] ++ stdenv.lib.optionals stdenv.isLinux [ - # ] ++ stdenv.lib.optionals stdenv.isDarwin [ - # xhyve - ]; - }; + default = buildEnv { + name = "default"; + ignoreCollisions = true; + paths = [ + aria + aspell + aspellDicts.en + cacert + clang + cloc + cscope + ctags + curl + # custom-pinentry + custom-youtube-dl + diffutils + docbook5 + emacs + entr + gist + gitAndTools.git-extras + gitAndTools.gitFull + gmp + gnumake + gnutar + gnutls + googler + graphviz-nox + haskellPackages.ShellCheck + haskellPackages.pandoc + htop + imagemagick + iperf + jq + keychain + less + llvm + mercurial + moreutils + mosh + mr + ncdu + openssl + p7zip + patchutils + pbzip2 + pkg-config + ponysay + pv + python27Packages.flake8 + python27Packages.howdoi + python27Packages.pip + python27Packages.pyflakes + python27Packages.pylint + python27Packages.virtualenv + restic + ripgrep + rlwrap + rsync + rtags + shfmt + silver-searcher + sloccount + sshpass + texlive.combined.scheme-basic + tmux + transcrypt + tree + unzip + upx + wakelan + watch + wget + xz + yq +# If I ever come up with some linux only stuff or figure out xhyve +# ] ++ stdenv.lib.optionals stdenv.isLinux [ +# ] ++ stdenv.lib.optionals stdenv.isDarwin [ +# xhyve + ]; }; - allowUnfree = true; - } + }; + allowUnfree = true; +} #+END_SRC diff --git a/tmux.org b/tmux.org index 9eeaae6..4cf4925 100644 --- a/tmux.org +++ b/tmux.org @@ -15,16 +15,16 @@ keybinds. Also set aggressive resize so our panes resize somewhat sanely with multiple clients. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - set-window-option -g mode-keys vi - set-window-option -g aggressive-resize on +set-window-option -g mode-keys vi +set-window-option -g aggressive-resize on #+END_SRC Use the only shell that matters for our login shell. Set our TERM to xterm-256color as well. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - set-option -g default-command 'zsh -l' - set-option -g default-terminal 'xterm-256color' +set-option -g default-command 'zsh -l' +set-option -g default-terminal 'xterm-256color' #+END_SRC Status line options. For the status line we want the selected window tabish @@ -41,43 +41,43 @@ ensures that any skew on waking up/updating isn't visible. Yes I'm weird in that if I specify 5 and don't get things updated every 0-4 seconds it annoys me. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - set-window-option -g window-status-current-style bg=white,fg=black - set-window-option -g window-status-style default - set-option -g window-status-format '#I #W#F' - set-option -g window-status-current-format '#I:#W#{?window_zoomed_flag, 🔍,}' - set-option -g status-style bg=black,fg=colour7 - set-option -g status-interval 7 - set-option -g status-left-length 24 - set-option -g status-left '' +set-window-option -g window-status-current-style bg=white,fg=black +set-window-option -g window-status-style default +set-option -g window-status-format '#I #W#F' +set-option -g window-status-current-format '#I:#W#{?window_zoomed_flag, 🔍,}' +set-option -g status-style bg=black,fg=colour7 +set-option -g status-interval 7 +set-option -g status-left-length 24 +set-option -g status-left '' #+END_SRC Right status just with Day HH:MM:SS to the right. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - set-option -g status-right-length 13 - set-option -g status-right "%a %H:%M:%S" +set-option -g status-right-length 13 +set-option -g status-right "%a %H:%M:%S" #+END_SRC Right status with battery shenanigans. Only present on macos for now. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - set-option -g status-right-length 20 - set-option -g @batt_remain_minimal true - set-option -g @batt_icon_status_charged ' ' - set-option -g @batt_icon_status_charging '↑' - set-option -g @batt_icon_status_discharging '↓' - set-option -g @batt_icon_status_unknown '?' - set-option -g @batt_color_status_primary_discharging colour9 - set-option -g status-right "#{battery_color_fg}#{battery_icon_status}#[default] #{battery_color_charge_bg}#{battery_remain}#[default] %a %H:%M:%S" - - run-shell ~/src/github.com/tmux-plugins/tmux-battery/battery.tmux +set-option -g status-right-length 20 +set-option -g @batt_remain_minimal true +set-option -g @batt_icon_status_charged ' ' +set-option -g @batt_icon_status_charging '↑' +set-option -g @batt_icon_status_discharging '↓' +set-option -g @batt_icon_status_unknown '?' +set-option -g @batt_color_status_primary_discharging colour9 +set-option -g status-right "#{battery_color_fg}#{battery_icon_status}#[default] #{battery_color_charge_bg}#{battery_remain}#[default] %a %H:%M:%S" + +run-shell ~/src/github.com/tmux-plugins/tmux-battery/battery.tmux #+END_SRC The highlight style is how tmux renders selected text. Black on red is what I use to make it obvious what is being selected. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - set-window-option -g mode-style bg=red,fg=black +set-window-option -g mode-style bg=red,fg=black #+END_SRC Pane border options, mostly an attempt to mimic/ape the status line setup. @@ -87,8 +87,8 @@ foreground so that if we are on a white on black, or black on white or some other scheme we don't have a gaudy background for the panes. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - set-option -g pane-border-style fg=colour7 - set-option -g pane-active-border-style fg=colour2 +set-option -g pane-border-style fg=colour7 +set-option -g pane-active-border-style fg=colour2 #+END_SRC TTY alert character stuff. Much like a phone, don't make a sound. Leave that @@ -97,9 +97,9 @@ kinda gaudy sound beeps to boomers. Basically flash the message/status bar with a black on white message. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - set-option -g visual-activity on - set-option -g visual-bell on - set-option -g message-style bg=colour7,fg=black +set-option -g visual-activity on +set-option -g visual-bell on +set-option -g message-style bg=colour7,fg=black #+END_SRC Use the window title if available and update it if it changes. Aka, in @@ -109,9 +109,9 @@ shell. Can rename it to something else if we want as well. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - set-option -g set-titles on - set-option -g set-titles-string '#T' - set-window-option -g automatic-rename on +set-option -g set-titles on +set-option -g set-titles-string '#T' +set-window-option -g automatic-rename on #+END_SRC Custom key rebindings. @@ -119,9 +119,9 @@ Custom key rebindings. PREFIX + R = Reload tmux configuration. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - bind-key R \ - source-file ~/.tmux.conf \;\ - display 'reloaded ~/.tmux.conf' +bind-key R \ + source-file ~/.tmux.conf \;\ + display 'reloaded ~/.tmux.conf' #+END_SRC Note, this uses tmux 2.9 syntax now. Which is annoying af, used to be able to @@ -142,103 +142,102 @@ green so we know we're logging. # FIXME #+BEGIN_SRC conf :tangle no - bind-key o \ - pipe-pane -o "cat >> $HOME/tmux-`iso8601`.log" \;\ - if-shell \ - "tmux show-window-options | grep 'window-status-current-style' | grep fg=green'" \ - "set-window-option - "display 'stopping logging pane output' - set-window-option window-status-current-style fg=green +bind-key o \ + pipe-pane -o "cat >> $HOME/tmux-`iso8601`.log" \;\ + if-shell \ + "tmux show-window-options | grep 'window-status-current-style' | grep fg=green'" \ + "set-window-option + "display 'stopping logging pane output' + set-window-option window-status-current-style fg=green #+END_SRC PREFIX + O = St*O*p logging pane output. Also reset the fg color back to default. #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) - bind-key O \ - pipe-pane \;\ - set-window-option window-status-current-style default \; +bind-key O \ + pipe-pane \;\ + set-window-option window-status-current-style default \; #+END_SRC #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (bound-and-true-p tmux-p)) +bind-key N new-session -t default + +# Using s for synchronizing panes, means that s for choosing sessions +# is now e +unbind-key s # interactive select sessions +bind-key e choose-tree - bind-key N new-session -t default - - # Using s for synchronizing panes, means that s for choosing sessions - # is now e - unbind-key s # interactive select sessions - bind-key e choose-tree - - # (un)synchronize panes with prefix-s - bind-key s \ - if-shell \ - "tmux show-window-options | grep 'synchronize-panes on'" \ - "set-window-option window-status-current-style bg=white,fg=black; \ - set-window-option pane-active-border-style bg=colour15,fg=colour2; \ - set-window-option synchronize-panes off; \ - display 'synchronization off'" \ - "set-window-option window-status-current-style bg=red,fg=black; \ - set-window-option pane-active-border-style bg=colour15,fg=red; \ - set-window-option synchronize-panes on; \ - display 'synchronizing'" - - # same thing as ^ so it sets up things if we were started with - # something else that set synchronization. +# (un)synchronize panes with prefix-s +bind-key s \ + if-shell \ + "tmux show-window-options | grep 'synchronize-panes on'" \ + "set-window-option window-status-current-style bg=white,fg=black; \ + set-window-option pane-active-border-style bg=colour15,fg=colour2; \ + set-window-option synchronize-panes off; \ + display 'synchronization off'" \ + "set-window-option window-status-current-style bg=red,fg=black; \ + set-window-option pane-active-border-style bg=colour15,fg=red; \ + set-window-option synchronize-panes on; \ + display 'synchronizing'" + +# same thing as ^ so it sets up things if we were started with +# something else that set synchronization. +if-shell \ + "tmux show-window-options | grep 'synchronize-panes on' || /bin/true" \ + "set-window-option window-status-current-style bg=red; \ + set-window-option pane-active-border-style bg=red,fg=black" + +# Setup splits to be less annoying +bind-key \\ split-window -h +bind-key - split-window -v + +# vi keybindings for pane navigation +bind-key k select-pane -U +bind-key j select-pane -D +bind-key h select-pane -L +bind-key l select-pane -R + +# Make it so that I can detach/etc while holding control down, +# PURE LAZY +bind-key C-d detach +bind-key C-n next-window +bind-key C-p previous-window + +bind-key C-k select-pane -U +bind-key C-j select-pane -D +bind-key C-h select-pane -L +bind-key C-l select-pane -R + +# Non confirming kill pane plskthxbai +bind-key x kill-pane + +# Lets change the prefix key so we don't clobber emacs back one char key +unbind-key C-b + +# hacky, but C-\ isn't used by anything overly important in emacs +set-option -g prefix 'C-\' + +# two C-\'s == C-\, if i need it, likely not +bind 'C-\' send-prefix + +# Delay in sending things is dumb +set-option -s escape-time 1 + +# so we can scroll the mouse, select panes, etc... +set -g mouse on +bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'" +bind-key m \ if-shell \ - "tmux show-window-options | grep 'synchronize-panes on' || /bin/true" \ - "set-window-option window-status-current-style bg=red; \ - set-window-option pane-active-border-style bg=red,fg=black" - - # Setup splits to be less annoying - bind-key \\ split-window -h - bind-key - split-window -v - - # vi keybindings for pane navigation - bind-key k select-pane -U - bind-key j select-pane -D - bind-key h select-pane -L - bind-key l select-pane -R - - # Make it so that I can detach/etc while holding control down, - # PURE LAZY - bind-key C-d detach - bind-key C-n next-window - bind-key C-p previous-window - - bind-key C-k select-pane -U - bind-key C-j select-pane -D - bind-key C-h select-pane -L - bind-key C-l select-pane -R - - # Non confirming kill pane plskthxbai - bind-key x kill-pane - - # Lets change the prefix key so we don't clobber emacs back one char key - unbind-key C-b - - # hacky, but C-\ isn't used by anything overly important in emacs - set-option -g prefix 'C-\' - - # two C-\'s == C-\, if i need it, likely not - bind 'C-\' send-prefix - - # Delay in sending things is dumb - set-option -s escape-time 1 - - # so we can scroll the mouse, select panes, etc... - set -g mouse on - bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'" - bind-key m \ - if-shell \ - "tmux show-options -g | grep 'mouse on'" \ - "set -g mouse off; \ - display 'Mouse modes off'" \ - "set -g mouse on; \ - display 'Mouse modes on'" + "tmux show-options -g | grep 'mouse on'" \ + "set -g mouse off; \ + display 'Mouse modes off'" \ + "set -g mouse on; \ + display 'Mouse modes on'" #+END_SRC Only set xclip for when x is in use #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (and (bound-and-true-p tmux-p) (bound-and-true-p x-p))) - bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer" - bind C-y run "tmux save-buffer - | xclip -i" +bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer" +bind C-y run "tmux save-buffer - | xclip -i" #+END_SRC diff --git a/zsh.org b/zsh.org index ebfade7..214ea0b 100644 --- a/zsh.org +++ b/zsh.org @@ -75,7 +75,7 @@ setopt print_exit_value # I love you zsh for this, print out non zero exits. other_term() { case $TERM in - *xterm*|*rxvt*|(dt|k|e)term) + *xterm*|*rxvt*|dtterm|kterm|eterm) print -Pn "\e]2;%~\a" ;; sun-cmd)