Ultisnips compatibility updates
This commit is contained in:
parent
521e07fcaf
commit
0c44323e52
6 changed files with 116 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
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 NODE_VERSION="22"
|
set -gx NODE_VERSION "23"
|
||||||
|
|
||||||
set -gx DOTFILES_PATH "$HOME/dotfiles"
|
set -gx DOTFILES_PATH "$HOME/dotfiles"
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,17 @@ set -gx GOPATH "$HOME/go"
|
||||||
set -gx GOBIN "$GOPATH/bin"
|
set -gx GOBIN "$GOPATH/bin"
|
||||||
fish_add_path --global "$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 "$HOMEBREW_PREFIX/node@$NODE_VERSION"
|
set -gx NODEPATH "$HOMEBREW_PREFIX/node@$NODE_VERSION"
|
||||||
fish_add_path --global "$NODEPATH/bin"
|
fish_add_path --global "$NODEPATH/bin"
|
||||||
|
|
|
@ -1,3 +1,33 @@
|
||||||
|
snippet note "Note Front Matter" b
|
||||||
|
---
|
||||||
|
title: "${1:Title}"
|
||||||
|
author: "${2:Max Bucknell}"
|
||||||
|
date: "${3:`date "+%A, %e, %B %Y"`}"
|
||||||
|
format:
|
||||||
|
html:
|
||||||
|
embed-resources: true
|
||||||
|
html-math-method: katex
|
||||||
|
mainfont: Lato
|
||||||
|
monofont: Input
|
||||||
|
theme:
|
||||||
|
light: flatly
|
||||||
|
dark: darkly
|
||||||
|
pdf:
|
||||||
|
documentclass: article
|
||||||
|
mainfont: Lato
|
||||||
|
monofont: Input
|
||||||
|
geometry:
|
||||||
|
- top=30mm
|
||||||
|
- left=20mm
|
||||||
|
- heightrounded
|
||||||
|
number-sections: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# $1
|
||||||
|
|
||||||
|
$0
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet :::n "Callout: Note" b
|
snippet :::n "Callout: Note" b
|
||||||
::: {.callout-note}
|
::: {.callout-note}
|
||||||
${0:${VISUAL:text...}}
|
${0:${VISUAL:text...}}
|
||||||
|
@ -29,6 +59,26 @@ ${0:${VISUAL:# code...}}
|
||||||
\`\`\`
|
\`\`\`
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet `py "Python Code Block" b
|
||||||
|
\`\`\`{python}
|
||||||
|
${1:#| output: ${2:false}}
|
||||||
|
${0:${VISUAL:# code...}}
|
||||||
|
\`\`\`
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet `ju "Julia Code Block" b
|
||||||
|
\`\`\`{julia}
|
||||||
|
${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
|
||||||
|
|
|
@ -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
|
|
@ -129,6 +129,7 @@ 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 quartoCalloutNote guibg=mpwb_callout_note
|
hi quartoCalloutNote guibg=mpwb_callout_note
|
||||||
hi quartoCalloutWarning guibg=mpwb_callout_warning
|
hi quartoCalloutWarning guibg=mpwb_callout_warning
|
||||||
|
|
|
@ -14,15 +14,17 @@ 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-surround'
|
|
||||||
Plug 'tpope/vim-repeat'
|
Plug 'tpope/vim-repeat'
|
||||||
|
Plug 'tpope/vim-surround'
|
||||||
|
|
||||||
Plug '/opt/homebrew/opt/fzf'
|
Plug '/opt/homebrew/opt/fzf'
|
||||||
Plug 'junegunn/fzf.vim'
|
Plug 'junegunn/fzf.vim'
|
||||||
|
|
||||||
Plug 'SirVer/ultisnips'
|
Plug 'SirVer/ultisnips'
|
||||||
Plug 'dense-analysis/ale'
|
Plug 'dense-analysis/ale'
|
||||||
|
Plug 'prabirshrestha/asyncomplete.vim'
|
||||||
|
|
||||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||||
Plug 'quarto-dev/quarto-vim'
|
Plug 'quarto-dev/quarto-vim'
|
||||||
|
@ -210,6 +212,7 @@ 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.
|
||||||
|
|
||||||
|
@ -386,7 +389,7 @@ def OpenDailyNote(offset = 0)
|
||||||
system(shellescape(template) .. " " .. shellescape(date) .. " > " .. shellescape(filename))
|
system(shellescape(template) .. " " .. shellescape(date) .. " > " .. shellescape(filename))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
execute "edit " .. filename
|
execute "silent edit " .. filename
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
|
||||||
|
@ -400,12 +403,14 @@ enddef
|
||||||
|
|
||||||
augroup StartUp
|
augroup StartUp
|
||||||
autocmd!
|
autocmd!
|
||||||
|
|
||||||
autocmd VimEnter * ++nested StartUp()
|
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
|
||||||
|
|
||||||
|
@ -437,6 +442,26 @@ 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#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()
|
||||||
|
@ -482,7 +507,7 @@ def SynStack()
|
||||||
if !exists("*synstack")
|
if !exists("*synstack")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")')
|
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
nnoremap <leader>\ <ScriptCmd>SynStack()<cr>
|
nnoremap <leader>\ <ScriptCmd>SynStack()<cr>
|
||||||
|
|
Loading…
Add table
Reference in a new issue