diff --git a/.blackbox/.gitattributes b/.blackbox/.gitattributes new file mode 100644 index 0000000..9602959 --- /dev/null +++ b/.blackbox/.gitattributes @@ -0,0 +1,2 @@ +blackbox-admins.txt text eol=lf +blackbox-files.txt text eol=lf diff --git a/.blackbox/blackbox-admins.txt b/.blackbox/blackbox-admins.txt new file mode 100644 index 0000000..1e2997c --- /dev/null +++ b/.blackbox/blackbox-admins.txt @@ -0,0 +1 @@ +561175887C6BE8AE1D5188CB55B058A80530EF22 diff --git a/.blackbox/blackbox-files.txt b/.blackbox/blackbox-files.txt new file mode 100644 index 0000000..0ba6c67 --- /dev/null +++ b/.blackbox/blackbox-files.txt @@ -0,0 +1,2 @@ +git/.gituser +ssh/.ssh/config diff --git a/.blackbox/pubring.kbx b/.blackbox/pubring.kbx new file mode 100644 index 0000000..68a5ad8 Binary files /dev/null and b/.blackbox/pubring.kbx differ diff --git a/.blackbox/trustdb.gpg b/.blackbox/trustdb.gpg new file mode 100644 index 0000000..824d301 Binary files /dev/null and b/.blackbox/trustdb.gpg differ diff --git a/.gitignore b/.gitignore index 456f349..58af093 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,12 @@ -.DS_Store -Spoons +*.id_ed25519 +*.id_rsa +*.pub +id_rsa +known_hosts + +/.blackbox/pubring.gpg~ +/.blackbox/pubring.kbx~ +/.blackbox/secring.gpg + +/git/.gituser +/ssh/.ssh/config diff --git a/LICENSE b/LICENSE index 2c5e8c9..b7efbd7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 - Copyright (C) 1981-2024 Josh Sherman + Copyright (C) 2010-2022 Josh Sherman Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long diff --git a/README.md b/README.md index 378a33b..d1c54aa 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,12 @@ -# The `dotfiles` of one Josh Sherman +# [joshtronic](https://joshtronic.com) does `dotfiles` -These are my `dotfiles`. -There are many like them, but these are mine. -My `dotfiles` are my best friend. -They are my life. -I must master them as I must master my life. -My `dotfiles`, without me, are useless. -Without my `dotfiles`, I am useless. - -## Installation +These are my `dotfiles`. There are many like them, but these are mine. My +`dotfiles` are my best friend. They are my life. I must master them as I must +master my life. My `dotfiles`, without me, are useless. Without my `dotfiles`, I +am useless. ```shell -sh -c "$(curl -fsSL https://git.sherver.org/joshtronic/dotfiles/raw/branch/main/install.sh)" +bash -c "$(curl -fsSL https://raw.githubusercontent.com/joshtronic/dotfiles/main/install)" ``` ![BOOM](https://media.giphy.com/media/laUY2MuoktHPy/source.gif) diff --git a/alacritty/.config/alacritty/alacritty.toml b/alacritty/.config/alacritty/alacritty.toml deleted file mode 100644 index 114fbcc..0000000 --- a/alacritty/.config/alacritty/alacritty.toml +++ /dev/null @@ -1,20 +0,0 @@ -general.import = ['~/.config/alacritty/themes/solarized_osaka.toml'] - -[window] -option_as_alt = 'Both' -padding.x = 5 -padding.y = 5 - -[font] -normal.family = 'Fira Code' -bold.family = 'Fira Code' -italic.family = 'Fira Code' -bold_italic.family = 'Fira Code' -size = 12.0 - -[colors] -cursor.text = '#d33682' -cursor.cursor = '#d33682' - -[env] -term = "xterm-256color" diff --git a/alacritty/.config/alacritty/themes/solarized_osaka.toml b/alacritty/.config/alacritty/themes/solarized_osaka.toml deleted file mode 100644 index 0f25c29..0000000 --- a/alacritty/.config/alacritty/themes/solarized_osaka.toml +++ /dev/null @@ -1,29 +0,0 @@ -# Colors (Solarized Osaka) -# Source https://github.com/craftzdog/solarized-osaka.nvim - -# Default colors -[colors.primary] -background = '#001a1d' -foreground = '#839496' - -# Normal colors -[colors.normal] -black = '#073642' -red = '#dc322f' -green = '#859900' -yellow = '#b58900' -blue = '#268bd2' -magenta = '#d33682' -cyan = '#2aa198' -white = '#eee8d5' - -# Bright colors -[colors.bright] -black = '#4c4c4c' -red = '#cb4b16' -green = '#586e75' -yellow = '#657b83' -blue = '#839496' -magenta = '#6c71c4' -cyan = '#93a1a1' -white = '#fdf6e3' diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish deleted file mode 100644 index b2a71b8..0000000 --- a/fish/.config/fish/config.fish +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env fish - -# Speed up `brew install` -set -gx HOMEBREW_NO_AUTO_UPDATE 1 -set -gx HOMEBREW_NO_INSTALL_CLEANUP 1 - -source $HOME/.env -source $HOME/.aliases - -eval (dircolors $HOME/.dircolors) - -# Load up and configure fzf, nvm, and zsh plugins -if test (uname) = "Darwin" - # macOs - -elif type -q apt - # Debian - -elif type -q pacman - # Arch - -end diff --git a/git/.gitconfig b/git/.gitconfig index aaec6b6..a9f6c7e 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -1,9 +1,5 @@ -[user] - name = Josh Sherman - email = joshsherman@gmail.com - -[github] - user = joshtronic +[include] + path = ~/.gituser [credential] helper = cache --timeout=86400 @@ -11,6 +7,7 @@ [color] branch = auto diff = auto + interactive = auto status = auto [core] @@ -46,6 +43,3 @@ smudge = git-lfs smudge -- %f process = git-lfs filter-process required = true - -[url "ssh://git@"] - insteadOf = git:// diff --git a/git/.gituser.gpg b/git/.gituser.gpg new file mode 100644 index 0000000..6cfa032 Binary files /dev/null and b/git/.gituser.gpg differ diff --git a/install.sh b/install similarity index 66% rename from install.sh rename to install index 7976829..f859f33 100755 --- a/install.sh +++ b/install @@ -4,7 +4,7 @@ if [ -z "$HOME" ]; then echo "Seems you're \$HOMEless :("; exit 1; fi -COMMANDS="curl git stow" +COMMANDS="blackbox_postdeploy curl git stow" for COMMAND in $COMMANDS; do if ! command -v "$COMMAND" &> /dev/null; then @@ -16,20 +16,16 @@ done DOTFILES=$HOME/.dotfiles if [ ! -d "$DOTFILES" ]; then - git clone ssh://git@git.sherver.org:22381/joshtronic/dotfiles.git "$DOTFILES" + git clone git@github.com:joshtronic/dotfiles.git "$DOTFILES" cd "$DOTFILES" || exit else cd "$DOTFILES" || exit git pull origin main fi -stow alacritty git nvim vim zsh +blackbox_postdeploy -if [[ `uname` == Darwin ]]; then - stow macos -fi - -mkdir -p ~/.local/share/vim/undo/ +stow git screen ssh vim zsh cd "$HOME" || exit rm -f "${HOME}/.zcompdump*" diff --git a/macos/.config/karabiner/karabiner.json b/macos/.config/karabiner/karabiner.json deleted file mode 100644 index 070ab7a..0000000 --- a/macos/.config/karabiner/karabiner.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "global": { "show_in_menu_bar": false }, - "profiles": [ - { - "complex_modifications": { - "rules": [ - { - "manipulators": [ - { - "description": "Change right_command to command+control+option+shift.", - "from": { - "key_code": "right_command", - "modifiers": { "optional": ["any"] } - }, - "to": [ - { - "key_code": "left_shift", - "modifiers": ["left_command", "left_control", "left_option"] - } - ], - "to_if_alone": [{ "key_code": "f20" }], - "type": "basic" - } - ] - } - ] - }, - "name": "Default profile", - "selected": true, - "simple_modifications": [ - { - "from": { "key_code": "caps_lock" }, - "to": [{ "key_code": "left_control" }] - } - ], - "virtual_hid_keyboard": { - "country_code": 0, - "keyboard_type_v2": "ansi" - } - } - ] -} \ No newline at end of file diff --git a/macos/.hammerspoon/images/homebrew-color.png b/macos/.hammerspoon/images/homebrew-color.png deleted file mode 100644 index d0bc201..0000000 Binary files a/macos/.hammerspoon/images/homebrew-color.png and /dev/null differ diff --git a/macos/.hammerspoon/images/homebrew-color.svg b/macos/.hammerspoon/images/homebrew-color.svg deleted file mode 100644 index ebe27a9..0000000 --- a/macos/.hammerspoon/images/homebrew-color.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/macos/.hammerspoon/images/homebrew-white.png b/macos/.hammerspoon/images/homebrew-white.png deleted file mode 100644 index 3977869..0000000 Binary files a/macos/.hammerspoon/images/homebrew-white.png and /dev/null differ diff --git a/macos/.hammerspoon/images/homebrew-white.svg b/macos/.hammerspoon/images/homebrew-white.svg deleted file mode 100644 index eeb1f37..0000000 --- a/macos/.hammerspoon/images/homebrew-white.svg +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/macos/.hammerspoon/images/slack-color.png b/macos/.hammerspoon/images/slack-color.png deleted file mode 100644 index b6dc3aa..0000000 Binary files a/macos/.hammerspoon/images/slack-color.png and /dev/null differ diff --git a/macos/.hammerspoon/images/slack-color.svg b/macos/.hammerspoon/images/slack-color.svg deleted file mode 100644 index d9accdf..0000000 --- a/macos/.hammerspoon/images/slack-color.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/macos/.hammerspoon/images/slack-white.png b/macos/.hammerspoon/images/slack-white.png deleted file mode 100644 index 89252b3..0000000 Binary files a/macos/.hammerspoon/images/slack-white.png and /dev/null differ diff --git a/macos/.hammerspoon/images/slack-white.svg b/macos/.hammerspoon/images/slack-white.svg deleted file mode 100644 index da1d12b..0000000 --- a/macos/.hammerspoon/images/slack-white.svg +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/macos/.hammerspoon/init.lua b/macos/.hammerspoon/init.lua deleted file mode 100644 index e1b57be..0000000 --- a/macos/.hammerspoon/init.lua +++ /dev/null @@ -1,148 +0,0 @@ -local hyper = { 'ctrl', 'alt', 'cmd', 'shift' } - --------------------------------------------------------------------------------- --- Application Hot Keys --------------------------------------------------------------------------------- - ---[=====[ -local applicationHotKeys = { - -- ['0'] = '', - ['1'] = 'Alacritty', - ['2'] = 'Firefox', - ['3'] = 'Slack', - ['4'] = 'Discord', - ['5'] = 'Spotify', - ['6'] = 'Finder', - -- ['7'] = '', - -- ['8'] = '', - -- ['9'] = '', -} - -for key, application in pairs(applicationHotKeys) do - hs.hotkey.bind(hyper, key, function() - hs.application.launchOrFocus(application) - end) -end ---]=====] - --------------------------------------------------------------------------------- --- Window Snapping --------------------------------------------------------------------------------- - -hs.window.animationDuration = 0 - --- Left half -hs.hotkey.bind(hyper, 'h', function() - local win = hs.window.focusedWindow() - if not win then return end - win:moveToUnit(hs.layout.left50) -end) - --- Right half -hs.hotkey.bind(hyper, 'l', function() - local win = hs.window.focusedWindow() - if not win then return end - win:moveToUnit(hs.layout.right50) -end) - --- Maximize -hs.hotkey.bind(hyper, 'k', function() - local win = hs.window.focusedWindow() - if not win then return end - win:moveToUnit(hs.layout.maximized) -end) - --- Simulates a 'reset' of the window -hs.hotkey.bind(hyper, 'j', function() - local win = hs.window.focusedWindow() - local f = win:frame() - local screen = win:screen() - local max = screen:frame() - - f.x = max.x - f.y = max.y - f.w = max.w / 2 - f.h = max.h / 2 - - win:setFrame(f) - win:centerOnScreen(screen, true) -end) - --------------------------------------------------------------------------------- --- Homebrew Update Indicator --------------------------------------------------------------------------------- - ---[=====[ -local homebrewIconWhite = hs.image - .imageFromPath('~/.hammerspoon/images/homebrew-white.png') - :setSize(hs.geometry.size(16, 16)) - -local homebrewMenubar = hs.menubar.new() -homebrewMenubar:setIcon(homebrewIconWhite) - -homebrewMenubar:setClickCallback(function() - hs.applescript.applescript([[ - tell application "Terminal" - do script "brew upgrade" - activate - end tell - ]]) -end) - -function updateHomebrewMenubar() - local outdated = hs.execute('/opt/homebrew/bin/brew outdated') - local _, numOutdated = outdated:gsub('\n', '\n') - - if numOutdated > 0 then - homebrewMenubar:setTitle(string.format(' %s', numOutdated)) - homebrewMenubar:setTooltip(outdated) - else - homebrewMenubar:setTitle(nil) - homebrewMenubar:setTooltip('Up to date') - end -end - -updateHomebrewMenubar() -hs.timer.doEvery(3600, updateHomebrewMenubar) ---]=====] - --------------------------------------------------------------------------------- --- Slack Message Indicator --------------------------------------------------------------------------------- - ---[=====[ -local slackIconWhite = hs.image - .imageFromPath('~/.hammerspoon/images/slack-white.png') - :setSize(hs.geometry.size(16, 16)) - -local slackMenubar = hs.menubar.new() -slackMenubar:setIcon(slackIconWhite) - -slackMenubar:setClickCallback(function() - slackMenubar:setTitle(nil) - hs.application.launchOrFocus('Slack') -end) - -function updateSlackMenubar() - local dock = hs.axuielement.applicationElement('Dock') - local children = dock:attributeValue('AXChildren') - - if children and children[1] and children[1]:attributeValue('AXRole') == 'AXList' then - local list = children[1]:attributeValue('AXChildren') - for _, v in pairs(list) do - if v:attributeValue('AXTitle') == 'Slack' then - local label = v:attributeValue('AXStatusLabel') or '0' - - if label == '0' then - slackMenubar:setTitle(nil) - else - slackMenubar:setTitle(string.format(' %s', label)) - end - end - end - end -end - -updateSlackMenubar() -hs.timer.doEvery(60, updateSlackMenubar) ---]=====] diff --git a/macos/.hushlogin b/macos/.hushlogin deleted file mode 100644 index e69de29..0000000 diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua deleted file mode 100644 index 2ed0d23..0000000 --- a/nvim/.config/nvim/init.lua +++ /dev/null @@ -1,76 +0,0 @@ --- Plugins -require('config.lazy'); - --- Color scheme and syntax highlighting -vim.cmd('syntax on') -vim.cmd('colorscheme solarized-osaka') -vim.o.background = 'dark' - --- Ensures misspellings are highlighted -vim.cmd('highlight SpellBad ctermfg=white ctermbg=red') - --- Global settings -vim.o.autoindent = true -vim.o.colorcolumn = '80,100,120' -vim.o.expandtab = true -vim.o.hidden = true -vim.o.hlsearch = true -vim.o.ignorecase = true -vim.o.incsearch = true -vim.o.laststatus = 2 -vim.o.number = true -vim.o.relativenumber = true -vim.o.shiftwidth = 2 -vim.o.smartindent = true -vim.o.softtabstop = 2 -vim.o.tabstop = 2 -vim.o.undofile = true - --- Filetype-specific settings -vim.api.nvim_create_autocmd('FileType', { - pattern = 'gitcommit', - callback = function() - vim.opt_local.colorcolumn = '50,72' - vim.opt_local.textwidth = 72 - end -}) - -vim.api.nvim_create_autocmd('FileType', { - pattern = {'gitcommit', 'markdown', 'text'}, - callback = function() - vim.opt_local.smartindent = false - vim.opt_local.spell = true - end -}) - -vim.api.nvim_create_autocmd('FileType', { - pattern = {'markdown', 'text'}, - callback = function() - vim.opt_local.textwidth = 80 - vim.opt_local.wrapmargin = 2 - end -}) - -vim.api.nvim_create_autocmd('FileType', { - pattern = {'php', 'python'}, - callback = function() - vim.opt_local.shiftwidth = 4 - vim.opt_local.softtabstop = 4 - vim.opt_local.tabstop = 4 - end -}) - --- Strip trailing whitespace on save -vim.api.nvim_create_autocmd('BufWritePre', { - pattern = '*', - command = [[%s/\s\+$//e]] -}) - --- Set runtime path for fzf based on the operating system -if vim.fn.has('macunix') == 1 then - vim.opt.rtp:append('/opt/homebrew/opt/fzf') -elseif vim.fn.executable('apt') == 1 then - vim.opt.rtp:append('/usr/share/doc/fzf/examples') -elseif vim.fn.executable('pacman') == 1 then - vim.opt.rtp:append('~/.fzf') -end diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json deleted file mode 100644 index b866212..0000000 --- a/nvim/.config/nvim/lazy-lock.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "ale": { "branch": "master", "commit": "2e5f135836a700dcc6b787f10097ebdeb8e22abb" }, - "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, - "cursor_open.nvim": { "branch": "main", "commit": "9d8dfac0142233de872765e31378c647829576ee" }, - "editorconfig-vim": { "branch": "master", "commit": "ba2ce027c5b0e523e658d24657ce3ae3306c9fe0" }, - "fzf": { "branch": "master", "commit": "90a8800bb596cd98e103788096f2780ee97100b4" }, - "fzf.vim": { "branch": "master", "commit": "ec75ffbfd50630bf2b8d444d89487e149bacf7f3" }, - "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, - "solarized-osaka.nvim": { "branch": "main", "commit": "126d394c0c979a99206214a2b6b8c86e456c9c0f" }, - "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, - "tsuquyomi": { "branch": "master", "commit": "e1afca562d46907bf63270157c88b7ec8f66e46b" }, - "typescript-vim": { "branch": "master", "commit": "8d169e16b5487771f6568125d4c63e6086e524d9" }, - "vim-gh-line": { "branch": "master", "commit": "731751fdfa4f64a061dbc7088cb7b2f12e0828ad" }, - "vim-polyglot": { "branch": "master", "commit": "bc8a81d3592dab86334f27d1d43c080ebf680d42" }, - "vimproc.vim": { "branch": "master", "commit": "63a4ce0768c7af434ac53d37bdc1e7ff7fd2bece" } -} diff --git a/nvim/.config/nvim/lua/config/lazy.lua b/nvim/.config/nvim/lua/config/lazy.lua deleted file mode 100644 index 1ed8a5d..0000000 --- a/nvim/.config/nvim/lua/config/lazy.lua +++ /dev/null @@ -1,69 +0,0 @@ --- Bootstrap lazy.nvim -local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = 'https://github.com/folke/lazy.nvim.git' - local out = vim.fn.system({ - 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath, - }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' }, - { out, 'WarningMsg' }, - { '\nPress any key to exit...' }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) - --- Make sure to setup `mapleader` and `maplocalleader` before loading lazy.nvim --- so that mappings are correct. This is also a good place to setup other --- settings (vim.opt) -vim.g.mapleader = '\\' -vim.g.maplocalleader = '\\' - -require('lazy').setup({ - spec = { - -- Solarized Osaka - { 'craftzdog/solarized-osaka.nvim' }, - -- File exploration and navigation - { - 'junegunn/fzf', - build = function() vim.cmd('FzfInstall') end, - event = 'VimEnter', - }, - { 'junegunn/fzf.vim' }, - -- File exploration and navigation (new) - { 'nvim-telescope/telescope.nvim' }, - -- Languages and syntax - { 'sheerun/vim-polyglot' }, - -- Style guide and linting - { 'dense-analysis/ale' }, - { 'editorconfig/editorconfig-vim' }, - -- TypeScript - { 'leafgarland/typescript-vim' }, - { 'Quramy/tsuquyomi' }, - { - 'Shougo/vimproc.vim', - build = 'make', - }, - -- GitHub integration - { 'github/copilot.vim' }, - { 'ruanyl/vim-gh-line' }, - -- Cursor integration - { - 'yuucu/cursor_open.nvim', - cmd = { 'CursorOpen' }, - keys = { - { 'oc', ':CursorOpen', desc = '[O]pen in [C]ursor' }, - { 'oC', ':CursorOpen!', desc = '[O]pen in [C]ursor (new window)' }, - }, - config = function() - require('cursor_open').setup() - end - }, - }, - install = { colorscheme = { 'solarized-osaka' } }, - checker = { enabled = true }, -}) diff --git a/screen/.screenrc b/screen/.screenrc new file mode 100644 index 0000000..7454bcd --- /dev/null +++ b/screen/.screenrc @@ -0,0 +1,3 @@ +startup_message off +defscrollback 1000000 +hardstatus alwayslastline "%w %= %S" diff --git a/ssh/.ssh/config.gpg b/ssh/.ssh/config.gpg new file mode 100644 index 0000000..c71ead5 Binary files /dev/null and b/ssh/.ssh/config.gpg differ diff --git a/vim/.config/nvim/init.vim b/vim/.config/nvim/init.vim new file mode 100644 index 0000000..f182e5b --- /dev/null +++ b/vim/.config/nvim/init.vim @@ -0,0 +1,3 @@ +set runtimepath^=~/.vim runtimepath+=~/.vim/after +let &packpath = &runtimepath +source ~/.vimrc diff --git a/vim/.vimrc b/vim/.vimrc index 311e488..e0f87ce 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -4,7 +4,6 @@ if empty(glob('~/.vim/autoload/plug.vim')) \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim endif -" A humble list of plugins call plug#begin() " Solarized, without the bullshit Plug 'romainl/flattened' @@ -18,51 +17,28 @@ call plug#begin() " TypeScript Plug 'leafgarland/typescript-vim' Plug 'Quramy/tsuquyomi' - Plug 'Shougo/vimproc.vim', {'do' : 'make'} - " GitHub integration - Plug 'github/copilot.vim' - Plug 'ruanyl/vim-gh-line' call plug#end() -" Color scheme and syntax highlighting syntax on color flattened_dark set background=dark -" Ensures misspellings are highlighted -highlight SpellBad ctermfg=white ctermbg=red -" Global settings -set autoindent -set colorcolumn=80,100,120 -set expandtab -set hidden -set hlsearch -set ignorecase -set incsearch -set laststatus=2 -set number -set relativenumber -set shiftwidth=2 -set smartindent -set softtabstop=2 -set tabstop=2 -set undodir=~/.local/share/vim/undo/ +" Ensures misspellings are highlighted +hi SpellBad ctermfg=white ctermbg=red + +set ai et si sts=2 sw=2 ts=2 +set cc=80,100,120 +set hid +set hls ic is +set nu rnu + set undofile -" Filetype-specific settings -autocmd FileType gitcommit setl colorcolumn=50,72 textwidth=72 -autocmd FileType gitcommit,markdown,text setl nosmartindent spell -autocmd FileType markdown,text setl textwidth=80 wrapmargin=2 -autocmd FileType php,python setl shiftwidth=4 softtabstop=4 tabstop=4 +autocmd FileType php,python setl sts=4 sw=4 ts=4 +autocmd FileType gitcommit,markdown,text setl nosi spell +autocmd FileType gitcommit setl cc=50,72 tw=72 +autocmd FileType markdown,text setl tw=80 wm=2 -" Strip trailing whitespace on save autocmd BufWritePre * :%s/\s\+$//e -" Set the runtime path for fzf based on OS -if has('mac') - set rtp+=/opt/homebrew/opt/fzf -elseif executable('apt') - set rtp+=/usr/share/doc/fzf/examples -elseif executable('pacman') - set rtp+=~/.fzf -endif +set rtp+=~/.fzf diff --git a/zsh/.aliases b/zsh/.aliases index b0082b0..70bb133 100644 --- a/zsh/.aliases +++ b/zsh/.aliases @@ -1,60 +1,39 @@ -# Starts with a clean slate unalias -a -# Prompt when doing something destructive +# Safety first alias cp='cp -i' alias mv='mv -i' alias rm='rm -i' -# Colorize output, make ls human-readable and add classification indicators +# Colorize output, make ls human readable and classify... if [[ `uname` == Darwin ]]; then - # macOS alias dircolors='gdircolors' - alias ls='gls --color=auto --human-readable --classify' - - # Force uuidgen to use lowercase letters like Linux - alias uuidgen='uuidgen | tr A-F a-f' + alias ls='gls --color=auto -hF' else - # Linux - alias ls='ls --color=auto --human-readable --classify' + alias ls='ls --color=auto -hF' - # Use the same open command as macOS + # ...and standardize to macOS naming on Linux alias open='xdg-open' fi -# Run ls immediately after cd +# Run ls after cd function cd { builtin cd "$@" && ls } -# Use bat instead of cat for syntax highlighting -if command -v apt-get &> /dev/null; then - # Debian - alias cat='batcat' -else - # Everybody else - alias cat='bat' -fi +# Colorize cat with bat +alias cat='bat' -# Make disk utility human-readable -alias df='df --human-readable' -alias du='du --human-readable' +# Disk utility aliases +alias df='df -h' +alias du='du -h' -# Colorize grep output and add some exclusions +# Colorize output and some exclusions alias grep="grep --color=auto --exclude-dir={.git,artwork,node_modules,vendor}" -# Use HTTPie in place of the old libwww-perl commands -alias GET='http' -alias POST='http POST' -alias HEAD='http HEAD' - -# Use htop instead of boring old top -alias top='htop' - -# Get the git branch name for the current directory (used in the prompt) +# Git functions git_current_branch() { (command git symbolic-ref -q HEAD || command git name-rev --name-only --no-undefined --always HEAD) 2> /dev/null } -# Get the default branch name for the current directory (usually master or main) git_default_branch() { (git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') 2> /dev/null } @@ -80,7 +59,6 @@ alias gl='git pull origin $(git_current_branch)' alias glg='git log' alias gm='git merge' alias gmm='git merge $(git_default_branch)' -alias gmt='git merge --strategy-option=theirs' alias gmv='git mv' alias gp='git push origin $(git_current_branch)' alias gpf='git push origin $(git_current_branch) --force' @@ -89,6 +67,11 @@ alias grbm='git rebase $(git_default_branch)' alias grm='git rm' alias gst='git status' -# Use nvim in place of vim +# HTTPie aliases +alias GET='http' +alias POST='http POST' +alias HEAD='http HEAD' + +# Nvim takeover alias vim='nvim' alias vimdiff='nvim -d' diff --git a/zsh/.env b/zsh/.env index 92f1920..c962745 100644 --- a/zsh/.env +++ b/zsh/.env @@ -2,4 +2,4 @@ export CLICOLOR=1 export EDITOR=nvim export KEYTIMEOUT=1 export QUOTING_STYLE=literal -export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/gcr/ssh +export TERM=xterm-256color diff --git a/zsh/.zshrc b/zsh/.zshrc index a9ca901..9174eda 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -2,39 +2,17 @@ # Speed up `brew install` export HOMEBREW_NO_AUTO_UPDATE=1 -export HOMEBREW_NO_INSTALL_CLEANUP=1 source $HOME/.env source $HOME/.aliases eval `dircolors $HOME/.dircolors` -# Load up and configure fzf, nvm, and zsh plugins -if [[ `uname` == Darwin ]]; then - # macOS - [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh -elif command -v apt &> /dev/null; then - # Debian - source /usr/share/doc/fzf/examples/completion.zsh - source /usr/share/doc/fzf/examples/key-bindings.zsh -elif command -v pacman &> /dev/null; then - # Arch - source /usr/share/fzf/completion.zsh - source /usr/share/fzf/key-bindings.zsh -fi - -# Load up Antigen and Zsh plugins -if [[ ! -f "${HOME}/.antigen/antigen.zsh" ]]; then - git clone https://github.com/zsh-users/antigen.git "${HOME}/.antigen" -fi -source "${HOME}/.antigen/antigen.zsh" -antigen bundle zsh-users/zsh-history-substring-search -antigen bundle zsh-users/zsh-syntax-highlighting -antigen apply - -bindkey '^[[A' history-substring-search-up -bindkey '^[[B' history-substring-search-down -HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1 +# TODO: May need to tweak this for macOS/brew installed stuff +source /usr/share/fzf/completion.zsh +source /usr/share/fzf/key-bindings.zsh +source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh HISTFILE=$HOME/.zsh_history HISTSIZE=1000000 @@ -65,6 +43,7 @@ setopt interactivecomments setopt share_history bindkey -v + bindkey '^a' beginning-of-line bindkey '^e' end-of-line @@ -86,32 +65,25 @@ PS1=' %F{blue}%~$(git_prompt) %F{244}%# %F{reset}' -# Load up NVM -if [[ ! -f "${HOME}/.nvm/nvm.sh" ]]; then - PROFILE=/dev/null bash -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash' -fi -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +# Only autoload nvm on a specific machine, default to lazy loading +# TODO: Maybe drop the lazy loading entirely as I never use nvm outside of work? +if [[ $(hostname) == "x1carbon.josh" ]]; then + export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] \ + && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +else + # Run `nvm` init script on demand to avoid constant slow downs + function nvm { + if [ -z ${NVM_DIR+x} ]; then + export NVM_DIR="$HOME/.nvm" -# Automatically use Node.js version specified in .nvmrc -autoload -U add-zsh-hook + if [ -s "$NVM_DIR/nvm.sh" ]; then + source "$NVM_DIR/nvm.sh" + elif [ -s "/usr/share/nvm/init-nvm.sh" ]; then + source /usr/share/nvm/init-nvm.sh + fi -load-nvmrc() { - local nvmrc_path="$(nvm_find_nvmrc)" - - if [ -n "$nvmrc_path" ]; then - local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") - - if [ "$nvmrc_node_version" = "N/A" ]; then - nvm install - elif [ "$nvmrc_node_version" != "$(nvm version)" ]; then - nvm use + nvm "$@" fi - elif [ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ] && [ "$(nvm version)" != "$(nvm version default)" ]; then - echo "Reverting to nvm default version" - nvm use default - fi -} - -add-zsh-hook chpwd load-nvmrc -load-nvmrc + } +fi