Compare commits

...

10 commits

Author SHA1 Message Date
Max Bucknell
150fb9cc7b
Fix bad merge 2025-01-19 12:10:36 +00:00
Max Bucknell
3ef0a4990a
Remove colors file as canonical truth 2025-01-19 12:10:04 +00:00
Max Bucknell
e272191f7e
Update shell config for path mapping 2025-01-19 12:09:54 +00:00
57b4f7048f
Vim config updates 2025-01-19 11:41:20 +00:00
c3f3999e02
Factor notes into plugin 2025-01-19 11:41:02 +00:00
d645160b4b
Update Git autocorrect setting 2025-01-19 11:38:53 +00:00
32c48f2e94
Add temp directory setting 2025-01-19 11:16:02 +00:00
9706f5d7fd
Add rust installation 2025-01-02 18:29:08 +00:00
0c44323e52
Ultisnips compatibility updates 2025-01-02 13:57:30 +00:00
521e07fcaf
Update Fish configuration 2024-12-31 12:00:54 +00:00
12 changed files with 193 additions and 150 deletions

View file

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

View file

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

View file

@ -17,34 +17,53 @@ if not contains "/opt/homebrew/share/info" $INFOPATH
end
# Rust
fish_add_path --global "$HOME/.cargo/bin"
fish_add_path --global --move --path "$HOME/.cargo/bin"
# Ruby
fish_add_path --global "$HOMEBREW_PREFIX/ruby/bin"
fish_add_path --global --move --path "$(brew --prefix ruby)/bin"
# Go
set -gx GOPATH "$HOME/go"
set -gx GOBIN "$GOPATH/bin"
fish_add_path --global "$GOBIN"
fish_add_path --global --move --path "$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
set -gx NODEPATH "$HOMEBREW_PREFIX/node@$NODE_VERSION"
fish_add_path --global "$NODEPATH/bin"
set -gx NODEPATH "$(brew --prefix node@$NODE_VERSION)"
fish_add_path --global --move --path "$NODEPATH/bin"
# pnpm
set -gx PNPM_HOME "$HOME/Library/pnpm"
fish_add_path --global "$PNPM_HOME"
fish_add_path --global --move --path "$PNPM_HOME"
# Java
set -gx JAVAPATH "$HOMEBREW_PREFIX/openjdk@21"
fish_add_path --global "$JAVAPATH/bin"
set -gx JAVAPATH "$(brew --prefix openjdk@21)"
fish_add_path --global --move --path "$JAVAPATH/bin"
# Android
set -gx ANDROID_HOME "$HOME/Library/Android/sdk"
fish_add_path --global "$ANDROID_HOME/emulator" "$ANDROID_HOME/platform-tools"
fish_add_path --global --move --path "$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
fish_add_path --global "$DOTFILES_PATH/bin" "$DOTFILES_PATH/bin/misc"
fish_add_path --global --move --path "$DOTFILES_PATH/bin" "$DOTFILES_PATH/bin/misc"
# FZF
set -gx FZF_DEFAULT_COMMAND 'rg --files --hidden --follow --glob "!.git/*"'
# Git
@ -91,5 +110,5 @@ set -g fish_color_valid_path --bold
set -g fish_color_command --bold
set -g fish_color_time magenta
# Greeting
set -g fish_greeting "You look nice today :-)"
# Greeting. I don't need a repeating message.
set -g fish_greeting

View file

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

View file

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

Binary file not shown.

View file

@ -1,34 +1,9 @@
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
- [ ] ${0:What would you like to do..?}
endsnippet
snippet --- "Horizontal Rule" b
--------------------------------------------------------------------------------
$0
endsnippet

View file

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

View file

@ -1,5 +0,0 @@
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

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

View file

@ -14,16 +14,16 @@ plug#begin()
Plug 'vimpostor/vim-lumen'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'arthurxavierx/vim-caser'
Plug '/opt/homebrew/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'SirVer/ultisnips'
Plug 'dense-analysis/ale'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'quarto-dev/quarto-vim'
@ -33,6 +33,12 @@ Plug 'elixir-editors/vim-elixir'
Plug 'bullets-vim/bullets.vim'
Plug 'maxbucknell/vim-mbnotes'
Plug 'SirVer/ultisnips'
Plug 'dense-analysis/ale'
Plug 'prabirshrestha/asyncomplete.vim'
plug#end()
# Language config
@ -109,34 +115,36 @@ matchadd('ColorColumn', '\%82v', 100)
# Mappings etc
g:mapleader = "\<space>"
g:localmapleader = "\\"
g:maplocalleader = ","
# Use jk to escape back to normal
inoremap jk <esc>
inoremap <esc> <nop>
# Hide search highlights
nnoremap <esc> :noh<cr>
nnoremap <leader>/ :noh<cr>
nnoremap <bs> :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
nnoremap <leader><leader> <c-^>
# Fix shift-semicolon to write
# Fix shift-semicolon to colon
noremap ; :
# Make it easier to use registers
nnoremap ' "
# I should map these to something useful
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
noremap <up> <nop>
noremap <down> <nop>
noremap <left> <nop>
noremap <right> <nop>
# Update almost a decade later: I mapped these to something useful!
noremap <left> :cprev<cr>
noremap <right> :cnext<cr>
# Case control
nnoremap <leader>u viwU
@ -210,6 +218,7 @@ enddef
# Git blame
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.
@ -233,6 +242,8 @@ augroup END
# Use tab for UltiSnips expansion, navigation, and
g:ulti_expand_or_jump_res = 0
g:UltiSnipsExpandOrJumpTrigger = '<tab>'
g:UltiSnipsSnippetStorageDirectoryForUltiSnipsEdit = $DOTFILES_PATH .. "/vim/vim.xdg.symlink/Ultisnips"
def g:Ultisnips_expand(default: string): string
UltiSnips#ExpandSnippetOrJump()
@ -248,11 +259,23 @@ enddef
# 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:pandoc#syntax#codeblocks#embeds#langs = ['r', 'elixir', 'python', 'html', 'rust']
# Enable bullets.vim in Quarto files
g:bullets_enabled_file_types = ['markdown', 'text', 'gitcommit', 'quarto']
g:bullets_enabled_file_types = ['markdown', 'text', 'gitcommit', 'quarto', 'mbnotes', 'mbnotes.quarto']
# Disable the bullet changing on indents (for now)
g:bullets_outline_levels = ['num', 'std-']
@ -321,13 +344,16 @@ def EditCodeBlock()
# Set file type, if it is correctly annotated
if @f != '`'
execute 'set filetype=' .. @f
@f = substitute(@f, "[\{\}]", "", "g")
execute 'setf=' .. @f
endif
set nomodified
enddef
def SaveCodeBlock()
command -nargs=0 EditCodeBlock EditCodeBlock()
def g:SaveCodeBlock()
var b = bufnr("%")
silent :%yank c
normal! mc
@ -342,70 +368,30 @@ enddef
augroup CodeBlocks
autocmd!
autocmd BufWriteCmd *.codeblock <ScriptCmd>SaveCodeBlock()
autocmd BufWriteCmd *.codeblock g:SaveCodeBlock()
augroup END
augroup Notes
# autocmd Filetype quarto setl tw=80 fo+=croqt ts=4 sts=4 sw=4 comments=n:>
autocmd!
# Surround mappings for Quarto callouts
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 imap <buffer> <tab> <c-r>=g:Ultisnips_expand("\<c-t>")<cr>
autocmd FileType mbnotes imap <buffer> <s-tab> <c-d>
autocmd FileType quarto imap <buffer> <tab> <c-r>=g:Ultisnips_expand("\<c-t>")<cr>
autocmd FileType quarto imap <buffer> <s-tab> <c-d>
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>
autocmd FileType mbnotes onoremap <expr> cb :<c-u>execute "normal! /^```\rk$ms?^```\rj:noh\rv`s"<cr>
autocmd FileType mbnotes nnoremap <leader>ec :EditCodeBlock<cr>
autocmd FileType mbnotes inoremap <c-e> <esc>:EditCodeBlock<cr>
augroup END
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
autocmd!
autocmd VimEnter * ++nested StartUp()
autocmd VimResized * wincmd =
augroup END
# LSP and other completion
g:ale_completion_enabled = 1
g:ale_elixir_elixir_ls_release = '/opt/homebrew/opt/elixir-ls/libexec'
g:ale_fix_on_save = 1
@ -437,16 +423,41 @@ nnoremap <leader>dx :ALEGoToDefinition -split<cr>
nnoremap <leader>dv :ALEGoToDefinition -vsplit<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
def PreviewQuarto()
ClosePreview()
echom 'Starting preview job'
b:file = expand('%')
b:preview_job = job_start(
\ ['quarto', 'preview', b:file],
\ )
b:preview_job = job_start([
'quarto',
'preview',
expand('%')
])
enddef
def ClosePreview()
@ -482,7 +493,7 @@ def SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")')
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
enddef
nnoremap <leader>\ <ScriptCmd>SynStack()<cr>