| @@ -3,11 +3,11 @@ | |||
| #+STARTUP: hidestars | |||
| #+STARTUP: odd | |||
| #+BABEL: :cache yes | |||
| #+PROPERTY: header-args :cache yes | |||
| #+PROPERTY: header-args :cache t | |||
| #+PROPERTY: header-args :padline no | |||
| #+PROPERTY: header-args :mkdirp yes | |||
| #+PROPERTY: header-args :mkdirp t | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| #+PROPERTY: header-args :replace t | |||
| #+PROPERTY: header-args :tangle-mode (identity #o755) | |||
| ~/bin files and other shenanigans | |||
| @@ -1006,7 +1006,7 @@ foreach my $input (@ARGV){ | |||
| 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)) | |||
| #+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 | |||
| @@ -1096,3 +1096,21 @@ TODO: why the hell is :mkdirp yes needed here but nowhere else? | |||
| end | |||
| end | |||
| #+END_SRC | |||
| * ~/bin/close | |||
| macos only, simple wrapper around osascript to send close to a gui application so I don't have to use the mouse/trackpad cause I'm lazy af. | |||
| #+BEGIN_SRC sh :padline no :tangle (tangle/file "bin/close" (bound-and-true-p macos-p)) | |||
| #!/bin/sh | |||
| if [ -z "${1}" ]; then | |||
| printf "usage: close app_name\n no application to close provided\n" | |||
| exit 1 | |||
| fi | |||
| osascript <<END | |||
| tell application "${1}" | |||
| quit | |||
| end tell | |||
| END | |||
| #+END_SRC | |||
| @@ -188,46 +188,90 @@ cconv() | |||
| #+END_SRC | |||
| ** git | |||
| General clone into ~/src/TLD/some/dir from a git uri function. | |||
| Tries to strip out miscellany that we don't need from the uri. Also allows | |||
| wrapper functions that simplify usage. | |||
| Note the gh and bb wrappers which make it easy to get repos from github and bitbucket. | |||
| Usage is simply: | |||
| try_git some_uri optional_branch_if_not_master | |||
| The gh wrapper wraps this and simplifies usage by setting up the uri as https so | |||
| we can do the following example: | |||
| gh user/repo maybe_branch | |||
| This checks out something from https://github.com/user/repo.git to | |||
| ~/src/github.com/user/repo | |||
| This also makes for a somewhat easy way to cd into the dir as well without | |||
| push/popd. The bb wrapper behaves the same. | |||
| Presuming using the bare try_git function, the dir in ~/src/TLD is simply | |||
| what comes after the tld. | |||
| Example: | |||
| 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)) | |||
| maybe_git_repo() | |||
| { | |||
| # assume https if input doesn't contain a protocol | |||
| proto=https | |||
| destination=${HOME}/src | |||
| 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 | |||
| git ls-remote "${rrepo}" > /dev/null 2>&1 | |||
| if [ $? = 0 ]; then | |||
| mkdir -p "${repo}" | |||
| echo "git clone ${rrepo} ${repo}" | |||
| git clone --recursive "${rrepo}" "${repo}" | |||
| 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 | |||
| else | |||
| echo "${rrepo} doesn't look to be a git repository" | |||
| [ -d "${repo}" ] && cd "${repo}" | |||
| fi | |||
| fi | |||
| [ -d "${repo}" ] && cd "${repo}" | |||
| } | |||
| } | |||
| gh() | |||
| { | |||
| maybe_git_repo "https://github.com/${1}" | |||
| } | |||
| gh() | |||
| { | |||
| try_git "https://github.com/${1}" "${2:-master}" | |||
| } | |||
| bb() | |||
| { | |||
| maybe_git_repo "https://bitbucket.org/${1}" | |||
| } | |||
| 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)) | |||
| @@ -256,27 +300,10 @@ mk_nix_shell() | |||
| > shell.nix; | |||
| } | |||
| nix_env_setup() | |||
| # TODO: any of this useful to keep around? | |||
| nr() | |||
| { | |||
| # The nix installer put something like this into the .profile. | |||
| # BAD INSTALLER NO COOKIE! | |||
| if [ -e ${HOME}/.nix-profile/etc/profile.d/nix.sh ]; then | |||
| . ${HOME}/.nix-profile/etc/profile.d/nix.sh; | |||
| export NIX_PATH=nixpkgs=${HOME}/src/github.com/NixOS/nixpkgs:staging=${HOME}/src/github.com/NixOS/nixpkgs/staging | |||
| export NIX_CFLAGS_COMPILE="-idirafter /usr/include" | |||
| export NIX_CFLAGS_LINK="-L/usr/lib" | |||
| export PKG_CONFIG_PATH="~/.nix-profile/lib/pkgconfig" | |||
| NIX_GHC=$(type -p ghc > /dev/null 2>&1) | |||
| if [ -n "$NIX_GHC" ]; then | |||
| eval $(grep export "$NIX_GHC") | |||
| fi | |||
| fi | |||
| nr() | |||
| { | |||
| nix-shell --run "$(echo $@)" | |||
| } | |||
| nix-shell --run "$(echo $@)" | |||
| } | |||
| nix-on() { | |||
| @@ -299,9 +326,15 @@ if [ ! -e ${HOME}/.nonix ]; then | |||
| fi | |||
| #+END_SRC | |||
| The nix installer adds this which I don't want, $HOME is fully prefixed in what is added. | |||
| #+BEGIN_SRC sh :tangle no | |||
| if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then . $HOME/.nix-profile/etc/profile.d/nix.sh # added by Nix installer | |||
| #+END_SRC | |||
| #+BEGIN_SRC sh :tangle (tangle/file ".profile" (bound-and-true-p nix-p)) | |||
| if [ ! -e ${HOME}/.nonix ]; then | |||
| nix_env_setup | |||
| if [ ! -e ${HOME}/.nonix ] && [ -e ~/.nix-profile/etc/profile.d/nix.sh ]; then | |||
| source ~/.nix-profile/etc/profile.d/nix.sh | |||
| fi | |||
| #+END_SRC | |||
| @@ -311,6 +311,33 @@ Typing out *yes* or *no* is stupid. | |||
| (fset 'yes-or-no-p 'y-or-n-p) | |||
| #+END_SRC | |||
| Disable the stupid prompt added in 23.2 that asks if you want to kill a buffer with a process attached. Yes, obviously, shut up and do it. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (setq kill-buffer-query-functions | |||
| (remq 'process-kill-buffer-query-function | |||
| kill-buffer-query-functions)) | |||
| #+END_SRC | |||
| TESTING tooltip mode | |||
| Puts all tooltips in the echo arear. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (tooltip-mode -1) | |||
| (custom-set-variables | |||
| '(tooltip-use-echo-area t)) | |||
| #+END_SRC | |||
| TESTING redisplay | |||
| Have emacs not redraw the display before processing input events. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (custom-set-variables | |||
| '(redisplay-dont-pause t)) | |||
| #+END_SRC | |||
| *** osx specific | |||
| **** no yes-or-no gui windows | |||
| @@ -384,11 +411,14 @@ Also have the scratch buffer be empty instead of have the derp message I never r | |||
| *** fonts | |||
| List of fonts in order of preference. | |||
| List of fonts in order of preference. Set preferred font list when we're in a | |||
| gui emacs session. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (defvar my/gui-fonts | |||
| '( | |||
| "ComicCode" | |||
| "Comic Code" | |||
| "PragmataPro" | |||
| "Pragmata Pro" ;; Seems to register differently on osx than X | |||
| "Source Code Pro" | |||
| @@ -396,14 +426,9 @@ List of fonts in order of preference. | |||
| "Monaco" | |||
| ) | |||
| ) | |||
| #+END_SRC | |||
| Set preferred font list when we're in a gui emacs session. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (with-no-warnings | |||
| (when window-system | |||
| (if (find-font (font-spec :name (car my/gui-fonts))) | |||
| (if (find-font (font-spec :name (car my/gui-fonts))) | |||
| (progn (set-frame-font (car my/gui-fonts)) | |||
| (set-face-attribute 'default nil :height 180)) | |||
| (progn (set-gui-font (cdr my/gui-fonts)))) | |||
| @@ -433,6 +458,17 @@ Set preferred font list when we're in a gui emacs session. | |||
| All the packages I use. | |||
| *** editorconfig | |||
| If editorconfig is around use it. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (use-package editorconfig | |||
| :ensure t | |||
| :config | |||
| (editorconfig-mode 1)) | |||
| #+END_SRC | |||
| *** tramp | |||
| #+BEGIN_SRC emacs-lisp | |||
| @@ -628,7 +664,6 @@ Org-mode keybindings and settings, pretty sparse really. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (use-package org | |||
| :ensure org-plus-contrib | |||
| :bind (("C-c a" . org-agenda) | |||
| ("C-c b" . org-iswitchb) | |||
| ("C-c c" . org-capture) | |||
| @@ -674,8 +709,8 @@ Org-mode keybindings and settings, pretty sparse really. | |||
| (sh . t) | |||
| ))) | |||
| (add-hook 'after-init-hook (lambda () (org-reload))) | |||
| ) | |||
| ) | |||
| ) | |||
| ) | |||
| (use-package org-bullets | |||
| :ensure t | |||
| :init | |||
| @@ -700,13 +735,26 @@ Org-mode keybindings and settings, pretty sparse really. | |||
| `(org-level-3 ((t (,@headline ,@variable-tuple :height 1.25)))) | |||
| `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.5)))) | |||
| `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.75)))) | |||
| `(org-document-title ((t (,@headline ,@variable-tuple :height 1.5 :underline nil)))))) | |||
| ) | |||
| `(org-document-title ((t (,@headline ,@variable-tuple :height 1.5 :underline nil))))))) | |||
| (font-lock-add-keywords 'org-mode | |||
| '(("^ +\\([-*]\\) " | |||
| (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) | |||
| ) | |||
| ) | |||
| (use-package org-roam | |||
| :hook | |||
| (after-init . org-roam-mode) | |||
| :init | |||
| (custom-set-variables '(org-roam-directory "~/.emacs.d")) | |||
| :bind (:map org-roam-mode-map | |||
| (("C-c n l" . org-roam) | |||
| ("C-c n f" . org-roam-find-file) | |||
| ("C-c n j" . org-roam-jump-to-index) | |||
| ("C-c n b" . org-roam-switch-to-buffer) | |||
| ("C-c n g" . org-roam-graph)) | |||
| :map org-mode-map | |||
| (("C-c n i" . org-roam-insert)))) | |||
| (use-package ob-async) | |||
| #+END_SRC | |||
| #+BEGIN_SRC emacs-lisp :tangle no | |||
| @@ -767,7 +815,9 @@ Not tangled into the config intentionally. | |||
| Auto complete functionality is nice to have. | |||
| #+BEGIN_SRC emacs-lisp | |||
| FIXME! | |||
| #+BEGIN_SRC emacs-lisp :tangle no | |||
| (use-package auto-complete | |||
| :diminish auto-complete-mode | |||
| :ensure t | |||
| @@ -865,7 +915,9 @@ Highlight TODO/FIXME type messages in comments. | |||
| *** projectile | |||
| #+BEGIN_SRC emacs-lisp | |||
| FIXME! | |||
| #+BEGIN_SRC emacs-lisp :tangle no | |||
| (use-package projectile | |||
| :diminish projectile-mode | |||
| :ensure t | |||
| @@ -936,6 +988,12 @@ So I write gooder. Me fail English? Thats unpossible. | |||
| (use-package writegood-mode :ensure t) | |||
| #+END_SRC | |||
| *** rust-mode | |||
| #+BEGIN_SRC emacs-lisp | |||
| (use-package rust-mode :commands rust-mode :mode ("\\*.rs\\'" . rust-mode) | |||
| :ensure t) | |||
| #+END_SRC | |||
| *** python-mode | |||
| Compress down python configuration a bit. | |||
| @@ -947,24 +1005,6 @@ Compress down python configuration a bit. | |||
| :ensure t | |||
| :init | |||
| (progn | |||
| (use-package jedi | |||
| :ensure t | |||
| :init | |||
| (progn | |||
| (jedi:install-server) | |||
| ) | |||
| :config | |||
| (progn | |||
| (custom-set-variables | |||
| '(jedi:complete-on-dot t) | |||
| '(jedi:install-imenu t) | |||
| ) | |||
| ) | |||
| :bind | |||
| (("M-." . jedi:goto-definition) | |||
| ("M-," . jedi:goto-definition-pop-marker) | |||
| ) | |||
| ) | |||
| (use-package company-anaconda | |||
| :ensure t | |||
| :config | |||
| @@ -983,7 +1023,6 @@ Compress down python configuration a bit. | |||
| (progn | |||
| (add-hook 'python-mode-hook' | |||
| (lambda () | |||
| (jedi:setup) | |||
| (push '("lambda" . ?λ) prettify-symbols-alist) | |||
| (push '("<=" . ?≤) prettify-symbols-alist) | |||
| (push '(">=" . ?≥) prettify-symbols-alist) | |||
| @@ -1123,10 +1162,9 @@ Make undo more useful, and treelike. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (use-package undo-tree | |||
| :diminish undo-tree-mode | |||
| :ensure t | |||
| :init | |||
| (progn (global-undo-tree-mode)) | |||
| (global-undo-tree-mode) | |||
| :config | |||
| (progn (defadvice undo-tree-visualize (around undo-tree-split-side-by-side activate) | |||
| "Split undo-tree side-by-side" | |||
| @@ -1142,7 +1180,8 @@ Make undo more useful, and treelike. | |||
| *** color-identifiers-mode | |||
| Color variables for easy identification, its like a rainbow puked over everything opened in prog-mode-hook. | |||
| Color variables for easy identification, its like a rainbow puked over | |||
| everything opened in prog-mode-hook. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (use-package color-identifiers-mode | |||
| @@ -1153,12 +1192,38 @@ Color variables for easy identification, its like a rainbow puked over everythin | |||
| ) | |||
| #+END_SRC | |||
| *** nix-mode | |||
| *** idle-highlight-mode | |||
| Highlight a variable when you're selecting it, helps in reviewing code to see | |||
| where it exists. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (use-package idle-highlight-mode | |||
| :diminish idle-highlight-mode | |||
| :ensure t | |||
| :config | |||
| (add-hook 'prog-mode-hook 'idle-highlight-mode) | |||
| ) | |||
| #+END_SRC | |||
| *** nix | |||
| Instead of text might as well get a decent mode hook going here. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (use-package nixos-options :ensure t) | |||
| (use-package company-nixos-options :ensure t) | |||
| #+END_SRC | |||
| #+BEGIN_SRC emacs-lisp :tangle no | |||
| (use-package nix-mode :ensure t) | |||
| (setq flycheck-command-wrapper-function | |||
| (lambda (command) (apply 'nix-shell-command (nix-current-sandbox) command)) | |||
| flycheck-executable-find | |||
| (lambda (cmd) (nix-executable-find (nix-current-sandbox) cmd))) | |||
| (add-to-list 'company-backends 'company-nixos-options) | |||
| #+END_SRC | |||
| *** docker-mode | |||
| @@ -1186,7 +1251,6 @@ Common mode defaults I think are sensible. | |||
| #+BEGIN_SRC emacs-lisp | |||
| (add-hook 'prog-mode-hook | |||
| '(lambda () | |||
| (auto-complete-mode) ;; can't get this to work with use-package easily | |||
| (interactive) | |||
| (hl-line-mode) | |||
| (whitespace-mode) | |||
| @@ -13,11 +13,16 @@ General git configuration split out into sections mostly. | |||
| * ~/.gitconfig | |||
| ** pager | |||
| 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 | |||
| #+END_SRC | |||
| ** color | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [color] | |||
| status = auto | |||
| @@ -38,6 +43,9 @@ General git configuration split out into sections mostly. | |||
| 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' | |||
| @@ -64,79 +72,161 @@ General git configuration split out into sections mostly. | |||
| effit = reset --hard | |||
| bn = rev-parse --abbrev-ref HEAD | |||
| cp = log --no-merges --cherry --graph --oneline | |||
| # What commits differ between branches, note, equivalent commits are omitted. | |||
| # Use this with three dot operator aka master...origin/master | |||
| cpd = log --no-merges --left-right --graph --cherry-pick --oneline | |||
| # Same as ^ only equivalent commits are listed with a = sign. | |||
| cmd = log --no-merges --left-right --graph --cherry-mark --oneline | |||
| # git update with submodule update | |||
| sup = !git pull --rebase && git submodule update --init --recursive | |||
| short = rev-parse --short | |||
| # git clone with submodules | |||
| sc = !git clone --recursive $1 | |||
| # 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}' | egrep -v '^\\s+$' | |||
| # 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 | |||
| # 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' | |||
| # short sha | |||
| short = rev-parse --short | |||
| # branch commits on lhs compared to rhs, use via g bcs $(g bn) ^other/branch | |||
| bcs = log --pretty="%H" --first-parent --no-merges | |||
| 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" | |||
| # 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}" | |||
| # push branch while setting the upstream to the default remote | |||
| pbr = !git push --set-upstream $(git defremote) $(git bn) | |||
| 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)' | |||
| # Pull all the commits missed from a git pull --depth N clone | |||
| unshallow = pull --unshallow | |||
| #+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 | |||
| #+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" | |||
| #+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" | |||
| #+END_SRC | |||
| ** github | |||
| My username for github. | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [github] | |||
| user = mitchty | |||
| #+END_SRC | |||
| ** credential | |||
| 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 | |||
| #+END_SRC | |||
| ** advice | |||
| Shut up already, I don't need hints. | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".gitconfig" (bound-and-true-p git-p)) | |||
| [advice] | |||
| statushints = false | |||
| #+END_SRC | |||
| ** gui | |||
| 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 | |||
| #+END_SRC | |||
| ** http | |||
| 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 | |||
| #+END_SRC | |||
| ** push | |||
| 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 | |||
| #+END_SRC | |||
| ** url rewrites | |||
| 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/ | |||
| #+END_SRC | |||
| ** username/email | |||
| Default username and email to use if not overridden. Note, this only applies to | |||
| where I actually do any commits. | |||
| My layout is ~/src/domain/... Not all domains might end up getting thrown in | |||
| here. Adjust what username/email gets used. Git 2.13+ only. Mostly for work | |||
| 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 | |||
| #+END_SRC | |||
| This silly text is here to make git merges easier for private branches. I got | |||
| sick of resolving silly merge conflicts. Let the fuzz detection figure it out. | |||
| HUNK PADDING | |||
| HUNK PADDING | |||
| HUNK PADDING | |||
| END HUNK PADDING | |||
| END HUNK PADDING | |||
| END HUNK PADDING | |||
| * ~/.gitignore | |||
| Common crap/build artifacts that git should always ignore. | |||
| @@ -15,7 +15,7 @@ Nix user config.nix setup. | |||
| { | |||
| packageOverrides = pkgs: with pkgs; | |||
| let in rec { | |||
| custom-pinentry = pinentry.override { gtk2 = null; qt4 = null; ncurses = null; }; | |||
| custom-pinentry = pinentry.override { gtk2 = null; ncurses = null; }; | |||
| custom-youtube-dl = python27Packages.youtube-dl.override { pandoc = null; }; | |||
| default = buildEnv { | |||
| @@ -25,10 +25,8 @@ Nix user config.nix setup. | |||
| aria | |||
| aspell | |||
| aspellDicts.en | |||
| cabal-install | |||
| cacert | |||
| clang | |||
| clang-analyzer | |||
| cloc | |||
| cscope | |||
| ctags | |||
| @@ -37,48 +35,37 @@ Nix user config.nix setup. | |||
| custom-youtube-dl | |||
| diffutils | |||
| docbook5 | |||
| duply | |||
| emacs | |||
| entr | |||
| gdbm | |||
| ghostscript | |||
| gist | |||
| gitAndTools.git-extras | |||
| gitAndTools.gitFull | |||
| gmp | |||
| gnumake | |||
| gnupg | |||
| gnupg1compat | |||
| gnutar | |||
| gnutls | |||
| googler | |||
| graphviz-nox | |||
| haskellPackages.ShellCheck | |||
| haskellPackages.ghc-mod | |||
| haskellPackages.hasktags | |||
| haskellPackages.hindent | |||
| haskellPackages.hspec | |||
| haskellPackages.pandoc | |||
| htop | |||
| imagemagick | |||
| iperf | |||
| jq | |||
| keychain | |||
| lastpass-cli | |||
| less | |||
| llvm | |||
| mercurial | |||
| moreutils | |||
| mosh | |||
| mr | |||
| multitail | |||
| munge | |||
| ncdu | |||
| openssl | |||
| p7zip | |||
| patchutils | |||
| pbzip2 | |||
| pigz | |||
| pixz | |||
| pkgconfig | |||
| pkg-config | |||
| ponysay | |||
| pv | |||
| python27Packages.flake8 | |||
| python27Packages.howdoi | |||
| @@ -86,15 +73,18 @@ Nix user config.nix setup. | |||
| python27Packages.pyflakes | |||
| python27Packages.pylint | |||
| python27Packages.virtualenv | |||
| restic | |||
| ripgrep | |||
| rlwrap | |||
| rsync | |||
| rtags | |||
| shfmt | |||
| silver-searcher | |||
| sloccount | |||
| sshpass | |||
| stack | |||
| texlive.combined.scheme-full | |||
| texlive.combined.scheme-basic | |||
| tmux | |||
| transcrypt | |||
| tree | |||
| unzip | |||
| upx | |||
| @@ -102,7 +92,7 @@ Nix user config.nix setup. | |||
| watch | |||
| wget | |||
| xz | |||
| zlib | |||
| 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 [ | |||
| @@ -0,0 +1,13 @@ | |||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||
| ;; File: mbp.el | |||
| ;; Copyright: 2017 Mitch Tishmack | |||
| ;; Description: Options for mb laptop | |||
| ;;(setq testing t) | |||
| (setq macos-p t) | |||
| (setq nix-p t) | |||
| (setq tmux-p t) | |||
| (setq git-p t) | |||
| (setq emacs-p t) | |||
| (setq zsh-p t) | |||
| (setq mosh-p t) | |||
| (setq perl-p t) | |||
| @@ -0,0 +1,13 @@ | |||
| ;;-*-mode: emacs-lisp; coding: utf-8;-*- | |||
| ;; File: mbp.el | |||
| ;; Copyright: 2017 Mitch Tishmack | |||
| ;; Description: Options for mbp laptop | |||
| ;;(setq testing t) | |||
| (setq macos-p t) | |||
| (setq nix-p t) | |||
| (setq tmux-p t) | |||
| (setq git-p t) | |||
| (setq emacs-p t) | |||
| (setq zsh-p t) | |||
| (setq mosh-p t) | |||
| (setq perl-p t) | |||
| @@ -8,64 +8,158 @@ | |||
| #+PROPERTY: header-args :comments no | |||
| #+PROPERTY: header-args :replace yes | |||
| Tmux configuration. Pretty boring in most ways. | |||
| Tmux configuration | |||
| Use vi mode for tmux keybindings. Means if we start emacs up, no conflicts for | |||
| 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)) | |||
| # Setup vi mode by default | |||
| 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. | |||
| # Force zsh to be a login shell | |||
| #+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' | |||
| #+END_SRC | |||
| # Status line options, mainly coloring | |||
| set-window-option -g window-status-bg colour6 | |||
| set-window-option -g window-status-fg black | |||
| set-window-option -g window-status-current-bg white | |||
| Status line options. For the status line we want the selected window tabish | |||
| thing to be white background and black foreground. | |||
| # Selection highlight color | |||
| set-window-option -g mode-style bg=red,fg=black | |||
| Use the default coloring which is white on black. Helps make the current tab | |||
| rather obvious from color alone ignoring the * character. | |||
| Additionally, setup the status lines so we have a mostly minimal setup on what | |||
| is displayed. Try to keep things as minimal as possible. | |||
| # Status line options | |||
| set-option -g status-bg black | |||
| set-option -g status-fg colour7 | |||
| Also note the status-interval is 7 seconds long, this is intentional as it | |||
| 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 '' | |||
| #+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-interval 7 | |||
| #+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 | |||
| #+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 | |||
| #+END_SRC | |||
| Pane border options, mostly an attempt to mimic/ape the status line setup. | |||
| Intent is we want to know what pane we're selected into, however we only set the | |||
| 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 | |||
| #+END_SRC | |||
| # Pane border options, mimics the status line coloring | |||
| set-option -g pane-border-bg colour15 | |||
| set-option -g pane-border-fg colour82 | |||
| set-option -g pane-active-border-bg colour15 | |||
| set-option -g pane-active-border-fg colour2 | |||
| TTY alert character stuff. Much like a phone, don't make a sound. Leave that | |||
| kinda gaudy sound beeps to boomers. | |||
| # Alert related things | |||
| 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-bg colour7 | |||
| set-option -g message-fg black | |||
| 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 | |||
| iterm2/Terminal.app on macos generally this is set to the active command or | |||
| shell. | |||
| # Pass through the window title and display it automatically on changes. | |||
| 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 | |||
| #+END_SRC | |||
| Custom key rebindings. | |||
| # Key rebinding to make things more au naturalle | |||
| 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 config' | |||
| display 'reloaded ~/.tmux.conf' | |||
| #+END_SRC | |||
| Note, this uses tmux 2.9 syntax now. Which is annoying af, used to be able to | |||
| just modify the fg/bg independently but now if you set the current style fg, it | |||
| presumes default for everything *GRRRR*. | |||
| So if you have to care about the background have to check that as well. Current | |||
| strategy here is to dump out the window options and look for | |||
| window-status-current-style and yoink the existing bg if present. | |||
| Essentially the foreground is changed to green when logging this pane. | |||
| Background is set to red when synchronizing. That's about it. | |||
| PREFIX + o = L*o*g pane output to a file. | |||
| Saved with the iso8601 command for the name. Also change the foreground text to | |||
| green so we know we're logging. | |||
| # FIXME | |||
| # Log pane output to a file, save with an iso8601 datestamp | |||
| #+BEGIN_SRC conf :tangle no | |||
| bind-key o \ | |||
| pipe-pane -o "cat >> $HOME/tmux-`iso8601`.log" \;\ | |||
| set-window-option window-status-current-fg green \; | |||
| 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-fg default \; | |||
| 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 | |||
| @@ -78,14 +172,12 @@ Tmux configuration. Pretty boring in most ways. | |||
| bind-key s \ | |||
| if-shell \ | |||
| "tmux show-window-options | grep 'synchronize-panes on'" \ | |||
| "set-window-option window-status-current-bg colour7; \ | |||
| set-window-option pane-active-border-fg colour2; \ | |||
| set-window-option pane-active-border-bg colour15; \ | |||
| "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-bg red; \ | |||
| set-window-option pane-active-border-fg red; \ | |||
| set-window-option pane-active-border-bg colour15; \ | |||
| "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'" | |||
| @@ -93,12 +185,11 @@ Tmux configuration. Pretty boring in most ways. | |||
| # something else that set synchronization. | |||
| if-shell \ | |||
| "tmux show-window-options | grep 'synchronize-panes on' || /bin/true" \ | |||
| "set-window-option window-status-current-bg red; \ | |||
| set-window-option pane-active-border-fg yellow; \ | |||
| set-window-option pane-active-border-bg red" | |||
| "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 -h | |||
| bind-key - split-window -v | |||
| # vi keybindings for pane navigation | |||
| @@ -145,26 +236,9 @@ Tmux configuration. Pretty boring in most ways. | |||
| display 'Mouse modes on'" | |||
| #+END_SRC | |||
| Only set xclip for x setup. | |||
| 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" | |||
| #+END_SRC | |||
| Testing of battery stuff, defaults in general. | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (and (bound-and-true-p tmux-p) (bound-and-true-p testing-p))) | |||
| set-option -g status-right-length 21 | |||
| set-option -g status-right "#{battery_status_fg}#{battery_remain} #{battery_icon}#[fg=white] %a %H:%M:%S" | |||
| set-option -g @batt_charged_icon "✓" | |||
| run-shell ~/src/github.com/tmux-plugins/tmux-battery/battery.tmux | |||
| #+END_SRC | |||
| And for macos, differ in that the battery charged icon is utf-8 really. TODO: do I need this really? | |||
| #+BEGIN_SRC conf :tangle (tangle/file ".tmux.conf" (and (bound-and-true-p testing-p) (bound-and-true-p tmux-p) (bound-and-true-p macos-p))) | |||
| set-option -g status-right-length 20 | |||
| set-option -g status-right "#{battery_remain} #{battery_icon} %a %H:%M:%S" | |||
| run-shell ~/src/github.com/tmux-plugins/tmux-battery/battery.tmux | |||
| #+END_SRC | |||