Compare commits

..

No commits in common. "150fb9cc7b3bf2f156951f3e30832ef155b242f1" and "0563d59eddc80faccb032fe58331184247ef938e" have entirely different histories.

12 changed files with 150 additions and 193 deletions

View file

@ -1 +0,0 @@
source "$HOME/.cargo/env.fish"

View file

@ -1,10 +1,4 @@
set -gx GIT_AUTHOR_NAME "Max Bucknell" set -gx GIT_AUTHOR_NAME="Max Bucknell"
set -gx GIT_AUTHOR_EMAIL "me@maxbucknell.com" set -gx GIT_AUTHOR_EMAIL="me@maxbucknell.com"
set -gx TEMP_DIR "$HOME/tmp" set -gx NODE_VERSION="22"
set -gx NODE_VERSION "23"
set -gx DOTFILES_PATH "$HOME/dotfiles"
set -gx DAILY_NOTES_PATH "$HOME/Dropbox (Maestral)/Daily Notes"

View file

@ -17,53 +17,34 @@ if not contains "/opt/homebrew/share/info" $INFOPATH
end end
# Rust # Rust
fish_add_path --global --move --path "$HOME/.cargo/bin" fish_add_path --global "$HOME/.cargo/bin"
# Ruby # Ruby
fish_add_path --global --move --path "$(brew --prefix ruby)/bin" fish_add_path --global "$HOMEBREW_PREFIX/ruby/bin"
# Go # Go
set -gx GOPATH "$HOME/go" set -gx GOPATH "$HOME/go"
set -gx GOBIN "$GOPATH/bin" set -gx GOBIN "$GOPATH/bin"
fish_add_path --global --move --path "$GOBIN" fish_add_path --global "$GOBIN"
# Python
set -gx VIRTUAL_ENV_DISABLE_PROMPT 1
if ! test -f "$HOME/dotfiles/python/venv/bin/activate.fish"
python3 -m venv "$HOME/dotfiles/python/venv"
end
source "$HOME/dotfiles/python/venv/bin/activate.fish"
set -gx PYTHONPATH "$PYTHONPATH:$HOME/dotfiles/lib/python"
# Node.js # Node.js
set -gx NODEPATH "$(brew --prefix node@$NODE_VERSION)" set -gx NODEPATH "$HOMEBREW_PREFIX/node@$NODE_VERSION"
fish_add_path --global --move --path "$NODEPATH/bin" fish_add_path --global "$NODEPATH/bin"
# pnpm # pnpm
set -gx PNPM_HOME "$HOME/Library/pnpm" set -gx PNPM_HOME "$HOME/Library/pnpm"
fish_add_path --global --move --path "$PNPM_HOME" fish_add_path --global "$PNPM_HOME"
# Java # Java
set -gx JAVAPATH "$(brew --prefix openjdk@21)" set -gx JAVAPATH "$HOMEBREW_PREFIX/openjdk@21"
fish_add_path --global --move --path "$JAVAPATH/bin" fish_add_path --global "$JAVAPATH/bin"
# Android # Android
set -gx ANDROID_HOME "$HOME/Library/Android/sdk" set -gx ANDROID_HOME "$HOME/Library/Android/sdk"
fish_add_path --global --move --path "$ANDROID_HOME/emulator" "$ANDROID_HOME/platform-tools" fish_add_path --global "$ANDROID_HOME/emulator" "$ANDROID_HOME/platform-tools"
# Python
source "$HOME/dotfiles/python/venv/bin/activate.fish"
set -gx PYTHONPATH "$PYTHONPATH:$DOTFILES_PATH/lib/python"
# Local path # Local path
fish_add_path --global --move --path "$DOTFILES_PATH/bin" "$DOTFILES_PATH/bin/misc" fish_add_path --global "$DOTFILES_PATH/bin" "$DOTFILES_PATH/bin/misc"
# FZF
set -gx FZF_DEFAULT_COMMAND 'rg --files --hidden --follow --glob "!.git/*"'
# Git # Git
@ -110,5 +91,5 @@ set -g fish_color_valid_path --bold
set -g fish_color_command --bold set -g fish_color_command --bold
set -g fish_color_time magenta set -g fish_color_time magenta
# Greeting. I don't need a repeating message. # Greeting
set -g fish_greeting set -g fish_greeting "You look nice today :-)"

View file

@ -1,6 +1,6 @@
# This file contains fish universal variable definitions. # This file contains fish universal variable definitions.
# VERSION: 3.0 # VERSION: 3.0
SETUVAR __fish_initialized:3800 SETUVAR __fish_initialized:3400
SETUVAR fish_color_autosuggestion:brblack SETUVAR fish_color_autosuggestion:brblack
SETUVAR fish_color_cancel:\x2dr SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:blue SETUVAR fish_color_command:blue

View file

@ -38,7 +38,7 @@
ui = auto ui = auto
[help] [help]
autocorrect = prompt autocorrect = 1
[push] [push]
default = current default = current

BIN
iterm/colors.pxd Normal file

Binary file not shown.

View file

@ -1,9 +1,34 @@
snippet :::n "Callout: Note" b
::: {.callout-note}
${0:${VISUAL:text...}}
:::
endsnippet
snippet :::t "Callout: Tip" b
::: {.callout-tip}
${0:${VISUAL:text...}}
:::
endsnippet
snippet :::w "Callout: Warning" b
::: {.callout-warning}
${0:${VISUAL:text...}}
:::
endsnippet
snippet :::i "Callout: Important" b
::: {.callout-important}
${0:${VISUAL:text...}}
:::
endsnippet
snippet `r "R Code Block" b
\`\`\`{r}
${1:#| output: ${2:false}}
${0:${VISUAL:# code...}}
\`\`\`
endsnippet
snippet todo "Make a To-Do List!" b snippet todo "Make a To-Do List!" b
- [ ] ${0:What would you like to do..?} - [ ] ${0:What would you like to do..?}
endsnippet endsnippet
snippet --- "Horizontal Rule" b
--------------------------------------------------------------------------------
$0
endsnippet

View file

@ -1,5 +0,0 @@
snippet gdef "Default global variable"
if !exists("g:${1:...}")
g:$1 = $2
endif$0
endsnippet

View file

@ -0,0 +1,5 @@
syn region quartoCalloutNote start=":::\s\+{\.callout-note\s*" end=":::$" keepend
syn region quartoCalloutWarning start=":::\s\+{\.callout-warning\s*" end=":::$" keepend
syn region quartoCalloutImportant start=":::\s\+{\.callout-important\s*" end=":::$" keepend
syn region quartoCalloutTip start=":::\s\+{\.callout-tip\s*" end=":::$" keepend
syn region quartoCalloutCaution start=":::\s\+{\.callout-caution\s*" end=":::$" keepend

View file

@ -1,24 +0,0 @@
function! asyncomplete#sources#ultisnips#get_source_options(opts)
let l:defaults={
\ 'name': 'ultisnips',
\ 'completor': function('asyncomplete#sources#ultisnips#completor'),
\ 'allowlist': ['*']
\ }
return extend(l:defaults, a:opts)
endfunction
function! asyncomplete#sources#ultisnips#completor(opt, ctx)
let l:snips = UltiSnips#SnippetsInCurrentScope()
let l:matches = []
let l:col = a:ctx['col']
let l:typed = a:ctx['typed']
let l:kwlen = len(l:typed)
let l:matches = map(keys(l:snips),'{"word":v:val,"dup":1,"icase":1,"menu": "Snips: " . l:snips[v:val]}')
let l:startcol = l:col - l:kwlen
call asyncomplete#complete(a:opt['name'], a:ctx, l:startcol, l:matches)
endfunction

View file

@ -29,36 +29,34 @@ let s:is_dark=(&background == 'dark')
" \ 'mpwb_green': '#20A92E', " \ 'mpwb_green': '#20A92E',
call extend(v:colornames, { call extend(v:colornames, {
\ 'mpwb_light': '#e7e3e9', \ 'mpwb_fg': '#201C22',
\ 'mpwb_dark': '#201c22', \ 'mpwb_bg': '#E7E3E9',
\ 'mpwb_fg': '#201c22', \ 'mpwb_tintbg': '#FCF7FE',
\ 'mpwb_bg': '#e7e3e9', \ 'mpwb_red': '#AD1C22',
\ 'mpwb_tintbg': '#fcf7fe', \ 'mpwb_orange': '#AF5F27',
\ 'mpwb_red': '#ad1c22', \ 'mpwb_yellow': '#AD9622',
\ 'mpwb_orange': '#af5f27', \ 'mpwb_green': '#20A951',
\ 'mpwb_yellow': '#ad9622', \ 'mpwb_cyan': '#20A9AE',
\ 'mpwb_green': '#20a951', \ 'mpwb_blue': '#2059AF',
\ 'mpwb_cyan': '#20a9ae', \ 'mpwb_purple': '#721CAF',
\ 'mpwb_blue': '#2059af', \ 'mpwb_magenta': '#AB177B',
\ 'mpwb_purple': '#721caf', \ 'mpwb_callout_note': '#CCD7E8',
\ 'mpwb_magenta': '#ab177b', \ 'mpwb_callout_tip': '#D2E8CC',
\ 'mpwb_callout_note': '#ccd7e8', \ 'mpwb_callout_important': '#E8CCCC',
\ 'mpwb_callout_tip': '#d2e8cc', \ 'mpwb_callout_warning': '#E8E3CC',
\ 'mpwb_callout_important': '#e8cccc',
\ 'mpwb_callout_warning': '#e8e3cc',
\ 'mpwb_cursorline': '#c6c2c8' \ 'mpwb_cursorline': '#c6c2c8'
\ }, 'force') \ }, 'force')
if s:is_dark if s:is_dark
call extend(v:colornames, { call extend(v:colornames, {
\ 'mpwb_fg': '#e7e3e9', \ 'mpwb_fg': '#E7E3E9',
\ 'mpwb_bg': '#201c22', \ 'mpwb_bg': '#201C22',
\ 'mpwb_tintbg': '#3b3440', \ 'mpwb_tintbg': '#3B3440',
\ 'mpwb_callout_note': '#002a68', \ 'mpwb_callout_note': '#002A68',
\ 'mpwb_callout_tip': '#156800', \ 'mpwb_callout_tip': '#156800',
\ 'mpwb_callout_important': '#680000', \ 'mpwb_callout_important': '#680000',
\ 'mpwb_callout_warning': '#685700', \ 'mpwb_callout_warning': '#685700',
\ 'mpwb_cursorline': '#29242c', \ 'mpwb_cursorline': '#29242C',
\ }, 'force') \ }, 'force')
endif endif
@ -93,13 +91,9 @@ hi! link MatchParen Search
" Chrome is purple " Chrome is purple
hi VertSplit guifg=mpwb_purple cterm=NONE hi VertSplit guifg=mpwb_purple cterm=NONE
hi StatusLine guibg=mpwb_light guifg=mpwb_purple hi StatusLine guifg=mpwb_purple cterm=bold
hi StatusLineNC guifg=mpwb_purple cterm=NONE hi StatusLineNC guifg=mpwb_purple cterm=NONE
hi TabLine guifg=mpwb_purple guibg=mpwb_bg
hi TabLineFill guibg=mpwb_bg guifg=mpwb_purple cterm=underline
hi TabLinesel guibg=mpwb_purple guifg=mpwb_light
hi Visual guibg=mpwb_fg guifg=mpwb_bg hi Visual guibg=mpwb_fg guifg=mpwb_bg
hi LineNr cterm=NONE guifg=mpwb_purple hi LineNr cterm=NONE guifg=mpwb_purple
@ -127,7 +121,7 @@ hi LspSigActiveParameter cterm=bold guifg=mpwb_bg guibg=mpwb_purple
hi pandocBlockQuote cterm=NONE guifg=mpwb_fg hi pandocBlockQuote cterm=NONE guifg=mpwb_fg
hi link elixirUnusedVariable Normal hi link elixirUnusedVariable Normal
" Notes " Notes in Quarto
hi Title cterm=bold guifg=mpwb_fg hi Title cterm=bold guifg=mpwb_fg
hi link pandocAtxHeaderMark Title hi link pandocAtxHeaderMark Title
@ -135,11 +129,10 @@ hi link pandocAtxStart Title
hi link pandocNoFormatted Keyword hi link pandocNoFormatted Keyword
hi link pandocDelimitedCodeBlockLanguage Normal hi link pandocDelimitedCodeBlockLanguage Normal
hi pandocBlockQuote cterm=italic hi pandocBlockQuote cterm=italic
hi pandocHRule guibg=mpwb_tintbg
hi mbnCalloutNote guibg=mpwb_callout_note hi quartoCalloutNote guibg=mpwb_callout_note
hi mbnCalloutWarning guibg=mpwb_callout_warning hi quartoCalloutWarning guibg=mpwb_callout_warning
hi mbnCalloutImportant guibg=mpwb_callout_important hi quartoCalloutImportant guibg=mpwb_callout_important
hi mbnCalloutTip guibg=mpwb_callout_tip hi quartoCalloutTip guibg=mpwb_callout_tip
hi mbnCalloutCaution guibg=mpwb_callout_warning hi quartoCalloutCaution guibg=mpwb_callout_warning

View file

@ -14,16 +14,16 @@ plug#begin()
Plug 'vimpostor/vim-lumen' Plug 'vimpostor/vim-lumen'
Plug 'tpope/vim-commentary' Plug 'tpope/vim-commentary'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive' Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround' Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'arthurxavierx/vim-caser'
Plug '/opt/homebrew/opt/fzf' Plug '/opt/homebrew/opt/fzf'
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
Plug 'SirVer/ultisnips'
Plug 'dense-analysis/ale'
Plug 'vim-pandoc/vim-pandoc-syntax' Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'quarto-dev/quarto-vim' Plug 'quarto-dev/quarto-vim'
@ -33,12 +33,6 @@ Plug 'elixir-editors/vim-elixir'
Plug 'bullets-vim/bullets.vim' Plug 'bullets-vim/bullets.vim'
Plug 'maxbucknell/vim-mbnotes'
Plug 'SirVer/ultisnips'
Plug 'dense-analysis/ale'
Plug 'prabirshrestha/asyncomplete.vim'
plug#end() plug#end()
# Language config # Language config
@ -115,36 +109,34 @@ matchadd('ColorColumn', '\%82v', 100)
# Mappings etc # Mappings etc
g:mapleader = "\<space>" g:mapleader = "\<space>"
g:maplocalleader = "," g:localmapleader = "\\"
# Use jk to escape back to normal # Use jk to escape back to normal
inoremap jk <esc> inoremap jk <esc>
inoremap <esc> <nop> inoremap <esc> <nop>
# Hide search highlights # Hide search highlights
nnoremap <bs> :noh<cr> nnoremap <esc> :noh<cr>
nnoremap <leader>/ :noh<cr>
# Hide warning about exiting vim when I type ctrl-c to edit windows
nnoremap <C-c> <silent> <C-c>
# Switch between recent buffers # Switch between recent buffers
nnoremap <leader><leader> <c-^> nnoremap <leader><leader> <c-^>
# Fix shift-semicolon to colon # Fix shift-semicolon to write
noremap ; : noremap ; :
# Make it easier to use registers
nnoremap ' "
# I should map these to something useful # I should map these to something useful
inoremap <up> <nop> inoremap <up> <nop>
inoremap <down> <nop> inoremap <down> <nop>
inoremap <left> <nop> inoremap <left> <nop>
inoremap <right> <nop> inoremap <right> <nop>
noremap <up> <nop> noremap <up> <nop>
noremap <down> <nop> noremap <down> <nop>
noremap <left> <nop>
# Update almost a decade later: I mapped these to something useful! noremap <right> <nop>
noremap <left> :cprev<cr>
noremap <right> :cnext<cr>
# Case control # Case control
nnoremap <leader>u viwU nnoremap <leader>u viwU
@ -218,7 +210,6 @@ enddef
# Git blame # Git blame
nnoremap <leader>a <ScriptCmd>Zoom()<cr>:Git blame<cr> nnoremap <leader>a <ScriptCmd>Zoom()<cr>:Git blame<cr>
nnoremap <leader>z <ScriptCmd>Zoom()<cr>
# Make directories in a filename if they don't exist. # Make directories in a filename if they don't exist.
@ -242,8 +233,6 @@ augroup END
# Use tab for UltiSnips expansion, navigation, and # Use tab for UltiSnips expansion, navigation, and
g:ulti_expand_or_jump_res = 0 g:ulti_expand_or_jump_res = 0
g:UltiSnipsExpandOrJumpTrigger = '<tab>' g:UltiSnipsExpandOrJumpTrigger = '<tab>'
g:UltiSnipsSnippetStorageDirectoryForUltiSnipsEdit = $DOTFILES_PATH .. "/vim/vim.xdg.symlink/Ultisnips"
def g:Ultisnips_expand(default: string): string def g:Ultisnips_expand(default: string): string
UltiSnips#ExpandSnippetOrJump() UltiSnips#ExpandSnippetOrJump()
@ -259,23 +248,11 @@ enddef
# Notes config # Notes config
g:mbnotes_dir = $HOME .. "/Dropbox (Maestral)/Notes"
g:mbnotes_out_dir = g:mbnotes_dir .. "/_output"
g:mbnotes_open_daily_on_startup = true
g:mbnotes_renderer_show = true
g:mbnotes_renderer_close_on_end = true
nnoremap <leader>t :MBNotesDaily<cr>
nnoremap <leader>n :MBNotes<cr>
nnoremap <c-n> :MBNotesNew<cr>
nnoremap <c-x> :MBNotesNewSplit<cr>
nnoremap <c-v> :vertical MBNotesNewSplit<cr>
g:markdown_fenced_languages = ['r', 'elixir', 'python', 'html', 'rust'] g:markdown_fenced_languages = ['r', 'elixir', 'python', 'html', 'rust']
g:pandoc#syntax#codeblocks#embeds#langs = ['r', 'elixir', 'python', 'html', 'rust'] g:pandoc#syntax#codeblocks#embeds#langs = ['r', 'elixir', 'python', 'html', 'rust']
# Enable bullets.vim in Quarto files # Enable bullets.vim in Quarto files
g:bullets_enabled_file_types = ['markdown', 'text', 'gitcommit', 'quarto', 'mbnotes', 'mbnotes.quarto'] g:bullets_enabled_file_types = ['markdown', 'text', 'gitcommit', 'quarto']
# Disable the bullet changing on indents (for now) # Disable the bullet changing on indents (for now)
g:bullets_outline_levels = ['num', 'std-'] g:bullets_outline_levels = ['num', 'std-']
@ -344,16 +321,13 @@ def EditCodeBlock()
# Set file type, if it is correctly annotated # Set file type, if it is correctly annotated
if @f != '`' if @f != '`'
@f = substitute(@f, "[\{\}]", "", "g") execute 'set filetype=' .. @f
execute 'setf=' .. @f
endif endif
set nomodified set nomodified
enddef enddef
command -nargs=0 EditCodeBlock EditCodeBlock() def SaveCodeBlock()
def g:SaveCodeBlock()
var b = bufnr("%") var b = bufnr("%")
silent :%yank c silent :%yank c
normal! mc normal! mc
@ -368,30 +342,70 @@ enddef
augroup CodeBlocks augroup CodeBlocks
autocmd! autocmd!
autocmd BufWriteCmd *.codeblock g:SaveCodeBlock() autocmd BufWriteCmd *.codeblock <ScriptCmd>SaveCodeBlock()
augroup END augroup END
augroup Notes augroup Notes
autocmd! # autocmd Filetype quarto setl tw=80 fo+=croqt ts=4 sts=4 sw=4 comments=n:>
autocmd FileType mbnotes imap <buffer> <tab> <c-r>=g:Ultisnips_expand("\<c-t>")<cr> # Surround mappings for Quarto callouts
autocmd FileType mbnotes imap <buffer> <s-tab> <c-d> autocmd FileType quarto b:surround_110 = "::: {.callout-note}\n\r\n:::"
autocmd FileType quarto b:surround_116 = "::: {.callout-tip}\n\r\n:::"
autocmd FileType quarto b:surround_119 = "::: {.callout-warning}\n\r\n:::"
autocmd FileType quarto b:surround_105 = "::: {.callout-important}\n\r\n:::"
autocmd FileType mbnotes onoremap <expr> cb :<c-u>execute "normal! /^```\rk$ms?^```\rj:noh\rv`s"<cr> autocmd FileType quarto imap <buffer> <tab> <c-r>=g:Ultisnips_expand("\<c-t>")<cr>
autocmd FileType mbnotes nnoremap <leader>ec :EditCodeBlock<cr> autocmd FileType quarto imap <buffer> <s-tab> <c-d>
autocmd FileType mbnotes inoremap <c-e> <esc>:EditCodeBlock<cr>
autocmd FileType quarto onoremap <expr> cb :<c-u>execute "normal! /^```\rk$ms?^```\rj:noh\rv`s"<cr>
autocmd FileType quarto nnoremap <expr> <leader>ec <ScriptCmd>EditCodeBlock()<cr>
autocmd FileType quarto inoremap <expr> <c-e> <esc><ScriptCmd>EditCodeBlock()<cr>
augroup END augroup END
nnoremap <leader>x :silent keepp s/^- \[ \]/- [o]/e<cr>:silent keepp s/^- \[x\]/- [ ]/e<cr>:silent keepp s/^- \[o\]/- [x]/e<cr> nnoremap <leader>x :silent keepp s/^- \[ \]/- [o]/e<cr>:silent keepp s/^- \[x\]/- [ ]/e<cr>:silent keepp s/^- \[o\]/- [x]/e<cr>
# Daily notes
def FormatOffset(offset: number): string
if offset == 0
return ""
elseif offset > 0
return "-v+" .. offset .. "d "
else
return "-v" .. offset .. "d "
endif
enddef
def OpenDailyNote(offset = 0)
var command = "date -v-4H " .. FormatOffset(offset) .. "\"+%Y-%m-%d\""
var date = trim(system(command))
var filename = $DAILY_NOTES_PATH .. "/" .. date .. "-daily.qmd"
if !filereadable(filename)
var template = $DAILY_NOTES_PATH .. "/template.py"
system(shellescape(template) .. " " .. shellescape(date) .. " > " .. shellescape(filename))
endif
execute "edit " .. filename
enddef
command -nargs=? Daily OpenDailyNote(<args>)
def StartUp()
if @% == ""
OpenDailyNote()
endif
enddef
augroup StartUp augroup StartUp
autocmd! autocmd!
autocmd VimEnter * ++nested StartUp()
autocmd VimResized * wincmd =
augroup END augroup END
# LSP and other completion # LSP and other completion
g:ale_completion_enabled = 1
g:ale_elixir_elixir_ls_release = '/opt/homebrew/opt/elixir-ls/libexec' g:ale_elixir_elixir_ls_release = '/opt/homebrew/opt/elixir-ls/libexec'
g:ale_fix_on_save = 1 g:ale_fix_on_save = 1
@ -423,41 +437,16 @@ nnoremap <leader>dx :ALEGoToDefinition -split<cr>
nnoremap <leader>dv :ALEGoToDefinition -vsplit<cr> nnoremap <leader>dv :ALEGoToDefinition -vsplit<cr>
nnoremap <leader>dt :ALEGoToDefinition -tab<cr> nnoremap <leader>dt :ALEGoToDefinition -tab<cr>
# au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#ale#get_source_options({
# \ 'priority': 10, " Provide your own overrides here
# \ }))
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>"
augroup Completion
autocmd!
autocmd User asyncomplete_setup {
asyncomplete#register_source(
asyncomplete#sources#mbnotes#get_source_options({ 'priority': 9 })
)
asyncomplete#register_source(
asyncomplete#sources#ale#get_source_options({ 'priority': 10 })
)
asyncomplete#register_source(
asyncomplete#sources#ultisnips#get_source_options({ 'priority': 11 })
)
}
augroup END
# File Running # File Running
def PreviewQuarto() def PreviewQuarto()
ClosePreview() ClosePreview()
echom 'Starting preview job' echom 'Starting preview job'
b:preview_job = job_start([ b:file = expand('%')
'quarto', b:preview_job = job_start(
'preview', \ ['quarto', 'preview', b:file],
expand('%') \ )
])
enddef enddef
def ClosePreview() def ClosePreview()