dotfiles

My personal home directory config files
git clone https://erai.gay/code/dotfiles/
Log | Files | Refs | LICENSE

commit 15738b54e8f30dea1a345078fb8203bae528dd5f
parent d1f145392784370577dfaa88231be2ae648b3507
Author: erai <erai@omiltem.net>
Date:   Mon, 16 Jun 2025 22:08:00 -0400

import dot files

Diffstat:
D.bashrc | 8--------
AXresources | 39+++++++++++++++++++++++++++++++++++++++
Abash_logout | 1+
Abash_profile | 3+++
Abashrc | 27+++++++++++++++++++++++++++
Abin/post | 3+++
Abin/watch.sh | 18++++++++++++++++++
Agdbinit | 1+
Agitconfig | 17+++++++++++++++++
Agitignore | 4++++
Agnupg/gpg-agent.conf | 1+
Agnupg/keys/brie@brie.gay.asc | 13+++++++++++++
Agnupg/keys/erai@omiltem.net.asc | 23+++++++++++++++++++++++
Agnupg/otrust.txt | 4++++
Agnupg/sshcontrol | 1+
Ainputrc | 1+
Ainstall.sh | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apythonrc | 3+++
Assh/authorized_keys | 1+
Assh/config | 15+++++++++++++++
Assh/known_hosts | 0
Assh/rc | 5+++++
Atmux.conf | 161+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avim/ftdetect/omiltem.vim | 1+
Avim/ftplugin/omiltem.vim | 8++++++++
Avim/indent/omiltem.vim | 40++++++++++++++++++++++++++++++++++++++++
Avim/plugin/postwrite.vim | 8++++++++
Avim/plugin/sensible.vim | 166+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avim/plugin/sudo.vim | 1+
Avim/plugin/writegood.vim | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avim/syntax/omiltem.vim | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Avim/vimrc | 19+++++++++++++++++++
Awgetrc | 1+
Axmodmap | 2++
34 files changed, 806 insertions(+), 8 deletions(-)

diff --git a/.bashrc b/.bashrc @@ -1,8 +0,0 @@ -# ~/.bashrc -set -o vi -export EDITOR=vim -export VISUAL=vim -export TZ=America/New_York -alias ls='ls --color=auto' -alias grep='grep --color=auto' -PS1='\033[0m; \u@\H:\w$(__git_ps1) \D{%s} status $?\n\$' diff --git a/Xresources b/Xresources @@ -0,0 +1,39 @@ +!xterm*reverseVideo: on +xterm*locale: true +xterm*faceName: DeJaVu Sans Mono:size=9 +xterm*vt100*translations: #override \n\ + Shift <Key> Delete: insert-selection(SELECT) \n\ + Shift Ctrl <Key> C: select-end(CLIPBOARD) \n\ + Shift Ctrl <Key> V: insert-selection(CLIPBOARD) \n\ + Shift Ctrl <Key> N: spawn-new-terminal() \n +xterm*selectToClipboard: true +xterm*metaSendsEscape: true +xterm*termName: xterm-256color + +!ivory background and black text +xterm*background: #fffff0 +xterm*foreground: #353535 +!black +xterm*color0: #353535 +xterm*color8: #666666 +!red +xterm*color1: #AE4747 +xterm*color9: #EE6363 +!green +xterm*color2: #85A642 +xterm*color10: #AED957 +!brown/yellow +xterm*color3: #DAA520 +xterm*color11: #FFC125 +!blue +xterm*color4: #3EA2FA +xterm*color12: #87A2FA +!magenta +xterm*color5: #8B7B8B +xterm*color13: #D8BFD8 +!cyan +xterm*color6: #A7A15E +xterm*color14: #F0E68C +!white +xterm*color7: #AAAAAA +xterm*color15: #FFFFFF diff --git a/bash_logout b/bash_logout @@ -0,0 +1 @@ +#!/bin/bash diff --git a/bash_profile b/bash_profile @@ -0,0 +1,3 @@ +#!/bin/bash + +[ -f "${HOME}/.bashrc" ] && source "${HOME}/.bashrc" diff --git a/bashrc b/bashrc @@ -0,0 +1,27 @@ +#!/bin/bash + +set -o vi + +PS1='\033[0m; \u@\H:\w \D{%s} status $?\n\$ ' + +export PATH="${HOME}/.bin:${PATH}" +export EDITOR=vi +export VISUAL=vi +export LANG=en_US.UTF-8 +export TZ=America/New_York +export LESSHISTFILE=- +export PYTHONSTARTUP="${HOME}/.pythonrc" +export HISTCONTROL=ignoreboth:erasedups + +unset HISTFILE + +alias ls='ls --color=auto' +alias grep='grep --color=auto' + +if [ -z "${TMUX:-}" ]; then + history -s 'tmux a || tmux' +fi + +if [ -z "${SSH_AUTH_SOCK}" ]; then + export SSH_AUTH_SOCK="${HOME}/.ssh/agent.S" +fi diff --git a/bin/post b/bin/post @@ -0,0 +1,3 @@ +#!/bin/sh + +: <> ~/.post diff --git a/bin/watch.sh b/bin/watch.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [ $# -lt 1 ]; then + echo "usage: watch.sh [command]" + exit 1 +fi + +echo "$ $*" + +: < ~/.post & pid=$! + +timeout 10 /bin/bash -c "$*" 2>&1 +echo "; status $?" +echo + +wait ${pid} + +exec "$0" "$@" diff --git a/gdbinit b/gdbinit @@ -0,0 +1 @@ +set debuginfod enabled off diff --git a/gitconfig b/gitconfig @@ -0,0 +1,17 @@ +[user] + name = erai + email = erai@omiltem.net + signingKey = 108EF1AE64324E7E512A6B3031FCC9D97A9B4FAB + +[commit] + gpgSign = true + +[merge] + conflictStyle = diff3 + +[core] + excludesFile = ~/.gitignore + editor = vim + +[init] + defaultBranch = main diff --git a/gitignore b/gitignore @@ -0,0 +1,4 @@ +[._]*.sw* +[._]sw* +*.py[cod] +__pycache_/ diff --git a/gnupg/gpg-agent.conf b/gnupg/gpg-agent.conf @@ -0,0 +1 @@ +enable-ssh-support diff --git a/gnupg/keys/brie@brie.gay.asc b/gnupg/keys/brie@brie.gay.asc @@ -0,0 +1,13 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mDMEZrqHYRYJKwYBBAHaRw8BAQdAFEU7Kv80H21kFThkONVXvDgoAMqJ7rap0kj1 +CcEa8JS0FEJyaWUgPGJyaWVAYnJpZS5nYXk+iJMEExYKADsCGwMFCwkIBwICIgIG +FQoJCAsCBBYCAwECHgcCF4AWIQQ7EY/61mt+7jqfUBeUv/g1Wps9RgUCZrqJvAAK +CRCUv/g1Wps9RpnZAP4jyqIW6SL/gCNcdsCF05/sNPONuMKdb1mefMITD3YxrQEA +5KRmMjMsiBeMXNW4EDezCzgnCCJjG1KgAheEakuFsAO4OARmuodhEgorBgEEAZdV +AQUBAQdAibLJLY7GaCBAAnyoM/2FsZmUGIVNO3AADJ4cibefDCoDAQgHiHgEGBYK +ACACGwwWIQQ7EY/61mt+7jqfUBeUv/g1Wps9RgUCZrqJzQAKCRCUv/g1Wps9Rsl2 +AP9OmXcN0jxDggtZqpxEXecpVet68068LkbwKPZ3GaeY7gEApzZAbncPDW2g+xb+ +8yNHVgPcAR6LXEGepz1/sYkgHAw= +=TP7k +-----END PGP PUBLIC KEY BLOCK----- diff --git a/gnupg/keys/erai@omiltem.net.asc b/gnupg/keys/erai@omiltem.net.asc @@ -0,0 +1,23 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mDMEZZOfExYJKwYBBAHaRw8BAQdAakni5Zjcw2ajtHh96FBAd1WREgWriA4V8q+v +lPzJwjK0F2VyYWkgPGVyYWlAb21pbHRlbS5uZXQ+iJYEExYIAD4WIQQQjvGuZDJO +flEqazAx/MnZeptPqwUCZZOfEwIbAQUJCWYBgAULCQgHAgYVCgkICwIEFgIDAQIe +AQIXgAAKCRAx/MnZeptPqytwAQD+YR5uWAkmqmNKMi8qf0c0Q4Ncmi5ldROZqnM9 +nvn6jQEAnsi05HfoJgTWGS7nD5HCelT+qq+xIAApYgvGu/DFxAy4MwRlk6AAFgkr +BgEEAdpHDwEBB0Ddpo4qE1PjPcyt01pSF/185ARsSCE1lnehT4XgKBA37Yj1BBgW +CAAmFiEEEI7xrmQyTn5RKmswMfzJ2XqbT6sFAmWToAACGwIFCQlmAYAAgQkQMfzJ +2XqbT6t2IAQZFggAHRYhBKAnHtcdAl6oc6Zqlbs9R0VpJAikBQJlk6AAAAoJELs9 +R0VpJAikqz8A/RmOPMT8RrHuInDAenS1R4iBzPA1cDIO/591wSsMQBHxAP96pEfV +A+jJ4oMBi2Z8Hbw64NjzMpJDuNYwIWRejOmHC2gsAQC/67yuxWS24wsLmn+iAJyQ +oxj0M631P4k5RoecFCi48AEAhiOE9WY41OMmsdtqDFuqOI5mT0auVwDvHIuDliuK +mQe4MwRlk6AlFgkrBgEEAdpHDwEBB0Ba+zAy2G1g1wDheCv+gIP/lVBM7L2lMb71 +uozdIPNMgoh+BBgWCAAmFiEEEI7xrmQyTn5RKmswMfzJ2XqbT6sFAmWToCUCGyAF +CQlmAYAACgkQMfzJ2XqbT6sf+wEA+CMgG+SutzvYVe/zwR4Ts9XXZ3YjgzCChe5c +U/BETUAA/RpQ7AE5RYZp1pf7bkyIv+XseSfrL8kAzWIoJSguwWQCuDgEZZOgSBIK +KwYBBAGXVQEFAQEHQG8RudlrPCPjVX4o+Z9NspiAAEGmTUjak3Hvt4vkLWElAwEI +B4h+BBgWCAAmFiEEEI7xrmQyTn5RKmswMfzJ2XqbT6sFAmWToEgCGwwFCQlmAYAA +CgkQMfzJ2XqbT6sC/AEA39b7QfmliK+H/jbD0QAvXuewG/7kmX7ElbqlHwLNxZkA +/RHE/N8W/XeG/616pRb5IWXR/3GdlPTsQjDSg1VTcnwJ +=D36l +-----END PGP PUBLIC KEY BLOCK----- diff --git a/gnupg/otrust.txt b/gnupg/otrust.txt @@ -0,0 +1,4 @@ +# List of assigned trustvalues, created Mon 16 Jun 2025 10:03:31 PM EDT +# (Use "gpg --import-ownertrust" to restore them) +108EF1AE64324E7E512A6B3031FCC9D97A9B4FAB:6: +3B118FFAD66B7EEE3A9F501794BFF8355A9B3D46:6: diff --git a/gnupg/sshcontrol b/gnupg/sshcontrol @@ -0,0 +1 @@ +CEB10293BB2DDBF94A945F704C2DAA88DA562489 diff --git a/inputrc b/inputrc @@ -0,0 +1 @@ +set editing-mode vi diff --git a/install.sh b/install.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +set -ue + +files=( + bash_logout + bash_profile + bashrc + inputrc + gdbinit + gitconfig + gitignore + pythonrc + tmux.conf + wgetrc + Xresources + xmodmap + gnupg/gpg-agent.conf + gnupg/sshcontrol + ssh/authorized_keys + ssh/config + ssh/known_hosts + ssh/rc + bin/post + bin/watch.sh + vim/ftdetect/omiltem.vim + vim/ftplugin/omiltem.vim + vim/indent/omiltem.vim + vim/syntax/omiltem.vim + vim/plugin/postwrite.vim + vim/plugin/sensible.vim + vim/plugin/sudo.vim + vim/plugin/writegood.vim + vim/vimrc +) + +if ! [ -p "${HOME}/.post" ]; then + rm -f "${HOME}/.post" && mkfifo "${HOME}/.post" +fi + +(umask 0077 && mkdir -p "${HOME}/.cache/vim" "${HOME}/.cache/vim/swap" "${HOME}/.cache/vim/undo") +(umask 0077 && mkdir -p "${HOME}/.gnupg") +chmod go-rx "${HOME}/.gnupg" "${HOME}/.cache/vim" + +gpg --import gnupg/keys/*.asc +gpg --import-ownertrust < gnupg/otrust.txt + +for src in "${files[@]}"; do + dest="${HOME}/.${src}" + mkdir -p "$(dirname "${dest}")" + + tmp=$(mktemp -u -p "${HOME}" .tmp.XXXXXXXXXX) + (umask 0222 && cp "${src}" "${tmp}") + mv -T --no-copy -f "${tmp}" "${dest}" || rm "${tmp}" +done diff --git a/pythonrc b/pythonrc @@ -0,0 +1,3 @@ +import readline + +readline.write_history_file = lambda *args: None diff --git a/ssh/authorized_keys b/ssh/authorized_keys @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFr7MDLYbWDXAOF4K/6Ag/+VUEzsvaUxvvW6jN0g80yC diff --git a/ssh/config b/ssh/config @@ -0,0 +1,15 @@ +Host * + HostbasedAuthentication no + KbdInteractiveAuthentication no + PasswordAuthentication no + PubkeyAuthentication yes + PreferredAuthentications publickey + KexAlgorithms sntrup761x25519-sha512@openssh.com, curve25519-sha256 + HostKeyAlgorithms ssh-ed25519 + PubkeyAcceptedAlgorithms ssh-ed25519 + Ciphers aes256-ctr + Compression no + MACs hmac-sha2-256, hmac-sha2-512-etm@openssh.com + ServerAliveInterval 5 + ServerAliveCountMax 60 + ObscureKeystrokeTiming no diff --git a/ssh/known_hosts b/ssh/known_hosts diff --git a/ssh/rc b/ssh/rc @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ -e "${SSH_AUTH_SOCK}" ]; then + ln -sf "${SSH_AUTH_SOCK}" "${HOME}/.ssh/agent.S" +fi diff --git a/tmux.conf b/tmux.conf @@ -0,0 +1,161 @@ +unbind -a + +set -g history-limit 100000 + +# don't wait for escapes +set -s escape-time 0 + +# resize current window +setw -g aggressive-resize + +# use vi keys for copy mode +setw -g mode-keys vi + +# start indexing at 1 +set -g base-index 1 +setw -g pane-base-index 1 + +# color terminal +set -g default-terminal "screen-256color" + +# status bars +# <username>@<hostname> <date>, <time> +set -g status-right-length 60 +set -g status-right "#h %a %h %-d, %-I:%M %P " +set -g status-left " [#S] " +set -g window-status-format " #I: #W " +set -g window-status-current-format "[#I: #W]" +set -g window-status-current-style "bg=yellow" + +# prefix +set -g prefix C-a +bind C-a send-prefix + +# clear screen +bind -n C-l clear-history + +# vi resize +bind -rn M-J resize-pane -D 5 +bind -rn M-K resize-pane -U 5 +bind -rn M-H resize-pane -L 5 +bind -rn M-L resize-pane -R 5 + +# navigation +bind -n M-h select-pane -L +bind -n M-j select-pane -D +bind -n M-k select-pane -U +bind -n M-l select-pane -R + +bind -n M-\{ swap-pane -U +bind -n M-\} swap-pane -D + +bind -n M-q select-window -t :5 +bind -n M-w select-window -t :6 +bind -n M-e select-window -t :7 +bind -n M-r select-window -t :8 + +bind -n M-1 select-window -t :1 +bind -n M-2 select-window -t :2 +bind -n M-3 select-window -t :3 +bind -n M-4 select-window -t :4 +bind -n M-5 select-window -t :5 +bind -n M-6 select-window -t :6 +bind -n M-7 select-window -t :7 +bind -n M-8 select-window -t :8 +bind -n M-9 select-window -t :9 +bind -n M-` command-prompt -p index "select-window -t ':%%'" + +bind -n M-. next-window +bind -n M-, previous-window +bind -n M-< swap-window -t -1 +bind -n M-> swap-window -t +1 + +# pane creation +bind -n M-! break-pane +bind -n M-@ command-prompt -p "send to:" "join-pane -t ':%%'" +bind -n M-c new-window -c "#{pane_current_path}" +bind -n M-\- split-window -c "#{pane_current_path}" +bind -n M-\\ split-window -h -c "#{pane_current_path}" + +bind -n M-x confirm-before -p "kill-pane #P? (y/n)" kill-pane +bind -n M-X confirm-before -p "kill-window #W? (y/n)" kill-window + +# layout +bind -n M-Space next-layout +bind -n M-S-Space previous-layout + +# standard +bind : command-prompt +bind ? list-keys +bind d detach-client +bind '~' show-messages +bind [ copy-mode +bind ] paste-buffer +bind f command-prompt "find-window '%%'" + +# defaults +bind C-o rotate-window +bind C-z suspend-client +bind Space next-layout +bind ! break-pane +bind '"' split-window +bind '#' list-buffers +bind '$' command-prompt -I '#S' "rename-session '%%'" +bind % split-window -h +bind & confirm-before -p "kill-window #W? (y/n)" kill-window +bind "'" command-prompt -p index "select-window -t ':%%'" +bind ( switch-client -p +bind ) switch-client -n +bind ',' command-prompt -I '#W' "rename-window '%%'" +bind - delete-buffer +bind . command-prompt "move-window -t '%%'" +bind 0 select-window -t :0 +bind 1 select-window -t :1 +bind 2 select-window -t :2 +bind 3 select-window -t :3 +bind 4 select-window -t :4 +bind 5 select-window -t :5 +bind 6 select-window -t :6 +bind 7 select-window -t :7 +bind 8 select-window -t :8 +bind 9 select-window -t :9 +bind ';' last-pane +bind = choose-buffer +bind D choose-client +bind L switch-client -l +bind c new-window +bind i display-message +bind l last-window +bind n next-window +bind o select-pane -t :.+ +bind p previous-window +bind q display-panes +bind r refresh-client +bind s choose-tree +bind t clock-mode +bind w choose-window +bind x confirm-before -p "kill-pane #P? (y/n)" kill-pane +bind z resize-pane -Z +bind \{ swap-pane -U +bind \} swap-pane -D +bind PPage copy-mode -u +bind -r Up select-pane -U +bind -r Down select-pane -D +bind -r Left select-pane -L +bind -r Right select-pane -R +bind M-1 select-layout even-horizontal +bind M-2 select-layout even-vertical +bind M-3 select-layout main-horizontal +bind M-4 select-layout main-vertical +bind M-5 select-layout tiled +bind M-n next-window -a +bind M-o rotate-window -D +bind M-p previous-window -a +bind -r M-Up resize-pane -U 5 +bind -r M-Down resize-pane -D 5 +bind -r M-Left resize-pane -L 5 +bind -r M-Right resize-pane -R 5 +bind -r C-Up resize-pane -U +bind -r C-Down resize-pane -D +bind -r C-Left resize-pane -L +bind -r C-Right resize-pane -R diff --git a/vim/ftdetect/omiltem.vim b/vim/ftdetect/omiltem.vim @@ -0,0 +1 @@ +au! BufRead,BufNewFile *.om setf omiltem diff --git a/vim/ftplugin/omiltem.vim b/vim/ftplugin/omiltem.vim @@ -0,0 +1,8 @@ +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +if !exists("g:omiltem_recommended_style") || g:omiltem_recommended_style != 0 + set noexpandtab tabstop=8 softtabstop=8 shiftwidth=8 +endif diff --git a/vim/indent/omiltem.vim b/vim/indent/omiltem.vim @@ -0,0 +1,40 @@ +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal autoindent +setlocal indentexpr=OmiltemIndent(v:lnum) +setlocal indentkeys+=0=},0=) + +let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys<" + +if exists('*OmiltemIndent') + finish +endif + +function! OmiltemIndent(lnum) + let l:prevlnum = prevnonblank(a:lnum-1) + if l:prevlnum == 0 + return 0 + endif + + " Strip comments + let l:prevl = substitute(getline(l:prevlnum), '//.*$', '', '') + let l:thisl = substitute(getline(a:lnum), '//.*$', '', '') + + " Match the previous indentation + let l:ind = indent(l:prevlnum) + + " Increase indentation after opening a block + if l:prevl =~ '[({]\s*$' + let l:ind += shiftwidth() + endif + + " Decrease indentation when closing a block + if l:thisl =~ '^\s*[)}]' + let l:ind -= shiftwidth() + endif + + return l:ind +endfunction diff --git a/vim/plugin/postwrite.vim b/vim/plugin/postwrite.vim @@ -0,0 +1,8 @@ +function PostWrite() + call system(": <> ~/.post") +endfunction + +augroup PostWrite + au! + au BufWritePost * call PostWrite() +augroup END diff --git a/vim/plugin/sensible.vim b/vim/plugin/sensible.vim @@ -0,0 +1,166 @@ +" sensible.vim - Defaults everyone can agree on +" Maintainer: Tim Pope <http://tpo.pe/> +" Version: 2.0 + +if exists('g:loaded_sensible') || &compatible + finish +else + let g:loaded_sensible = 'yes' +endif + +" Use :help 'option' to see the documentation for the given option. + +" Disable vi compatibility, if for some reason it's on. +if &compatible + set nocompatible +endif + +" Check if an option was set from a file in $HOME. This lets us avoid +" overriding options in the user's vimrc, but still override options in the +" system vimrc. +function! s:MaySet(option) abort + if exists('*execute') + let out = execute('verbose setglobal all ' . a:option . '?') + else + redir => out + silent verbose execute 'setglobal all' a:option . '?' + redir END + endif + return out !~# " \\(\\~[\\/]\\|Lua\\)[^\n]*$" +endfunction + +if s:MaySet('backspace') + set backspace=indent,eol,start +endif +" Disable completing keywords in included files (e.g., #include in C). When +" configured properly, this can result in the slow, recursive scanning of +" hundreds of files of dubious relevance. +set complete-=i +if s:MaySet('smarttab') + set smarttab +endif + +set nrformats-=octal + +" Make the escape key more responsive by decreasing the wait time for an +" escape sequence (e.g., arrow keys). +if !has('nvim') && &ttimeoutlen == -1 + set ttimeout + set ttimeoutlen=100 +endif + +if has('reltime') && s:MaySet('incsearch') + set incsearch +endif +" Use CTRL-L to clear the highlighting of 'hlsearch' (off by default) and call +" :diffupdate. +if maparg('<C-L>', 'n') ==# '' + nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L> +endif + +if s:MaySet('laststatus') + set laststatus=2 +endif +if s:MaySet('ruler') + set ruler +endif +if s:MaySet('wildmenu') + set wildmenu +endif + +if s:MaySet('scrolloff') + set scrolloff=1 +endif +if s:MaySet('sidescroll') && s:MaySet('sidescrolloff') + set sidescroll=1 + set sidescrolloff=2 +endif +set display+=lastline +if has('patch-7.4.2109') + set display+=truncate +endif + +if s:MaySet('listchars') + set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ +endif + +" Delete comment character when joining commented lines. +if v:version > 703 || v:version == 703 && has("patch541") + set formatoptions+=j +endif + +" Replace the check for a tags file in the parent directory of the current +" file with a check in every ancestor directory. +if has('path_extra') && (',' . &g:tags . ',') =~# ',\./tags,' + setglobal tags-=./tags tags-=./tags; tags^=./tags; +endif + +if s:MaySet('autoread') + set autoread +endif + +if s:MaySet('history') + set history=1000 +endif +if s:MaySet('tabpagemax') + set tabpagemax=50 +endif + +" Persist g:UPPERCASE variables, used by some plugins, in .viminfo. +if !empty(&viminfo) + set viminfo^=! +endif +" Saving options in session and view files causes more problems than it +" solves, so disable it. +set sessionoptions-=options +set viewoptions-=options + +" Allow color schemes to do bright colors without forcing bold. +if &t_Co == 8 && $TERM !~# '^Eterm' + set t_Co=16 +endif + +" If the running Vim lacks support for the Fish shell, use Bash instead. +if &shell =~# 'fish$' && (v:version < 704 || v:version == 704 && !has('patch276')) + set shell=/usr/bin/env\ bash +endif + +" Disable a legacy behavior that can break plugin maps. +if has('langmap') && exists('+langremap') && &langremap && s:MaySet('langremap') + set nolangremap +endif + +if !(exists('g:did_load_filetypes') && exists('g:did_load_ftplugin') && exists('g:did_indent_on')) + filetype plugin indent on +endif +if has('syntax') && !exists('g:syntax_on') + syntax enable +endif + +if empty(mapcheck('<C-U>', 'i')) + inoremap <C-U> <C-G>u<C-U> +endif +if empty(mapcheck('<C-W>', 'i')) + inoremap <C-W> <C-G>u<C-W> +endif + +" From `:help :DiffOrig`. +if exists(":DiffOrig") != 2 + command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ + \ | diffthis | wincmd p | diffthis +endif + +" Correctly highlight $() and other modern affordances in filetype=sh. +if !exists('g:is_posix') && !exists('g:is_bash') && !exists('g:is_kornshell') && !exists('g:is_dash') + let g:is_posix = 1 +endif + +" Load matchit.vim, but only if the user hasn't installed a newer version. +if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# '' + runtime! macros/matchit.vim +endif + +" Enable the :Man command shipped inside Vim's man filetype plugin. +if exists(':Man') != 2 && !exists('g:loaded_man') && &filetype !=? 'man' && !has('nvim') + runtime ftplugin/man.vim +endif diff --git a/vim/plugin/sudo.vim b/vim/plugin/sudo.vim @@ -0,0 +1 @@ +command WS w ! sudo tee "%" > /dev/null diff --git a/vim/plugin/writegood.vim b/vim/plugin/writegood.vim @@ -0,0 +1,85 @@ +" Based on https://matt.might.net/articles/shell-scripts-for-passive-voice-weasel-words-duplicates/ + +function WriteGoodStyle() + " Highlight lines that exceed 120 columns + call matchadd('ColorColumn', '\%121v.', 100) + + " Trailing spaces + call matchadd('Trailing', '\s\+$') + " Spaces before a tab + call matchadd('Trailing', ' \+\ze\t') + + " Apply these rules to plain text and to comments. Is there a better way? + let l:contained='contained' + if &ft=='text' || &ft=='' + let l:contained='' + endif + + " Duplicate words + exe 'syn match StyleDuplicate ' . l:contained . ' /\c\(\<\w\+\>\)\_s\+\<\1\>/' + + " Weasel words + let l:nonweasel=['apply'] + let l:weasel=['many', 'various', 'very', 'fairly', 'several', 'extremely'] + let l:weasel+=['exceedingly', 'quite', 'remarkably', 'few', 'surprisingly'] + let l:weasel+=['mostly', 'largely', 'huge', 'tiny', 'are a number'] + let l:weasel+=['is a number', 'excellent', 'interestingly', 'significantly'] + let l:weasel+=['substantially', 'clearly', 'vast', 'relatively'] + let l:weasel+=['completely', 'obviously', 'note that', 'particular'] + let l:weasel+=['specific', 'manner', 'purposes', 'that is', 'which are'] + let l:weasel+=['that are', 'differently', 'formally', 'in other words'] + let l:weasel+=['almost', '\w\+ly'] + let l:abbrev=['etc.', 'e.g.', 'i.e.'] + let l:nonweasel='\(' . join(l:nonweasel, '\|') . '\)\@!' + let l:weasel='\(' . substitute(join(l:weasel, '\|'), ' ', '\\_s\\+', 'g') . '\)' + let l:abbrev='\(' . substitute(join(l:abbrev, '\|'), '\.', '\\.', 'g') . '\)' + exec 'syn match StylePassive ' . l:contained . ' /\c\<' . l:nonweasel . l:weasel. '\>\|\<' . l:abbrev .'/' + + " Passive voice + let l:nontense=['red'] + let l:verb=['am', 'are', 'were', 'being', 'is', 'been', 'was', 'be'] + let l:tense=['\w\+ed', 'awoken', 'been', 'born', 'beat', 'become', 'begun'] + let l:tense+=['bent', 'beset', 'bet', 'bid', 'bidden', 'bound', 'bitten', 'bled'] + let l:tense+=['blown', 'broken', 'bred', 'brought', 'broadcast', 'built'] + let l:tense+=['burnt', 'burst', 'bought', 'cast', 'caught', 'chosen', 'clung'] + let l:tense+=['come', 'cost', 'crept', 'cut', 'dealt', 'dug', 'dived', 'done'] + let l:tense+=['drawn', 'dreamt', 'driven', 'drunk', 'eaten', 'fallen', 'fed'] + let l:tense+=['felt', 'fought', 'found', 'fit', 'fled', 'flung', 'flown'] + let l:tense+=['forbidden', 'forgotten', 'foregone', 'forgiven', 'forsaken'] + let l:tense+=['frozen', 'gotten', 'given', 'gone', 'ground', 'grown', 'hung'] + let l:tense+=['heard', 'hidden', 'hit', 'held', 'hurt', 'kept', 'knelt'] + let l:tense+=['knit', 'known', 'laid', 'led', 'leapt', 'learnt', 'left'] + let l:tense+=['lent', 'let', 'lain', 'lighted', 'lost', 'made', 'meant'] + let l:tense+=['met', 'misspelt', 'mistaken', 'mown', 'overcome', 'overdone'] + let l:tense+=['overtaken', 'overthrown', 'paid', 'pled', 'proven', 'put'] + let l:tense+=['quit', 'read', 'rid', 'ridden', 'rung', 'risen', 'run', 'sawn'] + let l:tense+=['said', 'seen', 'sought', 'sold', 'sent', 'set', 'sewn'] + let l:tense+=['shaken', 'shaven', 'shorn', 'shed', 'shone', 'shod', 'shot'] + let l:tense+=['shown', 'shrunk', 'shut', 'sung', 'sunk', 'sat', 'slept'] + let l:tense+=['slain', 'slid', 'slung', 'slit', 'smitten', 'sown', 'spoken'] + let l:tense+=['sped', 'spent', 'spilt', 'spun', 'spit', 'split', 'spread'] + let l:tense+=['sprung', 'stood', 'stolen', 'stuck', 'stung', 'stunk'] + let l:tense+=['stridden', 'struck', 'strung', 'striven', 'sworn', 'swept'] + let l:tense+=['swollen', 'swum', 'swung', 'taken', 'taught', 'torn', 'told'] + let l:tense+=['thought', 'thrived', 'thrown', 'thrust', 'trodden'] + let l:tense+=['understood', 'upheld', 'upset', 'woken', 'worn', 'woven'] + let l:tense+=['wed', 'wept', 'wound', 'won', 'withheld', 'withstood', 'wrung'] + let l:tense+=['written'] + let l:nontense='\(' . join(l:nontense, '\|') . '\)\@!' + let l:verb='\(' . join(l:verb, '\|') . '\)' + let l:tense='\(' . join(l:tense, '\|') . '\)' + exe 'syn match StylePassive ' . l:contained . ' /\c\<' . l:verb . '\>\_s\+\<' . l:nontense . l:tense . '\>/' + + syn cluster Style contains=StyleDuplicate,StyleWeasel,StylePassive + syn cluster Spell add=@Style + + hi def link StyleDuplicate StyleBad + hi def link StyleWeasel StyleBad + hi def link StylePassive StyleBad + hi def link StyleBad SpellBad +endfunction + +augroup Style + au! + au FileType,Syntax,VimEnter,WinEnter,BufRead,BufNewFile * call WriteGoodStyle() +augroup End diff --git a/vim/syntax/omiltem.vim b/vim/syntax/omiltem.vim @@ -0,0 +1,79 @@ +if exists("b:current_syntax") + finish +endif + +" return break sizeof if else loop continue goto var enum struct union byte +" int void func + +syn keyword oReturn return +syn keyword oBreak break +syn keyword oSizeof sizeof +syn keyword oIf if +syn keyword oElse else +syn keyword oLoop loop +syn keyword oContinue continue +syn keyword oGoto goto +syn keyword oVar var +syn keyword oEnum enum +syn keyword oStruct struct +syn keyword oUnion union +syn keyword oByte byte +syn keyword oInt int +syn keyword oVoid void +syn keyword oFunc func +syn keyword oAs as +syn keyword oType type +syn keyword oNil nil + +syn keyword oTodo contained TODO FIXME XXX BUG +syn cluster oCommentGroup contains=oTodo +syn region oComment start="//" end="$" contains=@oCommentGroup,@Spell + +syn region oString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell + +syn region oChar start=+'+ skip=+\\\\\|\\'+ end=+'+ + +syn match oDecInt "\<-\=\%(0\|\d\+\)\>" +syn match oHexInt "\<-\=0[xX]\%(\x\+\)\>" +syn match oBinInt "\<-\=0[bB]\%([01]\+\)\>" + +syn region oBlock start="{" end="}" transparent + +hi def link oDecInt Integer +hi def link oHexInt Integer +hi def link oBinInt Integer +hi def link Integer Number + +hi def link oChar Character + +hi def link oString String + +hi def link oComment Comment +hi def link oTodo Todo + +hi def link oReturn Keyword +hi def link oBreak Keyword +hi def link oSizeof Keyword + +hi def link oIf Conditional +hi def link oElse Conditional + +hi def link oLoop Repeat +hi def link oContinue Statement +hi def link oGoto Statement + +hi def link oVar Keyword +hi def link oAs Keyword +hi def link oNil Keyword + +hi def link oEnum Structure +hi def link oStruct Structure +hi def link oUnion Structure + +hi def link oByte Type +hi def link oInt Type +hi def link oVoid Type +hi def link oFunc Type +hi def link oType Type + +let b:current_syntax = "omiltem" diff --git a/vim/vimrc b/vim/vimrc @@ -0,0 +1,19 @@ +set nocompatible + +runtime! plugin/*.vim + +set ttymouse= mouse= belloff=all number autoindent hlsearch t_Co=256 +set spell spelllang=en printoptions+=formfeed:y + +set undofile +set undodir=~/.cache/vim/undo +set undolevels=10000 +set undoreload=100000 +set viminfofile=~/.cache/vim/viminfo +set directory=~/.cache/vim/swap +let netrw_home='~/.cache/vim' + +highlight LineNr ctermfg=gray +highlight StatusLine ctermfg=blue ctermbg=black +highlight ColorColumn ctermbg=gray +highlight Trailing ctermbg=gray diff --git a/wgetrc b/wgetrc @@ -0,0 +1 @@ +hsts=0 diff --git a/xmodmap b/xmodmap @@ -0,0 +1,2 @@ +clear lock +keysym Caps_Lock = Escape