repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

Update Neovim configuration

2726d0df905a1b33464d8e66d2af9d1d1fc01bf8

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (14)

neovim/after/ftplugin/vfp.lua

Modified
1 --- File: C:\Users\okr\AppData\Local\nvim\ftplugin\vfp.lua
2 --- Always-on dark flair for Visual FoxPro 9.0 (.prg files), blended with current theme
4 -local api = vim.api
6 --- Dark flair palette
7 -local dark_flair = {
8 - neon_red = '#FF1A1A',
9 - cyber_green = '#00FF66',
10 - shadow_purple = '#8A2BE2',
11 - toxic_yellow = '#FFFF33',
12 - gunmetal_gray = '#333333',
13 - faint_glow = '#666666',
16 --- OKLab blending
17 -local function rgb_to_oklab( r, g, b )
18 - r, g, b = r / 255, g / 255, b / 255
19 - local l = 0.412221 * r + 0.536332 * g + 0.051447 * b
20 - local m = 0.211666 * r + 0.680525 * g + 0.107809 * b
21 - local s = 0.088302 * r + 0.281718 * g + 0.629980 * b
22 - l, m, s = l ^ (1 / 3), m ^ (1 / 3), s ^ (1 / 3)
23 - local L = 0.210454 * l + 0.793617 * m - 0.004071 * s
24 - local a = 1.977998 * l - 2.428592 * m + 0.450594 * s
25 - local b_ = 0.025904 * l + 0.782771 * m - 0.808675 * s
26 - return L, a, b_
27 -end
29 -local function oklab_to_rgb( L, a, b_ )
30 - local l = L + 0.396337 * a + 0.215803 * b_
31 - local m = L - 0.105561 * a - 0.063854 * b_
32 - local s = L - 0.089484 * a - 1.291485 * b_
33 - l, m, s = l ^ 3, m ^ 3, s ^ 3
34 - local r = 4.076741 * l - 3.307711 * m + 0.230969 * s
35 - local g = -1.268143 * l + 2.609757 * m - 0.341319 * s
36 - local b = -0.004196 * l - 0.703228 * m + 1.707614 * s
37 - r, g, b = math.max( 0, math.min( 1, r ) ) * 255, math.max( 0, math.min( 1, g ) ) * 255,
38 - math.max( 0, math.min( 1, b ) ) * 255
39 - return math.floor( r ), math.floor( g ), math.floor( b )
40 -end
42 -local function blend_colors( fg_hex, bg_hex, factor )
43 - local fr, fg, fb = fg_hex:match '#(%x%x)(%x%x)(%x%x)'
44 - fr, fg, fb = tonumber( fr, 16 ) or 0, tonumber( fg, 16 ) or 0, tonumber( fb, 16 ) or 0
45 - local br, bg, bb = bg_hex:match '#(%x%x)(%x%x)(%x%x)'
46 - br, bg, bb = tonumber( br, 16 ) or 0, tonumber( bg, 16 ) or 0, tonumber( bb, 16 ) or 0
47 - local fL, fa, fb_ = rgb_to_oklab( fr, fg, fb )
48 - local bL, ba, bb_ = rgb_to_oklab( br, bg, bb )
49 - local L = bL + factor * (fL - bL)
50 - local a = ba + factor * (fa - ba)
51 - local b = bb_ + factor * (fb_ - bb_)
52 - local r, g, b = oklab_to_rgb( L, a, b ) ---@diagnostic disable-line: redefined-local
53 - return string.format( '#%02x%02x%02x', r, g, b )
54 -end
56 --- Fetch theme colors with nvim_get_hl
57 -local function get_theme_colors()
58 - local comment = api.nvim_get_hl( 0, { name = 'Comment' } ) or {}
59 - local statement = api.nvim_get_hl( 0, { name = 'Statement' } ) or {}
60 - local identifier = api.nvim_get_hl( 0, { name = 'Identifier' } ) or {}
61 - local str = api.nvim_get_hl( 0, { name = 'String' } ) or {}
62 - local constant = api.nvim_get_hl( 0, { name = 'Constant' } ) or {}
63 - local operator = api.nvim_get_hl( 0, { name = 'Operator' } ) or {}
64 - local err = api.nvim_get_hl( 0, { name = 'Error' } ) or {}
66 - return {
67 - comment = comment.fg and string.format( '#%06x', comment.fg ) or '#808080',
68 - statement = statement.fg and string.format( '#%06x', statement.fg ) or '#FFFF00',
69 - identifier = identifier.fg and string.format( '#%06x', identifier.fg ) or '#00FFFF',
70 - str = str.fg and string.format( '#%06x', str.fg ) or '#FF00FF',
71 - constant = constant.fg and string.format( '#%06x', constant.fg ) or '#00FF00',
72 - operator = operator.fg and string.format( '#%06x', operator.fg ) or '#FF0000',
73 - error = err.fg and string.format( '#%06x', err.fg ) or '#FF0000',
74 - }
75 -end
77 --- Apply dark flair
78 -local function apply_dark_flair( buf )
79 - local theme = get_theme_colors()
80 - local blend_factor = 0.7
82 - -- Create a buffer-local namespace
83 - local ns_id = api.nvim_create_namespace( 'vfp_dark_flair_' .. buf )
85 - -- Blend colors
86 - local blended = {
87 - special = blend_colors( dark_flair.neon_red, theme.operator, blend_factor ),
88 - preproc = blend_colors( dark_flair.shadow_purple, theme.str, blend_factor ),
89 - cmd = blend_colors( dark_flair.toxic_yellow, theme.statement, blend_factor ),
90 - func = blend_colors( dark_flair.toxic_yellow, theme.identifier, blend_factor ),
91 - sysvar = blend_colors( dark_flair.shadow_purple, theme.str, blend_factor ),
92 - str = blend_colors( dark_flair.shadow_purple, theme.str, blend_factor ),
93 - const = blend_colors( dark_flair.cyber_green, theme.constant, blend_factor ),
94 - number = blend_colors( dark_flair.cyber_green, theme.constant, blend_factor ),
95 - operator = blend_colors( dark_flair.neon_red, theme.operator, blend_factor ),
96 - comment = blend_colors( dark_flair.faint_glow, theme.comment, blend_factor ),
97 - error = blend_colors( dark_flair.neon_red, theme.error, blend_factor ),
98 - xmlfunc = blend_colors( dark_flair.cyber_green, theme.identifier, blend_factor ),
99 - oop = blend_colors( dark_flair.cyber_green, theme.identifier, blend_factor ),
100 - line = blend_colors( dark_flair.faint_glow, theme.comment, 0.4 ),
101 - }
103 - api.nvim_set_hl( ns_id, 'vfpSpecial', { fg = blended.special, bold = true } )
104 - api.nvim_set_hl( ns_id, 'vfpPreProc', { fg = blended.preproc, italic = true } )
105 - api.nvim_set_hl( ns_id, 'vfpCmd', { fg = blended.cmd, bold = true } )
106 - api.nvim_set_hl( ns_id, 'vfpFunc', { fg = blended.func } )
107 - api.nvim_set_hl( ns_id, 'vfpSysVar', { fg = blended.sysvar } )
108 - api.nvim_set_hl( ns_id, 'vfpString', { fg = blended.str, italic = true } )
109 - api.nvim_set_hl( ns_id, 'vfpConst', { fg = blended.const } )
110 - api.nvim_set_hl( ns_id, 'vfpNumber', { fg = blended.number } )
111 - api.nvim_set_hl( ns_id, 'vfpFloat', { fg = blended.number } )
112 - api.nvim_set_hl( ns_id, 'vfpOperator', { fg = blended.operator, bold = true } )
113 - api.nvim_set_hl( ns_id, 'vfpComment', { fg = blended.comment, italic = true } )
114 - api.nvim_set_hl( ns_id, 'vfpError', { fg = blended.error, bg = blended.bg, underline = true } )
115 - api.nvim_set_hl( ns_id, 'vfpXmlFunc', { fg = blended.xmlfunc, bold = true } )
116 - api.nvim_set_hl( ns_id, 'vfpOop', { fg = blended.oop, italic = true } )
117 - api.nvim_set_hl( ns_id, 'Normal', { bg = blended.bg } )
118 - api.nvim_set_hl( ns_id, 'LineNr', { fg = blended.line } )
119 -end
121 --- Autocommand to apply flair only to VFP buffers
122 -api.nvim_create_autocmd( 'BufEnter', {
123 - pattern = '*.prg',
124 - callback = function ()
125 - local buf = api.nvim_get_current_buf()
126 - apply_dark_flair( buf )
127 - end,
128 -} )
1 +vim.bo.commentstring = '* %s'

neovim/init.lua

Modified
89 89 --[[ PLUGINS ]]
90 90 --TODO: slowly move over plugins to "my stuff"
91 91 require 'bugabinga.autotag'
92 -require 'bugabinga.colorizer'
93 92 require 'bugabinga.devicons'
94 93 defer 'bugabinga.diff'
95 94 require 'bugabinga.file_explorer'
96 95 require 'bugabinga.format'
97 96 defer 'bugabinga.fuzzy_find'
98 -defer 'bugabinga.bookmarks'
99 97 defer 'bugabinga.jump2d'
100 98 defer 'bugabinga.key_preview'
101 99 defer 'bugabinga.move'

neovim/lua/bugabinga/bookmarks.lua

Deleted
deleted file mode 100644
1 -local puk = require 'std.puk'
2 -local map = require 'std.map'
4 -puk.defer 'grapple' (function(grapple)
5 - grapple.setup {
6 - scope = "git",
7 - icons = true,
8 - quick_select = "123456789",
9 - }
11 - map.normal { description = 'toggle tag on current file', category = 'grapple', keys = '<leader>mt', command = grapple.toggle }
12 - map.normal { description = 'open tags window', category = 'grapple', keys = '<leader>mT', command = grapple.toggle_tags }
13 - map.normal { description = 'cycle to next tag', category = 'grapple', keys = '<leader>mn', command = function() grapple.cycle_tags("next") end }
14 - map.normal { description = 'cycle to previous tag', category = 'grapple', keys = '<leader>mp', command = function() grapple.cycle_tags("prev") end }
15 - map.normal { description = 'select tag 1', category = 'grapple', keys = '<leader>1', command = function() grapple.select { index = 1 } end }
16 - map.normal { description = 'select tag 2', category = 'grapple', keys = '<leader>2', command = function() grapple.select { index = 2 } end }
17 - map.normal { description = 'select tag 3', category = 'grapple', keys = '<leader>3', command = function() grapple.select { index = 3 } end }
18 - map.normal { description = 'select tag 4', category = 'grapple', keys = '<leader>4', command = function() grapple.select { index = 4 } end }
19 - map.normal { description = 'select tag 5', category = 'grapple', keys = '<leader>5', command = function() grapple.select { index = 5 } end }
21 - require('bugabinga.statusline').register(function()
22 - if not grapple.exists() then return '' end
23 - return '󰛢 ' .. grapple.name_or_index()
24 - end)
25 -end)

neovim/lua/bugabinga/colorizer.lua

Deleted
deleted file mode 100644
1 -local puk = require 'std.puk'
2 -puk.defer 'colorizer' (function(colors)
3 - colors.setup {
4 - lazy_load = true,
5 - user_default_options = {
6 - mode = 'virtualtext',
7 - virtualtext_inline = true,
8 - css = false,
9 - xterm = false,
10 - names_custom = function()
11 - local buffer_name = vim.api.nvim_buf_get_name(0)
12 - return require 'bugabinga.nugu.palette'
13 - end,
14 - }
15 - }
16 -end)

neovim/lua/bugabinga/format.lua

Modified
3 3 local puk = require 'std.puk'
4 4 local dbg = require 'std.dbg'
5 5 local map = require 'std.map'
6 6 local user_command = require 'std.user_command'
8 -local format = function ()
9 - require 'conform'.format( { async = false }, function ( err )
8 +local has_treesitter_parser = function ( _, ctx )
9 + local filetype = vim.bo[ctx.buf].filetype
10 + if filetype == '' then return true end
11 + local language = vim.treesitter.language.get_lang( filetype )
12 + local ok = pcall( vim.treesitter.get_string_parser, '', language )
13 + return ok
14 +end
16 +local format = function ( async )
17 + require 'conform'.format( {
18 + async = async,
19 + lsp_format = 'fallback',
20 + }, function ( err )
10 21 if err then
11 22 dbg( 'Format failed %s', err )
13 24 end )
25 +end
15 - vim.lsp.buf.format {
16 - filter = function ( client )
17 - local ok = client:supports_method 'textDocument/formatting' ---@diagnostic disable-line: param-type-mismatch, missing-parameter
18 - if ok then dbg( 'Using LSP formatter: %s', client.name ) end
19 - return ok
20 - end,
21 - async = false,
22 - }
27 +local format_sync = function ()
28 + format( false )
29 +end
31 +local format_async = function ()
32 + format( true )
25 35 map.N {
26 36 description = 'Format buffer',
27 37 category = 'format',
28 38 keys = '=',
29 - command = format,
39 + command = format_async,
32 -user_command.Format 'Format the current buffer' ( format )
42 +user_command.Format 'Format the current buffer asynchronously' ( format_async )
43 +user_command.FormatSync 'Format the current buffer' ( format_sync )
34 45 vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
36 47 puk.defer 'conform' ( function ( conform )
37 48 conform.setup {
49 + formatters = {
50 + deno_fmt_markdown = {
51 + inherit = 'deno_fmt',
52 + append_args = { '--prose-wrap', 'preserve' },
53 + },
54 + injected = { condition = has_treesitter_parser },
55 + sqruff = {
56 + command = 'sqruff',
57 + args = { 'fix', '-' },
58 + stdin = true,
59 + },
60 + },
38 61 formatters_by_ft = {
39 62 toml = { 'taplo' },
40 - sh = { 'shfmt' },
41 - just = { 'just' },
42 - d2 = { 'd2_fmt' },
43 - markdown = { 'deno_fmt' },
44 - javascript = { 'deno_fmt' },
45 - typescript = { 'deno_fmt' },
46 - json = { 'deno_fmt' },
47 - -- Use the “*” file type to run formatters on all file types.
48 - ['*'] = { 'injected', 'typos' },
63 + sh = { 'shfmt' },
64 + just = { 'just' },
65 + go = { 'goimports', 'gofmt' },
66 + kdl = { 'kdlfmt' },
67 + nu = { 'nufmt' },
68 + sql = { 'sqruff' },
69 + d2 = { 'd2' },
70 + markdown = { 'deno_fmt_markdown', 'mdslw', 'injected' },
71 + ['markdown.mdx'] = { 'injected' },
72 + html = { 'injected' },
73 + javascript = { 'deno_fmt' },
74 + javascriptreact = { 'deno_fmt' },
75 + typescript = { 'deno_fmt' },
76 + typescriptreact = { 'deno_fmt' },
77 + json = { 'deno_fmt' },
78 + jsonc = { 'deno_fmt' },
79 + sass = { 'deno_fmt' },
49 80 -- Use the “_” file type to run formatters on file types that don't
50 81 -- have other formatters configured.
51 82 ['_'] = { 'trim_whitespace', 'trim_newlines' },

neovim/lua/bugabinga/nugu/init.lua

Modified
347 347 -- cterm attributes that must be mirrored to the cterm table
348 348 local cterm_attrs = {
349 - bold = true, italic = true, reverse = true, standout = true,
350 - underline = true, undercurl = true, underdouble = true,
351 - underdotted = true, underdashed = true, strikethrough = true,
349 + bold = true,
350 + italic = true,
351 + reverse = true,
352 + standout = true,
353 + underline = true,
354 + undercurl = true,
355 + underdouble = true,
356 + underdotted = true,
357 + underdashed = true,
358 + strikethrough = true,
352 359 nocombine = true,
365 372 if group[attr] then ct[attr] = true end
367 374 if next( ct ) then opts.cterm = ct end
368 - if group.blend then opts.blend = group.blend end
375 + if group.blend then opts.blend = group.blend end
369 376 if group.default then opts.default = group.default end
370 - if group.force then opts.force = group.force end
377 + if group.force then opts.force = group.force end
371 378 vim.api.nvim_set_hl( 0, name, opts )

neovim/lua/bugabinga/nugu/palette.lua

Modified
18 18 -- 19 ui_focus
20 20 return {
21 - debug = 16,
22 - error = 1,
23 - info = 9,
24 - warning = 3,
21 + ['debug'] = 16,
22 + ['error'] = 1,
23 + info = 9,
24 + warning = 3,
26 - content_normal = 7,
27 - content_backdrop = 0,
28 - content_accent = 5,
29 - content_minor = 8,
30 - content_focus = 2,
31 - content_unfocus = 6,
32 - content_important_global = 12,
33 - content_important_local = 4,
26 + content_normal = 7,
27 + content_backdrop = 0,
28 + content_accent = 5,
29 + content_minor = 8,
30 + content_focus = 2,
31 + content_unfocus = 6,
32 + content_important_global = 12,
33 + content_important_local = 4,
35 - ui_normal = 17,
36 - ui_backdrop = 11,
37 - ui_accent = 13,
38 - ui_minor = 18,
39 - ui_focus = 19,
40 - ui_unfocus = 10,
41 - ui_important_global = 15,
42 - ui_important_local = 14,
35 + ui_normal = 17,
36 + ui_backdrop = 11,
37 + ui_accent = 13,
38 + ui_minor = 18,
39 + ui_focus = 19,
40 + ui_unfocus = 10,
41 + ui_important_global = 15,
42 + ui_important_local = 14,

neovim/lua/bugabinga/options/filetypes.lua

Modified
4 4 vim.filetype.add {
5 5 extension = {
6 6 norg = 'norg',
7 7 prg = 'vfp',
8 8 nuon = 'nu',
9 9 d2 = 'd2',
10 + gotmpl = 'gotmpl',
11 + mdx = 'markdown.mdx',
12 + shtml = 'shtml',
13 + superhtml = 'superhtml',
10 14 tf = 'terraform',
15 + tofu = 'opentofu',
16 + tofuvars = 'opentofu-vars',
12 18 pattern = {
13 19 ['.*/%.vscode/.*%.json'] = 'json5', -- These json files frequently have comments
18 24 -- 3. Return the match, or fallback to 'terraform' if it's just 'file.tftpl'
19 25 return matched_ft or 'terraform'
20 26 end,
27 + ['.*docker%-compose.*%.ya?ml'] = 'yaml.docker-compose',
28 + ['.*gitlab%-ci.*%.ya?ml'] = 'yaml.gitlab',
29 + ['.*values.*%.ya?ml'] = 'yaml.helm-values',
21 30 README = 'markdown',
22 31 TODO = 'markdown',
23 32 COMMANDS = 'markdown',

neovim/lua/bugabinga/options/keymaps.lua

Modified
119 119 category = 'file',
120 120 keys = '<C-S>',
121 121 command = function()
122 - vim.cmd.Format()
122 + vim.cmd.FormatSync()
123 123 vim.cmd.wall()

neovim/lua/bugabinga/options/tty.lua

Modified
1 1 local is_tty = vim.env.XDG_SESSION_TYPE == 'tty' and vim.env.SSH_TTY == ''
2 2 if is_tty then
3 - vim.opt.termguicolors = false
4 - vim.g.nerdfont = false
5 - vim.opt.lazyredraw = true
3 + vim.g.nerdfont = false
4 + vim.opt.lazyredraw = true
6 5 else
7 - vim.opt.termguicolors = true
8 - vim.g.nerdfont = true
9 - vim.opt.lazyredraw = false
6 + vim.g.nerdfont = true
7 + vim.opt.lazyredraw = false

neovim/lua/bugabinga/surround.lua

Modified
1 -local puk = require 'std.puk'
2 1 local map = require 'std.map'
2 +local puk = require 'std.puk'
4 +vim.g.nvim_surround_no_mappings = true
4 6 puk.defer 'nvim-surround' ( function ( surround )
5 - vim.g.nvim_surround_no_mappings = true
6 7 surround.setup {
7 8 move_cursor = 'sticky',
11 + map.insert { keys = '<C-g>s', command = '<Plug>(nvim-surround-insert)', category = 'surround', description = 'pair in insert', remap = true }
12 + map.insert { keys = '<C-g>S', command = '<Plug>(nvim-surround-insert-line)', category = 'surround', description = 'pair line in insert', remap = true }
10 14 map.normal { keys = 'ma', command = '<Plug>(nvim-surround-normal)', category = 'surround', description = 'pair around motion' }
11 15 map.normal { keys = 'ml', command = '<Plug>(nvim-surround-normal-cur)', category = 'surround', description = 'pair around current line' }
12 16 map.normal { keys = 'mL', command = '<Plug>(nvim-surround-normal-cur-line)', category = 'surround', description = 'pair around current line, new lines' }
13 17 map.normal { keys = 'mm', command = '<Plug>(nvim-surround-normal-line)', category = 'surround', description = 'pair around motion, new lines' }
14 - map.normal.visual { keys = 'm', command = '<Plug>(nvim-surround-visual)', category = 'surround', description = 'pair around selection' }
15 - map.normal.visual { keys = 'M', command = '<Plug>(nvim-surround-visual-line)', category = 'surround', description = 'pair around selection, new lines' }
18 + map.visual { keys = 'm', command = '<Plug>(nvim-surround-visual)', category = 'surround', description = 'pair around selection' }
19 + map.visual { keys = 'M', command = '<Plug>(nvim-surround-visual-line)', category = 'surround', description = 'pair around selection, new lines' }
16 20 map.normal { keys = 'md', command = '<Plug>(nvim-surround-delete)', category = 'surround', description = 'delete' }
17 21 map.normal { keys = 'mr', command = '<Plug>(nvim-surround-change)', category = 'surround', description = 'change' }
18 22 map.normal { keys = 'mR', command = '<Plug>(nvim-surround-change-line)', category = 'surround', description = 'change pair, new lines' }

neovim/lua/bugabinga/terminal.lua

Modified
5 5 float = {
6 6 buffer = -1,
7 7 window = -1,
8 - }
8 + },
11 -local open_float = function(options)
11 +local open_float = function ( options )
12 12 options = options or {}
13 13 local max_width = vim.o.columns
14 14 local max_height = vim.o.lines
15 15 local size = options.size or 0.88
16 - local width = options.width or math.floor(max_width * size)
17 - local height = options.height or math.floor(max_height * size)
18 - local center_col = math.floor((max_width - width) / 2)
19 - local center_row = math.floor((max_height - height) / 2)
16 + local width = options.width or math.floor( max_width * size )
17 + local height = options.height or math.floor( max_height * size )
18 + local center_col = math.floor( (max_width - width) / 2 )
19 + local center_row = math.floor( (max_height - height) / 2 )
20 20 local buffer_created = false
21 - local create_buffer = function()
21 + local create_buffer = function ()
22 22 buffer_created = true
23 - return vim.api.nvim_create_buf(false, true)
23 + return vim.api.nvim_create_buf( false, true )
25 - local buffer = vim.api.nvim_buf_is_valid(options.buffer) and options.buffer
26 - or create_buffer()
25 + local buffer = vim.api.nvim_buf_is_valid( options.buffer ) and options.buffer
26 + or create_buffer()
27 27 local window_settings = {
28 - relative = "editor",
28 + relative = 'editor',
29 29 width = width,
30 30 height = height,
31 31 col = center_col,
33 33 style = 'minimal',
34 34 border = options.border or vim.g.border_style,
36 - local window = vim.api.nvim_open_win(buffer, true, window_settings)
36 + local window = vim.api.nvim_open_win( buffer, true, window_settings )
37 37 if buffer_created then
38 - vim.cmd.terminal('nu --login')
38 + vim.cmd.terminal 'nu --login'
40 40 vim.cmd.startinsert()
41 41 local buffer_options = {
42 42 buflisted = false,
44 - for buffer_option, value in pairs(buffer_options) do
45 - vim.api.nvim_set_option_value(buffer_option, value, {
44 + for buffer_option, value in pairs( buffer_options ) do
45 + vim.api.nvim_set_option_value( buffer_option, value, {
46 46 buf = buffer,
47 - })
47 + } )
49 49 local window_options = {
50 50 winbar = '',
52 - for window_option, value in pairs(window_options) do
53 - vim.api.nvim_set_option_value(window_option, value, {
52 + for window_option, value in pairs( window_options ) do
53 + vim.api.nvim_set_option_value( window_option, value, {
54 54 win = window,
55 - })
55 + } )
57 57 return {
58 58 buffer = buffer,
63 -local toggle_terminal = function()
64 - if vim.api.nvim_win_is_valid(state.float.window) then
65 - vim.api.nvim_win_hide(state.float.window)
63 +local toggle_terminal = function ()
64 + if vim.api.nvim_win_is_valid( state.float.window ) then
65 + vim.api.nvim_win_hide( state.float.window )
66 66 else
67 - state.float = open_float(state.float)
67 + state.float = open_float( state.float )
71 -user_command.Terminal 'Toggle Terminal in floating window' (toggle_terminal)
71 +user_command.Terminal 'Toggle Terminal in floating window' ( toggle_terminal )
72 72 map.normal.terminal {
73 73 description = 'Toggle terminal',
74 74 category = 'terminal',
75 75 keys = '<leader>tf',
76 76 command = toggle_terminal,
78 79 map.terminal {
79 80 description = 'Enter normal mode',
80 81 category = 'terminal',
81 82 keys = '<esc><esc>',
82 - command = '<c-\\><c-n>'
83 + command = '<c-\\><c-n>',

neovim/puk.nu

Modified
14 14 let plugins_path = [ $data_path site pack puk opt ] | path join
15 15 let plugin_specs = open puk.plugins.nuon
16 - print 'Installing plugins from puk.plugins.nuon.'
17 - $plugin_specs | par-each { install-spec $in $plugins_path $cache_path }
16 + let total = $plugin_specs | length
17 + print $"Installing plugins from puk.plugins.nuon. total: ($total)"
18 + let errors = $plugin_specs | par-each { install-spec $in $plugins_path $cache_path } | flatten
18 19 print 'Cleaning plugins, that are not part of puk.plugins.nuon.'
19 20 clean-plugins $plugins_path $plugin_specs
21 + print 'Cleaning stale cache archives.'
22 + clean-cache $cache_path $plugin_specs
20 23 # plugins need to be packadded before helptags can be generated
21 24 print 'Generating helptags.'
22 25 mut packs = $plugin_specs | par-each { | spec |
23 26 $"packadd ($spec.name)"
24 27 } | str join "\n"
25 28 nvim -u NONE --headless --cmd $packs --cmd 'helptags ALL' +q
29 + if not ($errors | is-empty) {
30 + let failed = $errors | length
31 + print $"\n($failed)/($total) plugins FAILED:"
32 + $errors | each { |e| print $" - ($e.name): ($e.error)" }
33 + exit 1
34 + }
28 37 # check online for fresh commits. Does not actually mutate or update anything.
63 72 let existing_plugin_name = $row.name | path basename
64 73 if ( $plugin_specs | where name == $existing_plugin_name | is-empty) {
65 74 print $"Found plugin, that is not part of the specs: ($existing_plugin_name)"
66 - rm --interactive --trash --recursive $row.name
75 + rm --trash --recursive $row.name
80 +# deletes all cache archives, that are NOT matching any spec's name+commit!
81 +def clean-cache [
82 + cache_path: path # folder containing cached archives
83 + plugin_specs: list<any> # all known plugins
84 +] {
85 + let expected = $plugin_specs | each { |spec| (make-archive-path $spec $cache_path | path basename) }
86 + try {
87 + glob $"($cache_path)/*.tar.gz" | each { |path|
88 + let name = $path | path basename
89 + if ($expected | where $it == $name | is-empty) {
90 + print $"Removing stale cache: ($name)"
91 + rm $path
92 + }
93 + }
94 + } catch {}
71 97 # given a plugin spec, and a plugins base install directory, this method generates
72 98 # a new path, that points to the location the plugin should be installed into.
73 99 def make-plugin-path [
167 193 $spec | format pattern $url_format
196 +def make-archive-path [
197 + spec: record # a plugin to install
198 + cache_path: path # folder to cache downloaded archives into
199 +] {
200 + [ $cache_path $"($spec.name)-($spec.commit).tar.gz" ] | path join
170 203 def download-plugin [
171 204 spec: record # a plugin to install
172 205 cache_path: path # folder to cache downloaded archives into
174 - let archive_path = [ $cache_path ($spec.name + '.tar.gz') ] | path join
207 + let archive_path = make-archive-path $spec $cache_path
175 208 if ($archive_path | path exists) {
176 209 print $"($spec.name) already cached in ($archive_path)"
177 210 return $archive_path
211 244 $name if $name =~ 'Pixel' => { 'so' },
212 245 _ => { error make { msg: 'unknown operating system' } },
214 -let allowed_filetypes = [ lua vim scm txt $allowed_shared_lib_type ]
247 +let base_filetypes = [ lua vim scm txt $allowed_shared_lib_type ]
215 249 let exclusions = [
216 250 **/tests/**,
217 251 **/test/**,
229 263 plugins_path: path # folder to install plugins into
231 265 let plugin_path = make-plugin-path $spec $plugins_path
232 - try { rm --trash --recursive $plugin_path }
233 - mkdir $plugin_path
266 + let tmp_path = [$plugins_path $".tmp.($spec.name)"] | path join
267 + try { rm --recursive $tmp_path }
268 + mkdir $tmp_path
234 269 cd $folder_path
235 - glob $"**/*.{($allowed_filetypes | str join ',')}" --exclude $exclusions |
270 + let filetypes = if ($spec.extra_extensions? | default null) != null {
271 + $base_filetypes | append $spec.extra_extensions
272 + } else {
273 + $base_filetypes
275 + glob $"**/*.{($filetypes | str join ',')}" --exclude $exclusions |
236 276 path relative-to (pwd) |
237 277 par-each { | file |
238 - let rebased_parent = [$plugin_path ($file | path dirname | to text)] | path join
278 + let rebased_parent = [$tmp_path ($file | path dirname | to text)] | path join
239 279 mkdir $rebased_parent
240 280 cp $file $rebased_parent
242 - let commit_file_path = make-commit-file-path $plugin_path
282 + let commit_file_path = make-commit-file-path $tmp_path
243 283 $spec.commit | save --force $commit_file_path
284 + try { rm --trash --recursive $plugin_path }
285 + mv $tmp_path $plugin_path
244 286 $plugin_path
250 292 cache_path: path # folder to cache downloaded archives into
252 294 if (plugin-is-installed $spec $plugins_path) {
253 - print $"Plugin ($spec.name) is already installed and up-to-date!"
254 - return
295 + return []
297 + try {
298 + print $"Downloading ($spec.name)..."
299 + let archive_path = download-plugin $spec $cache_path
300 + print $"Unpacking ($spec.name)..."
301 + let unpacked_path = unpack-plugin-archive $spec $archive_path
302 + print $"Installing ($spec.name)..."
303 + let installed_plugin_path = install-plugin $spec $unpacked_path $plugins_path
304 + print $"Plugin ($spec.name) installed into ($installed_plugin_path)!"
305 + return []
306 + } catch {
307 + |e|
308 + print $"FAILED ($spec.name): ($e.msg)"
309 + return [{ name: $spec.name, error: $e.msg }]
256 - print $"Downloading ($spec.name)..."
257 - let archive_path = download-plugin $spec $cache_path
258 - print $"Unpacking ($spec.name)..."
259 - let unpacked_path = unpack-plugin-archive $spec $archive_path
260 - print $"Installing ($spec.name)..."
261 - let installed_plugin_path = install-plugin $spec $unpacked_path $plugins_path
262 - print $"Plugin ($spec.name) installed into ($installed_plugin_path)!"

neovim/puk.plugins.nuon

Modified
14 14 [nvim-ts-autotag, github, windwp/nvim-ts-autotag, main, "88c1453db4ba7dd24131086fe51fdf74e587d275", null],
15 15 [oil, github, "stevearc/oil.nvim", master, "0fcc83805ad11cf714a949c98c605ed717e0b83e", null],
16 16 [nvim-surround, github, kylechui/nvim-surround, main, "9291040de8cd8a4439eb64c441e8d5d2bf884a5a", null],
17 - [conform, github, "stevearc/conform.nvim", master, "086a40dc7ed8242c03be9f47fbcee68699cc2395", null],
17 + [conform, github, "stevearc/conform.nvim", master, "dca1a190aa85f9065979ef35802fb77131911106", null],
18 18 [plenary, github, "nvim-lua/plenary.nvim", master, "74b06c6c75e4eeb3108ec01852001636d85a932b", null],
19 19 ["mini.splitjoin", github, "echasnovski/mini.splitjoin", main, "8bd5a3d581b9f3dd3bc91fe495e210b8b0ee981d", null],
20 20 ["mini.pick", github, "echasnovski/mini.pick", main, "437d44eb57312f23e6b931704694fc294922cd88", null],
27 27 ["mini.move", github, "echasnovski/mini.move", main, "74d140143b1bb905c3d0aebcfc2f216fd237080e", null],
28 28 ["mini.icons", github, "echasnovski/mini.icons", main, "bac6317300e205335df425296570d84322730067", null],
29 29 [nvim-autopairs, github, windwp/nvim-autopairs, master, "59bce2eef357189c3305e25bc6dd2d138c1683f5", null],
30 - [colorizer, github, "catgoose/nvim-colorizer.lua", master, "5cfe7fffbd01e17b3c1e14af85d5febdef88bd8c", null],
31 30 [specs, github, "cxwx/specs.nvim", main, "4a2f6f71eaa054a9355a2f424b4723e68f7ce22c", null],
32 31 [rulebook, github, chrisgrieser/nvim-rulebook, main, "083dd66b498bc142386a7c96dddab73acbf4ec20", null],
33 32 [profile, github, "stevearc/profile.nvim", master, "30433d7513f0d14665c1cfcea501c90f8a63e003", null],
34 - [grug-far, github, "MagicDuck/grug-far.nvim", main, "21604255d0e8f9968322f61f2b6c09e5efe1285a", null],
33 + [grug-far, github, "MagicDuck/grug-far.nvim", main, "21790e59dd0109a92a70cb874dd002af186314f5", null],
35 34 [incline, github, "b0o/incline.nvim", main, "8b54c59bcb23366645ae10edca6edfb9d3a0853e", null],
36 35 [dap, github, mfussenegger/nvim-dap, master, "45a69eba683a2c448dd9ecfc4de89511f0646b5f", null],
37 36 [dapui, github, rcarriga/nvim-dap-ui, master, "1a66cabaa4a4da0be107d5eda6d57242f0fe7e49", null],
38 37 [nio, github, nvim-neotest/nvim-nio, master, "21f5324bfac14e22ba26553caf69ec76ae8a7662", null],
39 38 [dap-disasm, github, Jorenar/nvim-dap-disasm, master, "1119f3f2b22e411adcd123cdcf6d0425b61a31a7", null],
40 39 [nvim-dap-virtual-text, github, theHamsta/nvim-dap-virtual-text, master, "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6", null],
41 - [grapple, github, "cbochs/grapple.nvim", main, "b41ddfc1c39f87f3d1799b99c2f0f1daa524c5f7", null],
42 - ["mini.notify", github, "echasnovski/mini.notify", main, "9e68ab0a54f90567b4fec2de22c851dba8480439", null],
40 + ["mini.notify", github, "echasnovski/mini.notify", main, "9e68ab0a54f90567b4fec2de22c851dba8480439", null]