dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit fa5da4426bd383137c24af232e3a0bc1539ec603
parent 807d46cb09a5c5055105560b6d0c93b36367317c
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed,  9 Oct 2019 14:07:47 +0200

Remove initialization scripts, Vim plugins, and unused configuration

Diffstat:
M.config/sh/commands | 2++
D.config/surf/script.js | 123-------------------------------------------------------------------------------
D.config/systemd/user/mbsync.service | 9---------
D.config/systemd/user/mbsync.timer | 11-----------
D.local/bin/alpine-headless | 70----------------------------------------------------------------------
D.local/bin/compile | 40----------------------------------------
M.local/bin/detect_file_changes | 8++++----
D.local/bin/dmenu_themed | 17-----------------
M.local/bin/duplicates | 2+-
D.local/bin/julia-fast | 2--
D.local/bin/mpc-newest.sh | 2--
D.local/bin/mpc-play-newest.sh | 12------------
D.local/bin/phony-headless | 63---------------------------------------------------------------
D.local/bin/sync-adamsgaard.dk.sh | 9---------
D.local/bin/sync-music-ad-server.sh | 15---------------
D.local/bin/tsp-rerun | 77-----------------------------------------------------------------------------
D.local/bin/xrandr-auto | 16----------------
D.local/bin/zzz- | 8--------
D.local/init/10_macos.sh | 960-------------------------------------------------------------------------------
D.local/init/10_macos_xcode.sh | 14--------------
D.local/init/10_symlinks.sh | 63---------------------------------------------------------------
D.local/init/20_debian_apt.sh | 99-------------------------------------------------------------------------------
D.local/init/20_macos_homebrew.sh | 12------------
D.local/init/30_macos_casks.sh | 48------------------------------------------------
D.local/init/30_macos_recipes.sh | 105-------------------------------------------------------------------------------
D.local/init/30_python_pip.sh | 44--------------------------------------------
D.local/init/31_perl_cpan.sh | 10----------
D.local/init/50_vim.sh | 15---------------
D.local/init/50_zsh.sh | 8--------
D.local/init/60_debian_services.sh | 10----------
D.local/init/60_macos_ca_certs.sh | 16----------------
D.local/init/aur_pkgs.csv | 25-------------------------
D.local/init/install | 7-------
D.local/init/pacman_pkgs.csv | 302------------------------------------------------------------------------------
D.local/init/pacman_pkgs.sh | 3---
M.urlview | 6------
D.vim/UltiSnips/html.snippets | 36------------------------------------
D.vim/UltiSnips/mail.snippets | 9---------
D.vim/UltiSnips/markdown.snippets | 10----------
D.vim/UltiSnips/tex.snippets | 188-------------------------------------------------------------------------------
D.vim/ftplugin/gitcommit.vim | 7-------
M.vim/ftplugin/markdown.vim | 3---
D.vim/ftplugin/startify.vim | 3---
M.vim/ftplugin/tex.vim | 9+--------
D.vim/plugin/00-general.vim | 48------------------------------------------------
D.vim/plugin/appearance.vim | 95-------------------------------------------------------------------------------
D.vim/plugin/correct.vim | 21---------------------
D.vim/plugin/keybinds.vim | 145-------------------------------------------------------------------------------
D.vim/plugins.vim | 74--------------------------------------------------------------------------
M.vim/vimrc | 206+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
D.vim/vimrc.noplugs | 8--------
D.vim/vimrc.tiny | 13-------------
D.w3m/bookmark.html | 2--
D.w3m/config | 139-------------------------------------------------------------------------------
D.w3m/keymap | 143-------------------------------------------------------------------------------
D.w3m/style.css | 2--
M.yashrc | 162++++++++++++++++++++++++++++++++++++-------------------------------------------
57 files changed, 282 insertions(+), 3274 deletions(-)

diff --git a/.config/sh/commands b/.config/sh/commands @@ -140,3 +140,5 @@ man9() { echo "$f" [ -e "$f" ] && man "$f" } + +alias julia-fast='julia --procs 1 --optimize=3 --math-mode=fast' diff --git a/.config/surf/script.js b/.config/surf/script.js @@ -1,123 +0,0 @@ -/* keyboard buttons for surf */ -/* Christian hahn <ch radamanthys de> wrote the original code */ - -function -keyboardButtons() -{ - const modKey = "f"; /* used to initiate keyboardButtons mode */ - const escKey = "Escape"; /* used to escape keyboardButtons mode (you can also release alt) */ - const labelStyle = ` - box-sizing: border-box; - position: absolute; - display: inline; - width: auto; - height: auto; - margin: 0; - z-index: 99999; - - padding: 2px; - border: 1px solid black; - border-radius: 0; - - color: black; - font-size: 10px; - font-weight: normal; - font-family: sans-serif; - font-decoration: none; - text-transform: none; - `; - const normalColor = "yellow"; - const highlightColor = "red"; - - var labels = {}; - var input = ""; - - function - updateLabelColor() - { - for (let id in labels) { - if (input && id.startsWith(input)) labels[id].elem.style.backgroundColor = highlightColor; - else labels[id].elem.style.backgroundColor = normalColor; - } - } - - /* by default, this function chooses some sequence of letters, change it to what you like */ - function - numberToLabel(n) - { - ++n; - const alphabet = "abcdeghijklmnopqstuvwxyz"; - /* r is removed as it reloads keyboardButtons */ - - var str = ""; - for (;n; n = Math.floor(n/alphabet.length)) { - str += alphabet[n%alphabet.length]; - } - return str; - } - - function - Label(button, text) - { - this.button = button; - - this.elem = document.createElement("span"); - this.elem.innerHTML = text; - this.elem.style = labelStyle; - this.elem.style.visibility = "hidden"; - const pos = this.button.getBoundingClientRect(); - this.elem.style.left = pos.left + scrollX + "px"; - this.elem.style.top = pos.top + scrollY + "px"; - document.body.appendChild(this.elem); - } - - function - createLabels() - { - for (let id in labels) labels[id].elem.parentNode.removeChild(labels[id].elem); - labels = {}; - - var buttons = Array.from(document.getElementsByTagName("a")) - .concat(Array.from(document.getElementsByTagName("button"))); - for (let i = 0; i < buttons.length; i++) { - const text = numberToLabel(i); - labels[text] = new Label(buttons[i], text); - } - updateLabelColor(); - } - - /* main */ - createLabels(); - /* set key handlers */ - addEventListener("keydown", function (e) { - if (e.key === modKey) { - input = ""; - for (let id in labels) labels[id].elem.style.visibility = "visible"; - updateLabelColor(); - } else if (e.getModifierState(modKey)) { - if (e.key === escKey || e.key === 'r') { - if (e.key === 'r') createLabels(); /* reload labels */ - input = ""; - for (let id in labels) labels[id].elem.style.visibility = "hidden"; - } else if (e.key.length === 1) { - input += e.key; - } - updateLabelColor(); - } - }); - addEventListener("keyup", function (e) { - if (e.key === modKey) { - if (labels[input] !== undefined) { - labels[input].button.click(); - } - input = ""; - for (let id in labels) labels[id].elem.style.visibility = "hidden"; - } - }); -} - -if (document.readyState === "complete") keyboardButtons(); -else document.addEventListener("readystatechange", function (e) { - if (e.target.readyState === "complete") keyboardButtons(); -}); - diff --git a/.config/systemd/user/mbsync.service b/.config/systemd/user/mbsync.service @@ -1,9 +0,0 @@ -# enable with `systemctl --user enable mbsync.timer` (not mbsync.service) -[Unit] -Description=Mailbox synchronization service - -[Service] -Type=oneshot -ExecStart=/usr/bin/mbsync -Va -ExecStartPost=/usr/bin/notmuch new -ExecStartPost=/home/ad/.local/bin/dwmstatus-refresh diff --git a/.config/systemd/user/mbsync.timer b/.config/systemd/user/mbsync.timer @@ -1,11 +0,0 @@ -# enable with `systemctl --user enable mbsync.timer` (not mbsync.service) -[Unit] -Description=Mailbox synchronization timer - -[Timer] -OnBootSec=2m -OnUnitActiveSec=5m -Unit=mbsync.service - -[Install] -WantedBy=timers.target diff --git a/.local/bin/alpine-headless b/.local/bin/alpine-headless @@ -1,70 +0,0 @@ -#!/bin/bash -#vmpath="Documents/Virtual Machines.localized/Debian 8.x 64-bit.vmwarevm/Debian 8.x 64-bit.vmx" -vmpath="$HOME/VMware Fusion VMs/alpine-virt.vmwarevm/alpine-virt.vmx" -#ip=172.16.106.42 -sshfsmount=~/alpine -cmd="tmux new-session -A -s misc" - -# 1. In vmware fusion gui app, configure network adapter to "Internet -# Sharing: Share with my Mac". Copy the MAC address under "Advanced options" -# 2. Insert an entry like the following to -# /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf : -# host Windows8x64 { -# hardware ethernet 00:0C:29:B6:22:3E; -# fixed-address 192.168.167.80; -# } -# 3. Afterwards, restart vmnet DHCP with -# sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop -# sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start -ip=192.168.44.100 -#ip=$(vmrun getGuestIPAddress "$vmpath") -echo "IP of VM: $ip" - -if [[ "$1" = "-h" ]]; then - echo "usage: $0 [start|suspend|stop|status|copysshkey|notmux]" - echo "If no arguments are passed this script will connect to the VM via ssh" - -elif [[ "$1" = "start" ]]; then - vmrun -T fusion start "$vmpath" nogui - vmrun list - -elif [[ "$1" = "suspend" ]]; then - vmrun -T fusion suspend "$vmpath" - vmrun list - -elif [[ "$1" = "stop" ]]; then - vmrun -T fusion stop "$vmpath" - vmrun list - -elif [[ "$1" = "status" ]]; then - vmrun list - -elif [[ "$1" = "copysshkey" ]]; then - ssh-copy-id -i ~/.ssh/id_rsa.pub "$ip" - -else - if [[ "$1" = "notmux" ]]; then - cmd="" - fi - - if [ "$(vmrun list | head -n 1 | awk '{ print $4 }')" -lt "1" ]; then - echo -n "Starting VM... " - vmrun -T fusion start "$vmpath" nogui - echo "done" - vmrun list - fi - - mkdir -p $sshfsmount - sshfs $ip:/home/ad $sshfsmount - ssh -Y $ip -t $cmd - - read -p "$(tput setaf 3)Suspend VM? [Y/n] $(tput sgr0)" -n 1 -r - echo - if [[ $REPLY =~ ^[Nn]$ ]]; then - echo "Not suspending. Bye." - else - echo "Suspending VM..." - vmrun -T fusion suspend "$vmpath" - vmrun list - fi -fi diff --git a/.local/bin/compile b/.local/bin/compile @@ -1,40 +0,0 @@ -#!/bin/sh - -# By lukesmithxyz - -# This script will compile or run another finishing operation on a document. I -# have this script run via vis. -# -# Compiles .tex. groff (.mom, .ms), .rmd, .md. Opens .sent files as sent -# presentations. Runs scripts based on extention or shebang - -file=$(readlink -f "$1") -dir=$(dirname "$file") -base="${file%.*}" - -cd "$dir" || exit - -textype() { \ - command="pdflatex" - ( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex" - $command --output-directory="$dir" "$base" && - grep -i addbibresource "$file" >/dev/null && - biber --input-directory "$dir" "$base" && - $command --output-directory="$dir" "$base" && - $command --output-directory="$dir" "$base" - } - -case "$file" in - *\.ms) refer -PS -e "$file" | groff -me -ms -kept -T pdf > "$base".pdf ;; - *\.mom) refer -PS -e "$file" | groff -mom -kept -T pdf > "$base".pdf ;; - *\.[0-9]) refer -PS -e "$file" | groff -mandoc -T pdf > "$base".pdf ;; - *\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;; - *\.tex) textype "$file" ;; - *\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; - *config.h) sudo make install ;; - *\.c) cc "$file" -o "$base" && "$base" ;; - *\.py) python "$file" ;; - *\.go) go run "$file" ;; - *\.sent) setsid sent "$file" 2>/dev/null & ;; - *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; -esac diff --git a/.local/bin/detect_file_changes b/.local/bin/detect_file_changes @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Specify the file name for storing the file checksums chksumfile=.checksums.txt @@ -37,7 +37,7 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then fi # Return checksums for all files in all subdirectories -function generate_checksums { +generate_checksums() { find . -type f `# search files in all subdirectories` \ ! -name "$chksumfile" `# ignore the checksumfile itself` \ ! -name "${0##*/}" `# ignore this file` \ @@ -45,14 +45,14 @@ function generate_checksums { -exec "$hashgen" '{}' + `# run hash command on every found file` } -function check_if_file_exists { +check_if_file_exists() { if [ ! -f "$1" ]; then (<&2 echo "Error: file '$1' was not found") exit 2 fi } -function update_checksum { +update_checksum() { file=${1//\//\\\/} # escape forward slashes file=${file//\./\\.} # escape periods file=${file// /\\ } # escape spaces diff --git a/.local/bin/dmenu_themed b/.local/bin/dmenu_themed @@ -1,17 +0,0 @@ -#!/bin/sh - -get_xresources_color() { - rg "\*\.$1:" ~/.Xresources | awk '{ print $2 }' -} - -dmenuopts="-nb $(get_xresources_color background)\ - -nf $(get_xresources_color foreground) \ - -sb $(get_xresources_color foreground) \ - -sf $(get_xresources_color background) \ - -fn PragmataPro-9" - -if [ "$1" = "run" ]; then - dmenu_run $dmenuopts -else - dmenu $dmenuopts "$@" -fi diff --git a/.local/bin/duplicates b/.local/bin/duplicates @@ -1,2 +1,2 @@ #!/bin/sh -find "$1" -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 15 +find "${1:-.}" -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 15 diff --git a/.local/bin/julia-fast b/.local/bin/julia-fast @@ -1,2 +0,0 @@ -#!/bin/sh -julia --procs 1 --optimize=3 --math-mode=fast "$@" diff --git a/.local/bin/mpc-newest.sh b/.local/bin/mpc-newest.sh @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -grep 'added' ~/.mpd/log | sed 's/.*added //' | sed 's/\// - /' | sed 's/\/.*//' | uniq | tail -n 20 diff --git a/.local/bin/mpc-play-newest.sh b/.local/bin/mpc-play-newest.sh @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -mpc clear >/dev/null - -#grep 'added' ~/.mpd/log | sed 's/.*added //' | tail -n 100 | tac | mpc add -albums="$(mpc-newest.sh | sed 's/.* - //')" - -while read -r album; do - #echo "$album" - mpc search album "$album" | mpc insert -done <<< "$albums" - -mpc play >/dev/null diff --git a/.local/bin/phony-headless b/.local/bin/phony-headless @@ -1,63 +0,0 @@ -#!/bin/bash -#vmpath="Documents/Virtual Machines.localized/Debian 8.x 64-bit.vmwarevm/Debian 8.x 64-bit.vmx" -vmpath="$HOME/VMware Fusion VMs/Debian 9.x 64-bit.vmwarevm/Debian 9.x 64-bit.vmx" -#ip=172.16.106.42 -sshfsmount=~/phony -cmd="tmux new-session -A -s misc" - -if [[ "$1" = "-h" ]]; then - echo "usage: $0 [start|suspend|stop|status|copysshkey|notmux]" - echo "If no arguments are passed this script will connect to the VM via ssh" - -elif [[ "$1" = "start" ]]; then - vmrun -T fusion start "$vmpath" nogui - vmrun list - -elif [[ "$1" = "suspend" ]]; then - vmrun -T fusion suspend "$vmpath" - vmrun list - -elif [[ "$1" = "stop" ]]; then - vmrun -T fusion stop "$vmpath" - vmrun list - -elif [[ "$1" = "status" ]]; then - vmrun list - -elif [[ "$1" = "copysshkey" ]]; then - ssh-copy-id -i ~/.ssh/id_rsa.pub "$ip" - -else - if [[ "$1" = "notmux" ]]; then - cmd="" - fi - - if [ "$(vmrun list | head -n 1 | awk '{ print $4 }')" -lt "1" ]; then - echo -n "Starting VM... " - vmrun -T fusion start "$vmpath" nogui - echo "done" - vmrun list - fi - # 1. In vmware fusion gui app, configure network adapter to "Internet - # Sharing: Share with my Mac". Copy the MAC address under "Advanced options" - # 2. Insert an entry like the following to - # /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf : - # host Windows8x64 { - # hardware ethernet 00:0C:29:B6:22:3E; - # fixed-address 192.168.167.80; - # } - ip=192.168.167.80 - #ip=$(vmrun getGuestIPAddress "$vmpath") - echo "IP of VM: $ip" - - mkdir -p $sshfsmount - sshfs $ip:/home/ad $sshfsmount - ssh -Y $ip -t $cmd - - #read -p "$(tput setaf 3)Suspend VM? [Y/n] $(tput sgr0)" -n 1 -r - #echo - #if [[ $REPLY =~ ^[Nn]$ ]]; then - #vmrun -T fusion suspend "$vmpath" - #vmrun list - #fi -fi diff --git a/.local/bin/sync-adamsgaard.dk.sh b/.local/bin/sync-adamsgaard.dk.sh @@ -1,9 +0,0 @@ -#!/bin/sh -host=ad@adamsgaard.dk:/var/www/domains/adamsgaard.dk -localdir="$HOME/code/adamsgaard.dk" - -echo "syncing new content to $host" -rsync --update -rav --progress -e "ssh" "$localdir"/* "$host"/ - -echo "syncing new content from $host" -rsync --update -rav --progress -e "ssh" "$host"/* "$localdir"/ diff --git a/.local/bin/sync-music-ad-server.sh b/.local/bin/sync-music-ad-server.sh @@ -1,15 +0,0 @@ -#!/bin/sh -host=adamsgaard.dk:/Volumes/ext2/Music/ -if [ "$(uname)" = "Darwin" ]; then - musicdir="$HOME/Music/iTunes/iTunes Media/Music/" -else - musicdir="$HOME/music/" -fi - -echo "syncing new music to $host" -rsync -rav --progress -e "ssh" "$musicdir" $host - -echo "syncing new music from $host" -rsync -rav --progress -e "ssh" $host "$musicdir" - -mpc update diff --git a/.local/bin/tsp-rerun b/.local/bin/tsp-rerun @@ -1,77 +0,0 @@ -#!/bin/sh - -version=0.1 - -show_help() { - echo "usage: ${0##*/} [OPTIONS] ID1 [ID2...[ID N]]" - echo "will rerun the command from each job ID from 'tsp' as a new 'tsp' job" - echo "If no ID is specified, this program will expect IDs as stdin." - echo - echo "OPTIONS are one or more of the following:" - echo " -V, --verbose show diagnostic information during execution" - echo " -v, --version show version and license information" - echo " -h, --help show this message" - echo " -- do not consider any following args as options" -} - -show_version() { - echo "${0##*/} version $version" - echo "Licensed under the GNU Public License, v3+" - echo "written by Anders Damsgaard, anders@adamsgaard.dk" - echo "https://gitlab.com/admesg/dotfiles" -} - -get_tsp_job_command() { - tsp | grep "^$1 " | sed 's/ */ /g' | cut -d' ' -f6- -} - -surround_paranthesis_words_with_ticks() { - sed 's/(/\\(/g; s/)/\\)/g; s/?/\\?/g' -} - -handle_id() { - cmd="tsp $(get_tsp_job_command "$1" | surround_paranthesis_words_with_ticks)" - [ "$verbose" = 1 ] && echo "$cmd" - eval "$cmd" -} - -die() { - printf '%s\n' "$1" >&2 - exit 1 -} - -verbose=0 -while :; do - case "$1" in - -h|-\?|--help) - show_help - exit 0 - ;; - -v|--version) - show_version - exit 0 - ;; - -V|--verbose) - verbose=1 - ;; - --) # end all options - shift - break - ;; - -?*) - die 'Error: Unknown option specified' - ;; - *) # No more options - break - esac - shift -done - -if [ $# -lt 1 ]; then - id="$(cat)" - handle_id "$id" -else - for id in "$@"; do - handle_id "$id" - done -fi diff --git a/.local/bin/xrandr-auto b/.local/bin/xrandr-auto @@ -1,16 +0,0 @@ -#!/bin/sh - -# combine with the following: /etc/udev/rules.d/95-display.rules -# ACTION=="change", SUBSYSTEM=="drm", RUN+="/bin/su ad -c 'sleep 12; /home/ad/.local/bin/xrandr-auto'" - -export DISPLAY=:0 -export XAUTHORITY=$HOME/.Xauthority - -internal_screen=LVDS1 -external_screen=DP3 - -if xrandr -q | grep "^$external_screen connected" >/dev/null; then - xrandr --output $external_screen --auto --output $internal_screen --off -else - xrandr --output $internal_screen --auto --output $external_screen --off -fi diff --git a/.local/bin/zzz- b/.local/bin/zzz- @@ -1,8 +0,0 @@ -#!/bin/sh - -mpc stop -xlock - -if [ "$(hostname)" = 'idkfa' ]; then - systemctl suspend-then-hibernate -fi diff --git a/.local/init/10_macos.sh b/.local/init/10_macos.sh @@ -1,960 +0,0 @@ -#!/usr/bin/env bash -[[ "$(uname)" != "Darwin" ]] && return 1 - -read -p "Do you want to set macOS settings? [y/n] " -n 1 -r -[[ "$REPLY" == [Nn]* ]] && return 1 - -# Derived from mathiasbynens's macos setup script - -# Close any open System Preferences panes, to prevent them from overriding -# settings we’re about to change -osascript -e 'tell application "System Preferences" to quit' - -# Ask for the administrator password upfront -sudo -v - -# Keep-alive: update existing `sudo` time stamp until `.macos` has finished -while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & - -############################################################################### -# General UI/UX # -############################################################################### - -# Set standby delay to 1 hour -sudo pmset -a standbydelay "$(echo "1*60*60"|bc)" - -# Disable the sound effects on boot -sudo nvram SystemAudioVolume=" " - -# Use dark theme -defaults write .GlobalPreferences AppleInterfaceStyle -string "Dark" - -# (Do not) disable transparency -defaults write com.apple.universalaccess reduceTransparency -bool false - -# Reduce motion animations -defaults write com.apple.universalaccess reduceMotion -bool true - -# Set highlight color to gray -#defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600" -defaults write NSGlobalDomain AppleHighlightColor -string "0.750000 0.750000 0.750000" - -# Set sidebar icon size to small -defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1 - -# Scrollbar preferences -defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling" -# Possible values: `WhenScrolling`, `Automatic` and `Always` - -# Disable the over-the-top focus ring animation -defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false - -# Increase window resize speed for Cocoa applications -defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 - -# Expand save panel by default -defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true -defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true - -# Expand print panel by default -defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true -defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true - -# Save to disk (not to iCloud) by default -defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false - -# Automatically quit printer app once the print jobs complete -defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true - -# Disable the “Are you sure you want to open this application?” dialog -defaults write com.apple.LaunchServices LSQuarantine -bool false - -# Remove duplicates in the “Open With” menu (also see `lscleanup` alias) -/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user - -# Display ASCII control characters using caret notation in standard text views -# Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` -defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true - -# Disable Resume system-wide -defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false - -# Disable automatic termination of inactive apps -defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true - -# Disable the crash reporter -#defaults write com.apple.CrashReporter DialogType -string "none" - -# Set Help Viewer windows to non-floating mode -defaults write com.apple.helpviewer DevMode -bool true - -# Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo) -# Commented out, as this is known to cause problems in various Adobe apps :( -# See https://github.com/mathiasbynens/dotfiles/issues/237 -#echo "0x08000100:0" > ~/.CFUserTextEncoding - -# Reveal IP address, hostname, OS version, etc. when clicking the clock -# in the login window -sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName - -# Restart automatically if the computer freezes -sudo systemsetup -setrestartfreeze on - -# Never go into computer sleep mode -#sudo systemsetup -setcomputersleep Off > /dev/null - -# Disable Notification Center and remove the menu bar icon -launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null - -# Disable automatic capitalization as it’s annoying when typing code -defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false - -# Disable smart dashes as they’re annoying when typing code -defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false - -# Disable automatic period substitution as it’s annoying when typing code -defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false - -# Disable smart quotes as they’re annoying when typing code -defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false - -# Disable auto-correct -defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false - -# Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and -# all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. -#rm -rf ~/Library/Application Support/Dock/desktoppicture.db -#sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg -#sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg - -############################################################################### -# SSD-specific tweaks # -############################################################################### - -# Disable hibernation (speeds up entering sleep mode) -#sudo pmset -a hibernatemode 0 - -# Remove the sleep image file to save disk space -#sudo rm /private/var/vm/sleepimage -# Create a zero-byte file instead… -#sudo touch /private/var/vm/sleepimage -# …and make sure it can’t be rewritten -#sudo chflags uchg /private/var/vm/sleepimage - -############################################################################### -# Trackpad, mouse, keyboard, Bluetooth accessories, and input # -############################################################################### - -# Trackpad: enable tap to click for this user and for the login screen -defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true -defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 -defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 - -# Enable "natural" (Lion-style) scrolling -defaults write NSGlobalDomain com.apple.swipescrolldirection -bool true - -# Increase sound quality for Bluetooth headphones/headsets -defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 - -# Enable full keyboard access for all controls -# (e.g. enable Tab in modal dialogs) -defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 - -# Use scroll gesture with the Ctrl (^) modifier key to zoom -defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true -defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 -# Follow the keyboard focus while zoomed in -defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true - -# Disable press-and-hold for keys in favor of key repeat -#defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false -defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool true - -# Set keyboard repeat rate (macOS defaults: 6 and 25) -defaults write NSGlobalDomain KeyRepeat -int 3 -defaults write NSGlobalDomain InitialKeyRepeat -int 30 - -# Set language and text formats -# Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with -# `Inches`, `en_GB` with `en_US`, and `true` with `false`. -defaults write NSGlobalDomain AppleLanguages -array "en" "da" -defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD" -defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" -defaults write NSGlobalDomain AppleMetricUnits -bool true - -# Show language menu in the top right corner of the boot screen -sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true - -# Set the timezone; see `sudo systemsetup -listtimezones` for other values -#sudo systemsetup -settimezone "Europe/Copenhagen" > /dev/null -sudo systemsetup -settimezone "America/New_York" > /dev/null - -# Stop iTunes from responding to the keyboard media keys -#launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null - -############################################################################### -# Screen # -############################################################################### - -# Require password immediately after sleep or screen saver begins -defaults write com.apple.screensaver askForPassword -int 1 -defaults write com.apple.screensaver askForPasswordDelay -int 0 - -# Save screenshots to the desktop -defaults write com.apple.screencapture location -string "${HOME}/Desktop" - -# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) -defaults write com.apple.screencapture type -string "png" - -# Disable shadow in screenshots -defaults write com.apple.screencapture disable-shadow -bool true - -# Enable subpixel font rendering on non-Apple LCDs -# Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501 -defaults write NSGlobalDomain AppleFontSmoothing -int 2 -defaults write com.apple.Terminal AppleFontSmoothing -int 0 - -# Enable HiDPI display modes (requires restart) -sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true - -############################################################################### -# Finder # -############################################################################### - -# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons -defaults write com.apple.finder QuitMenuItem -bool true - -# Finder: disable window animations and Get Info animations -defaults write com.apple.finder DisableAllAnimations -bool true - -# Set Desktop as the default location for new Finder windows -# For other paths, use `PfLo` and `file:///full/path/here/` -#defaults write com.apple.finder NewWindowTarget -string "PfDe" -#defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" - -# Set Home as the default location for new Finder windows -defaults write com.apple.finder NewWindowTarget -string "PfHm" -defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/" - -# Show icons for hard drives, servers, and removable media on the desktop -defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false -defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true -defaults write com.apple.finder ShowMountedServersOnDesktop -bool true -defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true - -# Finder: show hidden files by default -#defaults write com.apple.finder AppleShowAllFiles -bool true - -# Finder: show all filename extensions -defaults write NSGlobalDomain AppleShowAllExtensions -bool true - -# Finder: show status bar -defaults write com.apple.finder ShowStatusBar -bool true - -# Finder: show path bar -defaults write com.apple.finder ShowPathbar -bool true - -# Display full POSIX path as Finder window title -defaults write com.apple.finder _FXShowPosixPathInTitle -bool true - -# Keep folders on top when sorting by name -defaults write com.apple.finder _FXSortFoldersFirst -bool true - -# When performing a search, search the current folder by default -defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" - -# Disable the warning when changing a file extension -defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false - -# Enable spring loading for directories -defaults write NSGlobalDomain com.apple.springing.enabled -bool true - -# Remove the spring loading delay for directories -defaults write NSGlobalDomain com.apple.springing.delay -float 0 - -# Avoid creating .DS_Store files on network or USB volumes -defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true -defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true - -# Disable disk image verification -#defaults write com.apple.frameworks.diskimages skip-verify -bool true -#defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true -#defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true - -# Automatically open a new Finder window when a volume is mounted -defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true -defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true -defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true - -# Show item info near icons on the desktop and in other icon views -#/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist -#/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist -#/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist - -# Show item info to the right of the icons on the desktop -#/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist - -# Enable snap-to-grid for icons on the desktop and in other icon views -/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist -/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist -/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist - -# Increase grid spacing for icons on the desktop and in other icon views -/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist -/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist -/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist - -# Increase the size of icons on the desktop and in other icon views -#/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist -#/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist -#/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist - -# Use list view in all Finder windows by default -# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` -defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" - -# Disable the warning before emptying the Trash -defaults write com.apple.finder WarnOnEmptyTrash -bool false - -# Enable AirDrop over Ethernet and on unsupported Macs running Lion -defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true - -# Show the ~/Library folder -chflags nohidden ~/Library - -# Show the /Volumes folder -sudo chflags nohidden /Volumes - -# Remove Dropbox’s green checkmark icons in Finder -file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns -[ -e "${file}" ] && mv -f "${file}" "${file}.bak" - -# Expand the following File Info panes: -# “General”, “Open with”, and “Sharing & Permissions” -defaults write com.apple.finder FXInfoPanesExpanded -dict \ - General -bool true \ - OpenWith -bool true \ - Privileges -bool true - -############################################################################### -# Dock, Dashboard, and hot corners # -############################################################################### - -# Enable highlight hover effect for the grid view of a stack (Dock) -defaults write com.apple.dock mouse-over-hilite-stack -bool true - -# Set the icon size of Dock items to 36 pixels -defaults write com.apple.dock tilesize -int 36 - -# Change minimize/maximize window effect -defaults write com.apple.dock mineffect -string "scale" - -# Minimize windows into their application’s icon -defaults write com.apple.dock minimize-to-application -bool true - -# Enable spring loading for all Dock items -defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true - -# Show indicator lights for open applications in the Dock -defaults write com.apple.dock show-process-indicators -bool true - -# Wipe all (default) app icons from the Dock -# This is only really useful when setting up a new Mac, or if you don’t use -# the Dock to launch apps. -#defaults write com.apple.dock persistent-apps -array - -# Show only open applications in the Dock -#defaults write com.apple.dock static-only -bool true - -# Don’t animate opening applications from the Dock -defaults write com.apple.dock launchanim -bool false - -# Speed up Mission Control animations -defaults write com.apple.dock expose-animation-duration -float 0.1 - -# Don’t group windows by application in Mission Control -# (i.e. use the old Exposé behavior instead) -defaults write com.apple.dock expose-group-by-app -bool false - -# Disable Dashboard -defaults write com.apple.dashboard mcx-disabled -bool true - -# Don’t show Dashboard as a Space -defaults write com.apple.dock dashboard-in-overlay -bool true - -# Don’t automatically rearrange Spaces based on most recent use -defaults write com.apple.dock mru-spaces -bool false - -# Remove the auto-hiding Dock delay -defaults write com.apple.dock autohide-delay -float 0 -# Remove the animation when hiding/showing the Dock -defaults write com.apple.dock autohide-time-modifier -float 0 - -# Automatically hide and show the Dock -defaults write com.apple.dock autohide -bool true - -# Make Dock icons of hidden applications translucent -defaults write com.apple.dock showhidden -bool true - -# Disable the Launchpad gesture (pinch with thumb and three fingers) -#defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 - -# Reset Launchpad, but keep the desktop wallpaper intact -find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete - -# Add iOS & Watch Simulator to Launchpad -#sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app" -#sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app" - -# Add a spacer to the left side of the Dock (where the applications are) -#defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' -# Add a spacer to the right side of the Dock (where the Trash is) -#defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' - -# Hot corners -# Possible values: -# 0: no-op -# 2: Mission Control -# 3: Show application windows -# 4: Desktop -# 5: Start screen saver -# 6: Disable screen saver -# 7: Dashboard -# 10: Put display to sleep -# 11: Launchpad -# 12: Notification Center -# Top left -defaults write com.apple.dock wvous-tl-corner -int 0 -defaults write com.apple.dock wvous-tl-modifier -int 0 -# Top right -defaults write com.apple.dock wvous-tr-corner -int 0 -defaults write com.apple.dock wvous-tr-modifier -int 0 -# Bottom left -defaults write com.apple.dock wvous-br-corner -int 0 -defaults write com.apple.dock wvous-br-modifier -int 0 -# Bottom right -defaults write com.apple.dock wvous-bl-corner -int 0 -defaults write com.apple.dock wvous-bl-modifier -int 0 - -############################################################################### -# Safari & WebKit # -############################################################################### - -# Privacy: don’t send search queries to Apple -defaults write com.apple.Safari UniversalSearchEnabled -bool false -defaults write com.apple.Safari SuppressSearchSuggestions -bool true - -# Press Tab to highlight each item on a web page -defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true - -# Show the full URL in the address bar (note: this still hides the scheme) -defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true - -# Set Safari’s home page to `about:blank` for faster loading -defaults write com.apple.Safari HomePage -string "about:blank" - -# Prevent Safari from opening ‘safe’ files automatically after downloading -defaults write com.apple.Safari AutoOpenSafeDownloads -bool false - -# Allow hitting the Backspace key to go to the previous page in history -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true - -# Hide Safari’s bookmarks bar by default -defaults write com.apple.Safari ShowFavoritesBar -bool false - -defaults write com.apple.safari ShowOverlayStatusBar -int 1 - -# Hide Safari’s sidebar in Top Sites -defaults write com.apple.Safari ShowSidebarInTopSites -bool false - -# Disable Safari’s thumbnail cache for History and Top Sites -defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 - -# Enable Safari’s debug menu -defaults write com.apple.Safari IncludeInternalDebugMenu -bool true - -# Make Safari’s search banners default to Contains instead of Starts With -defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false - -# Remove useless icons from Safari’s bookmarks bar -defaults write com.apple.Safari ProxiesInBookmarksBar "()" - -# Enable the Develop menu and the Web Inspector in Safari -defaults write com.apple.Safari IncludeDevelopMenu -bool true -defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true - -# Add a context menu item for showing the Web Inspector in web views -defaults write NSGlobalDomain WebKitDeveloperExtras -bool true - -# Enable continuous spellchecking -defaults write com.apple.Safari WebContinuousSpellCheckingEnabled -bool true -# Disable auto-correct -defaults write com.apple.Safari WebAutomaticSpellingCorrectionEnabled -bool false - -# Disable AutoFill -#defaults write com.apple.Safari AutoFillFromAddressBook -bool false -#defaults write com.apple.Safari AutoFillPasswords -bool false -#defaults write com.apple.Safari AutoFillCreditCardData -bool false -#defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false - -# Warn about fraudulent websites -defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true - -# Disable plug-ins -defaults write com.apple.Safari WebKitPluginsEnabled -bool false -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2PluginsEnabled -bool false - -# Disable Java -defaults write com.apple.Safari WebKitJavaEnabled -bool false -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false - -# Block pop-up windows -defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false -defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false - -# Disable auto-playing video -#defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false -#defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false -#defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false -#defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false - -# Enable “Do Not Track” -defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true - -# Update extensions automatically -defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true - -# Use duckduckgo as search provider -defaults write com.apple.safari SearchProviderIdentifier 'com.duckduckgo' - -############################################################################### -# Mail # -############################################################################### - -# Disable send and reply animations in Mail.app -defaults write com.apple.mail DisableReplyAnimations -bool true -defaults write com.apple.mail DisableSendAnimations -bool true - -# Copy email addresses as `foo@example.com` instead of `Foo Bar <foo@example.com>` in Mail.app -defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false - -# Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app -#defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\U21a9" - -# Display emails in threaded mode, sorted by date (oldest at the top) -defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes" -defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes" -defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date" - -# Disable inline attachments (just show the icons) -defaults write com.apple.mail DisableInlineAttachmentViewing -bool true - -# Disable automatic spell checking -defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled" - -############################################################################### -# Spotlight # -############################################################################### - -# Hide Spotlight tray-icon (and subsequent helper) -#sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search -# Disable Spotlight indexing for any volume that gets mounted and has not yet -# been indexed before. -# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. -sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" -# Change indexing order and disable some search results -# Yosemite-specific search results (remove them if you are using macOS 10.9 or older): -# MENU_DEFINITION -# MENU_CONVERSION -# MENU_EXPRESSION -# MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple) -# MENU_WEBSEARCH (send search queries to Apple) -# MENU_OTHER -defaults write com.apple.spotlight orderedItems -array \ - '{"enabled" = 1;"name" = "APPLICATIONS";}' \ - '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ - '{"enabled" = 1;"name" = "DIRECTORIES";}' \ - '{"enabled" = 1;"name" = "PDF";}' \ - '{"enabled" = 1;"name" = "FONTS";}' \ - '{"enabled" = 0;"name" = "DOCUMENTS";}' \ - '{"enabled" = 0;"name" = "MESSAGES";}' \ - '{"enabled" = 0;"name" = "CONTACT";}' \ - '{"enabled" = 0;"name" = "EVENT_TODO";}' \ - '{"enabled" = 0;"name" = "IMAGES";}' \ - '{"enabled" = 0;"name" = "BOOKMARKS";}' \ - '{"enabled" = 0;"name" = "MUSIC";}' \ - '{"enabled" = 0;"name" = "MOVIES";}' \ - '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ - '{"enabled" = 0;"name" = "SPREADSHEETS";}' - '{"enabled" = 0;"name" = "MENU_OTHER";}' \ - '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \ - '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \ - '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \ - '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' -# Load new settings before rebuilding the index -killall mds > /dev/null 2>&1 -# Make sure indexing is enabled for the main volume -sudo mdutil -i on / > /dev/null -# Rebuild the index from scratch -sudo mdutil -E / > /dev/null - -############################################################################### -# Terminal & iTerm 2 # -############################################################################### - -# Only use UTF-8 in Terminal.app -defaults write com.apple.terminal StringEncodings -array 4 - -# Use a modified version of the Solarized Dark theme by default in Terminal.app -#osascript <<EOD -# -#tell application "Terminal" -# -# local allOpenedWindows -# local initialOpenedWindows -# local windowID -# set themeName to "Solarized Dark xterm-256color" -# -# (* Store the IDs of all the open terminal windows. *) -# set initialOpenedWindows to id of every window -# -# (* Open the custom theme so that it gets added to the list -# of available terminal themes (note: this will open two -# additional terminal windows). *) -# do shell script "open '$HOME/init/" & themeName & ".terminal'" -# -# (* Wait a little bit to ensure that the custom theme is added. *) -# delay 1 -# -# (* Set the custom theme as the default terminal theme. *) -# set default settings to settings set themeName -# -# (* Get the IDs of all the currently opened terminal windows. *) -# set allOpenedWindows to id of every window -# -# repeat with windowID in allOpenedWindows -# -# (* Close the additional windows that were opened in order -# to add the custom theme to the list of terminal themes. *) -# if initialOpenedWindows does not contain windowID then -# close (every window whose id is windowID) -# -# (* Change the theme for the initial opened terminal windows -# to remove the need to close them in order for the custom -# theme to be applied. *) -# else -# set current settings of tabs of (every window whose id is windowID) to settings set themeName -# end if -# -# end repeat -# -#end tell -# -#EOD - -# Enable “focus follows mouse” for Terminal.app and all X11 apps -# i.e. hover over a window and start typing in it without clicking first -#defaults write com.apple.terminal FocusFollowsMouse -bool true -#defaults write org.x.X11 wm_ffm -bool true - -# Enable Secure Keyboard Entry in Terminal.app -# See: https://security.stackexchange.com/a/47786/8918 -defaults write com.apple.terminal SecureKeyboardEntry -bool true - -# Disable the annoying line marks -defaults write com.apple.Terminal ShowLineMarks -int 0 - -# Install the Solarized Dark theme for iTerm -#open "${HOME}/init/Solarized Dark.itermcolors" - -# Don’t display the annoying prompt when quitting iTerm -defaults write com.googlecode.iterm2 PromptOnQuit -bool false - -############################################################################### -# Time Machine # -############################################################################### - -# Prevent Time Machine from prompting to use new hard drives as backup volume -defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true - -# Disable local Time Machine backups -#hash tmutil &> /dev/null && sudo tmutil disablelocal - -############################################################################### -# Activity Monitor # -############################################################################### - -# Show the main window when launching Activity Monitor -defaults write com.apple.ActivityMonitor OpenMainWindow -bool true - -# Visualize CPU usage in the Activity Monitor Dock icon -defaults write com.apple.ActivityMonitor IconType -int 5 - -# Show all processes in Activity Monitor -defaults write com.apple.ActivityMonitor ShowCategory -int 0 - -# Sort Activity Monitor results by CPU usage -defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" -defaults write com.apple.ActivityMonitor SortDirection -int 0 - -############################################################################### -# Address Book, Dashboard, iCal, TextEdit, and Disk Utility # -############################################################################### - -# Enable the debug menu in Address Book -defaults write com.apple.addressbook ABShowDebugMenu -bool true - -# Enable Dashboard dev mode (allows keeping widgets on the desktop) -defaults write com.apple.dashboard devmode -bool true - -# Enable the debug menu in iCal (pre-10.8) -defaults write com.apple.iCal IncludeDebugMenu -bool true - -# Use plain text mode for new TextEdit documents -defaults write com.apple.TextEdit RichText -int 0 -# Open and save files as UTF-8 in TextEdit -defaults write com.apple.TextEdit PlainTextEncoding -int 4 -defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 - -# Enable the debug menu in Disk Utility -defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true -defaults write com.apple.DiskUtility advanced-image-options -bool true - -# Auto-play videos when opened with QuickTime Player -defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool true - -############################################################################### -# Mac App Store # -############################################################################### - -# Enable the WebKit Developer Tools in the Mac App Store -defaults write com.apple.appstore WebKitDeveloperExtras -bool true - -# Enable Debug Menu in the Mac App Store -defaults write com.apple.appstore ShowDebugMenu -bool true - -# Enable the automatic update check -defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true - -# Check for software updates daily, not just once per week -defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 - -# Download newly available updates in background -defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 - -# Install System data files & security updates -defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 - -# Automatically download apps purchased on other Macs -defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1 - -# Turn on app auto-update -defaults write com.apple.commerce AutoUpdate -bool true - -# Allow the App Store to reboot machine on macOS updates -defaults write com.apple.commerce AutoUpdateRestartRequired -bool true - -############################################################################### -# Photos # -############################################################################### - -# Prevent Photos from opening automatically when devices are plugged in -defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true - -############################################################################### -# Messages # -############################################################################### - -# Disable automatic emoji substitution (i.e. use plain text smileys) -defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false - -# Disable smart quotes as it’s annoying for messages that contain code -defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false - -# Disable continuous spell checking -defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false - -############################################################################### -# Google Chrome & Google Chrome Canary # -############################################################################### - -# Disable the all too sensitive backswipe on trackpads -defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false -defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false - -# Disable the all too sensitive backswipe on Magic Mouse -defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false -defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false - -# Use the system-native print preview dialog -defaults write com.google.Chrome DisablePrintPreview -bool true -defaults write com.google.Chrome.canary DisablePrintPreview -bool true - -# Expand the print dialog by default -defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true -defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true - -############################################################################### -# GPGMail 2 # -############################################################################### - -# Disable signing emails by default -defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false - -############################################################################### -# Opera & Opera Developer # -############################################################################### - -# Expand the print dialog by default -defaults write com.operasoftware.Opera PMPrintingExpandedStateForPrint2 -boolean true -defaults write com.operasoftware.OperaDeveloper PMPrintingExpandedStateForPrint2 -boolean true - -############################################################################### -# SizeUp.app # -############################################################################### - -# Start SizeUp at login -defaults write com.irradiatedsoftware.SizeUp StartAtLogin -bool true - -# Don’t show the preferences window on next start -defaults write com.irradiatedsoftware.SizeUp ShowPrefsOnNextStart -bool false - -############################################################################### -# Sublime Text # -############################################################################### - -# Install Sublime Text settings -cp -r init/Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ Text*/Packages/User/Preferences.sublime-settings 2> /dev/null - -############################################################################### -# Spectacle.app # -############################################################################### - -# Set up my preferred keyboard shortcuts -cp -r init/spectacle.json ~/Library/Application\ Support/Spectacle/Shortcuts.json 2> /dev/null - -############################################################################### -# Transmission.app # -############################################################################### - -# Use `~/Documents/Torrents` to store incomplete downloads -#defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true -#defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" - -# Use `~/Downloads` to store completed downloads -defaults write org.m0k.transmission DownloadLocationConstant -bool true - -# Don’t prompt for confirmation before downloading -defaults write org.m0k.transmission DownloadAsk -bool false -defaults write org.m0k.transmission MagnetOpenAsk -bool false - -# Don’t prompt for confirmation before removing non-downloading active transfers -defaults write org.m0k.transmission CheckRemoveDownloading -bool true - -# Trash original torrent files -defaults write org.m0k.transmission DeleteOriginalTorrent -bool true - -# Hide the donate message -defaults write org.m0k.transmission WarningDonate -bool false -# Hide the legal disclaimer -defaults write org.m0k.transmission WarningLegal -bool false - -# IP block list. -# Source: https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/ -defaults write org.m0k.transmission BlocklistNew -bool true -defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz" -defaults write org.m0k.transmission BlocklistAutoUpdate -bool true - -# Randomize port on launch -defaults write org.m0k.transmission RandomPort -bool true - -############################################################################### -# Twitter.app # -############################################################################### - -# Disable smart quotes as it’s annoying for code tweets -defaults write com.twitter.twitter-mac AutomaticQuoteSubstitutionEnabled -bool false - -# Show the app window when clicking the menu bar icon -defaults write com.twitter.twitter-mac MenuItemBehavior -int 1 - -# Enable the hidden ‘Develop’ menu -defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true - -# Open links in the background -defaults write com.twitter.twitter-mac openLinksInBackground -bool true - -# Allow closing the ‘new tweet’ window by pressing `Esc` -defaults write com.twitter.twitter-mac ESCClosesComposeWindow -bool true - -# Show full names rather than Twitter handles -defaults write com.twitter.twitter-mac ShowFullNames -bool true - -# Hide the app in the background if it’s not the front-most window -defaults write com.twitter.twitter-mac HideInBackground -bool true - -############################################################################### -# Tweetbot.app # -############################################################################### - -# Bypass the annoyingly slow t.co URL shortener -defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true -defaults write com.tapbots.TweetbotMac showStatusItem -int 0 - -############################################################################### -# Reeder.app # -############################################################################### -defaults write com.reederapp.rkit2.mac AppIconUnreadCount -int 2 -defaults write com.reederapp.rkit2.mac AppOrderUnreadItems -int 1 -defaults write com.reederapp.rkit2.mac OpenLinksInBackground -int 1 -defaults write com.reederapp.rkit2.mac PrivateBrowsing -int 1 -defaults write com.reederapp.rkit2.mac WebKitPrivateBrowsingEnabled -int 1 -defaults write com.reederapp.rkit2.mac ShareRKServiceAppNet -dict enabled -int 0 -defaults write com.reederapp.rkit2.mac ShareRKServiceBuffer -dict enabled -int 0 -defaults write com.reederapp.rkit2.mac ShareRKServiceDelicious -dict enabled -int 0 -defaults write com.reederapp.rkit2.mac ShareRKServiceEvernote -dict enabled -int 0 -defaults write com.reederapp.rkit2.mac ShareRKServiceFacebook -dict enabled -int 0 -defaults write com.reederapp.rkit2.mac ShareRKServiceInstapaper -dict enabled -int 0 "show-in-toolbar" -int 0 -defaults write com.reederapp.rkit2.mac ShareRKServiceMailLink -dict enabled -int 1 "show-in-toolbar" -int 1 to -string "me@brad.is" -defaults write com.reederapp.rkit2.mac ShareRKServiceMarsEdit -dict enabled -int 0 -# defaults write com.reederapp.rkit2.mac ShareRKServiceMessage -dict enabled -int 1 -defaults write com.reederapp.rkit2.mac ShareRKServicePinboard -dict enabled -int 1 "show-in-toolbar" -int 1 -defaults write com.reederapp.rkit2.mac ShareRKServiceQuoteFMRead -dict enabled -int 0 -defaults write com.reederapp.rkit2.mac ShareRKServiceReadItLater -dict enabled -int 1 "show-in-toolbar" -int 1 -defaults write com.reederapp.rkit2.mac ShareRKServiceReadability -dict enabled -int 0 -# defaults write com.reederapp.rkit2.mac ShareRKServiceReadingList -dict enabled -int 1 -# defaults write com.reederapp.rkit2.mac ShareRKServiceSafari -dict enabled -int 1 -defaults write com.reederapp.rkit2.mac ShareRKServiceTwitter -dict enabled -int 0 - -############################################################################### -# Kill affected applications # -############################################################################### - -for app in "Activity Monitor" \ - "Address Book" \ - "Calendar" \ - "cfprefsd" \ - "Contacts" \ - "Dock" \ - "Finder" \ - "Google Chrome Canary" \ - "Google Chrome" \ - "Mail" \ - "Messages" \ - "Opera" \ - "Photos" \ - "Reeder" \ - "Safari" \ - "SizeUp" \ - "Spectacle" \ - "SystemUIServer" \ - "Terminal" \ - "Transmission" \ - "Tweetbot" \ - "Twitter" \ - "iCal"; do - killall "${app}" &> /dev/null -done -echo "Done. Note that some of these changes require a logout/restart to take effect." diff --git a/.local/init/10_macos_xcode.sh b/.local/init/10_macos_xcode.sh @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -# OSX-stuff only -[[ "$(uname)" != "Darwin" ]] && return 1 - -# check if command line tools are installed -xcode-select --print-path >/dev/null 2>&1 -xcodestatus=$? -gcc --version >/dev/null 2>&1 -gccstatus=$? -if [[ $xcodestatus -ne 0 || $gccstatus -ne 0 ]]; then - echo "xcode status: $xcodestatus, gcc status: $gccstatus" - sudo xcode-select --install -fi diff --git a/.local/init/10_symlinks.sh b/.local/init/10_symlinks.sh @@ -1,63 +0,0 @@ -#!/usr/bin/env bash - -# shopt -s dotglob -# for f in links/*; do -# -# # Skip . and .. -# [ "$f" = "." ] && continue -# [ "$f" = ".." ] && continue -# -# # Skip shell scripts and markdown -# [ "${f##*.}" = "md" ] && continue -# -# # Do not symlink these files/directories -# [[ "$f" =~ tags|.git/|.DS_Store|bar/|userChrome.css|init/ ]] && continue -# -# # .xinitrc doesn't work with XQuartz -# [[ "$(uname)" = "Darwin" && "$f" == ".xinitrc" ]] && continue -# -# SOURCE=$PWD/$f -# TARGET=~/$(basename $f) -# -# # Rename any original files or directories -# [ -f $TARGET ] && mv $TARGET ${TARGET}_bck -# [ -d $TARGET ] && mv $TARGET ${TARGET}_bck -# -# # Remove old symlinks -# [ -L $TARGET ] && rm $TARGET -# -# ln -sv $SOURCE $TARGET -# done -# -# # Create folders and non-symlink files -# mkdir -p ~/.ipython/profile_default -# mkdir -p ~/.mutt/cache -# chmod 0700 ~/.mutt/cache -# [ -f ~/.mutt/aliases ] || touch ~/.mutt/aliases -# mkdir -p ~/tmp -# -# # Symlink directories from iCloud drive to home -# if [ "$(uname)" = "Darwin" ]; then -# ln -shvf ~/Library/Mobile\ Documents/com\~apple\~CloudDocs \ -# ~/iCloud -# ln -shvf ~/iCloud/articles ~/articles -# ln -shvf ~/iCloud/articles/own/BIBnew.bib \ -# $(kpsexpand '$TEXMFHOME')/bibtex/bib/myfiles/BIB.bib -# ln -shvf ~/iCloud/articles/own/BIBnew.bib \ -# $(kpsexpand '$TEXMFHOME')/bibtex/bib/BIB.bib -# ln -shvf ~/iCloud/src ~/src -# ln -shvf ~/iCloud/doc ~/doc -# ln -shvf ~/doc/.password-store ~/.password-store -# ln -shvf ~/iCloud/uni ~/uni -# ln -shvf ~/iCloud/videos ~/videos -# ln -shvf \ -# ~/Library/Mobile\ Documents/27N4MQEA55~pro~writer/Documents/ \ -# ~/iawriter -# ln -shvf misc_code/firefox/userContent.css \ -# ~/Library/Application\ Support/Firefox/Profiles/ -# -# # XQuartz.app doesn't work with .xinitrc -# [ -L ~/.xinitrc ] && rm ~/.xinitrc -# fi - -[ -x ~/bin/shortcuts ] && ~/bin/shortcuts diff --git a/.local/init/20_debian_apt.sh b/.local/init/20_debian_apt.sh @@ -1,99 +0,0 @@ -#!/bin/bash -[[ "$(uname)" != "Linux" ]] && return 1 -[[ "$(cat /etc/issue 2> /dev/null)" =~ Debian ]] || return 1 - -read -p "Do you want to install APT packages? [y/n] " -n 1 -r -[[ "$REPLY" == [Nn]* ]] && return 1 - -apt_packages=( - apt-transport-https - autossh - bogofilter - build-essential - cmake - colordiff - curl - dict - dict-gcide - dictd - dunst - elinks - exuberant-ctags - ffmpeg - git - haskell-platform - highlight - hsetroot - htop - i3 - i3blocks - i3lock - imagemagick - imapfilter - ipython - jhead - latexmk - libnotify-bin - locate - mpc - mpd - mpv - msmtp - msmtp-gnome - mutt - notmuch - notmuch-mutt - ntp - offlineimap - okular - paraview - pass - python-ipdb - python-matplotlib - python-numpy - python-pip - python-scipy - redshift - ruby - rxvt-unicode-256color - screenfetch - scrot - shellcheck - sshfs - texlive - texlive-full - tig - tmux - tor - urlview - vim - vim-nox - w3m - weechat - weechat-plugins - weechat-scripts - wordnet - xautolock - xbacklight - xbindkeys - xautomation - xdotool - youtube-dl - zathura - zsh -) - -#for package in "${apt_packages[@]}"; do - #sudo apt -qq install "$package" -#done -sudo apt -qq install "${apt_packages[@]}" - - -# configure xdg-open with `mimeopen -d <file>` -# set zathura as default pdf viewer -xdg-mime default zathura.desktop application/pdf -xdg-mime default files.desktop inode/directory # nautilus -xdg-mime default eog.desktop image/jpeg -xdg-mime default eog.desktop image/png -xdg-mime default eog.desktop image/gif -xdg-mime default eog.desktop image/bmp diff --git a/.local/init/20_macos_homebrew.sh b/.local/init/20_macos_homebrew.sh @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -# OSX-stuff only -[[ "$(uname)" != "Darwin" ]] && return 0 - -[[ "$(type -P brew)" ]] && echo "Homebrew already installed." && return 0 - -# install homebrew -ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - -# Exit if, for some reason, Homebrew is not installed. -[[ ! "$(type -P brew)" ]] && echo "Homebrew failed to install." && return 1 diff --git a/.local/init/30_macos_casks.sh b/.local/init/30_macos_casks.sh @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -# OSX-stuff only -[[ "$(uname)" != "Darwin" ]] && return 0 - -# Exit if, for some reason, Homebrew is not installed. -[[ ! "$(type -P brew)" ]] && echo "Homebrew failed to install." && return 1 - -# from `brew cask list` -casks=( - adobe-acrobat-pro - adobe-creative-cloud - alfred - battle-net - bartender - bitbar - duet - firefox - google-cloud-sdk - julia - karabiner - mactex - magicavoxel - osxfuse - processing - signal - skim - skype - steam - torbrowser - transmission - vagrant - vlc - virtualbox - xquartz -) - -read -p "Do you want to install brew casks? [y/n] " -n 1 -r -echo -if [[ $REPLY =~ ^[Yy]$ ]]; then - for cask in "${casks[@]}"; do - #read -p "Do you want to install $cask? [y/n] " -n 1 -r - ##echo - #if [[ $REPLY =~ ^[Yy]$ ]]; then - brew cask install $cask - #fi - done -fi diff --git a/.local/init/30_macos_recipes.sh b/.local/init/30_macos_recipes.sh @@ -1,105 +0,0 @@ -#!/usr/bin/env bash - -# OSX-stuff only -[[ "$(uname)" != "Darwin" ]] && return 0 - -## Exit if, for some reason, Homebrew is not installed. -[[ ! "$(type -P brew)" ]] && echo "Recipes need Homebrew to install." && return 1 - -# from `brew list` -brews=( - abook # manage email aliases - ansifilter # convert terminal output to html - aria2 # download with resume - asciinema # save and upload recordings of terminal - asciinema2gif # convert asciinema recordings to gif - aspell # spell checking for vim - autoconf - automake - bench # benchmark cmdline commands with multiple runs and stats - c2048 # start with `2048` - catimg # convert image to ASCII in terminal - cliclick # similar to xdotool - cmake - colordiff # diff with colorized output - cpanminus # required for notmuch CPAN packages - ctags-exuberant - exiftool # used to manage RAW metadata - fdupes # find duplicates with `fdupes -m .`, delete with `fdupes -dN .` - ffmpeg - fortune - fzf # fuzzy file finder - gcal - git - gnupg - gnuski # skiing game - homebrew/science/paraview - homebrew/science/matplotlib - htop-osx - highlight # used for syntax highligting in fzf - id3v2 # mp3 metadata management - imagemagick - imapfilter - jhead # for gallery_shell (gallery.sh) - lua - mdp # markdown presentations - mosh # persistent SSH - mpc # command-line control over mpd - mpd # music player daemon - mpv # media player - msmtp # used to deliver mails - mutt - nmap - neovim - newsboat - notmuch - numpy - nyancat - offlineimap - openssl - pandoc - pass - pcre - pkg-config - proxychains-ng # torify alternative? - pwgen - qrencode # generate QR codes from command line - ranger # file manager - reattach-to-user-namespace # needed for tmux - rename # rename many files with convenient syntax - ripgrep # a faster grep - sc-im # terminal-based spreadsheets - shellcheck # bash linter - ssh-copy-id # add public key to a remote's authorized_keys file - sshfs - subliminal # search and download subtitles - surfraw # cmd-line interface to search engines (`sr` alias) - the_silver_searcher # ag - task # taskwarrior - task-spooler # ts command - tmux - translate-shell # provides `trans` interface to google translate - tig # git history - tor - torsocks - tree - urlview - vim - vimpc - vitetris # command line tetris - "vtk --with-tcl --with-qt --with-python --with-matplotlib --with-examples" - w3m - watch - wget - wtf # look up internet acronyns `wtf [is] <term>` - "wireshark --with-lua --with-qt5" - youtube-dl - zsh -) - -for brew in "${brews[@]}"; do - brew install "$brew" -done - -# install fzf shell extensions -/usr/local/opt/fzf/install diff --git a/.local/init/30_python_pip.sh b/.local/init/30_python_pip.sh @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -# pip packages -pkgs=( - bs4 - gcalcli - grepg - haxor-news - howdoi - jupyter - neovim - numexpr - pandas - Pillow - protobuf - psutil - requests - scikit-learn - sympy - tensorflow - virtualenv -) - -for PIP in pip pip2 pip3; do - if [[ "$(type -P $PIP)" ]]; then - echo "## Installing $PIP packages" - for pkg in "${pkgs[@]}"; do - $PIP install $pkg - [ "$pkg" == "gcalcli" ] && gcalcli list - done - else - echo "## $PIP not installed" - fi -done - -# tensorflow in virtualenv -#if [[ "$(type -P python3)" ]]; then -# targetdir=~/code/tensorflow -# mkdir -p $targetdir -# [ -d $targetdir/lib ] || \ -# virtualenv --system-site-packages -p python3 $targetdir -# source $targetdir/bin/activate -# pip3 install --upgrade tensorflow -#fi diff --git a/.local/init/31_perl_cpan.sh b/.local/init/31_perl_cpan.sh @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -# notmuch-mutt requirements -[[ ! "$(type -P cpanm)" ]] && echo "cpanm failed to install." && return 1 -cpanm Digest::SHA\ - Mail::Box\ - Mail::Header\ - Mail::Box::Maildir\ - String::ShellQuote\ - Term::ReadLine::Gnu diff --git a/.local/init/50_vim.sh b/.local/init/50_vim.sh @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -# Install vim-plug -[ ! -e ~/.vim/autoload/plug.vim ] && \ -curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - -[ ! -e ~/.local/share/nvim/site/autoload/plug.vim ] && \ -curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - -# Install and upgrade plugins -if [[ "$(type -P vim)" ]]; then - vim +PlugUpgrade +PlugUpdate +qall -fi diff --git a/.local/init/50_zsh.sh b/.local/init/50_zsh.sh @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -# zplug requires gawk -if [[ "$(uname)" = "Linux" ]]; then - if [[ "$(cat /etc/issue 2> /dev/null)" =~ Debian ]]; then - sudo apt install gawk - fi -fi diff --git a/.local/init/60_debian_services.sh b/.local/init/60_debian_services.sh @@ -1,10 +0,0 @@ -#!/bin/bash -[[ "$(uname)" != "Linux" ]] && return 1 -[[ "$(cat /etc/issue 2> /dev/null)" =~ Debian ]] || return 1 - -echo "Running MPD as a user service" -sudo systemctl disable mpd -systemctl --user enable mpd - -echo "Uninstalling GDM 3" -sudo apt remove gdm3 diff --git a/.local/init/60_macos_ca_certs.sh b/.local/init/60_macos_ca_certs.sh @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -e - -# OSX-stuff only -[[ "$(uname)" != "Darwin" ]] && return 0 - -if [[ ! -f /etc/ssl/certs/ca-certificates.crt ]]; then - cd ~/tmp - wget -O http://curl.haxx.se/download/curl-7.63.0.tar.bz2 - tar xzf curl-7.63.0.tar.bz2 - cd curl-7.63.0/lib/ - ./mk-ca-bundle.pl - sudo cp ca-bundle.crt /etc/ssl/certs/ca-certificates.crt - cd ~/tmp - rm -rf ~/tmp/curl-7.63.0 -fi diff --git a/.local/init/aur_pkgs.csv b/.local/init/aur_pkgs.csv @@ -1,25 +0,0 @@ -aic94xx-firmware -brother-cups-wrapper-laser -farbfeld -hunspell-da -languagetool-ngrams-en -languagetool-word2vec-en -libreoffice-extension-languagetool -libxlsxwriter -minecraft-launcher -openarena -otf-bitstream-charter -pioneers -sc-im -screenkey -sent -shellcheck-static -signal-desktop-bin -task-spooler -tor-browser -ttf-ms-fonts -ttf-symbola -urlview -wd719x-firmware -xmoto -yay diff --git a/.local/init/install b/.local/init/install @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -# Run initialization scripts -for s in *.sh; do - echo -e "\n### $s ###########################" - source "$s" -done diff --git a/.local/init/pacman_pkgs.csv b/.local/init/pacman_pkgs.csv @@ -1,302 +0,0 @@ -9base -abcde -acpi -acpi_call -adobe-source-code-pro-fonts -adobe-source-sans-pro-fonts -alsa-utils -arandr -arch-wiki-docs -arch-wiki-lite -aspell-en -at -autoconf -automake -bash -bash-completion -bind-tools -binutils -bison -bluez -bzip2 -calcurse -cdrtools -certbot -cmake -coreutils -cowsay -cronie -cryptsetup -ctags -cups -dash -device-mapper -dhcpcd -dialog -diffutils -dmenu -dopewars -dunst -duplicity -e2fsprogs -ed -efibootmgr -entr -etckeeper -exfat-utils -fakeroot -feh -figlet -file -filesystem -findutils -firejail -flex -font-bh-ttf -fortune-mod -fzf -fzy -gawk -gcc -gcc-libs -gdb -gettext -ghostscript -gimp -git -glibc -glyr -gnome-keyring -gnu-netcat -gnuplot -gource -gparted -graphicsmagick -grep -groff -grub -gzip -handbrake -highlight -hsetroot -htop -hugo -hunspell-en_US -i3lock -id3v2 -inetutils -inkscape -iotop -iproute2 -iputils -ipython -isync -jfsutils -jhead -jpegexiforient -jre-openjdk -julia -keynav -languagetool -less -libreoffice-extension-texmaths -libreoffice-fresh -libtool -libvdpau-va-gl -libvncserver -licenses -linux -linux-firmware -linux-headers -logrotate -lshw -lsof -lua-lpeg -lvm2 -m4 -macchanger -maim -make -man-db -man-pages -mdadm -mediainfo -mosh -mp3info -mpc -mpd -mpv -msmtp -msmtp-mta -mtr -mutt -ncdu -ncmpcpp -neovim -netctl -nethack -nethogs -network-manager-applet -newsboat -nmap -notmuch -notmuch-mutt -ntp -pacman -papirus-icon-theme -paraview -pass -patch -pciutils -perl -perl-authen-sasl -perl-file-mimeinfo -perl-image-exiftool -perl-mime-tools -perl-net-smtp-ssl -pkgconf -powertop -procps-ng -psmisc -pulseaudio -pulseaudio-alsa -pulsemixer -python-dbus -python-eyed3 -python-jinja -python-neovim -python-owslib -python-pandas -python-pip -python-psutil -python-scipy -python-seaborn -python-tensorflow -python-unidecode -python-urwid -python-virtualenv -python-wxpython -python-yaml -python2-pip -qrencode -redshift -reiserfsprogs -remmina -ripgrep -rsync -sed -shadow -sshfs -subdl -sudo -sxhkd -sxiv -sysfsutils -systemd -systemd-sysvcompat -tar -tensorboard -tensorflow -texinfo -texlive-bibtexextra -texlive-core -texlive-fontsextra -texlive-formatsextra -texlive-games -texlive-humanities -texlive-latexextra -texlive-music -texlive-pictures -texlive-pstricks -texlive-publishers -texlive-science -tlp -tmux -torsocks -tp_smapi -traceroute -transmission-cli -tre -ttf-bitstream-vera -ttf-croscore -ttf-dejavu -ttf-droid -ttf-freefont -ttf-inconsolata -ttf-joypixels -ttf-liberation -ttf-roboto -ttf-ubuntu-font-family -unclutter -unrar -unzip -usbutils -util-linux -valgrind -vi -vis -w3m -webkit2gtk -weechat -wget -which -wireless_tools -wireshark-qt -wkhtmltopdf -wpa_supplicant -xautolock -xbindkeys -xdotool -xf86-input-evdev -xf86-input-libinput -xf86-video-intel -xfsprogs -xonotic -xorg-bdftopcf -xorg-iceauth -xorg-luit -xorg-mkfontscale -xorg-server -xorg-sessreg -xorg-setxkbmap -xorg-smproxy -xorg-x11perf -xorg-xauth -xorg-xbacklight -xorg-xcmsdb -xorg-xcursorgen -xorg-xdpyinfo -xorg-xdriinfo -xorg-xev -xorg-xgamma -xorg-xhost -xorg-xinit -xorg-xinput -xorg-xkbcomp -xorg-xkbevd -xorg-xkbutils -xorg-xkill -xorg-xlsatoms -xorg-xlsclients -xorg-xlsfonts -xorg-xmodmap -xorg-xpr -xorg-xprop -xorg-xrandr -xorg-xrdb -xorg-xrefresh -xorg-xset -xorg-xsetroot -xorg-xvinfo -xorg-xwd -xorg-xwininfo -xorg-xwud -xsel -youtube-dl -youtube-viewer -zathura -zathura-djvu -zathura-pdf-mupdf -zathura-ps -zip -zsh diff --git a/.local/init/pacman_pkgs.sh b/.local/init/pacman_pkgs.sh @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -pacman -Qqen > pacman_pkgs.csv -pacman -Qqem > aur_pkgs.csv diff --git a/.urlview b/.urlview @@ -1,8 +1,2 @@ -# man urlview <Man page> - -# pattern to match URLs -#REGEXP (((http|https|ftp|gopher)|mailto):(//)?[^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):] -#REGEXP (((http|https|ftp|gopher)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):] REGEXP (((http|https|ftp|gopher)|mailto):(//)?[^ <>"\t]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)[^ .,;\t\n\r<">\):]?[^, <>"\t]*[^ .,;\t\n\r<">\):] - COMMAND linkhandler %s diff --git a/.vim/UltiSnips/html.snippets b/.vim/UltiSnips/html.snippets @@ -1,36 +0,0 @@ -snippet slide "Insert a reveal.js slide with html formatting" -<section> - <h2>$1</h2> - - $0 -</section> -endsnippet - -snippet markdownslide "Insert a reveal.js slide with Markdown formatting" -<section data-markdown> - <textarea data-template> - ## $1 - - $0 - - </textarea> -</section> -endsnippet - -snippet code "Insert a code block in HTML syntax" -<pre><code class="hljs${1: python}" data-trim contenteditable> -$0 -</code></pre> -endsnippet - -snippet pyprompt "Insert the Python prompt with HTML symbols" -&gt;&gt;&gt; $0 -endsnippet - -snippet highlight "Highlight some reveal.js text with a color" -<span class="fragment highlight-${1:red}">$0</span> -endsnippet - -snippet fade "grow/shrink/fade-out/fade-{up,down,left,right}/current-visible" -<p class="fragment ${1:grow}">$0</p> -endsnippet diff --git a/.vim/UltiSnips/mail.snippets b/.vim/UltiSnips/mail.snippets @@ -1,9 +0,0 @@ -snippet sig "Insert plain-text email signature" --- -Anders Damsgaard --- -Academia: https://adamsgaard.dk -Photography: https://andersdamsgaard.com -PGP public key: https://adamsgaard.dk/ad-public-key.txt -PGP key fingerprint: 5C95 9DF2 43CE 4DD1 7A5B 2610 B790 F4AD 1BF8 58FE -endsnippet diff --git a/.vim/UltiSnips/markdown.snippets b/.vim/UltiSnips/markdown.snippets @@ -1,10 +0,0 @@ -snippet fmatter "Insert yaml frontmatter for HTML" ---- -title: ${1:Title} -date: ${2:`date +%Y-%m-%d`} -tags: $3 ---- - -# $1 -$0 -endsnippet diff --git a/.vim/UltiSnips/tex.snippets b/.vim/UltiSnips/tex.snippets @@ -1,188 +0,0 @@ -priority 1 - -snippet eq "Insert equation environment" -\begin{equation} - $0 - \label{eq:$1} -\end{equation} -endsnippet - -snippet Eq "Insert reference to equation" -(Eq.~\ref{eq:$0}) -endsnippet - -snippet columnframe "Insert Beamer slide with two columns" -\begin{frame}{$1} - \begin{columns} - \begin{column}{${2:0.50}\textwidth} - $4 - \end{column} - \begin{column}{${3:0.50}\textwidth} - $5 - \end{column} - \end{columns} -\end{frame} -endsnippet - -snippet fig "Insert figure environment" -\begin{figure}[${5:htbp}] - \includegraphics[width=$1\textwidth]{$2} - \caption{\label{fig:${3:unnamed}}% - $4 - } -\end{figure} -endsnippet - -snippet includegraphics "Include graphics (no figure env)" -\includegraphics[width=$1\textwidth]{$2} -endsnippet - -snippet Fig "Insert reference to figure" -(Fig.~\ref{fig:$0}) -endsnippet - -# snippet sec "Insert section" -# \section{$1}% -# \label{sec:$2} -# $0 -# endsnippet - -snippet Sec "Insert reference to section" -(Section~\ref{sec:$0}) -endsnippet - -# snippet subsec "Insert subsection" -# \subsection{$1}% -# \label{subsec:$2} -# $0 -# endsnippet - -snippet Subsec "Insert reference to subsection" -(Section~\ref{subsec:$0}) -endsnippet - -snippet tab "Insert table environment" -\begin{table}[${1:htpb}] - \centering - \caption{$2} - \label{tab:${3:unnamed}} - \begin{tabular}{${4:c}} - $0 - \end{tabular} -\end{table} - -endsnippet - -snippet Tab "Insert reference to table" -(Tab.~\ref{fig:$0}) -endsnippet - -snippet vec "Insert boldsymbol vector" -\boldsymbol{$0} -endsnippet - -snippet $vec "Insert boldsymbol vector" -$\boldsymbol{$0}$ -endsnippet - -snippet vec_ "Insert boldsymbol vector" -\boldsymbol{$1}_\text{$2}^{$3} -endsnippet - -snippet $vec_ "Insert boldsymbol vector" -$\boldsymbol{$1}_\text{$2}^{$3}$ -endsnippet - -snippet article "Blank article template" -\documentclass[a4paper,twoside,onecolumn,10pt]{article} - -%% Language -\usepackage[english]{babel} % break words - -%\captionnamefont{\bfseries\footnotesize} -%\captiontitlefont{\footnotesize} -%\captionnamefont{\bfseries} -%\captiontitlefont{} -%\captionstyle{} -%\captiondelim{. } -%\changecaptionwidth{} -%\captionwidth{0.8\linewidth} - -%\usepackage[rightcaption]{sidecap} - -%% Font settings (recommended in Butterick's practical typography) -% http://practicaltypography.com/ -\usepackage[T1]{fontenc} % Font encoding -\usepackage{charter} % Serif body font -\usepackage[charter]{mathdesign} % Math font -\usepackage[scale=0.9]{sourcecodepro} % Monospaced fontenc -\usepackage[lf]{FiraSans} % Sans-serif font - -%% Graphics -\usepackage{graphicx} -\usepackage{tikz} % Drawing library - -%% Mathematics, scientific and chemical notation -\usepackage{amsmath} -%\usepackage{mathtools} -\usepackage{booktabs} % \toprule, \midrule and \bottomrule in tabular -\usepackage[detect-all]{siunitx} -\DeclareSIUnit\year{a} -%\usepackage[version=3]{mhchem} - -%% Code typesetting -% http://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings -\usepackage{listings} -% \begin{lstlisting}[float,label=lst:test,caption=A source code test,basicstyle=\ttfamily,language=Python] -\usepackage{color} -\definecolor{mygreen}{rgb}{0,0.6,0} -\definecolor{mygray}{rgb}{0.5,0.5,0.5} -\definecolor{mymauve}{rgb}{0.58,0,0.82} -\lstset{% - numbers=left, - numberstyle=\tiny, - language=Python, - basicstyle=\ttfamily\footnotesize, - captionpos=b, - frame=single, - keepspaces=true, - keywordstyle=\color{blue}, - showstringspaces=false, - stepnumber=1, - tabsize=4, - title=\lstname, - commentstyle=\color{mygreen}, - stringstyle=\color{myauve} -} - -%% Links, colors, citations -\usepackage{color} -%\definecolor{AUblue}{rgb}{0.0, 0.3, 0.5} -%\usepackage[colorlinks=true,linkcolor=red,citecolor=AUblue]{hyperref} -\usepackage{hyperref} -%\usepackage{chapterbib} % multiple bibliographies in a document -%\usepackage[round]{natbib} -%\bibliographystyle{abbrvnat} -\usepackage[natbib=true, style=authoryear, bibstyle=authoryear-comp, maxbibnames=10, -maxcitenames=2, backend=bibtex8]{biblatex} -%\bibliography{/Users/ad/articles/own/BIBnew.bib} - -%%% TITLE -\title{${1:Title}} -\author{${2:Anders Damsgaard}} -\date{${3:\today}} - -\begin{document} - -\maketitle - -$0 - -%% Bibliography -%\newpage -%\addcontentsline{toc}{part}{Bibliography} -%\bibliography{/Users/ad/articles/own/BIBnew.bib} -\printbibliography{} - -\end{document} -endsnippet diff --git a/.vim/ftplugin/gitcommit.vim b/.vim/ftplugin/gitcommit.vim @@ -1,7 +0,0 @@ -augroup gitcommit_typography - setlocal spell spl=en_us - setlocal completefunc=emoji#complete - - " instead modify previous commit with <leader>cc - nnoremap <buffer> <silent> <leader>cc :<C-U>Gcommit --amend --date="$(date)"<CR> -augroup END diff --git a/.vim/ftplugin/markdown.vim b/.vim/ftplugin/markdown.vim @@ -1,9 +1,6 @@ augroup markdown_typography - call pencil#init({'wrap': 'soft', 'textwidth': 80, 'conceallevel': 0}) setlocal spell spl=en_us setlocal fdo+=search setlocal nolist setlocal formatoptions=alw2qt " automatically reflow paragraphs - AdVIMsorEnable " detect weasel words, use of passive voice, word duplicates - ALEDisable augroup END diff --git a/.vim/ftplugin/startify.vim b/.vim/ftplugin/startify.vim @@ -1,3 +0,0 @@ -augroup startify_options - IndentLinesDisable -augroup END diff --git a/.vim/ftplugin/tex.vim b/.vim/ftplugin/tex.vim @@ -12,20 +12,14 @@ augroup latex_options " s = conceal superscripts/subscripts let g:tex_conceal="agm" - NoMatchParen " disable paranthesis matching for faster performance - " use latexmk as make program for continuous compilation "setlocal makeprg=latexmk\ -pdf\ % setlocal makeprg=latexmk\ -lualatex\ % - " or automake in tmux window: + " or automake in tmux window: nnoremap <leader>p :!tmux new-window -a -n "latexmk" "latexmk -pdf -pv -f %" \; select-window -l<cr><cr>:echo "Compiling once in new tmux window"<cr> nnoremap <leader>P :!tmux new-window -a -n "latexmk" "latexmk -pdf -pvc -f %" \; select-window -l<cr><cr>:echo "Autocompiling in new tmux window"<cr> - " disable continuous and slow chktex linting - let g:ale_lint_on_text_changed = 'never' - let g:ale_lint_on_enter = 0 - setlocal commentstring=%\ %s augroup END @@ -35,5 +29,4 @@ augroup latex_typography setlocal fdo+=search setlocal list setlocal formatoptions=alw2qt " automatically reflow paragraphs - AdVIMsorEnable " detect weasel words, use of passive voice, word duplicates augroup END diff --git a/.vim/plugin/00-general.vim b/.vim/plugin/00-general.vim @@ -1,48 +0,0 @@ -set clipboard=unnamed " use system clipboard -set dictionary+=/usr/share/dict/words " word completion using Ctrl-x Ctrl-k -set directory=.,~/tmp,/var/tmp,/tmp " location for swap files -set expandtab " use the appropriate number of spaces for <Tab> -set go+=c " do not show popups in gui -set hlsearch " highlight search matches -set ignorecase " case-insensitive search -set incsearch " search as you type -set laststatus=2 " always show the statusline -set lbr " break lines between words -set list " rendering of invisible characters -set listchars=tab:▸\ ,eol:¬ " Use symbols for tab and end-of-line -set nojoinspaces " disable double spaces after periods -set nomodeline " disable per-file options -set pastetoggle=<F2> " toggle paste mode -set scrolloff=3 " show context above-below cursorline -set shiftwidth=4 " width for autoindents -set smartcase " case-sensitive search if any caps -set tabstop=4 " number of spaces for tab -set textwidth=80 " default line width in number of characters -set wildmenu " show a navigable menu for tab completion -set wildmode=longest,list,full - -" specify mutt aliases path, autocomplete aliases with @@ in insert mode -let g:mutt_aliases_file = '~/.mutt/aliases' - -" split size for :Lex[plore] and :Hex[plore]. Percentage when positive, line/col -" number when negative -let g:netrw_winsize = 20 - -" use faster :grep alternatives when available -if executable("rg") - set grepprg=rg\ --vimgrep\ --no-heading - set grepformat=%f:%l:%c:%m,%f:%l:%m -elseif executable("ag") - set grepprg=ag\ --nogroup\ --nocolor\ --ignore-case\ --column - set grepformat=%f:%l:%c:%m,%f:%l:%m -endif - -function! StripTrailingWhitespace() - if !&binary && &filetype != 'diff' - normal mz - normal Hmy - %s/\s\+$//e - normal 'yz<cr> - normal `z - endif -endfunction diff --git a/.vim/plugin/appearance.vim b/.vim/plugin/appearance.vim @@ -1,95 +0,0 @@ -" highlight 81st column -set colorcolumn=+1 - -augroup GVimTweaks - if has("gui_running") - set guioptions-=T " no toolbar - set guioptions-=m " no menubar - set guioptions-=r " no right-hand scroll bar - set guioptions-=L " no left-hand scroll bar - if has("gui_gtk2") || has("gui_gtk3") - set guifont=Pragmata\ Pro\ 10 - elseif has("gui_macvim") - set guifont=Menlo\ Regular:h14 - elseif has("gui_win32") - "set guifont=Consolas:h11:cANSI - set guifont=PragmataPro:h11 - endif - endif -augroup end - -colorscheme adbasic - -" Show syntax highlighting groups for word under cursor -nnoremap <C-S-P> :call <SID>SynStack()<CR> -function! <SID>SynStack() - if !exists("*synstack") - return - endif - echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') -endfunc - -augroup AleAppearance - let g:ale_sign_error = '✖' - let g:ale_sign_warning = '⚠' - - highlight ALEErrorSign ctermbg=NONE ctermfg=Red - highlight ALEWarningSign ctermbg=NONE ctermfg=Yellow - - highlight ALEError ctermbg=NONE ctermfg=Red - highlight ALEWarning ctermbg=NONE ctermfg=Yellow -augroup end - -" statusline helper functions -function! StatuslineLinterWarnings() abort - let l:counts = ale#statusline#Count(bufnr('')) - let l:all_errors = l:counts.error + l:counts.style_error - let l:all_non_errors = l:counts.total - l:all_errors - return l:all_non_errors == 0 ? '' : printf(' %d ⚠ ', all_non_errors) -endfunction -" -function! StatuslineLinterErrors() abort - let l:counts = ale#statusline#Count(bufnr('')) - let l:all_errors = l:counts.error + l:counts.style_error - let l:all_non_errors = l:counts.total - l:all_errors - return l:all_errors == 0 ? '' : printf(' %d ✖', all_errors) -endfunction - -function! StatuslineLinterOK() abort - let l:counts = ale#statusline#Count(bufnr('')) - let l:all_errors = l:counts.error + l:counts.style_error - let l:all_non_errors = l:counts.total - l:all_errors - return l:counts.total == 0 ? '✓' : '' -endfunction - -augroup StatuslineConfig - - " define custom highlight groups for statusline coloring - highlight User1 ctermfg=NONE guifg=#d0d0d0 ctermbg=NONE guibg=#585858 - " highlight User2 ctermfg=NONE guifg=#969696 ctermbg=NONE guibg=#585858 - " highlight User3 ctermbg=NONE guibg=#808080 ctermfg=NONE guifg=#444444 - " highlight User4 ctermfg=NONE guifg=#d0d0d0 ctermbg=NONE guibg=#444444 - - " empty statusline and populate later - set statusline= - - " left - set statusline+=%1* " set User1 color - set statusline+=\%t\ " tail of filename - " set statusline+=%4* " set User4 color - set statusline+=\ %h%w%m%r\ " flags for help file, preview, modified, R/O - "set statusline+=%#LineNr# " set default background - - " center spacing - set statusline+=%= " add separation between left and right items - - " right - " set statusline+=%4* " set background color - if &rtp =~ 'ale' - set statusline+=%7*%{StatuslineLinterWarnings()}%4* " ALE warnings - set statusline+=%6*%{StatuslineLinterErrors()}%4* " ALE errors - set statusline+=%{StatuslineLinterOK()} " ALE ok - endif - " set statusline+=%3* " set User3 color - set statusline+=\ %c:%l " line and column view -augroup END diff --git a/.vim/plugin/correct.vim b/.vim/plugin/correct.vim @@ -1,21 +0,0 @@ -let user_correct_dict = { - \ 'Anders': ['ANders'], - \ 'anders@adamsgaard.dk': ['@@'], - \ 'https://adamsgaard.dk': ['adweb'], - \ } - -augroup litecorrect - autocmd! - autocmd FileType mail,markdown,tex call litecorrect#init(user_correct_dict) -augroup END - -augroup danish_symbols - " escape any of these by pressinv C-v before inserting the character - inoremap AE æ - inoremap OE ø - inoremap AA å -augroup END - -augroup abbreviations - iabbrev ssig -- <cr>Anders Damsgaard, Ph.D.<cr>https://adamsgaard.dk -augroup END diff --git a/.vim/plugin/keybinds.vim b/.vim/plugin/keybinds.vim @@ -1,145 +0,0 @@ -""" Keyboard shortcuts - -" use space instead of \ as leader -let mapleader="\<Space>" - -" Shortcut to reload .vimrc and ~/.vim/plugin/*.vim -nnoremap <leader>R :source $MYVIMRC<cr>:runtime! plugin/*.vim<cr>:echo "Configuration reloaded"<cr> - -nnoremap <Leader>w :w<cr> -nnoremap <Leader>W :wa<cr> -nnoremap <Leader>q :q<cr> -nnoremap <leader>Q :qa<cr> -nnoremap <Leader>x :x<cr> - -" toggle spelling -nnoremap <leader>s :set spell!<cr> - -" toggle line numbering -nnoremap <leader>N :set number!<cr> - -" toggle relative line numbering -nnoremap <leader>n :set relativenumber!<cr> - -" netrw -nnoremap <leader>d :Lex<cr> - -" https://www.vi-improved.org/recommendations/ -"" add files with wildcards -nnoremap <leader>a :argadd <c-r>=fnameescape(expand('%:p:h'))<cr>/*<c-d> -"" go to file open prompt -nnoremap <leader>e :e **/ -nnoremap <leader>g :grep<space> -"" ilist function from qlist, make ilist go into quickfix window -nnoremap <leader>i :Ilist<space> -nnoremap <leader>m :make<cr> -autocmd VimEnter * if exists(":Make") | - \ exe "nnoremap <leader>m :Make<cr>" | - \ endif - -"" strip trailing whitespace -nnoremap <leader>s :call StripTrailingWhitespace()<cr> -"" go to last used buffer -nnoremap <leader><tab> :b#<cr> - -nnoremap <leader>% :vsplit<space> -nnoremap <leader>" :split<space> - -" shortcuts to commonly used files -nnoremap <leader>CC :e $MYVIMRC<cr> -nnoremap <leader>CO :e ~/.vim/plugin/ -nnoremap <leader>CK :e ~/.vim/plugin/keybinds.vim<cr> -nnoremap <leader>CA :e ~/.vim/plugin/appearance.vim<cr> -nnoremap <leader>CG :e ~/.vim/plugin/00-general.vim<cr> -nnoremap <leader>CP :e ~/.vim/plugins.vim<cr> -nnoremap <leader>T :e ~/doc/todo.md<cr> -nnoremap <leader>B :e $BIB \| :windo normal G<cr> - -nnoremap <leader>r :read !scholarref<space> - -" insert date and time -nnoremap <leader>D :read !date +"\# \%Y-\%m-\%d \%T \%Z (\%z UTC)"<cr> - -" toggle x mark in checklist fields -nnoremap <leader>X :s/\[[x ]\]/\=submatch(0) == '[x]' ? '[ ]': '[x]'/<cr>:noh<cr> - -if exists(':tnoremap') - " escape from terminal mode - tnoremap <Esc> <C-\><C-n> - - " send escape to terminal - tnoremap <M-[> <Esc> - tnoremap <C-v><Esc> <Esc> - - " navigate away from terminals - tnoremap <C-h> <C-\><C-n><C-w>h - tnoremap <C-j> <C-\><C-n><C-w>j - tnoremap <C-k> <C-\><C-n><C-w>k - tnoremap <C-l> <C-\><C-n><C-w>l -end - -" launch terminal in current window -nnoremap <leader><cr> :terminal<cr> - -" bindings to fugitive -nnoremap <leader>ga :Gwrite<cr> -nnoremap <leader>gm :Gmove -nnoremap <leader>gb :Gblame<cr> -nnoremap <leader>gw :Gbrowse<cr> -nnoremap <leader>gs :Gstatus<cr> -nnoremap <leader>gc :Gcommit -v -S<cr> -nnoremap <leader>gp :Gpush<cr> -nnoremap <leader>gP :Gpull<cr> - -" Use home row keys as Esc -inoremap jk <Esc> - -" using fzf.vim -augroup FzfBinds - autocmd VimEnter * if exists(":Buffers") | - \ exe "nnoremap <leader><leader> :Rg<cr>" | - \ exe "nnoremap <leader>o :History<cr>" | - \ exe "nnoremap <leader>, :Buffers<cr>" | - \ exe "nnoremap <leader>f :Files<cr>" | - \ exe "nnoremap <leader>F :GFiles<cr>" | - \ exe "nnoremap <leader>l :Lines<cr>" | - \ exe "nnoremap <leader>t :Tags<cr>" | - \ else | - \ exe "nnoremap <leader>o :browse oldfiles<cr>" | - \ exe "nnoremap <leader>, :b <c-d>" | - \ exe "nnoremap <leader>f :e <c-d>" | - \ endif -augroup end - -" ALE navigation -nnoremap <silent> [W :ALEFirst<cr> -nnoremap <silent> [w :ALEPreviousWrap<cr> -nnoremap <silent> ]w :ALENextWrap<cr> -nnoremap <silent> ]W :ALELast<cr> - -" cycle through quickfix items -nnoremap <silent> ]c :cnext<cr> -nnoremap <silent> [c :cprevious<cr> - -" Add completion bindings (cycle with C-n, C-p), see :h ins-completion -" <C-x><C-l>: while line -" <C-x><C-n>: keywords in current file -" <C-x><C-i>: keywords in current and included files -" <C-x><C-k>: keywords in dictionary (:set dictionary) -" <C-x><C-t>: keywords in thesaurus (not functional) -" <C-x><C-]>: tags -" <C-x><C-f>: file names -" <C-x><C-d>: definitions or macros -" <C-x><C-v>: vim command-line -" <C-x><C-v>: omni completion -" <C-x>s: spelling suggestions - -" show as presentation in sent -nnoremap <silent><F7> :w!<cr>:Start! sent <c-r>%<cr><cr> - -" save current session -" (open with `vim -S <sessionname>.vim` or :source <sessionname> -nnoremap <leader>S :mksession! <c-r>%.session.vim - -" analyze written text with statistics and neural network -nnoremap <leader>L :w<cr>:cexpr system('languagetool-vim ' . shellescape(expand('%')))<cr> diff --git a/.vim/plugins.vim b/.vim/plugins.vim @@ -1,74 +0,0 @@ -""""" PLUGIN SOURCES """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -call plug#begin('~/.vim/vim-plugs') " Specify a directory for plugins - -""""" Misc """""" -Plug 'tpope/vim-unimpaired' " nav. errors with ]q, newlines with ]spc - -"""""" File system """"""" -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } -Plug 'junegunn/fzf.vim' " fzf commands from within vim -Plug 'ludovicchabant/vim-gutentags' " automatic tag generation -Plug 'tpope/vim-eunuch' " :SudoWrite, :Rename, :Move, etc - -"""""" Syntax checking """""" -Plug 'w0rp/ale' " asynchronous syntax check -Plug 'lukhio/adVIMsor', { 'on': 'AdVIMsorEnable' } " checks with :AdVIMsor* - -"""""" Buffer motion """""" -Plug 'justinmk/vim-sneak' " move cursor s{char}{char}, use cl for sub - -""""""" Text editing """""" -Plug 'tpope/vim-surround' " modify surrounding symbols -Plug 'tpope/vim-repeat' " repeat plugin bindings with . -Plug 'tomtom/tcomment_vim' " comment line with gcc, motion with gc -Plug 'reedes/vim-litecorrect' " autocorrect common typos -Plug 'reedes/vim-pencil' " used for line wrapping in mails - -"""""" Autocomplete """""" -Plug 'honza/vim-snippets' " snippets are separate from ultisnips -Plug 'SirVer/ultisnips' " complete boilerplate code - -"""""" Version control """""" -Plug 'tpope/vim-fugitive' " :Gread, :Gwrite, etc. -Plug 'airblade/vim-gitgutter' " show line changes since last git commit - -"""""" Processes """""" -Plug 'tpope/vim-dispatch' " for asynchronous :Make - - -"""""" File types """""" - -" Julia -Plug 'JuliaLang/julia-vim' - -" Python -Plug 'nvie/vim-flake8' -Plug 'vim-scripts/indentpython.vim' - -" Markdown -Plug 'tpope/vim-markdown' - -" Mail -Plug 'vim-scripts/mutt-aliases', { 'for': 'mail' } " complete aliases w C-x C-u - -call plug#end() " Initialize plugin system - - -""""" PLUGIN SETTINGS """""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -let g:gitgutter_map_keys = 0 - -let g:sneak#label = 1 - -" better key bindings for UltiSnipsExpandTrigger -let g:UltiSnipsExpandTrigger = "<tab>" -let g:UltiSnipsJumpForwardTrigger = "<tab>" -let g:UltiSnipsJumpBackwardTrigger = "<s-tab>" - -" vim-markdown configuration -let g:markdown_fenced_languages = ['html', 'python', 'bash=sh', 'julia', 'c', 'cpp'] -let g:markdown_syntax_conceal = 0 - -" ignore .gitignore files from ctags -let g:gutentags_file_list_command = 'rg --files' diff --git a/.vim/vimrc b/.vim/vimrc @@ -1,6 +1,202 @@ -" make sure that plugins are sourced first -if has("win32") - source ~/vimfiles/plugins.vim -else - source ~/.vim/plugins.vim +set nocompatible +filetype plugin indent on +syntax enable +set clipboard=unnamed " use system clipboard +set dictionary+=/usr/share/dict/words " word completion using Ctrl-x Ctrl-k +set directory=.,~/tmp,/var/tmp,/tmp " location for swap files +set go+=c " do not show popups in gui +set hlsearch " highlight search matches +set ignorecase " case-insensitive search +set incsearch " search as you type +set laststatus=2 " always show the statusline +set lbr " break lines between words +set list " rendering of invisible characters +set listchars=tab:▸\ ,eol:¬ " Use symbols for tab and end-of-line +set nojoinspaces " disable double spaces after periods +set nomodeline " disable per-file options +set pastetoggle=<F2> " toggle paste mode +set scrolloff=3 " show context above-below cursorline +set shiftwidth=4 " width for autoindents +set smartcase " case-sensitive search if any caps +set tabstop=4 " number of spaces for tab +set textwidth=80 " default line width in number of characters +set wildmenu " show a navigable menu for tab completion +set wildmode=longest,list,full + +" use faster :grep alternatives when available +if executable("rg") + set grepprg=rg\ --vimgrep\ --no-heading + set grepformat=%f:%l:%c:%m,%f:%l:%m +elseif executable("ag") + set grepprg=ag\ --nogroup\ --nocolor\ --ignore-case\ --column + set grepformat=%f:%l:%c:%m,%f:%l:%m endif + +" highlight 81st column +set colorcolumn=+1 + +colorscheme adbasic + +" statusline helper functions +function! StatuslineLinterWarnings() abort + let l:counts = ale#statusline#Count(bufnr('')) + let l:all_errors = l:counts.error + l:counts.style_error + let l:all_non_errors = l:counts.total - l:all_errors + return l:all_non_errors == 0 ? '' : printf(' %d ⚠ ', all_non_errors) +endfunction +" +function! StatuslineLinterErrors() abort + let l:counts = ale#statusline#Count(bufnr('')) + let l:all_errors = l:counts.error + l:counts.style_error + let l:all_non_errors = l:counts.total - l:all_errors + return l:all_errors == 0 ? '' : printf(' %d ✖', all_errors) +endfunction + +function! StatuslineLinterOK() abort + let l:counts = ale#statusline#Count(bufnr('')) + let l:all_errors = l:counts.error + l:counts.style_error + let l:all_non_errors = l:counts.total - l:all_errors + return l:counts.total == 0 ? '✓' : '' +endfunction + +augroup StatuslineConfig + + " define custom highlight groups for statusline coloring + highlight User1 ctermfg=NONE guifg=#d0d0d0 ctermbg=NONE guibg=#585858 + " highlight User2 ctermfg=NONE guifg=#969696 ctermbg=NONE guibg=#585858 + " highlight User3 ctermbg=NONE guibg=#808080 ctermfg=NONE guifg=#444444 + " highlight User4 ctermfg=NONE guifg=#d0d0d0 ctermbg=NONE guibg=#444444 + + " empty statusline and populate later + set statusline= + + " left + set statusline+=%1* " set User1 color + set statusline+=\%t\ " tail of filename + " set statusline+=%4* " set User4 color + set statusline+=\ %h%w%m%r\ " flags for help file, preview, modified, R/O + "set statusline+=%#LineNr# " set default background + + " center spacing + set statusline+=%= " add separation between left and right items + + " right + " set statusline+=%3* " set User3 color + set statusline+=\ %c:%l " line and column view +augroup END +let user_correct_dict = { + \ 'Anders': ['ANders'], + \ 'anders@adamsgaard.dk': ['@@'], + \ 'https://adamsgaard.dk': ['adweb'], + \ } + +augroup danish_symbols + " escape any of these by pressinv C-v before inserting the character + inoremap AE æ + inoremap OE ø + inoremap AA å +augroup END + +augroup abbreviations + iabbrev ssig -- <cr>Anders Damsgaard<cr>https://adamsgaard.dk +augroup END +""" Keyboard shortcuts + +" use space instead of \ as leader +let mapleader="\<Space>" + +" Shortcut to reload .vimrc and ~/.vim/plugin/*.vim +nnoremap <leader>R :source $MYVIMRC<cr>:runtime! plugin/*.vim<cr>:echo "Configuration reloaded"<cr> + +nnoremap <Leader>w :w<cr> +nnoremap <Leader>W :wa<cr> +nnoremap <Leader>q :q<cr> +nnoremap <leader>Q :qa<cr> +nnoremap <Leader>x :x<cr> + +nnoremap <leader>s :set spell!<cr> +nnoremap <leader>N :set number!<cr> +nnoremap <leader>n :set relativenumber!<cr> + +nnoremap <leader>d :Lex<cr> + +" https://www.vi-improved.org/recommendations/ +"" add files with wildcards +nnoremap <leader>a :argadd <c-r>=fnameescape(expand('%:p:h'))<cr>/*<c-d> +"" go to file open prompt +nnoremap <leader>e :e **/ +nnoremap <leader>g :grep<space> +"" ilist function from qlist, make ilist go into quickfix window +nnoremap <leader>i :Ilist<space> +nnoremap <leader>m :make<cr> +autocmd VimEnter * if exists(":Make") | + \ exe "nnoremap <leader>m :Make<cr>" | + \ endif + +"" go to last used buffer +nnoremap <leader><tab> :b#<cr> + +nnoremap <leader>% :vsplit<space> +nnoremap <leader>" :split<space> + +" shortcuts to commonly used files +nnoremap <leader>CC :e $MYVIMRC<cr> +nnoremap <leader>T :e ~/doc/todo.md<cr> +nnoremap <leader>B :e $BIB \| :windo normal G<cr> + +nnoremap <leader>r :read !scholarref<space> + +" insert date and time +nnoremap <leader>D :read !date +"\# \%Y-\%m-\%d \%T \%Z (\%z UTC)"<cr> + +" toggle x mark in checklist fields +nnoremap <leader>X :s/\[[x ]\]/\=submatch(0) == '[x]' ? '[ ]': '[x]'/<cr>:noh<cr> + +if exists(':tnoremap') + " escape from terminal mode + tnoremap <Esc> <C-\><C-n> + + " send escape to terminal + tnoremap <M-[> <Esc> + tnoremap <C-v><Esc> <Esc> + + " navigate away from terminals + tnoremap <C-h> <C-\><C-n><C-w>h + tnoremap <C-j> <C-\><C-n><C-w>j + tnoremap <C-k> <C-\><C-n><C-w>k + tnoremap <C-l> <C-\><C-n><C-w>l +end + +" launch terminal in current window +nnoremap <leader><cr> :terminal<cr> + +" Use home row keys as Esc +inoremap jk <Esc> + +nnoremap <leader>o :browse oldfiles<cr> +nnoremap <leader>, :b <c-d> +nnoremap <leader>f :e <c-d> + +" cycle through quickfix items +nnoremap <silent> ]c :cnext<cr> +nnoremap <silent> [c :cprevious<cr> + +" Add completion bindings (cycle with C-n, C-p), see :h ins-completion +" <C-x><C-l>: while line +" <C-x><C-n>: keywords in current file +" <C-x><C-i>: keywords in current and included files +" <C-x><C-k>: keywords in dictionary (:set dictionary) +" <C-x><C-t>: keywords in thesaurus (not functional) +" <C-x><C-]>: tags +" <C-x><C-f>: file names +" <C-x><C-d>: definitions or macros +" <C-x><C-v>: vim command-line +" <C-x><C-v>: omni completion +" <C-x>s: spelling suggestions + +" save current session +" (open with `vim -S <sessionname>.vim` or :source <sessionname> +nnoremap <leader>S :mksession! <c-r>%.session.vim + +" analyze written text with statistics and neural network +nnoremap <leader>L :w<cr>:cexpr system('languagetool-vim ' . shellescape(expand('%')))<cr> diff --git a/.vim/vimrc.noplugs b/.vim/vimrc.noplugs @@ -1,8 +0,0 @@ -" temporarily fix deprecation warning -if has('python3') - silent! python3 1 -endif - -set nocompatible -filetype plugin indent on -syntax enable diff --git a/.vim/vimrc.tiny b/.vim/vimrc.tiny @@ -1,13 +0,0 @@ -" Vim configuration file, in effect when invoked as "vi". The aim of this -" configuration file is to provide a Vim environment as compatible with the -" original vi as possible. Note that ~/.vimrc configuration files as other -" configuration files in the runtimepath are still sourced. -" When Vim is invoked differently ("vim", "view", "evim", ...) this file is -" _not_ sourced; /etc/vim/vimrc and/or /etc/vim/gvimrc are. - -" Debian system-wide default configuration Vim -set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim74,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after - -set compatible - -" vim: set ft=vim: diff --git a/.w3m/bookmark.html b/.w3m/bookmark.html @@ -1 +0,0 @@ -../code/adamsgaard.dk/bookmark.html- \ No newline at end of file diff --git a/.w3m/config b/.w3m/config @@ -1,139 +0,0 @@ -simple_preserve_space 0 -gb18030_as_ucs 0 -strict_iso2022 1 -use_jisx0213 0 -use_jisx0212 0 -use_jisx0201k 0 -use_jisc6226 0 -use_jisx0201 0 -use_gb12345_map 0 -fix_width_conv 1 -search_conv 1 -pre_conv 0 -ucs_conv 1 -use_language_tag 1 -east_asian_width 0 -use_combining 1 -use_wide 1 -ext_halfdump 0 -follow_locale 1 -system_charset UTF-8 -auto_detect 2 -document_charset UTF-8 -display_charset UTF-8 -cookie_avoid_wrong_number_of_dots -cookie_accept_domains -cookie_reject_domains -accept_bad_cookie 0 -accept_cookie 0 -show_cookie 1 -use_cookie 1 -ssl_ca_file -ssl_ca_path /etc/ssl/certs -ssl_key_file -ssl_cert_file -ssl_verify_server 1 -ssl_forbid_method 2 -no_cache 0 -noproxy_netaddr 0 -no_proxy -ftp_proxy -https_proxy -http_proxy -use_proxy 1 -max_news 50 -nntpmode -nntpserver -dns_order 0 -meta_refresh 1 -follow_redirection 10 -default_url 1 -retry_http 1 -argv_is_url 1 -accept_media text/html, text/*;q=0.5, image/*, application/*, video/*, audio/*, zz-application/*, message/*, x-scheme-handler/*, inode/* -accept_encoding gzip, compress, bzip, bzip2, deflate -accept_language en;q=1.0 -no_referer 0 -user_agent -pre_form_file ~/.w3m/pre_form -ftppass_hostnamegen 0 -ftppasswd anonymous@ -disable_secret_security_check 0 -passwd_file ~/.w3m/passwd -use_lessopen 0 -bgextviewer 1 -extbrowser3 -extbrowser2 /Applications/Safari.app -extbrowser /usr/bin/mozilla -mailer -mailto_options 1 -editor sensible-editor -urimethodmap ~/.w3m//urimethodmap, /etc/w3m/urimethodmap -mailcap ~/.w3m/mailcap, /etc/w3m/mailcap, /etc/mailcap -mime_types ~/.w3m/mime.types, /etc/mime.types -index_file -cgi_bin -personal_document_root -document_root -keymap_file keymap -preserve_timestamp 1 -auto_uncompress 0 -decode_cte 0 -clear_buffer 1 -fixed_wheel_scroll_count 5 -relative_wheel_scroll_ratio 30 -relative_wheel_scroll 0 -reverse_mouse 0 -use_mouse 1 -ignorecase_search 1 -wrap_search 1 -mark_all_pages 0 -vi_prec_num 1 -emacs_like_lineedit 0 -mark 0 -close_tab_back 0 -confirm_qq 1 -save_hist 1 -history 10000 -use_history 1 -pagerline 10000 -visited_color magenta -visited_anchor 0 -active_color cyan -active_style 0 -bg_color terminal -mark_color cyan -form_color red -image_color green -anchor_color blue -basic_color terminal -color 1 -nextpage_topline 0 -label_topline 0 -show_srch_str 1 -show_lnum 0 -fold_line 0 -pseudo_inlines 1 -display_image 0 -view_unseenobject 1 -ignore_null_img_alt 1 -display_ins_del 1 -fold_textarea 0 -graphic_char 0 -alt_entity 0 -multicol 0 -dictcommand file:///$LIB/w3mdict.cgi -use_dictcommand 0 -dirlist_cmd file:///$LIB/dirlist.cgi -ext_dirlist 1 -display_lineinfo 0 -decode_url 0 -display_link_number 1 -display_link 1 -open_tab_dl_list 1 -open_tab_blank 0 -target_self 0 -frame 0 -pixel_per_char 10 -indent_incr 4 -tabstop 8 diff --git a/.w3m/keymap b/.w3m/keymap @@ -1,143 +0,0 @@ -# A sample of ~/.w3m/keymap (default) -# -# Ctrl : C-, ^ -# Escape: ESC-, M-, ^[ -# Space : SPC, ' ' -# Tab : TAB, ^i, ^I -# Delete: DEL, ^? -# Up : UP, ^[[A -# Down : DOWN, ^[[B -# Right : RIGHT, ^[[C -# Left : LEFT, ^[[D - -keymap C-@ MARK -keymap C-a LINE_BEGIN -keymap C-b MOVE_LEFT -keymap C-e LINE_END -keymap C-f MOVE_RIGHT -keymap C-g LINE_INFO -keymap C-h HISTORY -keymap TAB NEXT_LINK -keymap C-j GOTO_LINK -keymap C-k COOKIE -keymap C-l REDRAW -keymap C-m GOTO_LINK -keymap C-n MOVE_DOWN -keymap C-p MOVE_UP -keymap C-q CLOSE_TAB -keymap C-r ISEARCH_BACK -keymap C-s ISEARCH -keymap C-t TAB_LINK -keymap C-u PREV_LINK -keymap C-v NEXT_PAGE -keymap C-w WRAP_TOGGLE -keymap C-z SUSPEND - -keymap SPC NEXT_PAGE -keymap ! SHELL -keymap \" REG_MARK -keymap # PIPE_SHELL -keymap $ LINE_END -keymap ( UNDO -keymap ) REDO -keymap + NEXT_PAGE -keymap , LEFT -keymap - PREV_PAGE -keymap . RIGHT -keymap / SEARCH -keymap : MARK_URL -keymap ";" MARK_WORD -keymap < SHIFT_LEFT -keymap = INFO -keymap > SHIFT_RIGHT -keymap ? SEARCH_BACK -keymap @ READ_SHELL -keymap B BACK -keymap D DOWNLOAD_LIST -keymap E EDIT -keymap F FRAME -keymap G END -keymap H HELP -keymap I VIEW_IMAGE -keymap J UP -keymap K DOWN -keymap L LIST -keymap M EXTERN -keymap N SEARCH_PREV -keymap Q EXIT -keymap R RELOAD -keymap S SAVE_SCREEN -keymap T NEW_TAB -keymap U GOTO -keymap V LOAD -keymap W PREV_WORD -keymap Z CENTER_H -keymap [ LINK_BEGIN -keymap ] LINK_END -keymap \^ LINE_BEGIN -keymap a SAVE_LINK -keymap b PREV_PAGE -keymap c PEEK -keymap g BEGIN -keymap h MOVE_LEFT -keymap i PEEK_IMG -keymap j MOVE_DOWN -keymap k MOVE_UP -keymap l MOVE_RIGHT -keymap m MOUSE_TOGGLE -keymap n SEARCH_NEXT -keymap o OPTIONS -keymap q QUIT -keymap r VERSION -keymap s SELECT_MENU -keymap u PEEK_LINK -keymap v VIEW -keymap w NEXT_WORD -keymap z CENTER_V -keymap { PREV_TAB -keymap | PIPE_BUF -keymap } NEXT_TAB - -keymap M-TAB PREV_LINK -keymap M-C-j SAVE_LINK -keymap M-C-m SAVE_LINK - -keymap M-: MARK_MID -keymap M-< BEGIN -keymap M-> END -keymap M-I SAVE_IMAGE -keymap M-M EXTERN_LINK -keymap M-W DICT_WORD_AT -keymap M-a ADD_BOOKMARK -keymap M-b BOOKMARK -keymap M-c COMMAND -keymap M-e EDIT_SCREEN -keymap M-g GOTO_LINE -keymap M-k DEFINE_KEY -keymap M-l LIST_MENU -keymap M-m MOVE_LIST_MENU -keymap M-n NEXT_MARK -keymap M-o SET_OPTION -keymap M-p PREV_MARK -keymap M-s SAVE -keymap M-t TAB_MENU -keymap M-u GOTO_RELATIVE -keymap M-v PREV_PAGE -keymap M-w DICT_WORD - -keymap UP MOVE_UP -keymap DOWN MOVE_DOWN -keymap RIGHT MOVE_RIGHT -keymap LEFT MOVE_LEFT - -keymap M-[E MENU -keymap M-[L MENU -keymap M-[Z PREV_LINK - -keymap M-[1~ BEGIN -keymap M-[2~ MENU -keymap M-[4~ END -keymap M-[5~ PREV_PAGE -keymap M-[6~ NEXT_PAGE -keymap M-[28~ MENU - diff --git a/.w3m/style.css b/.w3m/style.css @@ -1 +0,0 @@ -../code/adamsgaard.dk/style.css- \ No newline at end of file diff --git a/.yashrc b/.yashrc @@ -1,6 +1,7 @@ #!/bin/yash -[ -r ~/.config/sh/profile ] && . ~/.config/sh/profile +[ -f $HOME/.config/sh/profile ] && . $HOME/.config/sh/profile +[ -f $HOME/.config/sh/commands ] && . $HOME/.config/sh/commands HISTFILE=~/.yash_history HISTSIZE=65536 @@ -49,92 +50,75 @@ YASH_AFTER_CD=() ## define prompt : ${LOGNAME:=$(logname)} ${HOSTNAME:=$(uname -n)} -#if [ -n "${SSH_CONNECTION-}" ]; then -# _hc='\fy.' # yellow hostname for SSH remote -#else -# #_hc='\fg.' # green hostname for local -# _hc='\fD.' -#fi -#if [ "$(id -u)" -eq 0 ]; then -# _uc='\fr.' # red username for root -# _2c='\fr.' # red PS2 for root -#else -# _uc=$_hc _hc= # same username color as hostname for non-root user -# _2c= # PS2 in normal color for non-root user -#fi -## The main prompt ($YASH_PS1) contains the username, hostname, working -## directory, last exit status (only if non-zero), and $SHLVL (only if -## non-one). -#YASH_PS1=$_uc'${LOGNAME}'$_hc'@${HOSTNAME%%.*}\fd. '\ -#'${${${PWD:/~/\~}##*/}:-$PWD} ${{?:/0/}:+\\fr.$?\\fd. }${{SHLVL-0}:/1}\$ ' -#YASH_PS1R='\fc.${_vcs_info}' -#YASH_PS1S='\fo.' -#YASH_PS2=$_2c'> ' -##YASH_PS2R= -#YASH_PS2S=$YASH_PS1S -#YASH_PS4='\fm.+ ' -#YASH_PS4S='\fmo.' -#unset _hc _uc _2c -## No escape sequences allowed in the POSIXly-correct mode. -#PS1='${LOGNAME}@${HOSTNAME%%.*} '$PS1 -# -# -## define function that updates $_vcs_info and $_vcs_root -#_update_vcs_info() { -# typeset type branch -# { -# read --raw-mode type -# read --raw-mode _vcs_root -# read --raw-mode branch -# } <( -# exec 2>/dev/null -# typeset COMMAND_NOT_FOUND_HANDLER= -# while true; do -# if [ -e .git ] || [ . -ef "${GIT_WORK_TREE-}" ]; then -# printf 'git\n%s\n' "${GIT_WORK_TREE:-$PWD}" -# git branch --no-color | sed -n '/^\*/s/^..//p' -# exit -# elif [ -d .hg ]; then -# printf 'hg\n%s\n' "$PWD" -# exec cat .hg/branch -# elif [ -d .svn ]; then -# printf 'svn\n' -# _vcs_root=$(svn info --show-item=wc-root) -# printf '%s\n' "$_vcs_root" -# path=$(svn info --show-item=relative-url) -# case $path in -# (*/branches/*) -# printf '%s\n' "${${path#*/branches/}%%/*}" -# esac -# exit -# fi -# if [ / -ef . ] || [ . -ef .. ]; then -# exit -# fi -# cd -P .. -# done -# ) -# case "$type#$branch" in -# (hg#default) _vcs_info='hg';; -# (git#master) _vcs_info='git';; -# (*# ) _vcs_info="$type";; -# (* ) _vcs_info="$type@$branch";; -# esac -#} -## update $_vcs_info on each prompt -#PROMPT_COMMAND=("$PROMPT_COMMAND" '_update_vcs_info') - -#PS1=\ -#'${{{PWD:/~/\~}##*/}:-$PWD}'\ -#"${SSH_CONNECTION:+@${HOSTNAME}}"\ -#'${{?:/0/}:+?\\fr.$?\\fd.}'\ -#"\fg\$\fd " -#PS1R= -#PS1S= -#PS2='> ' -#PS2R= -#PS2S=$PS1S -#PS4='\fm.+ ' -#PS4S='\fmo.' +if [ -n "${SSH_CONNECTION-}" ]; then + _hc='\fy.' # yellow hostname for SSH remote +else + _hc='\fg.' # green hostname for local +fi +if [ "$(id -u)" -eq 0 ]; then + _uc='\fr.' # red username for root + _2c='\fr.' # red PS2 for root +else + _uc=$_hc _hc= # same username color as hostname for non-root user + _2c= # PS2 in normal color for non-root user +fi +# The main prompt ($YASH_PS1) contains the username, hostname, working +# directory, last exit status (only if non-zero), and $SHLVL (only if +# non-one). +YASH_PS1=$_uc'${LOGNAME}'$_hc'@${HOSTNAME%%.*}\fd. '\ +'${${${PWD:/~/\~}##*/}:-$PWD} ${{?:/0/}:+\\fr.$?\\fd. }${{SHLVL-0}:/1}\$ ' +YASH_PS1R='\fc.${_vcs_info}' +YASH_PS1S='\fo.' +YASH_PS2=$_2c'> ' +#YASH_PS2R= +YASH_PS2S=$YASH_PS1S +YASH_PS4='\fm.+ ' +YASH_PS4S='\fmo.' +unset _hc _uc _2c +# No escape sequences allowed in the POSIXly-correct mode. +PS1='${LOGNAME}@${HOSTNAME%%.*} '$PS1 -. $HOME/.config/sh/commands +# define function that updates $_vcs_info and $_vcs_root +_update_vcs_info() { + typeset type branch + { + read --raw-mode type + read --raw-mode _vcs_root + read --raw-mode branch + } <( + exec 2>/dev/null + typeset COMMAND_NOT_FOUND_HANDLER= + while true; do + if [ -e .git ] || [ . -ef "${GIT_WORK_TREE-}" ]; then + printf 'git\n%s\n' "${GIT_WORK_TREE:-$PWD}" + git branch --no-color | sed -n '/^\*/s/^..//p' + exit + elif [ -d .hg ]; then + printf 'hg\n%s\n' "$PWD" + exec cat .hg/branch + elif [ -d .svn ]; then + printf 'svn\n' + _vcs_root=$(svn info --show-item=wc-root) + printf '%s\n' "$_vcs_root" + path=$(svn info --show-item=relative-url) + case $path in + (*/branches/*) + printf '%s\n' "${${path#*/branches/}%%/*}" + esac + exit + fi + if [ / -ef . ] || [ . -ef .. ]; then + exit + fi + cd -P .. + done + ) + case "$type#$branch" in + (hg#default) _vcs_info='hg';; + (git#master) _vcs_info='git';; + (*# ) _vcs_info="$type";; + (* ) _vcs_info="$type@$branch";; + esac +} +# update $_vcs_info on each prompt +PROMPT_COMMAND=("$PROMPT_COMMAND" '_update_vcs_info')