From da58a604c28d6995199ed682fa79e57970fe28ff Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Sun, 29 Mar 2026 15:01:40 -0500 Subject: [PATCH] nvim: enable ui2 scratch plugin is not needed anymore. --- .config/nvim/autoload/scratch.vim | 49 ------------------------------- .config/nvim/plugin/scratch.vim | 15 ---------- .config/nvim/plugin/ui2.fnl | 2 ++ 3 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 .config/nvim/autoload/scratch.vim delete mode 100644 .config/nvim/plugin/scratch.vim create mode 100644 .config/nvim/plugin/ui2.fnl diff --git a/.config/nvim/autoload/scratch.vim b/.config/nvim/autoload/scratch.vim deleted file mode 100644 index 0a06cdc7..00000000 --- a/.config/nvim/autoload/scratch.vim +++ /dev/null @@ -1,49 +0,0 @@ -" Source: https://gist.github.com/romainl/eae0a260ab9c135390c30cd370c20cd7 -function! scratch#open(cmd, mods) abort - for win in filter(range(1, winnr('$')), 'getwinvar(v:val, "scratch")') - execute win . 'windo close' - endfor - if a:cmd =~# '^!' - let cmd = a:cmd =~# ' %' ? substitute(a:cmd, ' %', ' ' . expand('%:p'), '') : a:cmd - let output = systemlist(matchstr(cmd, '^!\zs.*')) - elseif a:cmd =~# '^@' - let output = getreg(a:cmd[1], 1, 1) - else - let output = split(execute(a:cmd), "\n") - endif - execute a:mods . ' new' - let w:scratch = 1 - call setline(1, output) - nnoremap q q - setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nomodifiable - call s:highlight(a:cmd) - - augroup scratch - autocmd BufEnter ++nested if winnr('$') < 2 | q | endif - augroup END -endfunction - -" Highlight scratch buffer to match native command output for certain commands -function! s:highlight(cmd) abort - let firstline = getline(1) - if firstline =~# '^--- Registers ---\|Type Name Content$' - call matchaddpos('Title', [1]) - call matchadd('SpecialKey', '\^\S\|<[^>]\{2}>') - elseif firstline =~# '^\%(mark\|change\| jump\) line col \%(file/\)\?text$' - call matchaddpos('Title', [1]) - elseif firstline =~# '^\w\+\s\+xxx \%(links\|cleared\|cterm\|gui\|term\)' - syntax match Keyword /\v%(c?term%([fb]g)?|gui%([fb]g)?)\=/ - syntax keyword Keyword links to - for linenr in range(1, line('$')) - let line = getline(linenr) - let syn = matchstr(line, '^\w\+') - let col = match(line, '\') - call matchaddpos(syn, [[linenr, col + 1, 3]]) - endfor - elseif search('\v^(E[0-9]+:|line\s+[0-9]+:)', 'cnW') - call matchadd('ErrorMsg', '^E[0-9]\+: .\+$') - call matchadd('LineNr', '^line\s\+[0-9]\+:$') - elseif a:cmd =~# '^dig' - call matchadd('SpecialKey', '[A-Za-z0-9[:graph:]]\{2}\s\+\zs\S\+\ze\s\+\d\+') - endif -endfunction diff --git a/.config/nvim/plugin/scratch.vim b/.config/nvim/plugin/scratch.vim deleted file mode 100644 index 059a21be..00000000 --- a/.config/nvim/plugin/scratch.vim +++ /dev/null @@ -1,15 +0,0 @@ -if exists('g:loaded_scratch') - finish -endif -let g:loaded_scratch = 1 - -command! -nargs=1 -complete=command Scratch call scratch#open(, ) -command! -nargs=? Marks Scratch marks -command! -nargs=0 Messages Scratch messages -command! -nargs=? Registers Scratch registers -command! -nargs=? Display Scratch display -command! -nargs=? -complete=highlight Highlight Scratch highlight -command! -nargs=0 Jumps Scratch jumps -command! -nargs=0 Changes Scratch changes -command! -nargs=0 Digraphs Scratch digraphs -command! -nargs=0 Scriptnames Scratch scriptnames diff --git a/.config/nvim/plugin/ui2.fnl b/.config/nvim/plugin/ui2.fnl new file mode 100644 index 00000000..8f015a0d --- /dev/null +++ b/.config/nvim/plugin/ui2.fnl @@ -0,0 +1,2 @@ +(let [ui2 (require "vim._core.ui2")] + (ui2.enable {:enable true})) -- knotmirror 0.0.1