├── .gitignore ├── Brewfile ├── Makefile ├── README.md ├── bin ├── ascii-encode.php ├── bootstrap.sh ├── docker-aws.sh ├── fuzzy-date-time.py ├── git-subsplit.sh ├── git_list_tags.sh ├── list-timezones.php ├── nato.py ├── netscan.sh ├── nmapscan.sh ├── repos.py ├── setup.sh ├── ssh-copy-id-with-key.sh └── triangles.pl ├── default.nix ├── dockerfiles └── aws.Dockerfile ├── emacs ├── .gitignore ├── .gitmodules ├── README.org ├── bin │ ├── php_class_finder.php │ └── php_resolve_namespace.php ├── custom.el ├── init.el ├── plugins │ ├── edit-server.el │ ├── hide-mode-line.el │ ├── rotate-text.el │ └── try-code.el ├── site-lisp │ ├── appearance.el │ ├── defuns.el │ ├── lib-core.el │ ├── lib-elisp.el │ ├── lib-org.el │ ├── lib-php.el │ ├── lib-projects.el │ ├── lib-vendor.el │ ├── mappings.el │ ├── setup-ai.el │ ├── setup-apache.el │ ├── setup-coffeescript.el │ ├── setup-core.el │ ├── setup-css.el │ ├── setup-dired.el │ ├── setup-docker.el │ ├── setup-edit-server.el │ ├── setup-elisp.el │ ├── setup-erc.el │ ├── setup-eshell.el │ ├── setup-git.el │ ├── setup-go.el │ ├── setup-groovy.el │ ├── setup-hashicorp.el │ ├── setup-help.el │ ├── setup-js.el │ ├── setup-jsonnet.el │ ├── setup-keys.el │ ├── setup-kubernetes.el │ ├── setup-lilypond.el │ ├── setup-lua.el │ ├── setup-markdown.el │ ├── setup-multiple-cursors.el │ ├── setup-nix.el │ ├── setup-org.el │ ├── setup-php.el │ ├── setup-protobuf.el │ ├── setup-pug.el │ ├── setup-python.el │ ├── setup-saltstack.el │ ├── setup-shell-script.el │ ├── setup-sql.el │ ├── setup-tmux.el │ ├── setup-typescript.el │ ├── setup-web-mode.el │ ├── setup-yaml.el │ └── setup-zig.el ├── snippets │ ├── css-mode │ │ ├── block-comment │ │ ├── bootstrap-breakpoint-down │ │ └── bootstrap-breakpoint-up │ ├── emacs-lisp-mode │ │ ├── add-hook │ │ ├── defkey │ │ ├── defun │ │ ├── eval-when-compile │ │ ├── eval-when-compile-use-package │ │ ├── evil-declare-key │ │ ├── general-define-key │ │ ├── let │ │ ├── provide │ │ ├── require │ │ └── use-package │ ├── fundamental-mode │ │ └── mit-license │ ├── go-mode │ │ ├── append │ │ ├── for │ │ ├── func │ │ ├── if │ │ ├── if-err │ │ ├── if-err-log-fatal │ │ ├── if-err-return │ │ ├── if-map-get │ │ ├── interface │ │ ├── return │ │ ├── return-err │ │ ├── return-false │ │ ├── return-nil │ │ ├── return-true │ │ ├── struct │ │ ├── struct-func │ │ ├── switch │ │ ├── table-test │ │ ├── test │ │ └── test-func │ ├── groovy-mode │ │ └── jenkins-pipeline │ ├── html-mode │ │ ├── a │ │ ├── a.class │ │ ├── b │ │ ├── body │ │ ├── br │ │ ├── code │ │ ├── code.class │ │ ├── div │ │ ├── div.class │ │ ├── div.id │ │ ├── div.id.class │ │ ├── form │ │ ├── head │ │ ├── html │ │ ├── img │ │ ├── input │ │ ├── link │ │ ├── p │ │ ├── p.class │ │ ├── pre │ │ ├── script │ │ ├── span │ │ ├── span.class │ │ ├── span.id │ │ ├── table │ │ └── title │ ├── javascript-mode │ │ ├── att │ │ ├── attr-fun │ │ ├── cha │ │ ├── chang │ │ ├── chi │ │ ├── click │ │ ├── desc │ │ ├── doc │ │ ├── eac │ │ ├── exca │ │ ├── exeq │ │ ├── ext │ │ ├── extru │ │ ├── for │ │ ├── forin │ │ ├── fun │ │ ├── get │ │ ├── grease │ │ ├── has │ │ ├── header │ │ ├── hov │ │ ├── if │ │ ├── ife │ │ ├── iife │ │ ├── init │ │ ├── is │ │ ├── it │ │ ├── jquery-ajax │ │ ├── jquery-selector │ │ ├── json │ │ ├── map │ │ ├── meth │ │ ├── ne │ │ ├── par │ │ ├── post │ │ ├── rea │ │ ├── ready │ │ ├── return-false │ │ ├── return-true │ │ ├── sib │ │ ├── sli │ │ ├── slid │ │ ├── thi │ │ ├── tmpl │ │ ├── tog │ │ └── view │ ├── js2-jsx-mode │ │ └── react-component │ ├── js2-mode │ │ └── .yas-parents │ ├── makefile-mode │ │ └── phony-target │ ├── markdown-mode │ │ ├── code-fence │ │ └── release │ ├── org-mode │ │ ├── bash-block │ │ ├── code-block │ │ ├── latex-export-header │ │ ├── lcomment │ │ ├── lilypond │ │ ├── monthly-file │ │ ├── text-block │ │ └── title │ ├── php-mode │ │ ├── arrayMember │ │ ├── arrayMemberSameName │ │ ├── assertEquals │ │ ├── assertFalse │ │ ├── assertInstanceOf │ │ ├── assertInternalType │ │ ├── assertNotNull │ │ ├── assertNotSame │ │ ├── assertNull │ │ ├── assertSame │ │ ├── assertTrue │ │ ├── author-annotation │ │ ├── class │ │ ├── class-property │ │ ├── dataProvider │ │ ├── deprecated_message │ │ ├── docblock │ │ ├── echo-short-tags │ │ ├── exception-class │ │ ├── expectException │ │ ├── expects │ │ ├── for │ │ ├── foreach │ │ ├── function │ │ ├── getinstance │ │ ├── getter-setter │ │ ├── if │ │ ├── if-else │ │ ├── interface │ │ ├── php │ │ ├── pre-print-r │ │ ├── private-function │ │ ├── protected-function │ │ ├── psalm-suppress │ │ ├── public-function │ │ ├── public-static-function │ │ ├── return │ │ ├── return-false │ │ ├── return-null │ │ ├── return-this │ │ ├── return-true │ │ ├── script │ │ ├── switch │ │ ├── symfony-controller │ │ ├── symfony-form-type │ │ ├── symfony-handle-form │ │ ├── symfony-vardump │ │ ├── test │ │ ├── this │ │ ├── this-assignment │ │ ├── throw │ │ ├── trait │ │ ├── try │ │ ├── vardump │ │ └── while │ ├── python-mode │ │ ├── async-def │ │ ├── async-method │ │ ├── def │ │ ├── for │ │ ├── if │ │ ├── ifmain │ │ ├── method │ │ ├── pathlib-file │ │ ├── return │ │ ├── return-false │ │ ├── return-true │ │ └── self-assignment │ ├── python-ts-mode │ │ └── .yas-parents │ ├── rst-mode │ │ ├── code-block │ │ ├── image │ │ └── note │ ├── sh-mode │ │ └── set-options │ ├── terraform-mode │ │ ├── output │ │ ├── resource │ │ └── variable │ ├── text-mode │ │ ├── git-commit │ │ └── git-commit-simple │ ├── web-mode │ │ ├── .yas-parents │ │ ├── php-for │ │ ├── php-foreach │ │ ├── php-if │ │ ├── twig-apply │ │ ├── twig-block │ │ ├── twig-extends │ │ ├── twig-for │ │ ├── twig-if │ │ ├── twig-if-else │ │ ├── twig-include │ │ ├── twig-macro │ │ ├── twig-path │ │ └── twig-set │ └── yaml-mode │ │ ├── salt-for │ │ ├── salt-if │ │ └── salt-if-else └── straight │ └── versions │ └── default.el ├── git ├── .gitconfig ├── .gitignore └── .stow-local-ignore ├── pgcli └── .config │ └── pgcli │ └── config ├── tmux └── .tmux.conf ├── vim └── .vimrc └── zsh └── .zshrc /.gitignore: -------------------------------------------------------------------------------- 1 | /xmonad/xmonad-i386-linux 2 | /xmonad/xmonad.errors 3 | /xmonad/xmonad.hi 4 | /xmonad/xmonad.o 5 | /group_vars/* 6 | !/group_vars/_example.yml 7 | /result 8 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | tap "d12frosted/emacs-plus" 2 | tap "hashicorp/tap" 3 | tap "warrensbox/tap" 4 | brew "libpng" 5 | brew "jpeg-xl" 6 | brew "aom" 7 | brew "autoconf" 8 | brew "automake" 9 | brew "python@3.11" 10 | brew "awscli" 11 | brew "libssh2" 12 | brew "bat" 13 | brew "bison" 14 | brew "freetype" 15 | brew "gettext" 16 | brew "glib" 17 | brew "cmake" 18 | brew "curl" 19 | brew "unbound" 20 | brew "gnutls" 21 | brew "harfbuzz" 22 | brew "leptonica" 23 | brew "libass" 24 | brew "pango" 25 | brew "srt" 26 | brew "tesseract" 27 | brew "ffmpeg" 28 | brew "figlet" 29 | brew "freetds" 30 | brew "fzf" 31 | brew "libavif" 32 | brew "gdk-pixbuf" 33 | brew "git-filter-repo" 34 | brew "go" 35 | brew "pkgconf" 36 | brew "gobject-introspection" 37 | brew "librsvg" 38 | brew "graphviz" 39 | brew "guile" 40 | brew "highlight" 41 | brew "hugo" 42 | brew "shared-mime-info" 43 | brew "libheif" 44 | brew "imagemagick" 45 | brew "ipcalc" 46 | brew "jless" 47 | brew "jpeg" 48 | brew "jsonnet" 49 | brew "lazygit" 50 | brew "libedit" 51 | brew "libiconv" 52 | brew "libxml2" 53 | brew "libzip" 54 | brew "linode-cli" 55 | brew "llvm@16" 56 | brew "logcli" 57 | brew "lua-language-server" 58 | brew "luarocks" 59 | brew "luv" 60 | brew "lychee" 61 | brew "markdown" 62 | brew "mysql-client" 63 | brew "neovim" 64 | brew "pandoc" 65 | brew "postgresql@14" 66 | brew "promtail" 67 | brew "pv" 68 | brew "python@3.10" 69 | brew "python@3.9" 70 | brew "re2c" 71 | brew "ruby" 72 | brew "step" 73 | brew "stow" 74 | brew "syncthing", restart_service: :changed 75 | brew "telnet" 76 | brew "terragrunt" 77 | brew "tmux" 78 | brew "tree" 79 | brew "watch" 80 | brew "yt-dlp" 81 | brew "zbar" 82 | brew "d12frosted/emacs-plus/emacs-plus@30" 83 | brew "hashicorp/tap/terraform-ls" 84 | brew "warrensbox/tap/tfswitch" 85 | cask "adobe-acrobat-reader" 86 | cask "calibre" 87 | cask "dbeaver-community" 88 | cask "docker" 89 | cask "firefox" 90 | cask "flux" 91 | cask "inkscape" 92 | cask "iterm2" 93 | cask "licecap" 94 | cask "loom" 95 | cask "mactex" 96 | cask "ngrok" 97 | cask "obs" 98 | cask "openra" 99 | cask "postman" 100 | cask "spectacle" 101 | cask "spotify" 102 | cask "steam" 103 | cask "uhk-agent" 104 | cask "vagrant" 105 | cask "vlc" 106 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: help 2 | help: 3 | @echo 'Usage: make [target]' 4 | @echo 'Available targets:' 5 | @echo 6 | @grep -Eo '^[-a-z/]+' Makefile | sort 7 | 8 | .PHONY: prepare 9 | prepare: 10 | if test ! -d ~/.config; then mkdir -v ~/.config; fi 11 | 12 | .PHONY: link 13 | link: prepare 14 | stow -v -t ~ git 15 | stow -v -t ~ pgcli 16 | stow -v -t ~ tmux 17 | stow -v -t ~ vim 18 | stow -v -t ~ zsh 19 | 20 | .PHONY: clean 21 | clean: 22 | for i in $$(find . -type d -maxdepth 1); do stow -v -t ~ -D $$(basename $$i); done 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dotfiles 2 | 3 | Help yourself. 4 | -------------------------------------------------------------------------------- /bin/ascii-encode.php: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | ', basename($_SERVER['PHP_SELF'])).PHP_EOL; 7 | exit(1); 8 | } 9 | 10 | $string = $args[1]; 11 | 12 | echo array_reduce(str_split($string), function($carry, $char) { 13 | return $carry.'&#'.ord($char).';'; 14 | }); 15 | -------------------------------------------------------------------------------- /bin/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -u 4 | 5 | wait() { 6 | echo 7 | echo "$1" 8 | read -p "Press enter when ready. " 9 | } 10 | 11 | # Install brew 12 | # Install chrome 13 | 14 | wait "* Open Google Chrome 15 | * Login to Bitwarden 16 | * Get your SSH key and install to ~/.ssh/ 17 | " 18 | 19 | mkdir -p ~/code/github.com/glynnforrest/ 20 | cd ~/code/github.com/glynnforrest/ 21 | 22 | if test ! -d dotfiles 23 | then 24 | echo "Cloning dotfiles..." 25 | git clone git@github.com:glynnforrest/dotfiles.git 26 | fi 27 | 28 | if test ! -d private-dotfiles 29 | then 30 | echo "Cloning private dotfiles..." 31 | git clone ssh://git@glynnforrest.com:404/~/projects/private-dotfiles 32 | fi 33 | -------------------------------------------------------------------------------- /bin/docker-aws.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | docker build -t aws -f ~/code/github.com/glynnforrest/dotfiles/dockerfiles/aws.Dockerfile . 6 | 7 | (docker stop aws && docker rm aws) || true 8 | 9 | docker run -ti --rm --name aws -d --privileged aws 10 | 11 | docker exec -ti aws /bin/bash 12 | 13 | -------------------------------------------------------------------------------- /bin/fuzzy-date-time.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from time import localtime, strftime 4 | import bisect 5 | 6 | minLookup=[ 7 | ' ', 8 | 'Five', 9 | 'Ten', 10 | 'Quarter', 11 | 'Twenty', 12 | 'Twenty-five', 13 | 'Half-past' 14 | ] 15 | hourLookup=[ 16 | 'Midnight', 17 | 'One', 18 | 'Two', 19 | 'Three', 20 | 'Four', 21 | 'Five', 22 | 'Six', 23 | 'Seven', 24 | 'Eight', 25 | 'Nine', 26 | 'Ten', 27 | 'Eleven', 28 | 'Twelve' 29 | ] 30 | 31 | #Get minutes 32 | time_min = strftime("%M", localtime()) 33 | #Get hour, as int 34 | time_hour = int(strftime("%H", localtime())) 35 | 36 | #round minutes to nearest 5, return as int 37 | time_min = int(round(float(time_min)*2,-1)/2) 38 | 39 | #Make it 12 hour, rather than 24 40 | if time_hour >= 13: 41 | time_hour = time_hour - 12 42 | 43 | #Get the O'Clock for if it's around 0mins past 44 | if time_min == 0: 45 | message = hourLookup[time_hour] + " O'Clock" 46 | elif time_min == 60: 47 | message = hourLookup[time_hour+1] + " O'Clock" 48 | #If it's less than half past, it'll be past 49 | elif time_min <= 30: 50 | message = minLookup[int(time_min/5)] + " past " + hourLookup[time_hour] 51 | #otherwise it'll be to, you need to invert the minutes and add on an hour 52 | # so 35 past 12 becomes: 25 to 1 53 | else: 54 | if time_hour == 12: 55 | time_hour = 0 56 | message = minLookup[int((60-time_min)/5)] + " to " + hourLookup[time_hour+1] 57 | 58 | print(message + ', ' + strftime("%a %b %-d", localtime())) 59 | -------------------------------------------------------------------------------- /bin/git-subsplit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # git-subsplit.sh: Automate and simplify the process of managing one-way 4 | # read-only subtree splits. 5 | # 6 | # Copyright (C) 2012 Dragonfly Development Inc. 7 | # 8 | if [ $# -eq 0 ]; then 9 | set -- -h 10 | fi 11 | OPTS_SPEC="\ 12 | git subsplit init url 13 | git subsplit publish splits --heads= --tags= --splits= 14 | git subsplit update 15 | -- 16 | h,help show the help 17 | q quiet 18 | debug show plenty of debug output 19 | n,dry-run do everything except actually send the updates 20 | work-dir directory that contains the subsplit working directory 21 | 22 | options for 'publish' 23 | heads= only publish for listed heads instead of all heads 24 | no-heads do not publish any heads 25 | tags= only publish for listed tags instead of all tags 26 | no-tags do not publish any tags 27 | update fetch updates from repository before publishing 28 | rebuild-tags rebuild all tags (as opposed to skipping tags that are already synced) 29 | " 30 | eval "$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)" 31 | 32 | # We can run this from anywhere. 33 | NONGIT_OK=1 34 | DEBUG=" :DEBUG >" 35 | 36 | PATH=$PATH:$(git --exec-path) 37 | 38 | . git-sh-setup 39 | 40 | if [ "$(hash git-subtree &>/dev/null && echo OK)" = "" ] 41 | then 42 | die "Git subplit needs git subtree; install git subtree or upgrade git to >=1.7.11" 43 | fi 44 | 45 | ANNOTATE= 46 | QUIET= 47 | COMMAND= 48 | SPLITS= 49 | REPO_URL= 50 | WORK_DIR="${PWD}/.subsplit" 51 | HEADS= 52 | NO_HEADS= 53 | TAGS= 54 | NO_TAGS= 55 | REBUILD_TAGS= 56 | DRY_RUN= 57 | VERBOSE= 58 | 59 | subsplit_main() 60 | { 61 | while [ $# -gt 0 ]; do 62 | opt="$1" 63 | shift 64 | case "$opt" in 65 | -q) QUIET=1 ;; 66 | --debug) VERBOSE=1 ;; 67 | --heads) HEADS="$1"; shift ;; 68 | --no-heads) NO_HEADS=1 ;; 69 | --tags) TAGS="$1"; shift ;; 70 | --no-tags) NO_TAGS=1 ;; 71 | --update) UPDATE=1 ;; 72 | -n) DRY_RUN="--dry-run" ;; 73 | --dry-run) DRY_RUN="--dry-run" ;; 74 | --rebuild-tags) REBUILD_TAGS=1 ;; 75 | --) break ;; 76 | *) die "Unexpected option: $opt" ;; 77 | esac 78 | done 79 | 80 | COMMAND="$1" 81 | shift 82 | 83 | case "$COMMAND" in 84 | init) 85 | if [ $# -lt 1 ]; then die "init command requires url to be passed as first argument"; fi 86 | REPO_URL="$1" 87 | shift 88 | subsplit_init 89 | ;; 90 | publish) 91 | if [ $# -lt 1 ]; then die "publish command requires splits to be passed as first argument"; fi 92 | SPLITS="$1" 93 | shift 94 | subsplit_publish 95 | ;; 96 | update) 97 | subsplit_update 98 | ;; 99 | *) die "Unknown command '$COMMAND'" ;; 100 | esac 101 | } 102 | say() 103 | { 104 | if [ -z "$QUIET" ]; 105 | then 106 | echo "$@" >&2 107 | fi 108 | } 109 | 110 | subsplit_require_work_dir() 111 | { 112 | if [ ! -e "$WORK_DIR" ] 113 | then 114 | die "Working directory not found at ${WORK_DIR}; please run init first" 115 | fi 116 | 117 | if [ -n "$VERBOSE" ]; 118 | then 119 | echo "${DEBUG} pushd \"${WORK_DIR}\" >/dev/null" 120 | fi 121 | 122 | pushd "$WORK_DIR" >/dev/null 123 | } 124 | 125 | subsplit_init() 126 | { 127 | if [ -e "$WORK_DIR" ] 128 | then 129 | die "Working directory already found at ${WORK_DIR}; please remove or run update" 130 | fi 131 | 132 | say "Initializing subsplit from origin (${REPO_URL})" 133 | 134 | if [ -n "$VERBOSE" ]; 135 | then 136 | echo "${DEBUG} git clone -q \"${REPO_URL}\" \"${WORK_DIR}\"" 137 | fi 138 | 139 | git clone -q "$REPO_URL" "$WORK_DIR" || die "Could not clone repository" 140 | } 141 | 142 | subsplit_publish() 143 | { 144 | subsplit_require_work_dir 145 | 146 | if [ -n "$UPDATE" ]; 147 | then 148 | subsplit_update 149 | fi 150 | 151 | if [ -z "$HEADS" ] && [ -z "$NO_HEADS" ] 152 | then 153 | # If heads are not specified and we want heads, discover them. 154 | HEADS="$(git ls-remote origin 2>/dev/null | grep "refs/heads/" | cut -f3- -d/)" 155 | 156 | if [ -n "$VERBOSE" ]; 157 | then 158 | echo "${DEBUG} HEADS=\"${HEADS}\"" 159 | fi 160 | fi 161 | 162 | if [ -z "$TAGS" ] && [ -z "$NO_TAGS" ] 163 | then 164 | # If tags are not specified and we want tags, discover them. 165 | TAGS="$(git ls-remote origin 2>/dev/null | grep -v "\^{}" | grep "refs/tags/" | cut -f3 -d/)" 166 | 167 | if [ -n "$VERBOSE" ]; 168 | then 169 | echo "${DEBUG} TAGS=\"${TAGS}\"" 170 | fi 171 | fi 172 | 173 | for SPLIT in $SPLITS 174 | do 175 | SUBPATH=$(echo "$SPLIT" | cut -f1 -d:) 176 | REMOTE_URL=$(echo "$SPLIT" | cut -f2- -d:) 177 | REMOTE_NAME=$(echo "$SPLIT" | git hash-object --stdin) 178 | 179 | if [ -n "$VERBOSE" ]; 180 | then 181 | echo "${DEBUG} SUBPATH=${SUBPATH}" 182 | echo "${DEBUG} REMOTE_URL=${REMOTE_URL}" 183 | echo "${DEBUG} REMOTE_NAME=${REMOTE_NAME}" 184 | fi 185 | 186 | if ! git remote | grep "^${REMOTE_NAME}$" >/dev/null 187 | then 188 | git remote add "$REMOTE_NAME" "$REMOTE_URL" 189 | 190 | if [ -n "$VERBOSE" ]; 191 | then 192 | echo "${DEBUG} git remote add \"${REMOTE_NAME}\" \"${REMOTE_URL}\"" 193 | fi 194 | fi 195 | 196 | 197 | say "Syncing ${SUBPATH} -> ${REMOTE_URL}" 198 | 199 | for HEAD in $HEADS 200 | do 201 | if [ -n "$VERBOSE" ]; 202 | then 203 | echo "${DEBUG} git show-ref --quiet --verify -- \"refs/remotes/origin/${HEAD}\"" 204 | fi 205 | 206 | if ! git show-ref --quiet --verify -- "refs/remotes/origin/${HEAD}" 207 | then 208 | say " - skipping head '${HEAD}' (does not exist)" 209 | continue 210 | fi 211 | LOCAL_BRANCH="${REMOTE_NAME}-branch-${HEAD}" 212 | 213 | if [ -n "$VERBOSE" ]; 214 | then 215 | echo "${DEBUG} LOCAL_BRANCH=\"${LOCAL_BRANCH}\"" 216 | fi 217 | 218 | say " - syncing branch '${HEAD}'" 219 | git checkout master >/dev/null 2>&1 220 | git branch -D "$LOCAL_BRANCH" >/dev/null 2>&1 221 | git branch -D "${LOCAL_BRANCH}-checkout" >/dev/null 2>&1 222 | git checkout -b "${LOCAL_BRANCH}-checkout" "origin/${HEAD}" >/dev/null 2>&1 223 | git subtree split -q --prefix="$SUBPATH" --branch="$LOCAL_BRANCH" "origin/${HEAD}" >/dev/null 224 | 225 | if [ -n "$VERBOSE" ]; 226 | then 227 | echo "${DEBUG} git checkout master >/dev/null 2>&1" 228 | echo "${DEBUG} git branch -D \"$LOCAL_BRANCH\" >/dev/null 2>&1" 229 | echo "${DEBUG} git branch -D \"${LOCAL_BRANCH}-checkout\" >/dev/null 2>&1" 230 | echo "${DEBUG} git checkout -b \"${LOCAL_BRANCH}-checkout\" \"origin/${HEAD}\" >/dev/null 2>&1" 231 | echo "${DEBUG} git subtree split -q --prefix=\"$SUBPATH\" --branch=\"$LOCAL_BRANCH\" \"origin/${HEAD}\" >/dev/null" 232 | fi 233 | 234 | if [ $? -eq 0 ] 235 | then 236 | PUSH_CMD="git push -q ${DRY_RUN} --force $REMOTE_NAME ${LOCAL_BRANCH}:${HEAD}" 237 | 238 | if [ -n "$VERBOSE" ]; 239 | then 240 | echo "${DEBUG} $PUSH_CMD" 241 | fi 242 | 243 | if [ -n "$DRY_RUN" ] 244 | then 245 | echo \# $PUSH_CMD 246 | $PUSH_CMD 247 | else 248 | $PUSH_CMD 249 | fi 250 | fi 251 | done 252 | 253 | for TAG in $TAGS 254 | do 255 | if [ -n "$VERBOSE" ]; 256 | then 257 | echo "${DEBUG} git show-ref --quiet --verify -- \"refs/tags/${TAG}\"" 258 | fi 259 | 260 | if ! git show-ref --quiet --verify -- "refs/tags/${TAG}" 261 | then 262 | say " - skipping tag '${TAG}' (does not exist)" 263 | continue 264 | fi 265 | LOCAL_TAG="${REMOTE_NAME}-tag-${TAG}" 266 | 267 | if [ -n "$VERBOSE" ]; 268 | then 269 | echo "${DEBUG} LOCAL_TAG="${LOCAL_TAG}"" 270 | fi 271 | 272 | if git branch | grep "${LOCAL_TAG}$" >/dev/null && [ -z "$REBUILD_TAGS" ] 273 | then 274 | say " - skipping tag '${TAG}' (already synced)" 275 | continue 276 | fi 277 | 278 | if [ -n "$VERBOSE" ]; 279 | then 280 | echo "${DEBUG} git branch | grep \"${LOCAL_TAG}$\" >/dev/null && [ -z \"${REBUILD_TAGS}\" ]" 281 | fi 282 | 283 | say " - syncing tag '${TAG}'" 284 | say " - deleting '${LOCAL_TAG}'" 285 | git branch -D "$LOCAL_TAG" >/dev/null 2>&1 286 | 287 | if [ -n "$VERBOSE" ]; 288 | then 289 | echo "${DEBUG} git branch -D \"${LOCAL_TAG}\" >/dev/null 2>&1" 290 | fi 291 | 292 | say " - subtree split for '${TAG}'" 293 | git subtree split -q --annotate="${ANNOTATE}" --prefix="$SUBPATH" --branch="$LOCAL_TAG" "$TAG" >/dev/null 294 | 295 | if [ -n "$VERBOSE" ]; 296 | then 297 | echo "${DEBUG} git subtree split -q --annotate=\"${ANNOTATE}\" --prefix=\"$SUBPATH\" --branch=\"$LOCAL_TAG\" \"$TAG\" >/dev/null" 298 | fi 299 | 300 | say " - subtree split for '${TAG}' [DONE]" 301 | if [ $? -eq 0 ] 302 | then 303 | PUSH_CMD="git push -q ${DRY_RUN} --force ${REMOTE_NAME} ${LOCAL_TAG}:refs/tags/${TAG}" 304 | 305 | if [ -n "$VERBOSE" ]; 306 | then 307 | echo "${DEBUG} PUSH_CMD=\"${PUSH_CMD}\"" 308 | fi 309 | 310 | if [ -n "$DRY_RUN" ] 311 | then 312 | echo \# $PUSH_CMD 313 | $PUSH_CMD 314 | else 315 | $PUSH_CMD 316 | fi 317 | fi 318 | done 319 | done 320 | 321 | popd >/dev/null 322 | } 323 | 324 | subsplit_update() 325 | { 326 | subsplit_require_work_dir 327 | 328 | say "Updating subsplit from origin" 329 | 330 | git fetch -q origin 331 | git fetch -q -t origin 332 | git checkout master 333 | git reset --hard origin/master 334 | 335 | if [ -n "$VERBOSE" ]; 336 | then 337 | echo "${DEBUG} git fetch -q origin" 338 | echo "${DEBUG} git fetch -q -t origin" 339 | echo "${DEBUG} git checkout master" 340 | echo "${DEBUG} git reset --hard origin/master" 341 | fi 342 | 343 | popd >/dev/null 344 | } 345 | 346 | subsplit_main "$@" 347 | -------------------------------------------------------------------------------- /bin/git_list_tags.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # list all git tags and the commit message for all repositories in the 4 | # current directory. 5 | 6 | for d in * 7 | do 8 | [[ ! -d "$d" ]] && continue 9 | [[ ! -d "$d/.git" ]] && continue 10 | echo "########" 11 | echo "$d" 12 | cd "$d" 13 | for t in `git tag` 14 | do 15 | echo -n "$t " 16 | git --no-pager log --oneline `git rev-parse $t` -1 17 | done 18 | cd "$OLDPWD" 19 | done 20 | -------------------------------------------------------------------------------- /bin/list-timezones.php: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | getOffset($now); 10 | 11 | $offsetHours = floor(abs($offset)/60/60); 12 | $offsetMins = (abs($offset)/60)%60; 13 | $offsetString = ($offset < 0 ? '-' : '+') . substr('0'.$offsetHours, -2) . substr('0'.$offsetMins, -2); 14 | 15 | $zones[] = [$timezone, $offsetString]; 16 | 17 | $maxLength = max($maxLength, strlen($timezone)); 18 | } 19 | 20 | usort($zones, function($a, $b) { 21 | return $a[1] <=> $b[1]; 22 | }); 23 | 24 | foreach ($zones as $zone) { 25 | echo sprintf('%s %s', str_pad($zone[0], $maxLength), $zone[1]) . PHP_EOL; 26 | } 27 | -------------------------------------------------------------------------------- /bin/nato.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Print the first argument (or stdin) using the NATO phonetic alphabet 4 | 5 | import sys 6 | import re 7 | 8 | words = { 9 | "A": "Alpha", 10 | "B": "Bravo", 11 | "C": "Charlie", 12 | "D": "Delta", 13 | "E": "Echo", 14 | "F": "Foxtrot", 15 | "G": "Golf", 16 | "H": "Hotel", 17 | "I": "India", 18 | "J": "Juliet", 19 | "K": "Kilo", 20 | "L": "Lima", 21 | "M": "Mike", 22 | "N": "November", 23 | "O": "Oscar", 24 | "P": "Papa", 25 | "Q": "Quebec", 26 | "R": "Romeo", 27 | "S": "Sierra", 28 | "T": "Tango", 29 | "U": "Uniform", 30 | "V": "Victor", 31 | "W": "Whiskey", 32 | "X": "X-Ray", 33 | "Y": "Yankee", 34 | "Z": "Zulu", 35 | "0": "Zero", 36 | "1": "One", 37 | "2": "Two", 38 | "3": "Three", 39 | "4": "Four", 40 | "5": "Five", 41 | "6": "Six", 42 | "7": "Seven", 43 | "8": "Eight", 44 | "9": "Nine", 45 | } 46 | 47 | 48 | def nato_char(char): 49 | try: 50 | return words[char.upper()] 51 | except KeyError: 52 | return char 53 | 54 | 55 | def nato(string): 56 | return re.sub(" +", " ", 57 | " ".join([nato_char(char) for char in string])) 58 | 59 | 60 | if __name__ == "__main__": 61 | if len(sys.argv) > 1: 62 | print(nato("".join(sys.argv[1:]))) 63 | sys.exit(0) 64 | 65 | buffer = '' 66 | while True: 67 | buffer_len = len(buffer) 68 | buffer += sys.stdin.read(1) 69 | 70 | if len(buffer) == buffer_len: 71 | print(nato(buffer)) 72 | sys.exit(0) 73 | 74 | if buffer.endswith('\n') or len(buffer) > 79: 75 | print(nato(buffer)) 76 | buffer = '' 77 | -------------------------------------------------------------------------------- /bin/netscan.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if test $# -ne 1 4 | then 5 | echo "netscan.sh"; 6 | echo "Scan for hosts on a subnet."; 7 | echo; 8 | echo "Usage: netscan.sh [IP PREFIX]"; 9 | echo "e.g. netscan.sh 192.168.0"; 10 | exit; 11 | fi; 12 | 13 | echo "Checking for hosts in the $1 subnet"; 14 | nmap -sn $1.0-255; 15 | -------------------------------------------------------------------------------- /bin/nmapscan.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if test $# -ne 1 4 | then 5 | echo "nmapscan.sh"; 6 | echo "Run a port scan on all available hosts on a subnet."; 7 | echo; 8 | echo "Usage: nmapscan.sh [IP PREFIX]"; 9 | echo "e.g. nmapscan.sh 192.168.0"; 10 | exit; 11 | fi; 12 | 13 | echo "Scanning hosts in the $1 subnet"; 14 | nmap -A -T4 $1.0-255; 15 | -------------------------------------------------------------------------------- /bin/repos.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import json 4 | import subprocess 5 | import os 6 | import sys 7 | from operator import itemgetter 8 | 9 | def usage(): 10 | print(""" 11 | Usage: {0} [COMMAND] 12 | 13 | Manage a collection of git repositories. 14 | 15 | Available commands: 16 | 17 | {0} add [URL] [DIRECTORY] 18 | {0} check 19 | {0} check [DIRECTORY] 20 | {0} clone 21 | {0} list 22 | """.format(os.path.basename(sys.argv[0]))) 23 | 24 | 25 | def git_clone(url, target): 26 | target = os.path.expanduser(target) 27 | parent_dir = os.path.dirname(target) 28 | if not os.path.isdir(parent_dir): 29 | print("Creating directory {}".format(parent_dir)) 30 | 31 | if os.path.isdir(target.rstrip("/")+"/.git"): 32 | return 33 | 34 | print("Cloning {} to {}".format(url, target)) 35 | command = "git clone {} {}".format(url, target) 36 | process = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True) 37 | for c in iter(lambda: process.stdout.read(1), b''): 38 | sys.stdout.write(c) 39 | 40 | def clone_repos(file): 41 | failures = [] 42 | with open(file) as json_data: 43 | for repo in json.load(json_data): 44 | git_clone(repo['url'], repo['target']) 45 | 46 | def git_check(command, dir): 47 | return subprocess.check_output(command, shell=True, cwd=dir).strip().splitlines() 48 | 49 | def check_repo(dir): 50 | problems = [] 51 | if not os.path.isdir(dir): 52 | problems.append("does not exist") 53 | 54 | unpushed_commits = git_check('git log --branches --not --remotes --oneline', dir) 55 | if len(unpushed_commits) > 0: 56 | problems.append("{} unpushed {}".format(len(unpushed_commits), 'commit' if len(unpushed_commits) == 1 else 'commits')) 57 | 58 | stashes = git_check('git stash list', dir) 59 | if len(stashes) > 0: 60 | problems.append("{} {}".format(len(stashes), 'stash' if len(stashes) == 1 else 'stashes')) 61 | 62 | changed_files = git_check('git status --short', dir) 63 | if len(changed_files) > 0: 64 | problems.append("{} changed or untracked {}".format(len(changed_files), 'file' if len(changed_files) == 1 else 'files')) 65 | 66 | if len(problems) > 0: 67 | raise Exception("{}".format(", ".join(problems))) 68 | 69 | def check_repos(file): 70 | with open(file) as json_data: 71 | repos = json.load(json_data) 72 | 73 | # do a quick loop without git commands first to get the max 74 | # directory length for print formatting 75 | max_dir_length = 0 76 | for repo in repos: 77 | dir_length = len(repo[u'target']) 78 | if dir_length > max_dir_length: 79 | max_dir_length = dir_length 80 | 81 | failures = [] 82 | for repo in repos: 83 | try: 84 | dir = repo[u'target'] 85 | check_repo(os.path.expanduser(dir)) 86 | except Exception as e: 87 | failures.append(dir) 88 | print(dir.ljust(max_dir_length) + " " + str(e)) 89 | 90 | if len(failures) > 0: 91 | print("") 92 | print("{} {} unpushed changes.".format(len(failures), 'repo has' if len(failures) == 1 else 'repos have')) 93 | exit(1) 94 | 95 | print("All repos are synced with the remotes.") 96 | 97 | def add_repo(file, url, target): 98 | home = os.path.expanduser("~") 99 | if home in target: 100 | target = "~/" + os.path.relpath(os.path.expanduser(target), home) 101 | 102 | repos = [] 103 | try: 104 | with open(file) as json_data: 105 | repos = json.load(json_data) 106 | for repo in repos: 107 | if repo['target'] == target: 108 | print("Target {} already exists in {}.".format(target, file)) 109 | return 110 | repos.append({ 111 | 'url': url, 112 | 'target': target 113 | }) 114 | repos = sorted(repos, key=itemgetter('target')) 115 | except Exception as e: 116 | print(e) 117 | pass 118 | 119 | with open(file, mode='w+') as save_file: 120 | json.dump(repos, save_file, indent=4) 121 | save_file.write('\n') 122 | 123 | def list_dirs(file): 124 | with open(file) as json_data: 125 | for repo in json.load(json_data): 126 | print(os.path.expanduser(repo['target'].strip())) 127 | 128 | if len(sys.argv) < 2: 129 | usage() 130 | exit(1) 131 | 132 | cmd = sys.argv[1] 133 | config_file = os.path.expanduser('~/.repos.json') 134 | 135 | if cmd == "clone": 136 | clone_repos(config_file) 137 | elif cmd == "check": 138 | if len(sys.argv) == 3: 139 | try: 140 | check_repo(os.path.expanduser(sys.argv[2])) 141 | except Exception as e: 142 | print(e) 143 | exit(1); 144 | else: 145 | check_repos(config_file) 146 | elif cmd == "add" and len(sys.argv) == 4: 147 | add_repo(config_file, sys.argv[2], sys.argv[3]) 148 | elif cmd == "list": 149 | list_dirs(config_file) 150 | else: 151 | usage() 152 | exit(1) 153 | -------------------------------------------------------------------------------- /bin/setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -u 4 | 5 | wait() { 6 | echo 7 | echo "$1" 8 | read -p "Press enter when ready. " 9 | } 10 | 11 | title() { 12 | echo 13 | echo "$1" 14 | echo 15 | } 16 | 17 | is_mac () { 18 | test `uname` = "Darwin" 19 | } 20 | 21 | # if is_mac 22 | # then 23 | # xcode-select --install 24 | # fi 25 | -------------------------------------------------------------------------------- /bin/ssh-copy-id-with-key.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if test $# -ne 3 4 | then 5 | SCRIPT=`basename $0` 6 | echo "Copy an ssh key to a host, using a given private key to login"; 7 | echo; 8 | echo "Usage: $SCRIPT [PRIVATE_KEY] [HOST] [PUBLIC_KEY]"; 9 | echo "e.g. $SCRIPT ./vagrant/machines/box/virtualbox/private_key vagrant@vagrant-box ~/.ssh/id_rsa.pub "; 10 | exit; 11 | fi; 12 | 13 | PRIVATE_KEY=$1 14 | HOST=$2 15 | PUBLIC_KEY=$3 16 | 17 | echo "Copying $PUBLIC_KEY to $HOST"; 18 | cat $PUBLIC_KEY | ssh -i $PRIVATE_KEY $HOST "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys" 19 | -------------------------------------------------------------------------------- /bin/triangles.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl -l 2 | # Usage: triangles.pl 3 | 4 | $x=2**pop;print$"x--$x,map$x&$_?$"x2:"/\\",0..$y++while$x 5 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | let 2 | pkgs = import 3 | (builtins.fetchTarball { 4 | url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/24.05.tar.gz"; 5 | sha256 = "1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx"; 6 | }) 7 | { config.allowUnfree = true; }; 8 | 9 | repo_dir = "~/code/github.com/glynnforrest/dotfiles"; 10 | 11 | wrapBin = bin: pkgs.writeShellScriptBin "${bin}" '' 12 | PATH=${repo_dir}/result/bin:/usr/local/bin:/usr/bin:/bin 13 | ${repo_dir}/bin/${bin} $@ 14 | ''; 15 | 16 | bins = builtins.readDir ./bin; 17 | files = builtins.filter (f: bins.${f} == "regular") (builtins.attrNames bins); 18 | wrappers = map wrapBin files; 19 | 20 | python = (pkgs.python311.withPackages (ps: [ 21 | ps.black 22 | ps.click 23 | ps.flake8 24 | ps.requests 25 | ])); 26 | 27 | z = pkgs.stdenv.mkDerivation rec { 28 | pname = "z"; 29 | version = "1.2"; 30 | 31 | src = pkgs.fetchurl { 32 | url = "https://github.com/rupa/z/raw/refs/tags/v${version}/z.sh"; 33 | hash = "sha256-v7UXX0ifFMnNKmXuc3N4HdcbyYaGQYuQxVABFaqLL5k="; 34 | postFetch = '' 35 | mv $downloadedFile $out 36 | ''; 37 | }; 38 | 39 | dontUnpack = true; 40 | 41 | installPhase = '' 42 | mkdir -p $out/lib 43 | cp $src $out/lib/z.sh 44 | ''; 45 | }; 46 | 47 | in 48 | pkgs.buildEnv { 49 | name = "dotfiles"; 50 | paths = with pkgs; [ 51 | gron 52 | htop 53 | jq 54 | nmap 55 | nodejs 56 | php 57 | python 58 | ripgrep 59 | svgcleaner 60 | tldr 61 | yq-go 62 | z 63 | zig 64 | ] ++ wrappers; 65 | } 66 | -------------------------------------------------------------------------------- /dockerfiles/aws.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM amazonlinux:latest 2 | 3 | RUN yum install -y systemd sudo 4 | 5 | CMD ["/sbin/init"] 6 | -------------------------------------------------------------------------------- /emacs/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | ac-comphist.dat 3 | auto-save-list 4 | bookmarks 5 | *.elc 6 | elpa 7 | eshell 8 | image-dired* 9 | site-lisp/setup-personal.el 10 | places 11 | recentf 12 | savehist 13 | saveplace 14 | session.* 15 | .smex-items 16 | tramp 17 | url 18 | projectile* 19 | /skewer-cache/ 20 | /history 21 | transient/ 22 | /straight/* 23 | !/straight/versions 24 | /lsp-cache/ 25 | /.lsp-session-v1 26 | /.cache/ 27 | /eln-cache/ 28 | /tree-sitter/ 29 | -------------------------------------------------------------------------------- /emacs/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "plugins/evil-numbers"] 2 | path = plugins/evil-numbers 3 | url = https://github.com/cofi/evil-numbers.git 4 | [submodule "plugins/nyan-mode"] 5 | path = plugins/nyan-mode 6 | url = https://github.com/TeMPOraL/nyan-mode.git 7 | [submodule "plugins/php-auto-yasnippets"] 8 | path = plugins/php-auto-yasnippets 9 | url = https://github.com/ejmr/php-auto-yasnippets.git 10 | -------------------------------------------------------------------------------- /emacs/README.org: -------------------------------------------------------------------------------- 1 | * My emacs settings 2 | The emacs configuration of a vim convert. 3 | -------------------------------------------------------------------------------- /emacs/bin/php_class_finder.php: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | $cache_file"; 73 | 74 | passthru($command); 75 | 76 | if (isset($_SERVER['argv'][2])) { 77 | echo "Refreshed cache file $cache_file for $directory" . PHP_EOL; 78 | exit(0); 79 | } 80 | 81 | echo file_get_contents($cache_file); 82 | -------------------------------------------------------------------------------- /emacs/bin/php_resolve_namespace.php: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | $path) { 21 | $pos = strpos($file, $path); 22 | if ($pos === false) { 23 | continue; 24 | } 25 | $file = substr(dirname($file), $pos + strlen($path)); 26 | $file = trim($namespace, '\\') . $file; 27 | echo str_replace('/', '\\', $file); 28 | exit; 29 | } 30 | 31 | function getAutoloadPaths($file) { 32 | $dir = $file; 33 | while ($dir !== '/') { 34 | $dir = rtrim(dirname($dir), '/'). '/'; 35 | $composerJson = $dir.'composer.json'; 36 | if (!file_exists($composerJson)) { 37 | continue; 38 | } 39 | $config = json_decode(file_get_contents($composerJson), true); 40 | $paths = array_merge( 41 | isset($config['autoload']['psr-4']) ? $config['autoload']['psr-4'] : [], 42 | isset($config['autoload-dev']['psr-4']) ? $config['autoload-dev']['psr-4'] : [] 43 | ); 44 | if (empty($paths)) { 45 | continue; 46 | } 47 | foreach ($paths as $namespace => $path) { 48 | $path = trim($path); 49 | if ($path !== '') { 50 | $paths[$namespace] = trim($path, '/'); 51 | continue; 52 | } 53 | //path is empty, e.g. 'Vendor\FooBundle' => '' 54 | // file is src/FooBundle/Entity/Something.php 55 | // we want to return Vendor => 'src' 56 | $pieces = explode('\\', trim($namespace, '\\')); 57 | $lastNamespaceSegment = end($pieces); 58 | $pos = strpos($file, $lastNamespaceSegment); 59 | $paths[$namespace] = substr(dirname($file), strlen($path), $pos + strlen($lastNamespaceSegment)); 60 | } 61 | 62 | return $paths; 63 | } 64 | 65 | return []; 66 | } 67 | -------------------------------------------------------------------------------- /emacs/custom.el: -------------------------------------------------------------------------------- 1 | 2 | (custom-set-variables 3 | ;; custom-set-variables was added by Custom. 4 | ;; If you edit it by hand, you could mess it up, so be careful. 5 | ;; Your init file should contain only one such instance. 6 | ;; If there is more than one, they won't work right. 7 | '(custom-safe-themes 8 | '("37c8c2817010e59734fe1f9302a7e6a2b5e8cc648cf6a6cc8b85f3bf17fececf" default))) 9 | (custom-set-faces 10 | ;; custom-set-faces was added by Custom. 11 | ;; If you edit it by hand, you could mess it up, so be careful. 12 | ;; Your init file should contain only one such instance. 13 | ;; If there is more than one, they won't work right. 14 | ) 15 | -------------------------------------------------------------------------------- /emacs/init.el: -------------------------------------------------------------------------------- 1 | (defvar bootstrap-version) 2 | (let ((bootstrap-file 3 | (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) 4 | (bootstrap-version 6)) 5 | (unless (file-exists-p bootstrap-file) 6 | (with-current-buffer 7 | (url-retrieve-synchronously 8 | "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 9 | 'silent 'inhibit-cookies) 10 | (goto-char (point-max)) 11 | (eval-print-last-sexp))) 12 | (load bootstrap-file nil 'nomessage)) 13 | 14 | (straight-use-package 'use-package) 15 | (require 'use-package) 16 | 17 | ;; Tell straight to install the package for each use-package declaration 18 | (eval-when-compile (require 'straight)) 19 | (setq straight-use-package-by-default t) 20 | 21 | (add-to-list 'load-path (expand-file-name "site-lisp" user-emacs-directory)) 22 | (add-to-list 'load-path (expand-file-name "plugins" user-emacs-directory)) 23 | 24 | (require 'tramp) 25 | (require 'setup-core) 26 | (require 'setup-keys) 27 | 28 | ;; Major modes 29 | (require 'setup-ai) 30 | (require 'setup-apache) 31 | (require 'setup-coffeescript) 32 | (require 'setup-css) 33 | (require 'setup-hashicorp) 34 | (require 'setup-dired) 35 | (require 'setup-docker) 36 | (require 'setup-edit-server) 37 | (require 'setup-elisp) 38 | (require 'setup-git) 39 | (require 'setup-go) 40 | (require 'setup-groovy) 41 | (require 'setup-help) 42 | (require 'setup-js) 43 | (require 'setup-jsonnet) 44 | (require 'setup-kubernetes) 45 | (require 'setup-lua) 46 | (require 'setup-markdown) 47 | (require 'setup-nix) 48 | (require 'setup-org) 49 | (require 'setup-php) 50 | (require 'setup-protobuf) 51 | (require 'setup-pug) 52 | (require 'setup-python) 53 | (require 'setup-saltstack) 54 | (require 'setup-shell-script) 55 | (require 'setup-sql) 56 | (require 'setup-typescript) 57 | (require 'setup-tmux) 58 | (require 'setup-web-mode) 59 | (require 'setup-yaml) 60 | (require 'setup-zig) 61 | 62 | ;; Personal config if available, like usernames and passwords 63 | (require 'setup-personal nil t) 64 | 65 | ;; Load custom settings 66 | (setq custom-file "~/.emacs.d/custom.el") 67 | (load custom-file 'noerror) 68 | 69 | ;; Quarantine - old files that need updating 70 | ;; (require 'defuns) 71 | ;; (require 'mappings) 72 | ;; (require 'appearance) 73 | ;; (require 'setup-erc) 74 | ;; (require 'setup-eshell) 75 | ;; (require 'setup-lilypond) 76 | ;; (require 'setup-multiple-cursors) 77 | 78 | ;; Quarantined packages 79 | ;; dired+ 80 | ;; epl 81 | ;; impatient-mode 82 | ;; php-eldoc 83 | -------------------------------------------------------------------------------- /emacs/plugins/rotate-text.el: -------------------------------------------------------------------------------- 1 | ;;; rotate-text.el --- cycle through words, symbols and patterns 2 | ;; 3 | ;; Copyright (C) 2009 Nikolaj Schumacher 4 | ;; 5 | ;; Author: Nikolaj Schumacher 6 | ;; Version: 0.1 7 | ;; Keywords: abbrev, convenience, matching 8 | ;; URL: http://nschum.de/src/emacs/rotate-text/ 9 | ;; Compatibility: GNU Emacs 22.x, GNU Emacs 23.x 10 | ;; 11 | ;; This file is NOT part of GNU Emacs. 12 | ;; 13 | ;; This program is free software; you can redistribute it and/or 14 | ;; modify it under the terms of the GNU General Public License 15 | ;; as published by the Free Software Foundation; either version 2 16 | ;; of the License, or (at your option) any later version. 17 | ;; 18 | ;; This program is distributed in the hope that it will be useful, 19 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | ;; GNU General Public License for more details. 22 | ;; 23 | ;; You should have received a copy of the GNU General Public License 24 | ;; along with this program. If not, see . 25 | ;; 26 | ;;; Commentary: 27 | ;; 28 | ;; rotate-text allows you cycle through commonly interchanged text with a single 29 | ;; keystroke. For example, you can toggle between "frame-width" and 30 | ;; "frame-height", between "public", "protected" and "private" and between 31 | ;; "variable1", "variable2" through "variableN". 32 | ;; 33 | ;; Add the following to your .emacs: 34 | ;; 35 | ;; (add-to-list 'load-path "/path/to/rotate-text") 36 | ;; (autoload 'rotate-text "rotate-text" nil t) 37 | ;; (autoload 'rotate-text-backward "rotate-text" nil t) 38 | ;; 39 | ;; Customize the variables `rotate-text-patterns', `rotate-text-symbols' and 40 | ;; `rotate-text-words'. You can make buffer-local additions in 41 | ;; `rotate-text-local-patterns', `rotate-text-local-symbols' and 42 | ;; `rotate-text-local-words'. 43 | ;; 44 | ;; Use the commands `rotate-text' and `rotate-text-backward' to rotate the 45 | ;; text. 46 | ;; 47 | ;;; Change Log: 48 | ;; 49 | ;; 2009-04-13 (0.1) 50 | ;; Initial release. 51 | ;; 52 | ;;; Code: 53 | 54 | (eval-when-compile (require 'cl)) 55 | 56 | (add-to-list 'debug-ignored-errors "^Nothing to rotate$") 57 | 58 | (defgroup rotate-text nil 59 | "Cycle through words, symbols and patterns." 60 | :group 'abbrev 61 | :group 'convenience 62 | :group 'matching) 63 | 64 | (defcustom rotate-text-patterns 65 | '(("\\_<[^-]\\(\\sw\\|\\s_\\)*[0-9]+" rotate-text-increment-number-in-symbol) 66 | ("-?0x?[0-9a-fA-F]+" rotate-text-increment-hex-number) 67 | ("-?[0-9]+" rotate-text-increment-number)) 68 | "*Patterns and functions to rotate them. 69 | Each entry is a list. Its first element should be the regular expression to 70 | replace, the second element is a function. When rotating, it is called with the 71 | matching text and an integer determining the rotation amount and direction." 72 | :group 'rotate-text 73 | :type '(repeat (list (string :tag "Regular expression") 74 | (function :tag "Rotation function")))) 75 | 76 | (defcustom rotate-text-symbols '(("private" "protected" "public")) 77 | "*List of symbol names to rotate. 78 | Each element is a list of symbols that should be cycled through." 79 | :group 'rotate-text 80 | :type '(repeat (repeat :tag "Rotation group" (string :tag "Symbol")))) 81 | 82 | (defcustom rotate-text-words '(("width" "height") 83 | ("left" "right" "top" "bottom")) 84 | "*List of words to rotate. 85 | Each element is a list of words that should be cycled through. Individual 86 | segments in symbol names are recognized as words, i.e. windowWidth can be 87 | replaced with windowHeight. 88 | All entries must be in lower case. The case is determined by the rotated 89 | text." 90 | :group 'rotate-text 91 | :type '(repeat (repeat :tag "Rotation group" (string :tag "Word")))) 92 | 93 | (defvar rotate-text-local-patterns nil 94 | "*Buffer local additions to `rotate-text-patterns'.") 95 | (make-variable-buffer-local 'rotate-text-local-patterns) 96 | 97 | (defvar rotate-text-local-symbols nil 98 | "*Buffer local additions to `rotate-text-symbols'.") 99 | (make-variable-buffer-local 'rotate-text-local-symbols) 100 | 101 | (defvar rotate-text-local-words nil 102 | "*Buffer local additions to `rotate-text-words'.") 103 | (make-variable-buffer-local 'rotate-text-local-words) 104 | 105 | ;;; numbers ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 106 | 107 | (defun rotate-text-increment-number (original arg &optional minimum) 108 | (number-to-string (max (+ (string-to-number original) arg) 109 | (or minimum most-negative-fixnum)))) 110 | 111 | (defun rotate-text-increment-hex-number (original arg) 112 | (when (string-match "\\`-?\\(0x\\)" original) 113 | (setq original (replace-match "" t t original 1))) 114 | (let ((result (+ (string-to-number original 16) arg))) 115 | (format "%s0x%x" (if (< result 0) "-" "") (abs result)))) 116 | 117 | (defun rotate-text-increment-number-in-symbol (original arg) 118 | (when (string-match "[0-9]+" original) 119 | (replace-match (rotate-text-increment-number (match-string 0 original) 120 | arg 0) 121 | t t original))) 122 | 123 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 124 | 125 | (defun rotate-text-replacement (replacements original dir) 126 | "Find the replacement for ORIGINAL in REPLACEMENTS." 127 | (save-match-data 128 | (if (functionp (car replacements)) 129 | ;; function 130 | (if (and (< dir 0) (functionp (cadr replacements))) 131 | (funcall (cadr replacements) original (- dir)) 132 | (funcall (car replacements) original dir)) 133 | ;; list 134 | (let ((rest-pattern (member original replacements))) 135 | (when rest-pattern 136 | (car (nthcdr (mod (- dir (length rest-pattern)) (length replacements)) 137 | replacements))))))) 138 | 139 | (defun rotate-text-match-at-point (regexp) 140 | (save-excursion 141 | (let ((pos (point))) 142 | (goto-char (point-at-bol)) 143 | (catch 'match 144 | (while (re-search-forward regexp (1+ (point-at-eol)) t) 145 | (and (>= pos (match-beginning 0)) 146 | (<= pos (match-end 0)) 147 | (throw 'match (match-string-no-properties 0)))))))) 148 | 149 | (defun rotate-text-symbol-at-point () 150 | "Rotate the symbol at point." 151 | (rotate-text-match-at-point "\\_<\\(\\s_\\|\\sw\\)+\\_>")) 152 | 153 | (defun rotate-text-word-at-point () 154 | "Rotate the word at point." 155 | (let ((case-fold-search nil)) 156 | (or (rotate-text-match-at-point "\\(\\<\\|[[:upper:]]\\)[[:lower:]]+") 157 | (rotate-text-match-at-point "\\<[[:upper:]]+")))) 158 | 159 | (defun rotate-text-match-case (original new) 160 | "Match the case of ORIGINAL in NEW." 161 | (let ((case-fold-search nil)) 162 | (save-match-data 163 | (cond 164 | ((string-match "\\`[[:upper:]][[:lower:]]" original) (capitalize new)) 165 | ((string-match "\\`[[:upper:]][[:upper:]]" original) (upcase new)) 166 | (t new))))) 167 | 168 | (defvar rotate-text-last-offset nil) 169 | 170 | ;;;###autoload 171 | (defun rotate-text (arg) 172 | "Rotate the text at point." 173 | (interactive (list (if (consp current-prefix-arg) 174 | -1 175 | (prefix-numeric-value current-prefix-arg)))) 176 | (let ((pos (point)) 177 | (offset 0) 178 | match replacement) 179 | (or ;; symbols 180 | (when (setq match (rotate-text-symbol-at-point)) 181 | (dolist (symbols (append rotate-text-local-symbols 182 | rotate-text-symbols)) 183 | (when (setq replacement 184 | (rotate-text-replacement symbols match arg)) 185 | (return t)))) 186 | ;; words 187 | (when (setq match (rotate-text-word-at-point)) 188 | (dolist (words (append rotate-text-local-words 189 | rotate-text-words)) 190 | (when (setq replacement 191 | (rotate-text-replacement words (downcase match) arg)) 192 | (setq replacement (rotate-text-match-case match replacement)) 193 | (return t)))) 194 | ;; regexp 195 | (dolist (pattern (append rotate-text-local-patterns 196 | rotate-text-patterns)) 197 | (when (setq match (rotate-text-match-at-point (car pattern))) 198 | (setq replacement (rotate-text-replacement (cdr pattern) match arg)) 199 | (return t))) 200 | (error "Nothing to rotate")) 201 | 202 | (unless (eq last-command this-command) 203 | (setq rotate-text-last-offset 204 | (if (eq pos (match-end 0)) 205 | 'end 206 | (- pos (match-beginning 0))))) 207 | 208 | (replace-match replacement) 209 | 210 | (goto-char (if (eq rotate-text-last-offset 'end) 211 | (match-end 0) 212 | (min (+ (match-beginning 0) rotate-text-last-offset) 213 | (match-end 0)))))) 214 | 215 | ;;;###autoload 216 | (defun rotate-text-backward (arg) 217 | "Rotate the text at point backwards." 218 | (interactive (list (if (consp current-prefix-arg) 219 | -1 220 | (prefix-numeric-value current-prefix-arg)))) 221 | (rotate-text (- arg))) 222 | 223 | (provide 'rotate-text) 224 | ;;; rotate-text.el ends here 225 | -------------------------------------------------------------------------------- /emacs/site-lisp/appearance.el: -------------------------------------------------------------------------------- 1 | ;; Cursor configuration. 2 | (setq evil-insert-state-cursor '("#38a2ea" bar)) 3 | (setq evil-normal-state-cursor '("#38a2ea" box)) 4 | (setq evil-emacs-state-cursor '("#d72626" bar)) 5 | 6 | ;; Other stuff 7 | (add-to-list 'default-frame-alist '(internal-border-width . 0)) 8 | 9 | ;; Change opacity of the frame. 10 | (defun djcb-opacity-modify (&optional dec) 11 | "modify the transparency of the emacs frame; if DEC is t, 12 | decrease the transparency, otherwise increase it in 10%-steps" 13 | (let* ((alpha-or-nil (frame-parameter nil 'alpha)) ; nil before setting 14 | (oldalpha (if alpha-or-nil alpha-or-nil 100)) 15 | (newalpha (if dec (- oldalpha 10) (+ oldalpha 10)))) 16 | (when (and (>= newalpha frame-alpha-lower-limit) (<= newalpha 100)) 17 | (modify-frame-parameters nil (list (cons 'alpha newalpha)))))) 18 | 19 | 20 | 21 | (global-set-key (kbd "C-8") '(lambda()(interactive)(djcb-opacity-modify t))) 22 | (global-set-key (kbd "C-9") '(lambda()(interactive)(djcb-opacity-modify))) 23 | (global-set-key (kbd "C-0") '(lambda()(interactive) 24 | (modify-frame-parameters nil `((alpha . 100))))) 25 | 26 | ;; View hex colours in the following modes 27 | (dolist (mode '( 28 | css-mode 29 | scss-mode 30 | emacs-lisp-mode 31 | haskell-mode 32 | lisp-interaction-mode 33 | lisp-mode 34 | )) 35 | (font-lock-add-keywords mode 36 | '((fontify-hex-colors)))) 37 | 38 | (provide 'appearance) 39 | -------------------------------------------------------------------------------- /emacs/site-lisp/defuns.el: -------------------------------------------------------------------------------- 1 | (defun gf/comma-to-end-of-sentence () 2 | "Change the next comma to a full stop and capitalise the next word." 3 | (interactive) 4 | (if (not (looking-at-p ",")) 5 | (evil-find-char 1 (string-to-char ","))) 6 | (delete-char 1) 7 | (insert ".") 8 | (evil-forward-word-begin) 9 | (evil-upcase (point) (+ 1 (point)))) 10 | 11 | (defun gf/end-of-sentence-to-comma () 12 | "Change the next full stop to a comma and lowercase the next word." 13 | (interactive) 14 | (if (not (looking-at-p "\\.")) 15 | (evil-find-char 1 (string-to-char "."))) 16 | (delete-char 1) 17 | (insert ",") 18 | (evil-forward-word-begin) 19 | (if (not (looking-at-p "I")) 20 | (evil-downcase (point) (+ 1 (point))))) 21 | 22 | 23 | (defun gf/split-window-and-move-right () 24 | (interactive) 25 | (split-window-right) 26 | (other-window 1)) 27 | 28 | (defun gf/split-window-and-move-below () 29 | (interactive) 30 | (split-window-below) 31 | (other-window 1)) 32 | 33 | (defun gf/save-and-eval-buffer () 34 | (interactive) 35 | (save-buffer) 36 | (eval-buffer)) 37 | 38 | (defun gf/eval-and-replace-sexp () 39 | "Replace the preceding sexp with its value." 40 | (interactive) 41 | (if (evil-normal-state-p) (evil-append 1)) 42 | (backward-kill-sexp) 43 | (prin1 (eval (read (current-kill 0))) 44 | (current-buffer))) 45 | 46 | (defun gf/setup-electric-semicolon (mode-map) 47 | "Adds mappings for electric semicolon to MODE-MAP. 48 | Press ; for electric-semicolon, C-; to insert a semicolon." 49 | (evil-declare-key 'insert mode-map ";" 'gf/electric-semicolon) 50 | (evil-declare-key 'insert mode-map (kbd "C-;") (lambda() 51 | (interactive) 52 | (insert ";")))) 53 | 54 | (defun gf/electric-semicolon () 55 | "Inserts a semicolon at the end of the current line if not already there." 56 | (interactive) 57 | (let ((beg (point))) 58 | (end-of-line) 59 | (if (not (looking-back ";")) 60 | (insert ";") 61 | (goto-char beg) 62 | ))) 63 | 64 | (defun gf/fix-double-capital() 65 | "Go back to last occurence of a 'double capital' and correct." 66 | (interactive) 67 | ;; <<<<<<< glynn : *old code* >>>>>>>> 68 | ;; (save-excursion 69 | ;; (re-search-backward "[[:upper:]]\\{2\\}" 70 | ;; nil 71 | ;; (message "No double capital found!")) 72 | ;; (forward-char) 73 | ;; (set-mark-command nil) 74 | ;; (forward-char) 75 | ;; (setq deactivate-mark nil) 76 | ;; (call-interactively 'downcase-region))) 77 | ;; ======= *test code* ============== 78 | (re-search-backward "[[:upper:]]\\{2\\}" 79 | nil 80 | (message "No double capital found!"))) 81 | 82 | ;; >>>>>>> *end* <<<<<<<<<<<<<<<<<<<<< 83 | (provide 'defuns) 84 | -------------------------------------------------------------------------------- /emacs/site-lisp/lib-core.el: -------------------------------------------------------------------------------- 1 | (defun gf/buffer-file-name-body () 2 | (if (buffer-file-name) 3 | (car (split-string (file-name-nondirectory (buffer-file-name)) "\\.")))) 4 | 5 | (defun gf/filename-extension (filename) 6 | "Get the extension from a file path." 7 | (car (last (s-split "\\." filename)))) 8 | 9 | (defun gf/in-file-type (extension) 10 | "Return t if the extension of the current buffer file matches 11 | EXTENSION. Only the last extension of the file is considered." 12 | (equal extension (gf/filename-extension (buffer-file-name)))) 13 | 14 | (defun gf/candidates-from-command (command) 15 | "Get a list of candidates from running a command in the projectile root." 16 | (split-string (shell-command-to-string 17 | (concat "cd " (projectile-project-root) " && " command)) "\n" t)) 18 | 19 | (defun gf/open-init-file () 20 | (interactive) 21 | (find-file "~/.emacs.d/init.el")) 22 | 23 | (defun gf/open-personal-file () 24 | (interactive) 25 | (find-file "~/.emacs.d/site-lisp/setup-personal.el")) 26 | 27 | (defun gf/find-emacs-d-file () 28 | (interactive) 29 | (projectile-find-file-in-directory user-emacs-directory)) 30 | 31 | (defun gf/open-zshrc () 32 | (interactive) 33 | (find-file "~/.zshrc")) 34 | 35 | (defun gf/open-zshrc-local () 36 | (interactive) 37 | (find-file "~/.zshrc.local")) 38 | 39 | (defun gf/open-dotenv-file () 40 | (interactive) 41 | (when (projectile-project-root) 42 | (find-file (concat (projectile-project-root) "/.env.local")))) 43 | 44 | (defun gf/save-buffers-kill-emacs-no-prompt () 45 | "Save some buffers, then exit unconditionally" 46 | (interactive) 47 | (save-some-buffers t) 48 | (kill-emacs)) 49 | 50 | (defun gf/close-buffer-other-window () 51 | "Closes the buffer in the other window." 52 | (interactive) 53 | (other-window 1) 54 | (kill-buffer (current-buffer)) 55 | (other-window 1)) 56 | 57 | (defun gf/props-at-point () 58 | "Get the properties of the text at point. This excludes any overlays 59 | such as hl-line." 60 | (interactive) 61 | (message 62 | (format "%S" (text-properties-at (point))))) 63 | 64 | (defun gf/refresh-major-mode () 65 | "Refresh the major mode of the current buffer." 66 | (interactive) 67 | (call-interactively major-mode) 68 | (message (format "Refreshed %s" major-mode))) 69 | 70 | (defun gf/switch-to-scratch-buffer () 71 | "Switch to the scratch buffer. If the buffer doesn't exist, 72 | create it and write the initial message into it." 73 | (interactive) 74 | (let* ((scratch-buffer-name "*scratch*") 75 | (scratch-buffer (get-buffer scratch-buffer-name))) 76 | (unless scratch-buffer 77 | (setq scratch-buffer (get-buffer-create scratch-buffer-name)) 78 | (with-current-buffer scratch-buffer 79 | (lisp-interaction-mode) 80 | (insert initial-scratch-message))) 81 | (switch-to-buffer scratch-buffer))) 82 | 83 | (defun gf/switch-to-messages-buffer () 84 | "Switch to the messages buffer." 85 | (interactive) 86 | (switch-to-buffer "*Messages*")) 87 | 88 | (defvar gf/url-regex-string "https?:\/\/[-a-z0-9\.\/_\?=%&]+") 89 | 90 | (defun gf/open-url-from-buffer () 91 | "Prompt to open one of the urls in the current buffer." 92 | (interactive) 93 | (save-excursion 94 | (goto-char (point-min)) 95 | (let ((urls ())) 96 | (while (re-search-forward gf/url-regex-string nil t) 97 | (let ((url (match-string-no-properties 0))) 98 | (add-to-list 'urls url) 99 | )) 100 | (let ((url (completing-read "Open url in buffer: " urls nil t))) 101 | (when url 102 | (browse-url url)))))) 103 | 104 | (defun gf/open-recent-url () 105 | "Open the url closest behind the current point, for example in an 106 | ERC buffer." 107 | (interactive) 108 | (save-excursion 109 | (re-search-backward gf/url-regex-string nil t) 110 | (let ((url (match-string-no-properties 0))) 111 | (when url 112 | (browse-url url))))) 113 | 114 | (defun gf/make-current-file-executable () 115 | "Add the executable bit to the current file." 116 | (interactive) 117 | (if (buffer-file-name) 118 | (set-file-modes (buffer-file-name) 119 | (logior (file-modes (buffer-file-name)) (logand ?\111 (default-file-modes)))) 120 | (error "Not visiting a file."))) 121 | 122 | (defun gf/evil-forward-arg (count) 123 | "Small wrapper around evil-forward-arg when at the opening bracket." 124 | (interactive "p") 125 | (if (looking-at-p "(") 126 | (forward-char)) 127 | (evil-forward-arg count)) 128 | 129 | (defun gf/maybe-smerge () 130 | (save-excursion 131 | (goto-char (point-min)) 132 | (when (re-search-forward "^<<<<<<< " nil t) 133 | (smerge-mode t)))) 134 | 135 | (defun gf/hexstring (length) 136 | "Generate a hexadecimal string." 137 | (let ((hash (md5 (number-to-string (random))))) 138 | (substring hash 0 length))) 139 | 140 | (defmacro gf/link-handler (name key regex transform-match) 141 | (let ((func-name-get (intern (format "gf/get-%s-link" name))) 142 | (func-name-open (intern (format "gf/open-%s-link" name))) 143 | (func-name-copy (intern (format "gf/copy-%s-link" name)))) 144 | `(progn 145 | (defun ,func-name-get () 146 | (let ((match (gf/regex-dwim ,regex))) 147 | (if match 148 | (,transform-match match) 149 | nil))) 150 | (defun ,func-name-open () 151 | (interactive) 152 | (let ((url (,func-name-get))) 153 | (if url 154 | (browse-url url) 155 | (error (format "no %s match found" ,name))))) 156 | (defun ,func-name-copy () 157 | (interactive) 158 | (message (,func-name-get))) 159 | (general-define-key 160 | :states '(normal visual insert emacs) 161 | :prefix "SPC" 162 | :non-normal-prefix "M-SPC" 163 | ,(concat "g" key) ',func-name-open)))) 164 | 165 | (defun gf/regex-dwim (regex) 166 | (save-excursion 167 | (save-match-data 168 | (let ((start-position (point))) 169 | (if (eq major-mode 'org-mode) 170 | (gf/org-up-to-level 2) 171 | (if (derived-mode-p 'prog-mode) 172 | (beginning-of-defun) 173 | (beginning-of-line))) 174 | (if (re-search-forward regex start-position t) 175 | (match-string-no-properties 0)))))) 176 | 177 | 178 | (defun gf/uuid () 179 | "Generate a pseudo-random UUID. Just the format, not adhering to any versioned UUID spec." 180 | (let ((hash (md5 (number-to-string (random))))) 181 | (format "%s-%s-%s-%s-%s" 182 | (substring hash 0 8) 183 | (substring hash 8 12) 184 | (substring hash 12 16) 185 | (substring hash 16 20) 186 | (substring hash 20 32)))) 187 | 188 | ;; from `diary.el' (`diary-ordinal-suffix') 189 | (defun ordinal-suffix (n) 190 | "Ordinal suffix for N. That is, `st', `nd', `rd', or `th', as appropriate." 191 | (if (or (memq (% n 100) '(11 12 13)) (< 3 (% n 10))) 192 | "th" 193 | (aref ["th" "st" "nd" "rd"] (% n 10)))) 194 | 195 | (defun gf/short-date () 196 | "Get a short date for headers etc." 197 | (format (format-time-string "%a %-d%%s %b %Y") (ordinal-suffix (string-to-number (format-time-string "%-d"))))) 198 | 199 | (defun gf/normalize-quotes (start end) 200 | "Replace left and right quotation marks with regular versions" 201 | (interactive "r") 202 | (replace-regexp-in-region "[““””]" "\"" start end) 203 | (replace-regexp-in-region "[‘’]" "'" start end)) 204 | 205 | (provide 'lib-core) 206 | -------------------------------------------------------------------------------- /emacs/site-lisp/lib-elisp.el: -------------------------------------------------------------------------------- 1 | ;; pp-macroexpand-last-sexp does the same, but isn't read-only and writes a noisy message 2 | (defun gf/show-previous-sexp-macro-expand () 3 | "Show the result of macro expanding the previous sexp." 4 | (interactive) 5 | (let ((lisp (macroexpand (elisp--preceding-sexp)))) 6 | (with-current-buffer-window 7 | "*Macro Expansion*" nil nil 8 | (pp lisp) 9 | (emacs-lisp-mode) 10 | (read-only-mode)))) 11 | 12 | (defun lisp-describe-thing-at-point () 13 | "Show the documentation of the Elisp function and variable near point. 14 | This checks in turn: 15 | -- for a function name where point is 16 | -- for a variable name where point is 17 | -- for a surrounding function call" 18 | (interactive) 19 | (let (sym) 20 | ;; sigh, function-at-point is too clever. we want only the first half. 21 | (cond ((setq sym (ignore-errors 22 | (with-syntax-table emacs-lisp-mode-syntax-table 23 | (save-excursion 24 | (or (not (zerop (skip-syntax-backward "_w"))) 25 | (eq (char-syntax (char-after (point))) ?w) 26 | (eq (char-syntax (char-after (point))) ?_) 27 | (forward-sexp -1)) 28 | (skip-chars-forward "`'") 29 | (let ((obj (read (current-buffer)))) 30 | (and (symbolp obj) (fboundp obj) obj)))))) 31 | (describe-function sym)) 32 | ((setq sym (variable-at-point)) (describe-variable sym))))) 33 | 34 | (provide 'lib-elisp) 35 | -------------------------------------------------------------------------------- /emacs/site-lisp/lib-org.el: -------------------------------------------------------------------------------- 1 | (require 'org) 2 | (require 's) 3 | 4 | (defun gf/org-select-project-file-header () 5 | "Visit a location to store a new note in the current project." 6 | (interactive) 7 | (gf/projects-open-org-file) 8 | (gf/org-select-top-level-header)) 9 | 10 | (defun gf/org-select-other-project-file-header () 11 | "Visit a location to store a new note in another project." 12 | (interactive) 13 | (let ((project (file-truename (completing-read "Project: " (projectile-relevant-known-projects))))) 14 | (message project) 15 | (find-file (gf/projects--resolve-org-path project)) 16 | (gf/org-select-top-level-header))) 17 | 18 | (defun gf/org-select-top-level-header () 19 | "Visit a top level heading in the current file." 20 | (interactive) 21 | (goto-char (point-min)) 22 | (let ((choice (completing-read "Heading: " (gf/org--get-top-level-headings)))) 23 | (goto-char (point-min)) 24 | (re-search-forward (format "^\* %s" choice))) 25 | (outline-show-children)) 26 | 27 | (defun gf/org-select-top-level-header-or-all (arg) 28 | "Visit a heading in the current file. Choose from top level headings, or all headings if called with a prefix argument." 29 | (interactive "P") 30 | (if arg 31 | (helm-org-in-buffer-headings) 32 | (gf/org-select-top-level-header))) 33 | 34 | (defun gf/org--get-top-level-headings () 35 | "Get the names of the top level headings in the current org file." 36 | (save-excursion 37 | (goto-char (point-min)) 38 | (let ((headings nil)) 39 | (while (re-search-forward "^\\* \\(.+\\)" nil t) 40 | (add-to-list 'headings (match-string-no-properties 1) t)) 41 | headings))) 42 | 43 | (defun gf/org-select-next-task () 44 | "Select an item marked as NEXT in the current buffer." 45 | (interactive) 46 | (let* ((choices (gf/org--get-keyword-items "NEXT")) 47 | (choice (cadr (assoc (completing-read "Next task: " choices) choices)))) 48 | (goto-char (point-min)) 49 | (re-search-forward choice) 50 | (beginning-of-line) 51 | (gf/org-show-entry))) 52 | 53 | (defun gf/org--get-keyword-items (keyword) 54 | "Get the names of all headings with todo keyword KEYWORD." 55 | (save-excursion 56 | (goto-char (point-min)) 57 | (let ((headings nil)) 58 | (while (re-search-forward (format "\\(^\\*+ %s .+\\)" keyword) nil t) 59 | (let* ((match (match-string-no-properties 1)) 60 | (parent-headings nil) 61 | (label nil)) 62 | (save-excursion 63 | (while (not (equal (org-outline-level) 1)) 64 | (outline-up-heading 1 t) 65 | (beginning-of-line) 66 | (re-search-forward "^\\*+ \\(.+\\)") 67 | (add-to-list 'parent-headings (match-string-no-properties 1)))) 68 | (setq label (seq-reduce (lambda (initial item) 69 | (if (equal initial match) 70 | (concat match " | " item) 71 | (concat initial " - " item))) 72 | parent-headings 73 | match)) 74 | (add-to-list 'headings (list label match) t))) 75 | headings))) 76 | 77 | (defun gf/org-insert-blank-title () 78 | (interactive) 79 | (goto-char (point-min)) 80 | (if (looking-at-p ":PROPERTIES:") 81 | (progn 82 | (re-search-forward ":END:") 83 | (forward-line 1) 84 | (beginning-of-line))) 85 | (insert "#+TITLE: ") 86 | (newline) 87 | (newline) 88 | (forward-line -2) 89 | (end-of-line) 90 | (evil-insert-state)) 91 | 92 | (defun gf/org-show-entry () 93 | "Show the current entry and all parent headers." 94 | (interactive) 95 | (outline-show-entry) 96 | (save-excursion 97 | (outline-up-heading 1 t) 98 | (outline-show-branches))) 99 | 100 | (defun gf/org-find-file () 101 | (interactive) 102 | (projectile-find-file-in-directory org-directory)) 103 | 104 | (defun gf/org-up-to-level (level) 105 | "Move up to the previous LEVEL heading." 106 | (interactive) 107 | (let ((pattern (concat (s-repeat level "\\*") " "))) 108 | (beginning-of-line) 109 | (while (not (looking-at-p pattern)) 110 | (progn 111 | (if (equal (buffer-substring-no-properties (line-beginning-position) (line-end-position)) "") 112 | (forward-line -1) 113 | (org-up-element)))))) 114 | 115 | (provide 'lib-org) 116 | -------------------------------------------------------------------------------- /emacs/site-lisp/lib-php.el: -------------------------------------------------------------------------------- 1 | ;; (defun test-this-or-related-php-file () 2 | ;; "Run test-case-run on the current buffer, or the related test case 3 | ;; file if open." 4 | ;; (interactive) 5 | ;; (save-buffer) 6 | ;; (if (or test-case-mode (test-case-mode)) 7 | ;; (test-case-run) 8 | ;; (let ((b (concat 9 | ;; (car (split-string (buffer-name) "\\.")) 10 | ;; "Test." 11 | ;; (car (cdr (split-string (buffer-name) "\\.")))))) 12 | ;; (if (get-buffer b) 13 | ;; (progn 14 | ;; (switch-to-buffer-other-window b) 15 | ;; (save-buffer) 16 | ;; (test-case-run) 17 | ;; (other-window 1)) 18 | ;; (message (format "buffer not found: %s" b)))))) 19 | 20 | (defun gf/php-use-class (classname) 21 | "Insert CLASSNAME after the last use statement at the top of this file." 22 | (interactive) 23 | (save-excursion 24 | (goto-char (point-max)) 25 | (if (not (re-search-backward "^use" nil t)) 26 | (progn 27 | (goto-char (point-min)) 28 | (if (not (re-search-forward "^namespace" nil t)) 29 | (error "Namespace declaration not found.")) 30 | (end-of-line) 31 | (newline))) 32 | (end-of-line) 33 | (newline) 34 | (insert (concat "use " classname ";")))) 35 | 36 | (defun gf/php-use-trait (classname) 37 | "Use CLASSNAME as a trait in the current file." 38 | (interactive) 39 | (gf/php-use-class classname) 40 | (save-excursion 41 | (goto-char (point-max)) 42 | (if (not (re-search-backward "^ use" nil t)) 43 | (progn 44 | (goto-char (point-min)) 45 | (if (not (re-search-forward "^class" nil t)) 46 | (error "Unable to detect where to add a trait use statement.")) 47 | (forward-line) 48 | (when (not (looking-at-p "{")) 49 | (forward-line -1)) 50 | (end-of-line) 51 | (newline) 52 | (forward-line -1))) 53 | (end-of-line) 54 | (newline) 55 | (let ((classbasename (car (last (split-string classname "\\\\"))))) 56 | (insert (concat " use " classbasename ";"))))) 57 | 58 | (defun gf/php-class-candidates () 59 | "Get a list of available PHP classes in the current projectile project." 60 | (interactive) 61 | (split-string (shell-command-to-string 62 | (concat "~/.emacs.d/bin/php_class_finder.php " (projectile-project-root))) "\n" t)) 63 | 64 | (defun gf/php-refresh-class-candidates () 65 | "Refresh the list of available PHP classes in the current projectile project." 66 | (interactive) 67 | (start-process-shell-command "php-class-candidates" nil (concat "~/.emacs.d/bin/php_class_finder.php " (projectile-project-root) " refresh")) 68 | (message (format "Refreshing class candidates for %s" (projectile-project-root)))) 69 | 70 | (defun gf/php-use-class-select () 71 | "Add a class to the use declarations in the current file." 72 | (interactive) 73 | (gf/php-use-class (completing-read 74 | "Class: " 75 | (gf/php-class-candidates)))) 76 | 77 | (defun gf/php-use-trait-select () 78 | "Use a trait in the current class." 79 | (interactive) 80 | (gf/php-use-trait (completing-read 81 | "Trait: " 82 | (gf/php-class-candidates)))) 83 | 84 | (defun gf/php-insert-class () 85 | "Insert a class name in the current projectile project." 86 | (interactive) 87 | (let ((class (completing-read 88 | "Class: " 89 | (gf/php-class-candidates)))) 90 | (insert class))) 91 | 92 | (defun gf/php-current-file-namespace () 93 | "Get a suitable namespace for the current file." 94 | (gf/php-file-namespace buffer-file-name)) 95 | 96 | (defun gf/php-file-namespace (file) 97 | "Get a suitable namespace for `FILE`." 98 | (shell-command-to-string 99 | (concat user-emacs-directory "bin/php_resolve_namespace.php " file))) 100 | 101 | (defun gf/evil-open-below-docblock (count) 102 | "Same as `evil-open-below`, but insert * if in a docblock." 103 | (interactive "p") 104 | (evil-first-non-blank) 105 | (if (looking-at-p "*") 106 | (progn 107 | (evil-open-below count) 108 | (insert "* ")) 109 | (evil-open-below count))) 110 | 111 | (evil-declare-key 'normal php-mode-map "o" 'gf/evil-open-below-docblock) 112 | 113 | (defun gf/php-cleanup-style () 114 | "Cleanup the style of the current php file with php-cs-fixer." 115 | (interactive) 116 | (save-buffer) 117 | (shell-command (concat "php-cs-fixer fix --rules=@Symfony --using-cache=false " (buffer-file-name))) 118 | (let ((point (point))) 119 | (revert-buffer t t) 120 | (goto-char point))) 121 | 122 | (defun gf/php-in-template-p () 123 | "Return t if the current php file looks like a template." 124 | (and (> (point-max) 5) 125 | (not (equal (buffer-substring-no-properties 1 6) "") 'delete-window) 12 | 13 | (defun ac-pcomplete () 14 | ;; eshell uses `insert-and-inherit' to insert a \t if no completion 15 | ;; can be found, but this must not happen as auto-complete source 16 | (cl-flet ((insert-and-inherit (&rest args))) 17 | ;; this code is stolen from `pcomplete' in pcomplete.el 18 | (let* (tramp-mode ;; do not automatically complete remote stuff 19 | (pcomplete-stub) 20 | (pcomplete-show-list t) ;; inhibit patterns like * being deleted 21 | pcomplete-seen pcomplete-norm-func 22 | pcomplete-args pcomplete-last pcomplete-index 23 | (pcomplete-autolist pcomplete-autolist) 24 | (pcomplete-suffix-list pcomplete-suffix-list) 25 | (candidates (pcomplete-completions)) 26 | (beg (pcomplete-begin)) 27 | ;; note, buffer text and completion argument may be 28 | ;; different because the buffer text may bet transformed 29 | ;; before being completed (e.g. variables like $HOME may be 30 | ;; expanded) 31 | (buftext (buffer-substring beg (point))) 32 | (arg (nth pcomplete-index pcomplete-args))) 33 | ;; we auto-complete only if the stub is non-empty and matches 34 | ;; the end of the buffer text 35 | (when (and (not (zerop (length pcomplete-stub))) 36 | (or (string= pcomplete-stub ; Emacs 23 37 | (substring buftext 38 | (max 0 39 | (- (length buftext) 40 | (length pcomplete-stub))))) 41 | (string= pcomplete-stub ; Emacs 24 42 | (substring arg 43 | (max 0 44 | (- (length arg) 45 | (length pcomplete-stub))))))) 46 | ;; Collect all possible completions for the stub. Note that 47 | ;; `candidates` may be a function, that's why we use 48 | ;; `all-completions`. 49 | (let* ((cnds (all-completions pcomplete-stub candidates)) 50 | (bnds (completion-boundaries pcomplete-stub 51 | candidates 52 | nil 53 | "")) 54 | (skip (- (length pcomplete-stub) (car bnds)))) 55 | ;; We replace the stub at the beginning of each candidate by 56 | ;; the real buffer content. 57 | (mapcar #'(lambda (cand) (concat buftext (substring cand skip))) 58 | cnds)))))) 59 | 60 | (defvar ac-source-pcomplete 61 | '((candidates . ac-pcomplete))) 62 | 63 | (add-hook 'eshell-mode-hook #'(lambda () (setq ac-sources '(ac-source-pcomplete)))) 64 | (add-to-list 'ac-modes 'eshell-mode) 65 | 66 | (provide 'setup-eshell) 67 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-git.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package magit 4 | :commands magit-status 5 | :config 6 | (setq 7 | magit-log-arguments '("-n256" "--decorate") 8 | magit-log-margin '(t "%H:%M %a %d %b %Y" magit-log-margin-width t 18)) 9 | (add-hook 'with-editor-mode-hook 'evil-insert-state) 10 | 11 | (general-define-key 12 | :keymaps '(magit-mode-map magit-diff-mode-map) 13 | "SPC" 'nil)) 14 | 15 | ;; (general-define-key 16 | ;; :states '(normal) 17 | ;; :keymaps 'magit-blame-mode-map 18 | ;; "b" 'magit-blame 19 | ;; "j" 'magit-blame-next-chunk 20 | ;; "k" 'magit-blame-previous-chunk 21 | ;; "y" 'magit-blame-copy-hash)) 22 | 23 | (use-package git-link 24 | :after magit 25 | :config 26 | 27 | (setq git-link-open-in-browser t) 28 | 29 | (general-define-key 30 | :states '(normal visual insert emacs) 31 | :prefix gf/leader-key 32 | :non-normal-prefix gf/non-normal-leader-key 33 | "go" 'git-link)) 34 | 35 | (use-package git-gutter 36 | :diminish "" 37 | :config 38 | (global-git-gutter-mode t)) 39 | 40 | (use-package git-timemachine 41 | :config 42 | (defhydra hydra-git-timemachine () 43 | "Git timemachine" 44 | ("n" git-timemachine-show-next-revision "Next commit") 45 | ("p" git-timemachine-show-previous-revision "Previous commit") 46 | ("q" git-timemachine-quit "Quit" :exit t)) 47 | 48 | (defun gf/git-timemachine () 49 | "Start git-timemachine with a hydra." 50 | (interactive) 51 | (git-timemachine) 52 | (hydra-git-timemachine/body))) 53 | 54 | (provide 'setup-git) 55 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-go.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package go-mode 4 | :config 5 | (progn 6 | (add-hook 'before-save-hook 'gofmt-before-save)) 7 | 8 | (general-define-key 9 | :states '(normal visual insert emacs) 10 | :prefix gf/major-mode-leader-key 11 | :non-normal-prefix gf/major-mode-non-normal-leader-key 12 | :keymaps 'go-mode-map 13 | "a" 'go-import-add)) 14 | 15 | (provide 'setup-go) 16 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-groovy.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package groovy-mode 4 | :mode "\\.painless$" 5 | :config) 6 | 7 | (provide 'setup-groovy) 8 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-hashicorp.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package hcl-mode 4 | :mode "\\.hcl2\\'") 5 | 6 | (use-package terraform-mode 7 | 8 | :config 9 | 10 | (general-define-key 11 | :states '(normal visual insert emacs) 12 | :prefix "SPC" 13 | :non-normal-prefix "M-SPC" 14 | :keymaps 'terraform-mode-map 15 | "+" 'terraform-format-buffer) 16 | ) 17 | 18 | (provide 'setup-hashicorp) 19 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-help.el: -------------------------------------------------------------------------------- 1 | (evil-set-initial-state 'help-mode 'normal) 2 | 3 | (general-define-key 4 | :states '(normal) 5 | :keymaps 'help-mode-map 6 | "q" 'quit-window) 7 | 8 | (general-define-key 9 | :keymaps 'help-mode-map 10 | "o" 'ace-link-help) 11 | 12 | (general-define-key 13 | :keymaps 'Info-mode-map 14 | "o" 'ace-link-info) 15 | 16 | (provide 'setup-help) 17 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-js.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | (use-package js2-mode 3 | :init 4 | (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) 5 | (add-to-list 'auto-mode-alist '("\\.mjs$" . js2-mode)) 6 | (add-to-list 'auto-mode-alist '("\\.jsx$" . js2-jsx-mode)) 7 | (add-to-list 'auto-mode-alist '("\\.json$" . javascript-mode)) 8 | (add-to-list 'magic-mode-alist '("#!/usr/bin/env node" . js2-mode)) 9 | :config 10 | 11 | (add-hook 'js2-mode-hook (lambda () 12 | (flycheck-mode -1))) 13 | 14 | (setq-default js2-basic-offset 2) 15 | 16 | (defun gf/js2-mode-toggle-indent-offset () 17 | "Switch between 2 and 4 spaces for javascript indentation" 18 | (interactive) 19 | (if (eq (default-value 'js2-basic-offset) 4) 20 | (setq-default js2-basic-offset 2) 21 | (setq-default js2-basic-offset 4)) 22 | (message (format "Default javascript indentation is now %s spaces" (default-value 'js2-basic-offset)))) 23 | 24 | (general-define-key 25 | :states '(normal visual insert emacs) 26 | :prefix "SPC" 27 | :non-normal-prefix "M-SPC" 28 | :keymaps 'js2-mode-map 29 | "ti" '(gf/js2-mode-toggle-indent-offset :which-key "javascript indentation"))) 30 | 31 | (use-package js2-refactor 32 | :after js2-mode) 33 | 34 | (use-package js-comint 35 | :config 36 | (setq inferior-js-program-command "env NODE_NO_READLINE=1 node")) 37 | 38 | (provide 'setup-js) 39 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-jsonnet.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package jsonnet-mode) 4 | 5 | (provide 'setup-jsonnet) 6 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-keys.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package general 4 | :config 5 | (general-define-key 6 | :states '(normal visual insert emacs) 7 | :prefix gf/leader-key 8 | :non-normal-prefix gf/non-normal-leader-key 9 | 10 | "a" 'consult-imenu 11 | 12 | "b" '(:ignore t :which-key "buffers") 13 | "bb" 'consult-buffer 14 | "bd" 'kill-current-buffer 15 | "bD" 'kill-matching-buffers 16 | "bm" 'gf/switch-to-messages-buffer 17 | "bs" 'gf/switch-to-scratch-buffer 18 | 19 | "c" 'org-capture 20 | 21 | "d" '(:ignore t :which-key "dired") 22 | "dc" `(,(gf/key 'dired "~/code") :which-key "~/code") 23 | "dd" 'dired 24 | "dj" 'dired-jump 25 | "dh" `(,(gf/key 'dired "~/Desktop") :which-key "~/Desktop") 26 | "dH" `(,(gf/key 'dired "~") :which-key "~") 27 | "dp" 'projectile-find-dir 28 | "dP" 'projectile-dired 29 | 30 | "e" '(:ignore t :which-key "emacs/eval/editor") 31 | "eb" 'eval-buffer 32 | "ec" 'editorconfig-display-current-properties 33 | "eC" 'editorconfig-apply 34 | "em" 'gf/show-previous-sexp-macro-expand 35 | "ep" 'package-list-packages 36 | "eP" 'package-autoremove 37 | 38 | "f" '(:ignore t :which-key "files") 39 | "fc" `(,(gf/key 'gf/helm-find-in-directory "~/code/") :which-key "~/code") 40 | "fD" 'vnd/delete-current-buffer-file 41 | "fe" 'gf/find-emacs-d-file 42 | "fE" 'editorconfig-find-current-editorconfig 43 | "ff" 'find-file 44 | "fF" 'find-function 45 | "fh" `(,(gf/key 'gf/helm-find-in-directory "~/Desktop/") :which-key "~/Desktop") 46 | "fH" `(,(gf/key 'gf/helm-find-in-directory "~/") :which-key "~") 47 | "fi" '(gf/open-init-file :which-key "open init.el") 48 | "fI" '(gf/open-personal-file :which-key "open setup-personal.el") 49 | "fo" 'gf/org-find-file 50 | "fp" 'projectile-find-file 51 | "fr" 'consult-recent-file 52 | "fR" 'vnd/rename-current-buffer-file 53 | "fs" 'save-buffer 54 | "fw" 'write-file 55 | "fx" 'gf/make-current-file-executable 56 | "fz" '(gf/open-zshrc :which-key "open .zshrc") 57 | "fZ" '(gf/open-zshrc-local :which-key "open .zshrc.local") 58 | "f." '(gf/open-dotenv-file :which-key "open dotenv for this project") 59 | 60 | "h" '(:ignore t :which-key "docs") 61 | "ht" 'gf/php-show-date-format-help 62 | 63 | "g" '(:ignore t :which-key "git") 64 | "gb" 'magit-blame 65 | "gs" 'magit-status 66 | "gt" '(gf/git-timemachine :which-key "git-timemachine") 67 | 68 | "G" 'git-gutter:revert-hunk 69 | 70 | "i" '(:ignore t :which-key "insert") 71 | "ib" '((lambda () (interactive) (insert (gf/buffer-file-name-body))) :which-key "gf/buffer-file-name-body") 72 | "ic" 'gf/php-insert-class 73 | "id" '((lambda () (interactive) (insert (gf/short-date))) :which-key "short date") 74 | "ir" 'gf/php-insert-symfony-route 75 | "is" 'gf/php-insert-service 76 | "it" 'gf/php-insert-symfony-twig-helper 77 | "iu" '((lambda () (interactive) (insert (gf/uuid))) :which-key "gf/uuid") 78 | "i4" '((lambda () (interactive) (insert (gf/hexstring 4))) :which-key "4-char hex") 79 | "i6" '((lambda () (interactive) (insert (gf/hexstring 6))) :which-key "6-char hex") 80 | "i8" '((lambda () (interactive) (insert (gf/hexstring 8))) :which-key "8-char hex") 81 | 82 | "j" 'vnd/arrayify 83 | 84 | "l" 'evil-lisp-state 85 | 86 | "m" '(:ignore t :which-key "major-mode") 87 | 88 | "n" '(:ignore t :which-key "narrowing") 89 | "nf" 'narrow-to-defun 90 | "nr" 'narrow-to-region 91 | "nw" 'widen 92 | 93 | "o" '(:ignore t :which-key "org") 94 | "oi" '(gf/find-org-info-file :which-key "open info file") 95 | "ol" 'org-capture-goto-last-stored 96 | "oL" 'org-refile-goto-last-stored 97 | "oN" 'gf/commit-notes 98 | "om" 'gf/find-current-month-notes-file 99 | "op" 'gf/projects-toggle-org-file 100 | 101 | "p" '(:ignore t :which-key "projects") 102 | "pk" 'projectile-kill-buffers 103 | "ps" 'projectile-switch-project 104 | "pS" 'projectile-save-project-buffers 105 | "pr" 'projectile-replace 106 | "pR" 'projectile-remove-known-project 107 | 108 | "P" 'yank-from-kill-ring 109 | 110 | "q" '(:ignore t :which-key "quitting") 111 | "qf" 'delete-frame 112 | "qq" 'save-buffers-kill-emacs 113 | "qQ" 'gf/save-buffers-kill-emacs-no-prompt 114 | "qr" 'restart-emacs 115 | 116 | "r" 'gf/tmux-run-last 117 | "R" 'gf/tmux-run 118 | 119 | "s" '(:ignore t :which-key "search") 120 | "sp" 'consult-ripgrep 121 | "sP" (lambda () 122 | (interactive) 123 | (let ((current-prefix-arg 4)) 124 | (call-interactively 'consult-ripgrep))) 125 | "so" 'org-search-view 126 | 127 | "t" '(:ignore t :which-key "toggle") 128 | "tr" 'rainbow-mode 129 | "tg" '(global-git-gutter-mode :which-key "git-gutter") 130 | "tl" 'lsp-mode 131 | "tw" '(global-whitespace-mode :which-key "whitespace") 132 | "ts" '(flyspell-mode :which-key "flyspell") 133 | "tp" '(smartparens-mode :which-key "smartparens") 134 | "tW" '(ws-butler-mode :which-key "whitespace butler") 135 | 136 | "T" 'try-code 137 | 138 | "u" 'universal-argument 139 | "U" 'undo-tree-visualize 140 | 141 | "v" '(er/expand-region :which-key "expand-region") 142 | 143 | "w" '(:ignore t :which-key "what") 144 | "wp" 'gf/props-at-point 145 | 146 | "x" 'execute-extended-command 147 | 148 | "y" '(:ignore t :which-key "yasnippet") 149 | "yi" 'yas-insert-snippet 150 | "yr" 'yas-reload-all 151 | 152 | ";" 'consult-line 153 | "=" 'gf/indent-buffer 154 | "-" 'gf/untabify-buffer 155 | "+" 'gf/indent-cleanup-buffer 156 | "!" 'flycheck-next-error 157 | "*" '(hydra-rotate-text/body :which-key "rotate text") 158 | "$" 'gf/refresh-major-mode 159 | "\\" 'align-regexp) 160 | 161 | (general-define-key 162 | :states '(normal) 163 | "g+" 'evil-numbers/inc-at-pt 164 | "g=" 'evil-numbers/inc-at-pt 165 | "g-" 'evil-numbers/dec-at-pt) 166 | 167 | (general-define-key 168 | :states '(normal visual) 169 | "j" 'evil-next-visual-line 170 | "k" 'evil-previous-visual-line 171 | "gj" 'evil-next-line 172 | "gk" 'evil-previous-line 173 | "L" 'gf/evil-forward-arg 174 | "H" 'evil-backward-arg 175 | "K" 'evil-jump-out-args 176 | 177 | "M-j" 'move-text-down 178 | "M-k" 'move-text-up) 179 | 180 | (general-define-key 181 | :states '(insert) 182 | "C-a" 'beginning-of-line 183 | "C-e" 'end-of-line) 184 | 185 | (general-define-key 186 | :states '(visual) 187 | "<" 'gf/visual-shift-left 188 | ">" 'gf/visual-shift-right 189 | "K" 'sort-lines 190 | 191 | ;; fix move-text for visual mode 192 | "M-j" (concat ":m '>+1" (kbd "RET") "gv=gv") 193 | "M-k" (concat ":m '<-2" (kbd "RET") "gv=gv")) 194 | 195 | (general-define-key 196 | :states '(visual) 197 | :prefix gf/leader-key 198 | "\"" 'gf/normalize-quotes) 199 | 200 | (general-define-key 201 | :keymaps 'evil-window-map 202 | "d" 'delete-window 203 | "m" '(delete-other-windows :which-key "maximise window") 204 | "u" 'winner-undo 205 | "U" 'winner-redo 206 | "o" 'vnd/alternate-buffer 207 | "C-o" 'vnd/alternate-buffer 208 | "C-l" 'evil-window-right 209 | "C-h" 'evil-window-left) 210 | 211 | (general-define-key 212 | :keymaps '(global prog-mode-map) 213 | "M-q" 'gf/close-buffer-other-window 214 | "M-d" 'scroll-other-window 215 | "M-u" 'scroll-other-window-down)) 216 | 217 | (provide 'setup-keys) 218 | 219 | ;; (evil-declare-key 'insert org-mode-map (kbd "M-") (lambda() 220 | ;; (interactive) 221 | ;; (evil-append-line 1) 222 | ;; (org-meta-return) 223 | ;; )) 224 | ;; (evil-declare-key 'normal org-mode-map (kbd "M-") (lambda() 225 | ;; (interactive) 226 | ;; (evil-append-line 1) 227 | ;; (org-meta-return) 228 | ;; )) 229 | ;; (evil-declare-key 'normal org-mode-map (kbd "") 'org-open-at-point) 230 | ;; (evil-declare-key 'normal org-mode-map (kbd "RET") 'org-open-at-point) 231 | 232 | ;; (define-key global-map (kbd "C-c a") 'org-agenda) 233 | 234 | ;; (define-key global-map (kbd "C-c l") 'org-store-link) 235 | ;; ;;; to insert the link into an org mode buffer, use C-c C-l 236 | 237 | ;; ;; Vim style navigation 238 | ;; (define-key org-mode-map (kbd "C-c h") 'outline-up-heading) 239 | ;; (define-key org-mode-map (kbd "C-c j") 'outline-next-visible-heading) 240 | ;; (define-key org-mode-map (kbd "C-c k") 'outline-previous-visible-heading) 241 | ;; (define-key org-mode-map (kbd "C-c g") 'gf/org-end-of-section) 242 | ;; (define-key org-mode-map (kbd "C-c J") 'org-forward-heading-same-level) 243 | ;; (define-key org-mode-map (kbd "C-c K") 'org-backward-heading-same-level) 244 | 245 | ;; (evil-declare-key 'normal org-mode-map ",N" 'org-narrow-to-subtree) 246 | 247 | ;; (evil-declare-key 'normal org-mode-map (kbd "M-i") 'org-display-inline-images) 248 | ;; (evil-declare-key 'normal org-mode-map (kbd "M-I") 'org-remove-inline-images) 249 | 250 | ;; (evil-declare-key 'normal org-mode-map ",e" 'org-ctrl-c-ctrl-c) 251 | 252 | ;; (evil-declare-key 'normal org-mode-map ",a" 'helm-org-headlines) 253 | 254 | 255 | ;; (evil-declare-key 'normal php-mode-map ",z" 'gf/toggle-php-web-mode) 256 | ;; (evil-declare-key 'normal web-mode-map ",z" 'gf/toggle-php-web-mode) 257 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-kubernetes.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package kubel-evil 4 | :defer t) 5 | 6 | (provide 'setup-kubernetes) 7 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-lilypond.el: -------------------------------------------------------------------------------- 1 | (use-package lilypond-mode 2 | :mode ("\\.ly$" . LilyPond-mode)) 3 | 4 | ;; (defvar ac-lilypond-identifiers 5 | ;; '((candidates 6 | ;; . (lambda () 7 | ;; (all-completions ac-target LilyPond-identifiers))))) 8 | 9 | ;; ;; I need to do a mapcar on the list of keywords to put an extra \\ in front of the \\ that is there already. 10 | ;; ;; This will probably done if any LaTeX is used for auto-complete. 11 | 12 | ;; (defvar ni-LilyPond-keywords 13 | ;; (mapcar (lambda (x) (concat "\\" x)) LilyPond-keywords)) 14 | 15 | ;; (defvar ac-lilypond-keywords 16 | ;; '((candidates 17 | ;; . (lambda () 18 | ;; (all-completions ac-target ni-LilyPond-keywords))))) 19 | 20 | ;; (defvar ac-lilypond-Creserved-words 21 | ;; '((candidates 22 | ;; . (lambda () 23 | ;; (all-completions ac-target LilyPond-Capitalized-Reserved-Words))))) 24 | 25 | ;; (defvar ac-lilypond-ncreserved-words 26 | ;; '((candidates 27 | ;; . (lambda () 28 | ;; (all-completions ac-target LilyPond-non-capitalized-reserved-words))))) 29 | 30 | ;; (setq ac-sources '(ac-lilypond-ncreserved-words 31 | ;; ac-lilypond-Creserved-words 32 | ;; ac-lilypond-keywords 33 | ;; ac-lilypond-identifiers ;these don't work. why? 34 | ;; ac-source-abbrev 35 | ;; ac-source-words-in-buffer)) 36 | 37 | (provide 'setup-lilypond) 38 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-lua.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package lua-mode 4 | :config 5 | ) 6 | 7 | (provide 'setup-lua) 8 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-markdown.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package markdown-mode 4 | :mode 5 | (("\\.md\\'" . markdown-mode) 6 | ("\\.markdown\\'" . markdown-mode)) 7 | :config 8 | (setq markdown-asymmetric-header t) 9 | 10 | (general-define-key 11 | :keymaps 'markdown-mode-map 12 | "M-h" 'markdown-promote-subtree 13 | "M-l" 'markdown-demote-subtree 14 | "M-H" 'markdown-promote 15 | "M-L" 'markdown-demote 16 | "M-RET" 'markdown-insert-header-dwim) 17 | 18 | (general-define-key 19 | :keymaps 'markdown-mode-map 20 | :states 'normal 21 | "TAB" 'outline-cycle) 22 | 23 | (add-hook 'markdown-mode-hook 'flyspell-mode) 24 | (add-hook 'markdown-mode-hook 'ws-butler-mode) 25 | (add-hook 'markdown-mode-hook 'outline-minor-mode)) 26 | 27 | (provide 'setup-markdown) 28 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-multiple-cursors.el: -------------------------------------------------------------------------------- 1 | (use-package multiple-cursors 2 | :config 3 | ;; Thanks to tkf on 4 | ;; https://github.com/magnars/multiple-cursors.el/issues/19 5 | (defvar gf/mc-previous-state nil) 6 | 7 | (defun gf/mc-switch-to-emacs-state () 8 | (when (and (bound-and-true-p evil-mode) 9 | (not (eq evil-state 'emacs))) 10 | (setq gf/mc-previous-state evil-state) 11 | (evil-emacs-state))) 12 | 13 | (defun gf/mc-back-to-previous-state () 14 | (when gf/mc-previous-state 15 | (unwind-protect 16 | (case gf/mc-previous-state 17 | ((normal visual insert) (evil-force-normal-state)) 18 | (t (message "Don't know how to handle previous state: %S" 19 | gf/mc-previous-state))) 20 | (setq gf/mc-previous-state nil)))) 21 | 22 | (add-hook 'multiple-cursors-mode-enabled-hook 'gf/mc-switch-to-emacs-state) 23 | (add-hook 'multiple-cursors-mode-disabled-hook 'gf/mc-back-to-previous-state)) 24 | 25 | (provide 'setup-multiple-cursors) 26 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-nix.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | (use-package nix-mode 3 | :mode "\\.nix\\'") 4 | 5 | (provide 'setup-nix) 6 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-php.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package php-mode 4 | :defer t 5 | :mode "\\.php$" 6 | :commands (gf/php-insert-class 7 | gf/php-insert-service 8 | gf/php-insert-route 9 | gf/php-show-date-format-help) 10 | :config 11 | (add-hook 'php-mode-hook 'php-enable-psr2-coding-style) 12 | (require 'lib-php) 13 | 14 | (general-define-key 15 | :states '(normal visual insert emacs) 16 | :prefix gf/major-mode-leader-key 17 | :non-normal-prefix gf/major-mode-non-normal-leader-key 18 | :keymaps 'php-mode-map 19 | "c" 'gf/php-use-class-select 20 | "r" 'gf/php-refresh-class-candidates 21 | "t" 'gf/php-use-trait-select) 22 | 23 | (general-define-key 24 | :states '(normal visual insert emacs) 25 | :prefix gf/leader-key 26 | :non-normal-prefix gf/non-normal-leader-key 27 | :keymaps 'php-mode-map 28 | "+" 'gf/php-cleanup-style)) 29 | 30 | (provide 'setup-php) 31 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-protobuf.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package protobuf-mode) 4 | 5 | (provide 'setup-protobuf) 6 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-pug.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package pug-mode 4 | :config 5 | (setq pug-tab-width 2)) 6 | 7 | (provide 'setup-pug) 8 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-python.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode)) 4 | 5 | (use-package lsp-python-ms 6 | :ensure t 7 | :init (setq lsp-python-ms-auto-install-server t) 8 | :hook (python-ts-mode . (lambda () 9 | (require 'lsp-python-ms) 10 | (lsp-deferred)))) 11 | 12 | (provide 'setup-python) 13 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-saltstack.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package salt-mode 4 | :config 5 | (add-hook 'salt-mode-hook 6 | (lambda () 7 | (flyspell-mode 1))) 8 | 9 | (general-define-key 10 | :states '(normal) 11 | :keymaps 'salt-mode-map 12 | "K" 'salt-mode-browse-doc)) 13 | 14 | (provide 'setup-saltstack) 15 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-shell-script.el: -------------------------------------------------------------------------------- 1 | (use-package shell-script-mode 2 | :straight nil 3 | :mode ("\\.zsh$" . shell-script-mode)) 4 | 5 | (provide 'setup-shell-script) 6 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-sql.el: -------------------------------------------------------------------------------- 1 | (use-package sqlup-mode 2 | :defer t 3 | :init 4 | (add-hook 'sql-mode-hook 'sqlup-mode) 5 | (add-hook 'sql-interactive-mode-hook 'sqlup-mode) 6 | :config 7 | (general-define-key 8 | :states '(normal visual insert emacs) 9 | :prefix "SPC" 10 | :non-normal-prefix "M-SPC" 11 | :keymaps '(sql-mode-map sql-interactive-mode-map) 12 | "tu" '(sqlup-mode :which-key "toggle sqlup-mode"))) 13 | 14 | (provide 'setup-sql) 15 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-tmux.el: -------------------------------------------------------------------------------- 1 | (defvar gf/tmux--target-panes nil "p-list of tmux sessions and their target panes.") 2 | (defvar gf/tmux--previous-cmds nil "p-list of tmux sessions and their previous commands.") 3 | 4 | (defun gf/tmux--list-sessions () 5 | (split-string (shell-command-to-string 6 | "tmux list-sessions") "\n")) 7 | 8 | (defun gf/tmux--set-target-session (session) 9 | "Set the name of the tmux session for the current frame." 10 | (set-frame-parameter nil 'tmux-session session)) 11 | 12 | (defun gf/tmux--get-target-session () 13 | "Get the name of the tmux session for the current frame, prompting for one if not set yet." 14 | (unless (frame-parameter nil 'tmux-session) 15 | (gf/tmux--set-target-session 16 | (car 17 | (split-string 18 | (completing-read "Tmux session for this frame: " (gf/tmux--list-sessions) nil t) ":")))) 19 | (frame-parameter nil 'tmux-session)) 20 | 21 | (defun gf/tmux--list-panes (session) 22 | (split-string (shell-command-to-string 23 | (format "tmux list-panes -st %s -F \"#{window_index}.#{pane_index} #{pane_current_command} in #{pane_current_path}\" | column -t" session)) "\n")) 24 | 25 | (defun gf/tmux--set-target-pane (session pane) 26 | "Set the target pane to run tmux commands in." 27 | (setq gf/tmux--target-panes 28 | (plist-put gf/tmux--target-panes session pane))) 29 | 30 | (defun gf/tmux--get-target-pane (session) 31 | "Get the target pane for the given tmux session, prompting for one if not set yet." 32 | (when (or (not (plist-member gf/tmux--target-panes session)) current-prefix-arg) 33 | (gf/tmux--set-target-pane 34 | session 35 | (concat 36 | session ":" 37 | (car 38 | (split-string 39 | (completing-read "Select target tmux pane: " (gf/tmux--list-panes session) nil t) " "))))) 40 | (plist-get gf/tmux--target-panes session)) 41 | 42 | (defun gf/tmux-clear-previous-cmds () 43 | (interactive) 44 | (setq gf/tmux--previous-cmds nil)) 45 | 46 | (defun gf/tmux--create-command (cmd) 47 | (let ((target (gf/tmux--get-target-pane (gf/tmux--get-target-session)))) 48 | (format "tmux send-keys -t %s -l '%s' && tmux send-keys -t %s Enter" target cmd target))) 49 | 50 | (defun gf/tmux--do-run (cmd) 51 | (save-buffer) 52 | (shell-command-to-string 53 | (gf/tmux--create-command cmd)) 54 | ;; should use cl-pushnew onto a stack of commands for each session 55 | (setq gf/tmux--previous-cmds 56 | (plist-put gf/tmux--previous-cmds (gf/tmux--get-target-session) cmd))) 57 | 58 | (defun gf/tmux-run (cmd) 59 | "Run a command in the target tmux pane." 60 | (interactive "MCommand: ") 61 | (gf/tmux--do-run cmd)) 62 | 63 | (defun gf/tmux-run-last () 64 | "Run the last command in the previous tmux pane." 65 | (interactive) 66 | (if (plist-member gf/tmux--previous-cmds (gf/tmux--get-target-session)) 67 | (gf/tmux--do-run (plist-get gf/tmux--previous-cmds (gf/tmux--get-target-session))) 68 | (call-interactively 'gf/tmux-run))) 69 | 70 | (defun gf/tmux-reset () 71 | "Reset the target pane and last command." 72 | (interactive) 73 | (setq gf/tmux--target-pane nil 74 | gf/tmux--previous-cmd nil)) 75 | 76 | 77 | (defmacro gf/tmux-def-command (name command &rest args) 78 | "Create a new function gf/tmux-command-NAME to run COMMAND in a tmux pane. 79 | 80 | COMMAND should be a string, or a lisp form that returns a string. 81 | When a lisp form, it will be evaluated when the function is called. 82 | 83 | 84 | Optional properties: 85 | 86 | :key The string name of a key to bind the function to SPC c `KEY' 87 | 88 | :project-root If t, run the command inside the projectile project root of the current buffer. 89 | 90 | 91 | Examples: 92 | 93 | (gf/tmux-def-command \"ls\" \"ls\") 94 | 95 | (gf/tmux-def-command \"figlet buffer name\" 96 | (concat \"figlet \" (buffer-file-name)) 97 | :key \"f\") 98 | " 99 | (let ((function (intern (s-dashed-words (format "gf/tmux-command-%s" name)))) 100 | (key (plist-get args :key))) 101 | `(progn 102 | (defun ,function () 103 | (interactive) 104 | (gf/tmux--do-run ,(gf/tmux--command-modify command args))) 105 | ,(when key 106 | `(general-define-key 107 | :states '(normal visual insert emacs) 108 | :prefix "SPC" 109 | :non-normal-prefix "M-SPC" 110 | ,(concat "c" key) '(,function :which-key ,name)))))) 111 | 112 | (defun gf/tmux--command-modify (command args) 113 | "Modify a command according to the properties in ARGS." 114 | (when (plist-get args :project-root) 115 | (setq command `(concat "(cd " (projectile-project-root) " && " ,command ")"))) 116 | command) 117 | 118 | (general-define-key 119 | :states '(normal) 120 | :prefix "SPC" 121 | :non-normal-prefix "M-SPC" 122 | "c" '(:ignore t :which-key "tmux commands")) 123 | 124 | (provide 'setup-tmux) 125 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-typescript.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | (use-package typescript-mode) 3 | 4 | (provide 'setup-typescript) 5 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-web-mode.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package web-mode 4 | :mode 5 | ( 6 | ".twig$" 7 | ".html?$" 8 | ".hbs$" 9 | ".vue$" 10 | ".blade.php$" 11 | ) 12 | :config 13 | (setq 14 | web-mode-markup-indent-offset 2 15 | web-mode-css-indent-offset 2 16 | web-mode-code-indent-offset 2 17 | web-mode-style-padding 2 18 | web-mode-script-padding 2 19 | web-mode-enable-auto-closing t 20 | web-mode-enable-auto-opening t 21 | web-mode-enable-auto-pairing t 22 | web-mode-enable-auto-indentation t) 23 | 24 | ;; Let smartparens handle auto closing brackets, e.g. {{ }} or {% %} 25 | ;; https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/web/%2Bhtml.el#L56 26 | (dolist (alist web-mode-engines-auto-pairs) 27 | (setcdr alist 28 | (cl-loop for pair in (cdr alist) 29 | unless (string-match-p "^[a-z-]" (cdr pair)) 30 | collect (cons (car pair) 31 | (string-trim-right (cdr pair) 32 | "\\(?:>\\|]\\|}\\)+\\'"))))) 33 | ) 34 | 35 | ;; (defun gf/web-mode-toggle-markup-offset () 36 | ;; "Switch between 2 and 4 spaces for markup indentation" 37 | ;; (interactive) 38 | ;; (if (eq web-mode-markup-indent-offset 2) 39 | ;; (setq web-mode-markup-indent-offset 4) 40 | ;; (setq web-mode-markup-indent-offset 2)) 41 | ;; (message (format "Set markup indendation to %s spaces" web-mode-markup-indent-offset)) 42 | ;; (web-mode)) 43 | 44 | (defun gf/toggle-php-web-mode () 45 | "Switch between php-mode and web-mode for the current buffer." 46 | (interactive) 47 | (if (equal (symbol-name (buffer-local-value 'major-mode (current-buffer))) "web-mode") 48 | (php-mode) 49 | (web-mode))) 50 | 51 | (defun gf/web-maybe-activate-lsp () 52 | "Maybe activate language server protocol for the current buffer." 53 | (if (equal (gf/filename-extension (buffer-file-name)) "vue") 54 | (lsp-vue-mmm-enable))) 55 | 56 | ;; (when (not (version< emacs-version "25.1")) 57 | ;; (use-package lsp-vue 58 | ;; :after web-mode 59 | ;; :config 60 | ;; (add-hook 'web-mode-hook #'gf/web-maybe-activate-lsp))) 61 | 62 | (provide 'setup-web-mode) 63 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-yaml.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package yaml-mode 4 | :mode "\\.ya?ml.dist\\'" 5 | :config 6 | (setq-default yaml-indent-offset 4) 7 | 8 | (defun gf/yaml-toggle-indent-offset () 9 | "Toggle between 4 and 2 spaces for indenting yaml files." 10 | (interactive) 11 | (if (eq (default-value 'yaml-indent-offset) 4) 12 | (setq-default yaml-indent-offset 2) 13 | (setq-default yaml-indent-offset 4)) 14 | (message "Default yaml indentation is now %s spaces" (default-value 'yaml-indent-offset))) 15 | 16 | (general-define-key 17 | :states '(normal visual insert emacs) 18 | :prefix "SPC" 19 | :non-normal-prefix "M-SPC" 20 | :keymaps 'yaml-mode-map 21 | "ti" '(gf/yaml-toggle-indent-offset :which-key "yaml indentation"))) 22 | 23 | (provide 'setup-yaml) 24 | -------------------------------------------------------------------------------- /emacs/site-lisp/setup-zig.el: -------------------------------------------------------------------------------- 1 | (eval-when-compile (require 'use-package)) 2 | 3 | (use-package zig-mode) 4 | 5 | (provide 'setup-zig) 6 | -------------------------------------------------------------------------------- /emacs/snippets/css-mode/block-comment: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: block comment 3 | # key: /* 4 | # -- 5 | /* 6 | $0 7 | */ -------------------------------------------------------------------------------- /emacs/snippets/css-mode/bootstrap-breakpoint-down: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: bootstrap breakpoint down 3 | # key: brd 4 | # -- 5 | @include media-breakpoint-down('${1:md}') { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/css-mode/bootstrap-breakpoint-up: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: bootstrap breakpoint up 3 | # key: bru 4 | # -- 5 | @include media-breakpoint-up('${1:md}') { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/add-hook: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: (add-hook ...) 3 | # key: ah 4 | # -- 5 | (add-hook '${1:hook} '${2:function}) -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/defkey: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: (define-key ...) 3 | # key: defkey 4 | # -- 5 | (define-key $1 ${2:(kbd "$3")} $4)$0 -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/defun: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: (defun ...) 3 | # key: defun 4 | # -- 5 | (defun ${1:func} ($2) 6 | "$3" 7 | $0 8 | ) -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/eval-when-compile: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: (eval-when-compile ...) 3 | # key: ec 4 | # -- 5 | (eval-when-compile $0) -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/eval-when-compile-use-package: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: eval-when-compile use-package 3 | # key: ecu 4 | # -- 5 | (eval-when-compile (require 'use-package)) 6 | $0 -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/evil-declare-key: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: (evil-declare-key ...) 3 | # key: evil-declare 4 | # -- 5 | (evil-declare-key '$1 $2 ${3:(kbd "$4")} $5)$0 -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/general-define-key: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: (general-define-key ...) 3 | # key: key 4 | # -- 5 | (general-define-key 6 | ${1::states '(${2:normal}) 7 | }${3::keymaps '${4:mode-map} 8 | }${5::prefix ${6:gf/major-mode-leader-key} 9 | }${7::non-normal-prefix ${8:gf/major-mode-non-normal-leader-key} 10 | }$0) 11 | -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/let: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: let 3 | # key: let 4 | # -- 5 | (let ((${1:var} (${2:body}))))$0 -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/provide: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: (provide ...) 3 | # key: pro 4 | # -- 5 | (provide '`(gf/buffer-file-name-body)`)$0 -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/require: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: (require ...) 3 | # key: req 4 | # -- 5 | (require '$1)$0 -------------------------------------------------------------------------------- /emacs/snippets/emacs-lisp-mode/use-package: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: (use-package ...) 3 | # key: use 4 | # -- 5 | (use-package $1 6 | :config 7 | $0 8 | ) -------------------------------------------------------------------------------- /emacs/snippets/fundamental-mode/mit-license: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: MIT license 3 | # key: MIT 4 | # -- 5 | The MIT License (MIT) 6 | 7 | Copyright (c) ${1:`(format-time-string "%Y")`} ${2:author} 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in all 17 | copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | SOFTWARE. -------------------------------------------------------------------------------- /emacs/snippets/go-mode/append: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go append 3 | # key: ap 4 | # -- 5 | ${1:var} = append($1, $2)$0 -------------------------------------------------------------------------------- /emacs/snippets/go-mode/for: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go for 3 | # key: for 4 | # -- 5 | for $1 { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/go-mode/func: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go func 3 | # key: f 4 | # -- 5 | func ${1:name}(${2:arguments}) (${3:results}) { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/go-mode/if: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go if 3 | # key: if 4 | # -- 5 | if $1 { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/go-mode/if-err: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go if err not nil 3 | # key: ife 4 | # -- 5 | if err != nil { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/go-mode/if-err-log-fatal: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go if err not nil log fatal 3 | # key: ifel 4 | # -- 5 | if err != nil { 6 | log.Fatalln(err) 7 | }$0 -------------------------------------------------------------------------------- /emacs/snippets/go-mode/if-err-return: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go if err not nil return 3 | # key: ifer 4 | # -- 5 | if err != nil { 6 | return err 7 | }$0 -------------------------------------------------------------------------------- /emacs/snippets/go-mode/if-map-get: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go if map get ok 3 | # key: ifm 4 | # -- 5 | if ${1:val}, ok := ${2:dict}[$3]; ok { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/go-mode/interface: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go interface 3 | # key: i 4 | # -- 5 | type $1 interface { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/go-mode/return: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: go return 3 | # key: r 4 | # -- 5 | return $0 -------------------------------------------------------------------------------- /emacs/snippets/go-mode/return-err: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: go return err 3 | # key: re 4 | # -- 5 | return err -------------------------------------------------------------------------------- /emacs/snippets/go-mode/return-false: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: go return false 3 | # key: rf 4 | # -- 5 | return false -------------------------------------------------------------------------------- /emacs/snippets/go-mode/return-nil: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: go return nil 3 | # key: rn 4 | # -- 5 | return nil -------------------------------------------------------------------------------- /emacs/snippets/go-mode/return-true: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: go return true 3 | # key: rt 4 | # -- 5 | return true -------------------------------------------------------------------------------- /emacs/snippets/go-mode/struct: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go struct 3 | # key: s 4 | # -- 5 | type $1 struct { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/go-mode/struct-func: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go struct func 3 | # key: sf 4 | # -- 5 | func ($1) $2($3) $4 { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/go-mode/switch: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: go switch 3 | # key: switch 4 | # -- 5 | switch $1 { 6 | case $2: 7 | $0 8 | default: 9 | } 10 | -------------------------------------------------------------------------------- /emacs/snippets/go-mode/table-test: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: table test 3 | # key: tt 4 | # -- 5 | for _, tc := range []struct { 6 | name string 7 | $0 8 | }{ 9 | { 10 | name: "", 11 | }, 12 | } { 13 | t.Run(tc.name, func(t *testing.T) { 14 | 15 | }) 16 | } -------------------------------------------------------------------------------- /emacs/snippets/go-mode/test: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: test 3 | # key: t 4 | # -- 5 | t.Run("$1", func(t *testing.T) { 6 | $0 7 | }) -------------------------------------------------------------------------------- /emacs/snippets/go-mode/test-func: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: test func 3 | # key: T 4 | # -- 5 | func Test$1(t *testing.T) { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/groovy-mode/jenkins-pipeline: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: jenkins-pipeline 3 | # key: pipeline 4 | # -- 5 | pipeline { 6 | agent { 7 | docker '' 8 | } 9 | 10 | triggers { 11 | cron('H */4 * * 1-5') 12 | pollSCM('H */4 * * 1-5') 13 | upstream(upstreamProjects: 'job1,job2', threshold: hudson.model.Result.SUCCESS) 14 | } 15 | 16 | environment { 17 | DB_ENGINE = 'sqlite' 18 | } 19 | 20 | stages { 21 | stage('build') { 22 | steps { 23 | sh 'echo $PWD' 24 | } 25 | } 26 | stage('test') { 27 | failFast true 28 | parallel { 29 | stage('test-1') { 30 | steps { 31 | } 32 | } 33 | stage('test-2') { 34 | steps { 35 | } 36 | } 37 | } 38 | } 39 | } 40 | 41 | post { 42 | always { 43 | junit 'build/*.xml' 44 | deleteDir() 45 | } 46 | success { 47 | } 48 | failure { 49 | mail to: 'me@glynnforrest.com', 50 | subject: "Failed Pipeline: \${currentBuild.fullDisplayName}", 51 | body: "See \${env.BUILD_URL}" 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /emacs/snippets/html-mode/a: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: a 4 | # -- 5 | $2 -------------------------------------------------------------------------------- /emacs/snippets/html-mode/a.class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: ac 4 | # -- 5 | $0 -------------------------------------------------------------------------------- /emacs/snippets/html-mode/b: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: b 4 | # -- 5 | $1 -------------------------------------------------------------------------------- /emacs/snippets/html-mode/body: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: body 4 | # -- 5 | 6 | $0 7 | -------------------------------------------------------------------------------- /emacs/snippets/html-mode/br: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name:
3 | # key: br 4 | # -- 5 |
-------------------------------------------------------------------------------- /emacs/snippets/html-mode/code: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: code 4 | # -- 5 | 6 | $0 7 | -------------------------------------------------------------------------------- /emacs/snippets/html-mode/code.class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: codec 4 | # -- 5 | 6 | $0 7 | -------------------------------------------------------------------------------- /emacs/snippets/html-mode/div: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name:
...
3 | # key: div 4 | # -- 5 |
6 | $0 7 |
-------------------------------------------------------------------------------- /emacs/snippets/html-mode/div.class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name:
...
3 | # key: divc 4 | # -- 5 |
6 | $0 7 |
-------------------------------------------------------------------------------- /emacs/snippets/html-mode/div.id: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name:
...
3 | # key: divi 4 | # -- 5 |
6 | $0 7 |
-------------------------------------------------------------------------------- /emacs/snippets/html-mode/div.id.class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name:
...
3 | # key: divic 4 | # -- 5 |
6 | $0 7 |
-------------------------------------------------------------------------------- /emacs/snippets/html-mode/form: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name :
3 | # key: form 4 | # -- 5 |
6 | $0 7 | 8 |
-------------------------------------------------------------------------------- /emacs/snippets/html-mode/head: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: head 4 | # -- 5 | 6 | $0 7 | -------------------------------------------------------------------------------- /emacs/snippets/html-mode/html: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: html 4 | # -- 5 | 6 | 7 | 8 | 9 | 10 | ${1:title} 11 | 12 | 13 | $0 14 | 15 | -------------------------------------------------------------------------------- /emacs/snippets/html-mode/img: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: img 4 | # -- 5 | $2 -------------------------------------------------------------------------------- /emacs/snippets/html-mode/input: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: 3 | # key: input 4 | # -- 5 | -------------------------------------------------------------------------------- /emacs/snippets/html-mode/link: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: Link tag 3 | # key: link 4 | # -- 5 | $0 -------------------------------------------------------------------------------- /emacs/snippets/html-mode/p: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name:

...

3 | # key: p 4 | # -- 5 |

$1

-------------------------------------------------------------------------------- /emacs/snippets/html-mode/p.class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name:

...

3 | # key: pc 4 | # -- 5 |

$2

-------------------------------------------------------------------------------- /emacs/snippets/html-mode/pre: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name:
...
3 | # key: pre 4 | # -- 5 |
6 |   $0
7 | 
-------------------------------------------------------------------------------- /emacs/snippets/html-mode/script: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : 3 | # key: script 4 | # -- 5 | -------------------------------------------------------------------------------- /emacs/snippets/html-mode/span: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: span 4 | # -- 5 | $1 -------------------------------------------------------------------------------- /emacs/snippets/html-mode/span.class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: spanc 4 | # -- 5 | $2 -------------------------------------------------------------------------------- /emacs/snippets/html-mode/span.id: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: spani 4 | # -- 5 | $2 -------------------------------------------------------------------------------- /emacs/snippets/html-mode/table: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: table 3 | # key: table 4 | # -- 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
8 |
$0
16 | -------------------------------------------------------------------------------- /emacs/snippets/html-mode/title: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: ... 3 | # key: title 4 | # -- 5 | $1 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/att: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery Attr() 3 | # key: att 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | attr(${1:item})$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/attr-fun: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: attr: function 3 | # key: fun 4 | # contributor: David Miller 5 | # -- 6 | // $1 7 | ${2:attribute}: function (${3:args}) { 8 | $0 9 | } -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/cha: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery change() 3 | # key: cha 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | change(function(){ 8 | $0 9 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/chang: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery change() 3 | # key: cha 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | change(function(){ 8 | $0 9 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/chi: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: Children 3 | # key: chi 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | children( ${1:item} )$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/click: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; coding: utf-8 -*- 2 | # name: jQuery Click 3 | # key: click 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | click(function() { 8 | $0 9 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/desc: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: Jasmine describe 3 | # key: desc 4 | # group: Jasmine 5 | # contributor: David Miller 6 | # -- 7 | 8 | describe('${1:Spec}', function (){ 9 | $0 10 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/doc: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: Docblock 3 | # key: doc 4 | # contributor: David Miller 5 | # -- 6 | // ${1:Title} 7 | // 8 | // $2 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/eac: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery each() 3 | # key: eac 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | $.each(${1:an-array}, function(i){ 8 | $0 9 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/exca: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: Jasmine expect CalledWith 3 | # key: exca 4 | # group: Jasmine 5 | # contributor: David Miller 6 | # -- 7 | expect(${1:callable}).toHaveBeenCalledWith(${2:expected});$0 8 | -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/exeq: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: Jasmine expect Equal 3 | # key: exeq 4 | # group: Jasmine 5 | # contributor: David Miller 6 | # -- 7 | expect(${1:attribute}).toEqual(${2:expected});$0 8 | -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/ext: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: _.extend 3 | # key: ext 4 | # group: _ 5 | # contributor: David Miller 6 | # -- 7 | _.extend(${1:Target}, { 8 | $0 9 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/extru: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: Jasmine expect Truthy 3 | # key: extru 4 | # group: Jasmine 5 | # contributor: David Miller 6 | # -- 7 | expect(${1:true}).toBeTruthy(); 8 | $0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/for: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # name: for 3 | # contributor: David Miller 4 | # -- 5 | for (var i=0; i < ${1:something}.${2:length}; i++) { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/forin: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # name: forin 3 | # contributor: David Miller 4 | # -- 5 | for( ${1:var} in ${2:obj} ) 6 | { 7 | $0 8 | } -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/fun: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: fun 3 | # contributor: David Miller 4 | # -- 5 | /** $1 */ 6 | function ${2:my_function}( ${3:args} ){ 7 | $0 8 | } -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/get: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery selector 3 | # key: get 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | $.get(${1:url}, 8 | ${2:values}, 9 | function(data){ 10 | $0 11 | } 12 | ); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/grease: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # name: grease 3 | # group: greasemonkey 4 | # contributor: David Miller 5 | # -- 6 | // ${1:Script Name} 7 | // version ${2:0.1} 8 | // ${3:2009-12-26} 9 | // 10 | // Copyright 2009 David Miller 11 | // @url http://www.deadpansincerity.com 12 | // 13 | // This program is free software: you can redistribute it and/or modify 14 | // it under the terms of the GNU General Public License as published by 15 | // the Free Software Foundation, either version 3 of the License, or 16 | // (at your option) any later version. 17 | // 18 | // This program is distributed in the hope that it will be useful, 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | // GNU General Public License for more details. 22 | // 23 | // You should have received a copy of the GNU General Public License 24 | // along with this program. If not, see . 25 | // 26 | // -------------------------------------------------------------------- 27 | // 28 | // This Greasemonkey script ${4:Long description} 29 | // 30 | // -------------------------------------------------------------------- 31 | // 32 | // ==UserScript== 33 | // @name $1 34 | // @namespace http://code.deadpansincerity.com 35 | // @description ${5:Short Description} 36 | // @include ${6:domain} 37 | // ==/UserScript== 38 | $0 39 | -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/has: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery hasClass() 3 | # key: has 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | hasClass( "${1:class}" )$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/header: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: File header 3 | # key: header 4 | # contributor: David Miller 5 | # -- 6 | // 7 | // `(file-name-nondirectory (buffer-file-name))` v ${1:version} 8 | // 9 | // ${2:Short desc} 10 | // 11 | // Commentary: 12 | // 13 | // $0 14 | // 15 | // Additional Reserved Names: 16 | // 17 | // ${3:None} 18 | // 19 | // Code: -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/hov: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery selector 3 | # key: hov 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | hover( 8 | function(){ 9 | $0 10 | }, 11 | function(){ 12 | 13 | } 14 | ); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/if: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: if 3 | # contributor: David Miller 4 | # -- 5 | if (${1:condition}) { 6 | $0 7 | } -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/ife: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: if...else 3 | # key: ife 4 | # contributor: David Miller 5 | # -- 6 | if (${1:condition}) { 7 | $0 8 | } else { 9 | } -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/iife: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: immediately invoked function expression 3 | # key: iife 4 | # -- 5 | (function () { 6 | $0 7 | })(); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/init: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: Backbone initialize 3 | # key: init 4 | # group: backbone 5 | # contributor: David Miller 6 | # -- 7 | initialize: function(){ 8 | _.bindAll(this, "render"); 9 | $0 10 | }, -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/is: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; coding: utf-8 -*- 2 | # name: jQuery Click 3 | # key: is 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | is("${1:condition}")$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/it: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: Jasmine it 3 | # key: it 4 | # group: Jasmine 5 | # contributor: David Miller 6 | # -- 7 | it('Should ${1:have a description}', function () { 8 | var $0 9 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/jquery-ajax: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: jQuery ajax 3 | # key: $.ajax 4 | # -- 5 | $.ajax({ 6 | url: $1, 7 | type: '${2:post}', 8 | data: {$3}, 9 | success: function (data) { 10 | $0 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/jquery-selector: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery selector 3 | # key: $ 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | \$(${1:"#selector"}).$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/json: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # name: jQuery getJSON() 3 | # key: json 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | \$.getJSON( "${1:url/to/hit}", function( data ){ 8 | $0 9 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/map: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: _.map 3 | # key: map 4 | # group: _ 5 | # contributor: David Miller 6 | # -- 7 | _.map(${1:iterable}, function(${2:args}){ 8 | $0 9 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/meth: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # name: meth 3 | # contributor: David Miller 4 | # -- 5 | this.$1 = function( ${2:args} ) 6 | { 7 | $0 8 | } -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/ne: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery next() 3 | # key: ne 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | next(${1:'#selector'}).$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/par: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery Parent() 3 | # key: par 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | parent(${1:item})$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/post: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery selector 3 | # key: post 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | $.post(${1:url}, 8 | ${2:values}, 9 | function(data){ 10 | $0 11 | } 12 | ); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/rea: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery Ready 3 | # key: rea 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | $(document).ready( function(){ 8 | $0 9 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/ready: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: jquery document.ready 3 | # key: ready 4 | # -- 5 | $(function () { 6 | $0 7 | }); -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/return-false: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | #name : return false 3 | #key : rf 4 | # -- 5 | return false; -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/return-true: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | #name : return true 3 | #key : rt 4 | # -- 5 | return true; -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/sib: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; coding: utf-8 -*- 2 | # name: jQuery siblings() 3 | # group: jquery 4 | # contributor: David Miller 5 | # -- 6 | siblings(${1:"#selector"}).$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/sli: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery slideDown() 3 | # key: sli 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | slideDown(${1:'slow'}).$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/slid: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery slideUp() 3 | # key: sli 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | slideUp(${1:'slow'}).$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/thi: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery this 3 | # key: thi 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | $(this).$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/tmpl: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: tmpl 3 | # key: tmpl 4 | # group: templating 5 | # contributor: David Miller 6 | # -- 7 | -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/tog: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: jQuery toggleClass() 3 | # key: tog 4 | # group: jquery 5 | # contributor: David Miller 6 | # -- 7 | toggleClass( "${1:class}" )$0 -------------------------------------------------------------------------------- /emacs/snippets/javascript-mode/view: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; mode: snippet -*- 2 | # name: Backbone View 3 | # key: view 4 | # group: backbone 5 | # contributor: David Miller 6 | # -- 7 | ${1:NAMESPACE}.views.${2:View} = Backbone.View.extend({ 8 | tagName: $3, 9 | className: $4 10 | el: \$("$5"), 11 | template: \$("$6"), 12 | 13 | initialize: function(){ 14 | _.bindAll(this, "render"); 15 | }, 16 | 17 | render: function(){ 18 | $(this.el).html(this.template.tmpl()); 19 | return this 20 | }, 21 | $0 22 | 23 | }); 24 | -------------------------------------------------------------------------------- /emacs/snippets/js2-jsx-mode/react-component: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: react-component 3 | # key: class 4 | # -- 5 | import React from 'react'; 6 | 7 | class $1 extends React.Component { 8 | constructor(props) { 9 | super(props); 10 | this.state = { 11 | }; 12 | } 13 | 14 | $0 15 | 16 | render() { 17 | return ( 18 |
19 |
20 | ) 21 | } 22 | } 23 | 24 | export default $1; 25 | -------------------------------------------------------------------------------- /emacs/snippets/js2-mode/.yas-parents: -------------------------------------------------------------------------------- 1 | javascript-mode -------------------------------------------------------------------------------- /emacs/snippets/makefile-mode/phony-target: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | #name : phony make target 3 | #key : . 4 | # -- 5 | .PHONY: ${1:target} 6 | $1: 7 | $0 -------------------------------------------------------------------------------- /emacs/snippets/markdown-mode/code-fence: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: Code fence 3 | # key: ` 4 | # -- 5 | \`\`\`${1:lang} 6 | $0 7 | \`\`\` -------------------------------------------------------------------------------- /emacs/snippets/markdown-mode/release: -------------------------------------------------------------------------------- 1 | # name: Changelog release 2 | # key: release 3 | # -- 4 | ### ${1:version} ${2:`(format-time-string "%Y-%m-%d")`} 5 | 6 | $0 -------------------------------------------------------------------------------- /emacs/snippets/org-mode/bash-block: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: bash block 3 | # key: / 4 | # -- 5 | #+begin_src bash 6 | $0 7 | #+end_src -------------------------------------------------------------------------------- /emacs/snippets/org-mode/code-block: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: code block 3 | # key: . 4 | # -- 5 | #+begin_src $1 6 | $0 7 | #+end_src -------------------------------------------------------------------------------- /emacs/snippets/org-mode/latex-export-header: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: latex export header 3 | # key: tex 4 | # -- 5 | #+LATEX_HEADER: \usepackage{parskip} \makeatletter \@ifpackageloaded{geometry}{\geometry{margin=2cm}}{\usepackage[margin=2cm]{geometry}} \makeatother \hypersetup{hidelinks} 6 | #+OPTIONS: toc:nil 7 | #+OPTIONS: toc:nil author:nil 8 | #+TITLE: 9 | #+DATE: -------------------------------------------------------------------------------- /emacs/snippets/org-mode/lcomment: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: latex commentary 3 | # key: lcomment 4 | # -- 5 | \newline 6 | \newline 7 | \textit{ 8 | \textcolor{$1}{ 9 | $0 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /emacs/snippets/org-mode/lilypond: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: lilypond babel 3 | # key: lily 4 | # -- 5 | #+begin_src lilypond :file /tmp/$1.png 6 | \include "lilypond-book-preamble.ly" 7 | \paper { oddFooterMarkup = ##f } 8 | $0 9 | #+end_src 10 | -------------------------------------------------------------------------------- /emacs/snippets/org-mode/monthly-file: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: monthly-file 3 | # key: m 4 | # -- 5 | :PROPERTIES: 6 | :type: month 7 | :END: 8 | #+TITLE: `(gf/org-full-month-name-from-filename (gf/buffer-file-name-body))` 9 | 10 | * Tasks 11 | ** NEXT Move tasks from `(gf/org-previous-month-name-from-filename (gf/buffer-file-name-body))`$0 12 | * Journal 13 | -------------------------------------------------------------------------------- /emacs/snippets/org-mode/text-block: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: text block 3 | # key: , 4 | # -- 5 | #+begin_src text 6 | $0 7 | #+end_src -------------------------------------------------------------------------------- /emacs/snippets/org-mode/title: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: title 3 | # key: t 4 | # -- 5 | #+TITLE: $0 6 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/arrayMember: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | #name : array member 3 | #key : + 4 | # -- 5 | '${1:var}' => $${2:$1},$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/arrayMemberSameName: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | #name : array member same name 3 | #key : = 4 | # -- 5 | '${1:var}' => $$1,$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/assertEquals: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: assertEquals 3 | # key: ae 4 | # -- 5 | $this->assertEquals(${1:$expected}, ${2:$actual});$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/assertFalse: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: assertFalse 3 | # key: af 4 | # -- 5 | $this->assertFalse(${1:$condition});$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/assertInstanceOf: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: assertInstanceOf 3 | # key: ai 4 | # -- 5 | $this->assertInstanceOf(${1:Class\Name}::class, ${2:$actual});$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/assertInternalType: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: assertInternalType 3 | # key: ait 4 | # -- 5 | $this->assertInternalType('${1:type}', ${2:$actual});$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/assertNotNull: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: assertNotNull 3 | # key: ann 4 | # -- 5 | $this->assertNotNull(${1:$condition});$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/assertNotSame: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: assertNotSame 3 | # key: ans 4 | # -- 5 | $this->assertNotSame(${1:$expected}, ${2:$actual});$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/assertNull: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: assertNull 3 | # key: an 4 | # -- 5 | $this->assertNull(${1:$condition});$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/assertSame: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: assertSame 3 | # key: as 4 | # -- 5 | $this->assertSame(${1:$expected}, ${2:$actual});$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/assertTrue: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: assertTrue 3 | # key: at 4 | # -- 5 | $this->assertTrue(${1:$condition});$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/author-annotation: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline nil -*- 2 | # name: author annotation 3 | # key: @a 4 | # -- 5 | @author Glynn Forrest -------------------------------------------------------------------------------- /emacs/snippets/php-mode/class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name : class definition 3 | # key : class 4 | # condition: (not (s-ends-with? "Exception.php" (buffer-file-name))) 5 | # -- 6 | 6 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/exception-class: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name : exception class definition 3 | # key : class 4 | # condition: (s-ends-with? "Exception.php" (buffer-file-name)) 5 | # -- 6 | expectException(${1:\\Exception}::class);$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/expects: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: expects 3 | # key: exp 4 | # -- 5 | expects($this->$1) 6 | ->method('$2') 7 | ->with($3) 8 | ->will($this->returnValue($4)); 9 | $0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/for: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : for 3 | #key : for 4 | # -- 5 | for (${1:$i} ${2:= 0}; $1 ${3:< $condition}; $1${4:++}) { 6 | $0 7 | } 8 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/foreach: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : foreach 3 | #key : fe 4 | # -- 5 | foreach (${1:$array} as ${2:$k => $v}) { 6 | $0 7 | } 8 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/function: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : function 3 | #key : fun 4 | # -- 5 | function ${1:name}($2) 6 | { 7 | $0 8 | } 9 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/getinstance: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: getInstance 3 | # key: getInstance 4 | # -- 5 | protected static $instance; 6 | 7 | protected function __construct() 8 | { 9 | } 10 | 11 | public static function getInstance() 12 | { 13 | if(!self::$instance) { 14 | self::$instance = new self(); 15 | } 16 | 17 | return self::$instance; 18 | } 19 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/getter-setter: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: getter-setter 3 | # key: getset 4 | # -- 5 | public function set${1:Property}(${2:$1} $${3:var}): self 6 | { 7 | $this->$3 = $$3; 8 | 9 | return $this; 10 | } 11 | 12 | public function get$1(): $2 13 | { 14 | return $this->$3; 15 | } -------------------------------------------------------------------------------- /emacs/snippets/php-mode/if: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : if 3 | #key : if 4 | # -- 5 | if (${1:condition}) { 6 | $0 7 | } 8 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/if-else: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : if else 3 | #key : ife 4 | # -- 5 | if (${1:condition}) { 6 | $2 7 | } else { 8 | $0 9 | } 10 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/interface: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name : interface definition 3 | # key : interface 4 | # -- 5 | 8 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/pre-print-r: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: pre print_r 3 | # key: prepr 4 | # -- 5 | echo '
';
6 | print_r($1);
7 | echo '
';$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/private-function: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : private function 3 | #key : pri 4 | # -- 5 | private function ${1:name}(${2:$args}) 6 | { 7 | $0 8 | } 9 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/protected-function: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : protected function 3 | #key : pro 4 | # -- 5 | protected function ${1:name}(${2:$args}) 6 | { 7 | $0 8 | } 9 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/psalm-suppress: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | #name : psalm-suppress 3 | #key : ps 4 | # -- 5 | /** @psalm-suppress ${1:all} */$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/public-function: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : public function 3 | #key : pub 4 | # -- 5 | public function ${4:name}($5) 6 | { 7 | $0 8 | } 9 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/public-static-function: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : public static function 3 | #key : pubs 4 | # -- 5 | public static function ${4:name}($5) 6 | { 7 | $0 8 | } 9 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/return: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: return 3 | # key: r 4 | # -- 5 | return $0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/return-false: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | #name : return false 3 | #key : rf 4 | # -- 5 | return false; -------------------------------------------------------------------------------- /emacs/snippets/php-mode/return-null: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | #name : return null 3 | #key : rn 4 | # -- 5 | return null; -------------------------------------------------------------------------------- /emacs/snippets/php-mode/return-this: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | #name : return this 3 | #key : rth 4 | # -- 5 | return $this; -------------------------------------------------------------------------------- /emacs/snippets/php-mode/return-true: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | #name : return true 3 | #key : rt 4 | # -- 5 | return true; -------------------------------------------------------------------------------- /emacs/snippets/php-mode/script: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline nil -*- 2 | # name: script 3 | # key: script 4 | # -- 5 | #!/usr/bin/env php 6 | setDefaults([ 25 | 'data_class' => ${1:Class\Name}::class, 26 | ]); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /emacs/snippets/php-mode/symfony-handle-form: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: symfony handle form 3 | # key: syhf 4 | # -- 5 | $${1:form}->handleRequest($request); 6 | if ($$1->isSubmitted() && $$1->isValid()) { 7 | $0 8 | } -------------------------------------------------------------------------------- /emacs/snippets/php-mode/symfony-vardump: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: symfony-vardump 3 | # key: sv 4 | # -- 5 | \Symfony\Component\VarDumper\VarDumper::dump($1);$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/test: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: PHPUnit test case 3 | # key: test 4 | # -- 5 | 3 | # key: t 4 | # -- 5 | $this->$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/this-assignment: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: $this assignment 3 | # key: t- 4 | # -- 5 | $this->${1:object} = $$1;$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/throw: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | # name: throw 3 | # key: th 4 | # -- 5 | throw new ${1:\\}Exception('$2');$0 -------------------------------------------------------------------------------- /emacs/snippets/php-mode/trait: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet -*- 2 | #name : trait definition 3 | #key : trait 4 | # -- 5 | 7 | $0 8 | 9 | -------------------------------------------------------------------------------- /emacs/snippets/web-mode/php-foreach: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name : php foreach 3 | # key : fe 4 | # condition: (gf/in-file-type "php") 5 | # -- 6 | $v}): ?> 7 | $0 8 | 9 | -------------------------------------------------------------------------------- /emacs/snippets/web-mode/php-if: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name : php if 3 | # key : if 4 | # condition: (gf/in-file-type "php") 5 | # -- 6 | 7 | $0 8 | 9 | -------------------------------------------------------------------------------- /emacs/snippets/web-mode/twig-apply: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: twig-apply 3 | # key: apply 4 | # condition: (gf/in-file-type "twig") 5 | # -- 6 | {% apply ${1:filter} %} 7 | $0 8 | {% endapply %} -------------------------------------------------------------------------------- /emacs/snippets/web-mode/twig-block: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: twig-block 3 | # key: block 4 | # condition: (gf/in-file-type "twig") 5 | # -- 6 | {% block ${1:name} %} 7 | $0 8 | {% endblock %} -------------------------------------------------------------------------------- /emacs/snippets/web-mode/twig-extends: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: twig-extends 3 | # key: ext 4 | # condition: (gf/in-file-type "twig") 5 | # -- 6 | {% extends '$1' %} -------------------------------------------------------------------------------- /emacs/snippets/web-mode/twig-for: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: twig-for 3 | # key: for 4 | # condition: (gf/in-file-type "twig") 5 | # -- 6 | {% for ${1:item} in ${2:list} %} 7 | $0 8 | {% endfor %} -------------------------------------------------------------------------------- /emacs/snippets/web-mode/twig-if: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: twig-if 3 | # key: if 4 | # condition: (gf/in-file-type "twig") 5 | # -- 6 | {% if ${1:condition} %} 7 | $0 8 | {% endif %} -------------------------------------------------------------------------------- /emacs/snippets/web-mode/twig-if-else: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: twig-if-else 3 | # key: ife 4 | # condition: (gf/in-file-type "twig") 5 | # -- 6 | {% if ${1:condition} %} 7 | $0 8 | {% else %} 9 | {% endif %} -------------------------------------------------------------------------------- /emacs/snippets/web-mode/twig-include: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: twig-include 3 | # key: inc 4 | # condition: (gf/in-file-type "twig") 5 | # -- 6 | {{ include('$1') }} -------------------------------------------------------------------------------- /emacs/snippets/web-mode/twig-macro: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: twig-macro 3 | # key: macro 4 | # condition: (gf/in-file-type "twig") 5 | # -- 6 | {% macro ${1:name} %} 7 | $0 8 | {% endmacro %} -------------------------------------------------------------------------------- /emacs/snippets/web-mode/twig-path: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: twig-path 3 | # key: path 4 | # condition: (gf/in-file-type "twig") 5 | # -- 6 | {{path($1)}}$0 -------------------------------------------------------------------------------- /emacs/snippets/web-mode/twig-set: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: twig-set 3 | # key: set 4 | # condition: (gf/in-file-type "twig") 5 | # -- 6 | {% set $1 = $0 %} -------------------------------------------------------------------------------- /emacs/snippets/yaml-mode/salt-for: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: salt-for 3 | # key: for 4 | # -- 5 | {% for ${1:item} in ${2:list} %} 6 | $0 7 | {% endfor %} -------------------------------------------------------------------------------- /emacs/snippets/yaml-mode/salt-if: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: salt-if 3 | # key: if 4 | # -- 5 | {%- if ${1:True} %} 6 | $0 7 | {%- endif %} -------------------------------------------------------------------------------- /emacs/snippets/yaml-mode/salt-if-else: -------------------------------------------------------------------------------- 1 | # -*- mode: snippet; require-final-newline: nil -*- 2 | # name: salt-if-else 3 | # key: ife 4 | # -- 5 | {%- if ${1:True} %} 6 | $0 7 | {%- else %} 8 | {%- endif %} -------------------------------------------------------------------------------- /emacs/straight/versions/default.el: -------------------------------------------------------------------------------- 1 | (("Emacs-wgrep" . "208b9d01cfffa71037527e3a324684b3ce45ddc4") 2 | ("ace-link" . "d9bd4a25a02bdfde4ea56247daf3a9ff15632ea4") 3 | ("annalist.el" . "e1ef5dad75fa502d761f70d9ddf1aeb1c423f41d") 4 | ("apache-mode" . "00595893920ce755014d793839086bf15ac90075") 5 | ("autothemer" . "cb4d4b69f8bb1f8158d2311692b7607794b75829") 6 | ("avy" . "933d1f36cca0f71e4acb5fac707e9ae26c536264") 7 | ("cask-mode" . "be8b69e55916cf2e78886927f58c7c49b969c0b8") 8 | ("coffee-mode" . "1c6adeae14f3795d3b1e44321189ed7c2c93c967") 9 | ("company-mode" . "9c273fc7c1a9dd69ccf508589211c4f8bd0e0765") 10 | ("compat" . "bc0a31aa823e9ed7b3397cc748eaf6afb014b61c") 11 | ("consult" . "afda4c68a4ebcc9104bf2a645848d7e92269f054") 12 | ("dash.el" . "1de9dcb83eacfb162b6d9a118a4770b1281bcd84") 13 | ("diminish.el" . "fbd5d846611bad828e336b25d2e131d1bc06b83d") 14 | ("dired-rsync" . "5bcb851f3bf9c4f7c07299fcc25be7c408a68cda") 15 | ("docker.el" . "6f8bba0d11a5143872dfc25afdabe16cae410d11") 16 | ("dockerfile-mode" . "4d893bd2da15833ce056332e6c972d5d93e78f04") 17 | ("eat" . "3a6f418f55d183b9d86f99c140caed4ba3d44f93") 18 | ("editorconfig-emacs" . "24f5b2b1cd4e37adc245fb59f7edeb6872a707a4") 19 | ("el-autoyas.el" . "bde0251ecb504f585dfa27c205c8e312655310cc") 20 | ("el-get" . "847901f07bdf67763fa3a6c0fb057048cd58603b") 21 | ("eldoc" . "91a8ae2fa66ac09f45337f9eca6c7aa643a063f4") 22 | ("elisp-slime-nav" . "8588d80d414aee1fafce5b9da0e913612ee0bcdd") 23 | ("emacs" . "4e521e716c2c914d7003243238a00ed330cd17c9") 24 | ("emacs-aio" . "da93523e235529fa97d6f251319d9e1d6fc24a41") 25 | ("emacs-bind-map" . "d7b0e42b78f708669ec368ebbd1f503094ceee22") 26 | ("emacs-kaolin-themes" . "343ad8cd73c7509af2ea7af5eb856ece97dee7a3") 27 | ("emacs-pug-mode" . "73f8c2f95eba695f701df20c8436f49abadebdc1") 28 | ("emacs-reformatter" . "f13f5b4ce51db95ea317d57a83be0358bbf3ec30") 29 | ("emacs-web-server" . "3982c55e9061475038a3ccd61aecb2de3d407cec") 30 | ("emacs-which-key" . "38d4308d1143b61e4004b6e7a940686784e51500") 31 | ("emacs_chrome" . "46406090ff2491c41e6b77f52f7c8c2a2367ccb5") 32 | ("emacsmirror-mirror" . "5676d81e6309fccf096767a1321174c9798ade69") 33 | ("embark" . "d2daad08e04090391b3221fa95000492a1f8aabe") 34 | ("emmet-mode" . "322d3bb112fced57d63b44863357f7a0b7eee1e3") 35 | ("evil" . "b7ab3840dbfc1da5f9ad56542fc94e3dab4be5f1") 36 | ("evil-args" . "a8151556f63c9d45d0c44c8a7ef9e5a542f3cdc7") 37 | ("evil-collection" . "5a1315bfc7f21533de12f35544b29c29ccec491d") 38 | ("evil-exchange" . "5f0a2d41434c17c6fb02e4f744043775de1c63a2") 39 | ("evil-lisp-state" . "3c65fecd9917a41eaf6460f22187e2323821f3ce") 40 | ("evil-nerd-commenter" . "ae52c5070a48793e2c24474c9c8dbf20175d18a0") 41 | ("evil-numbers" . "c7899894515d6be40dfcd589fb27c1801c5b199c") 42 | ("evil-surround" . "da05c60b0621cf33161bb4335153f75ff5c29d91") 43 | ("exec-path-from-shell" . "72ede29a0e0467b3b433e8edbee3c79bab005884") 44 | ("expand-region.el" . "541d971f7c77ca5c0f66c88bcbfeb0d165883023") 45 | ("f.el" . "931b6d0667fe03e7bf1c6c282d6d8d7006143c52") 46 | ("flycheck" . "5217e0e02f487d70e3d418e5e6ce884fc9711511") 47 | ("flyspell-correct" . "1e7a5a56362dd875dddf848b9a9e25d1395b9d37") 48 | ("general.el" . "826bf2b97a0fb4a34c5eb96ec2b172d682fd548f") 49 | ("git-gutter" . "5e4b70f33ce07efe62ac4901b6f3eba249c04c0b") 50 | ("git-link" . "fd33c3f7692bdf4b039afaa88cf07580429043ad") 51 | ("git-timemachine" . "3780835fcd67c3703ffa768206121851e6895ece") 52 | ("gnu-elpa-mirror" . "b612d60157ce0e17d4698900871e8e6be249d66c") 53 | ("go-mode.el" . "602d73e22646b1b98b2eb97927fd426c0d1d2f92") 54 | ("goto-chg" . "72f556524b88e9d30dc7fc5b0dc32078c166fda7") 55 | ("groovy-emacs-modes" . "7b8520b2e2d3ab1d62b35c426e17ac25ed0120bb") 56 | ("hcl-mode" . "1da895ed75d28d9f87cbf9b74f075d90ba31c0ed") 57 | ("ht.el" . "1c49aad1c820c86f7ee35bf9fff8429502f60fef") 58 | ("hydra" . "317e1de33086637579a7aeb60f77ed0405bf359b") 59 | ("js-comint" . "103e5748dff6d97fea1bea08e3a517491d76b5ac") 60 | ("js2-mode" . "62d6cb169ed4cb6d7ae3ddbd8da9c995fed0ab32") 61 | ("js2-refactor.el" . "a0977c4ce1918cc266db9d6cd7a2ab63f3a76b9a") 62 | ("jsonnet-mode" . "7c9961b084b1ea352555317076bc27a512dd341f") 63 | ("kubel" . "7b4f967ee8733a1f8798c39255a26d71aff1f55b") 64 | ("lsp-mode" . "9b104105adecf637188f4e3bf5cc228bda12374a") 65 | ("lsp-python-ms" . "7bda327bec7b219d140c34dab4b1e1fbd41bc516") 66 | ("lua-mode" . "d074e4134b1beae9ed4c9b512af741ca0d852ba3") 67 | ("magit" . "b2b07b993ec2d80f6f7b8b34df0cc77565d9fb18") 68 | ("marginalia" . "be2e57efff640880251c082ac93bd365b7202e6a") 69 | ("markdown-mode" . "6102ac5b7301b4c4fc0262d9c6516693d5a33f2b") 70 | ("melpa" . "f164afd56fe77159209247c648c8f3adc21067dc") 71 | ("mmm-jinja2" . "0bdcb5c7547cbf353f960c36ca4090520f6fc3c3") 72 | ("mmm-mode" . "b1f5c7dbdc405e6e10d9ddd99a43a6b2ad61b176") 73 | ("move-text" . "2a8ebefeb0b363681e9562847eca3fd66e090d70") 74 | ("multiple-cursors.el" . "c870c18462461df19382ecd2f9374c8b902cd804") 75 | ("nix-mode" . "719feb7868fb567ecfe5578f6119892c771ac5e5") 76 | ("nongnu-elpa" . "4b8b3633c7e29412c89f1c9d6ad7a951772be758") 77 | ("orderless" . "96b74d2450ab4ab1a175d0e86c62f6695c4709b5") 78 | ("org" . "5e86016cf97d2f97dcf722e7c0733fa35f91a3d5") 79 | ("php-mode" . "31f702ee2de35d514fb633c0c37531cb648bff70") 80 | ("powerline" . "c35c35bdf5ce2d992882c1f06f0f078058870d4a") 81 | ("projectile" . "9b466af28bac6d61fd0e717f1a4b0fcd2f18f37f") 82 | ("protobuf" . "2fe8aaa15868c8d419ea6532cecf7f0045b3779b") 83 | ("queue" . "8df1334d54d4735d2f821790422a850dfaaa08ef") 84 | ("rainbow-delimiters" . "f40ece58df8b2f0fb6c8576b527755a552a5e763") 85 | ("rainbow-mode" . "2e6b18609c2fdd1a2dc513937a64d276fd6cf24c") 86 | ("restart-emacs" . "1607da2bc657fe05ae01f7fdf26f716eafead02c") 87 | ("rotate-text" . "74c456f91bfefb19dfcd33dbb3bd8574d1f185c6") 88 | ("s.el" . "dda84d38fffdaf0c9b12837b504b402af910d01d") 89 | ("salt-mode" . "c46b24e7fdf4a46df5507dc9c533bbc0064a46fa") 90 | ("scss-mode" . "cf58dbec5394280503eb5502938f3b5445d1b53d") 91 | ("seq" . "da86da9bf111f68fb81efd466d76d53af5aebc00") 92 | ("skewer-mode" . "e5bed351939c92a1f788f78398583c2f83f1bb3c") 93 | ("smartparens" . "c7519a1b69f196050a13e2230b7532893b077086") 94 | ("spaceline" . "086420d16e526c79b67fc1edec4c2ae1e699f372") 95 | ("spinner" . "fa117f0893788f3fe24673715a6b83bb34d238dd") 96 | ("sqlup-mode.el" . "3f9df9c88d6a7f9b1ae907e401cad8d3d7d63bbf") 97 | ("straight.el" . "88e574ae75344e39b436f863ef0344135c7b6517") 98 | ("tablist" . "fcd37147121fabdf003a70279cf86fbe08cfac6f") 99 | ("terraform-mode" . "abfc10f5e313c4bb99de136a14636e9bc6df74f6") 100 | ("tramp" . "457490a587cfb71d909326be330fb674a9e3ce88") 101 | ("transient" . "d6b52b6eb7655d538b410ae60f85fbaa4d58a608") 102 | ("try-code" . "5ad967508e281b0bd1339e8f344011e87ef63680") 103 | ("typescript.el" . "fc3a4f3b275e8cf6cf41aa0c9ef42e25ef908feb") 104 | ("undo-tree" . "d8f72bbe7d3c3a2808986febd3bb1a46d4da7f51") 105 | ("use-package" . "a6e856418d2ebd053b34e0ab2fda328abeba731c") 106 | ("vertico" . "e826dfcb14af5e2cfd88ed110d0208ddc2d37788") 107 | ("web-mode" . "0c83581d1e93d1d802c730a1d5e90cd1c740e1b2") 108 | ("with-editor" . "77cb2403158cfea9d8bfb8adad81b84d1d6d7c6a") 109 | ("ws-butler" . "e3a38d93e01014cd47bf5af4924459bd145fd7c4") 110 | ("yaml-mode" . "d91f878729312a6beed77e6637c60497c5786efa") 111 | ("yasnippet" . "fe1f4e0e96ce42d8668920335eb22c3c009dab3e") 112 | ("zig-mode" . "42aa16cac26cb62768d3cba9854af904c35dbbf9")) 113 | :gamma 114 | -------------------------------------------------------------------------------- /git/.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Glynn Forrest 3 | useConfigOnly = true 4 | 5 | [core] 6 | excludesfile = ~/.gitignore 7 | 8 | [alias] 9 | s = status --short 10 | ch = checkout 11 | br = branch 12 | rmb = !git branch --merged | grep -v '*' | xargs git branch -d 13 | authors = shortlog --summary --numbered --email 14 | l = log --oneline --decorate 15 | la = log --oneline --decorate --graph --all 16 | whatadded = log --diff-filter=A 17 | -------------------------------------------------------------------------------- /git/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com$ 4 | *.class$ 5 | *.dll$ 6 | *.exe$ 7 | *.o$ 8 | *.so$ 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z$ 15 | *.dmg$ 16 | *.gz$ 17 | *.iso$ 18 | *.jar$ 19 | *.rar$ 20 | *.tar$ 21 | *.zip$ 22 | 23 | # OS generated files # 24 | ###################### 25 | .DS_Store 26 | .DS_Store? 27 | ._* 28 | .Spotlight-V100 29 | .Trashes 30 | ehthumbs.db 31 | Thumbs.db 32 | 33 | # Others # 34 | ########## 35 | .ropeproject 36 | .php_cs.cache 37 | -------------------------------------------------------------------------------- /git/.stow-local-ignore: -------------------------------------------------------------------------------- 1 | # required so stow doesn't ignore .gitignore 2 | -------------------------------------------------------------------------------- /pgcli/.config/pgcli/config: -------------------------------------------------------------------------------- 1 | # vi: ft=dosini 2 | [main] 3 | 4 | # Enables context sensitive auto-completion. If this is disabled the all 5 | # possible completions will be listed. 6 | smart_completion = True 7 | 8 | # Display the completions in several columns. (More completions will be 9 | # visible.) 10 | wider_completion_menu = False 11 | 12 | # Multi-line mode allows breaking up the sql statements into multiple lines. If 13 | # this is set to True, then the end of the statements must have a semi-colon. 14 | # If this is set to False then sql statements can't be split into multiple 15 | # lines. End of line (return) is considered as the end of the statement. 16 | multi_line = False 17 | 18 | # If multi_line_mode is set to "psql", in multi-line mode, [Enter] will execute 19 | # the current input if the input ends in a semicolon. 20 | # If multi_line_mode is set to "safe", in multi-line mode, [Enter] will always 21 | # insert a newline, and [Esc] [Enter] or [Alt]-[Enter] must be used to execute 22 | # a command. 23 | multi_line_mode = psql 24 | 25 | # Enables expand mode, which is similar to `\x` in psql. 26 | expand = False 27 | 28 | # Enables auto expand mode, which is similar to `\x auto` in psql. 29 | auto_expand = False 30 | 31 | # If set to True, table suggestions will include a table alias 32 | generate_aliases = False 33 | 34 | # log_file location. 35 | # In Unix/Linux: ~/.config/pgcli/log 36 | # In Windows: %USERPROFILE%\AppData\Local\dbcli\pgcli\log 37 | # %USERPROFILE% is typically C:\Users\{username} 38 | log_file = default 39 | 40 | # keyword casing preference. Possible values "lower", "upper", "auto" 41 | keyword_casing = auto 42 | 43 | # casing_file location. 44 | # In Unix/Linux: ~/.config/pgcli/casing 45 | # In Windows: %USERPROFILE%\AppData\Local\dbcli\pgcli\casing 46 | # %USERPROFILE% is typically C:\Users\{username} 47 | casing_file = default 48 | 49 | # If generate_casing_file is set to True and there is no file in the above 50 | # location, one will be generated based on usage in SQL/PLPGSQL functions. 51 | generate_casing_file = False 52 | 53 | # Casing of column headers based on the casing_file described above 54 | case_column_headers = True 55 | 56 | # history_file location. 57 | # In Unix/Linux: ~/.config/pgcli/history 58 | # In Windows: %USERPROFILE%\AppData\Local\dbcli\pgcli\history 59 | # %USERPROFILE% is typically C:\Users\{username} 60 | history_file = default 61 | 62 | # Default log level. Possible values: "CRITICAL", "ERROR", "WARNING", "INFO" 63 | # and "DEBUG". "NONE" disables logging. 64 | log_level = INFO 65 | 66 | # Order of columns when expanding * to column list 67 | # Possible values: "table_order" and "alphabetic" 68 | asterisk_column_order = table_order 69 | 70 | # Whether to qualify with table alias/name when suggesting columns 71 | # Possible values: "always", never" and "if_more_than_one_table" 72 | qualify_columns = if_more_than_one_table 73 | 74 | # When no schema is entered, only suggest objects in search_path 75 | search_path_filter = False 76 | 77 | # Default pager. 78 | # By default 'PAGER' environment variable is used 79 | pager = less -SRXF 80 | 81 | # Timing of sql statments and table rendering. 82 | timing = True 83 | 84 | # Table format. Possible values: psql, plain, simple, grid, fancy_grid, pipe, 85 | # ascii, double, github, orgtbl, rst, mediawiki, html, latex, latex_booktabs, 86 | # textile, moinmoin, jira, vertical, tsv, csv. 87 | # Recommended: psql, fancy_grid and grid. 88 | table_format = psql 89 | 90 | # Syntax Style. Possible values: manni, igor, xcode, vim, autumn, vs, rrt, 91 | # native, perldoc, borland, tango, emacs, friendly, monokai, paraiso-dark, 92 | # colorful, murphy, bw, pastie, paraiso-light, trac, default, fruity 93 | syntax_style = default 94 | 95 | # Keybindings: 96 | # When Vi mode is enabled you can use modal editing features offered by Vi in the REPL. 97 | # When Vi mode is disabled emacs keybindings such as Ctrl-A for home and Ctrl-E 98 | # for end are available in the REPL. 99 | vi = False 100 | 101 | # Error handling 102 | # When one of multiple SQL statements causes an error, choose to either 103 | # continue executing the remaining statements, or stopping 104 | # Possible values "STOP" or "RESUME" 105 | on_error = STOP 106 | 107 | # Set threshold for row limit prompt. Use 0 to disable prompt. 108 | row_limit = 1000 109 | 110 | # Skip intro on startup and goodbye on exit 111 | less_chatty = False 112 | 113 | # Postgres prompt 114 | # \t - Current date and time 115 | # \u - Username 116 | # \h - Hostname of the server 117 | # \d - Database name 118 | # \p - Database port 119 | # \i - Postgres PID 120 | # \# - "@" sign if logged in as superuser, '>' in other case 121 | # \n - Newline 122 | # \dsn_alias - name of dsn alias if -D option is used (empty otherwise) 123 | prompt = '\u@\h:\d> ' 124 | 125 | # Number of lines to reserve for the suggestion menu 126 | min_num_menu_lines = 4 127 | 128 | # Character used to left pad multi-line queries to match the prompt size. 129 | multiline_continuation_char = '' 130 | 131 | # The string used in place of a null value. 132 | null_string = '' 133 | 134 | # Custom colors for the completion menu, toolbar, etc. 135 | [colors] 136 | Token.Menu.Completions.Completion.Current = 'bg:#ffffff #000000' 137 | Token.Menu.Completions.Completion = 'bg:#008888 #ffffff' 138 | Token.Menu.Completions.Meta.Current = 'bg:#44aaaa #000000' 139 | Token.Menu.Completions.Meta = 'bg:#448888 #ffffff' 140 | Token.Menu.Completions.MultiColumnMeta = 'bg:#aaffff #000000' 141 | Token.Menu.Completions.ProgressButton = 'bg:#003333' 142 | Token.Menu.Completions.ProgressBar = 'bg:#00aaaa' 143 | Token.SelectedText = '#ffffff bg:#6666aa' 144 | Token.SearchMatch = '#ffffff bg:#4444aa' 145 | Token.SearchMatch.Current = '#ffffff bg:#44aa44' 146 | Token.Toolbar = 'bg:#222222 #aaaaaa' 147 | Token.Toolbar.Off = 'bg:#222222 #888888' 148 | Token.Toolbar.On = 'bg:#222222 #ffffff' 149 | Token.Toolbar.Search = 'noinherit bold' 150 | Token.Toolbar.Search.Text = 'nobold' 151 | Token.Toolbar.System = 'noinherit bold' 152 | Token.Toolbar.Arg = 'noinherit bold' 153 | Token.Toolbar.Arg.Text = 'nobold' 154 | Token.Toolbar.Transaction.Valid = 'bg:#222222 #00ff5f bold' 155 | Token.Toolbar.Transaction.Failed = 'bg:#222222 #ff005f bold' 156 | 157 | # Named queries are queries you can execute by name. 158 | [named queries] 159 | 160 | # DNS to call by -D option 161 | [alias_dsn] 162 | # example_dsn = postgresql://[user[:password]@][netloc][:port][/dbname] 163 | 164 | # Format for number representation 165 | # for decimal "d" - 12345678, ",d" - 12,345,678 166 | # for float "g" - 123456.78, ",g" - 123,456.78 167 | [data_formats] 168 | decimal = ",d" 169 | float = "" 170 | -------------------------------------------------------------------------------- /tmux/.tmux.conf: -------------------------------------------------------------------------------- 1 | # Most of this file is 'borrowed' from 2 | # https://github.com/davidbrewer/tmux-conf/ 3 | # Thanks! 4 | 5 | # unbind some default keybindings 6 | unbind C-b 7 | 8 | # set prefix key to ctrl-a 9 | set -g prefix C-a 10 | 11 | # lower command delay 12 | set -sg escape-time 0 13 | 14 | # start first window and pane at 1, not zero 15 | set -g base-index 1 16 | set -g pane-base-index 1 17 | 18 | # bind r to reloading the config file 19 | bind r source-file ~/.tmux.conf \; display "Reloaded tmux config file." 20 | 21 | # pass through a ctrl-a if you press it twice 22 | bind C-a send-prefix 23 | 24 | # better mnemonics for splitting panes! 25 | bind | split-window -h 26 | bind - split-window -v 27 | 28 | # vim / xmonad style bindings for pane movement 29 | bind h select-pane -L 30 | bind j select-pane -D 31 | bind k select-pane -U 32 | bind l select-pane -R 33 | 34 | # vim / xmonad style bindings for window movement 35 | bind -r C-h select-window -t :- 36 | bind -r C-l select-window -t :+ 37 | 38 | # shift-movement keys will resize panes 39 | bind -r H resize-pane -L 5 40 | bind -r J resize-pane -D 5 41 | bind -r K resize-pane -U 5 42 | bind -r L resize-pane -R 5 43 | 44 | # kill the current pane without confirmation 45 | bind x kill-pane 46 | 47 | # renumber windows sequentially when one is closed 48 | set -g renumber-windows on 49 | 50 | # disable mouse support (at least while we're learning) 51 | set-option -g mouse off 52 | 53 | # colours 54 | # support 256 colours 55 | set -g default-terminal "screen-256color" 56 | set -g terminal-overrides "screen-256color" 57 | 58 | # default colour changes depending on the setting 59 | # status bar 60 | set -g status-style fg=default,bg=colour234 61 | # command line 62 | set -g message-style fg=default,bg=colour234 63 | # borders 64 | set -g pane-border-style fg=colour234,bg=default 65 | set -g pane-active-border-style fg=colour67,bg=default 66 | # windows in the status bar 67 | setw -g window-status-style fg=default,bg=colour234 68 | setw -g window-status-current-style fg=colour67,bg=colour234 69 | setw -g window-status-activity-style fg=colour234,bg=colour245 70 | 71 | # session switcher etc 72 | setw -g mode-style fg=default,bg=colour67 73 | 74 | # configure contents of status bar 75 | set -g status-left-length 40 76 | set -g status-left "#S --- #h" 77 | set -g status-right "%d %b %R ♫ " 78 | 79 | set -g status-justify centre 80 | 81 | # get notified of activity, but don't message about it 82 | setw -g monitor-activity on 83 | set -g visual-activity off 84 | 85 | # automatic rename is actually pretty annoying 86 | set -g allow-rename off 87 | setw -g automatic-rename off 88 | 89 | # navigate using vim-style keys 90 | setw -g mode-keys vi 91 | 92 | # copy/paste using vim-style keys 93 | bind Escape copy-mode 94 | unbind p 95 | bind p paste-buffer 96 | bind-key -T copy-mode-vi v send-keys -X begin-selection 97 | bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel 98 | 99 | # opposite of ! for break-pane 100 | bind-key ` choose-window 'join-pane -h -s "%%"' 101 | 102 | # xclip support (commented as this often doesn't make sense on remote servers) 103 | #bind C-c run "tmux save-buffer - / xclip -i -sel clipboard" 104 | #bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer" 105 | -------------------------------------------------------------------------------- /vim/.vimrc: -------------------------------------------------------------------------------- 1 | """""""""""""""""" 2 | "Vim configuration 3 | """""""""""""""""" 4 | "Author: Glynn Forrest 5 | "me@glynnforrest.com 6 | 7 | """"""""""""""""" 8 | "General settings 9 | """"""""""""""""" 10 | 11 | "Enable highlighting 12 | syntax on 13 | 14 | "Enable filetypes 15 | filetype plugin on 16 | filetype indent on 17 | 18 | "We're not using vi 19 | set nocompatible 20 | 21 | "Don't leave backups everywhere 22 | set nobackup 23 | set nowritebackup 24 | set noswapfile 25 | 26 | "Searching wraps around end of file and travels 27 | set wrapscan 28 | set incsearch 29 | set nohlsearch 30 | 31 | "Search smartly 32 | set smartcase 33 | set ignorecase 34 | 35 | "Line numbers and show where we are 36 | set number 37 | set ruler 38 | 39 | "Show our half typed commands 40 | set showcmd 41 | 42 | "Indenting properly 43 | set autoindent 44 | set smartindent 45 | set shiftwidth=4 46 | set softtabstop=4 47 | set tabstop=4 48 | set expandtab 49 | set smarttab 50 | set lbr 51 | set tw=0 52 | 53 | "Expand most folds 54 | set foldlevel=5 55 | 56 | "Change buffers without saving 57 | set hidden 58 | 59 | "Better filename completion 60 | set wildmode=longest,list,full 61 | set wildmenu 62 | set completeopt=longest,menuone 63 | 64 | "See the cursor when moving vertically 65 | set scrolloff=4 66 | 67 | "Don't redraw while executing macros 68 | set nolazyredraw 69 | 70 | "Refresh automatically 71 | set autoread 72 | 73 | "Show tabline only when there are more than 1 74 | set stal=1 75 | 76 | "Disable alt menu keys so they can be used for mappings 77 | "Use to open the menu 78 | set winaltkeys=no 79 | 80 | colorscheme elflord 81 | 82 | """"""""""""""""""""" 83 | " Mappings 84 | """"""""""""""""""""" 85 | 86 | "Map the leader to an easy key 87 | let g:mapleader = " " 88 | 89 | "Hotkeys to edit and reload .vimrc 90 | map v :e! ~/.vimrc 91 | map V :source ~/.vimrc 92 | 93 | "Quick file write 94 | map w :w 95 | vmap w :w 96 | 97 | "Quick file open 98 | map e :e 99 | 100 | "Quick split 101 | map s :vsplw 102 | map S :splw 103 | 104 | "Copy and paste from the system clipboard 105 | map P "+P 106 | map p "+p 107 | map Y "+Y 108 | map y "+y 109 | 110 | "Quick format of file 111 | map = gg=G 112 | 113 | "Navigate up and down a long line 114 | nnoremap j gj 115 | nnoremap k gk 116 | 117 | "Scroll a bit faster 118 | nnoremap 3 119 | nnoremap 3 120 | 121 | "Buffers and tabs 122 | map :bp 123 | map :bn 124 | map x :bd 125 | map q :q 126 | 127 | map :tabf % 128 | map z :tabclose 129 | 130 | "Window management 131 | map j 132 | map k 133 | map h 134 | map l 135 | map < 136 | map > 137 | 138 | "Quick change directory 139 | map cd :cd 140 | 141 | "Change directory to current buffer 142 | map d :cd %:p:h 143 | 144 | "Move up a directory 145 | map D :cd .. 146 | 147 | "Ultimate in lazy 148 | map ; : 149 | 150 | "Clearer searching 151 | map n nzz 152 | map N Nzz 153 | map * *zz 154 | map # #zz 155 | 156 | "Increment everything 157 | set nrformats=alpha,octal,hex 158 | 159 | "Toggle line relative line numbers 160 | function! g:ToggleRelativeNumbers() 161 | if(&rnu == 1) 162 | set nu 163 | else 164 | set rnu 165 | endif 166 | endfunc 167 | 168 | map :call g:ToggleRelativeNumbers() 169 | 170 | """"""""""" 171 | "Statusline 172 | """"""""""" 173 | set laststatus=2 174 | set statusline=\ %F%m%r\ %y\ [%{&ff}]\ %l/%L\ %{getcwd()} 175 | 176 | "Remembers cursor position in a file 177 | au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif 178 | --------------------------------------------------------------------------------