Skip to content

Instantly share code, notes, and snippets.

View b0o's full-sized avatar
👻
Boo!

Maddison Hellstrom b0o

👻
Boo!
View GitHub Profile
@b0o
b0o / bookmarks.lua
Last active June 12, 2024 15:44
nvim-tree quickfix
-- Important: Put this in your config directory at lua/nvim-tree/renderer/decorator/bookmarks.lua
--
-- HACK: Although this file is named bookmarks.lua, it is actually a decorator
-- for the quickfix list. Because nvim-tree does not provide a way to add a custom decorator,
-- we are overriding the built-in bookmarks decorator with our own quickfix list decorator.
-- If you don't want to override the bookmarks.lua decorator, you can override a different one.
local HL_POSITION = require('nvim-tree.enum').HL_POSITION
local ICON_PLACEMENT = require('nvim-tree.enum').ICON_PLACEMENT
@b0o
b0o / Nvim Tree Preview.md
Last active April 28, 2024 05:35
Nvim-Tree Preview
Error executing Lua callback: ...nvim/nui-components.nvim/lua/nui-components/utils/fn.lua:18: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
[C]: in function 'ipairs'
...nvim/nui-components.nvim/lua/nui-components/utils/fn.lua:18: in function 'get_max_width'
...vim/nui-components.nvim/lua/nui-components/paragraph.lua:133: in function 'on_layout'
...ui-components.nvim/lua/nui-components/component/size.lua:208: in function 'get_size'
...ui-components.nvim/lua/nui-components/component/init.lua:358: in function 'render'
...ui-components.nvim/lua/nui-components/component/init.lua:346: in function 'func'
...nvim/nui-components.nvim/lua/nui-components/utils/fn.lua:19: in function 'ireduce'
...ui-components.nvim/lua/nui-components/component/init.lua:344: in function 'render'
@b0o
b0o / test.lua
Last active April 19, 2024 06:40
local n = require 'nui-components'
local signal = n.create_signal {
name = '',
description = '',
}
local function test_ui()
local renderer = n.create_renderer {
width = 60,
Outer
execve("/usr/bin/entr", ["entr", "bash", "./self-entr.sh", "--inner"], 0x7fff5e5a1088 /* 179 vars */) = 0
brk(NULL) = 0x563684b3a000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffc98182a70) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=322755, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 322755, PROT_READ, MAP_PRIVATE, 3, 0) = 0x14884d01e000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
#!/usr/bin/env bash
if [[ ${1:-} == "--inner" ]]; then
echo "Inner"
exit 0
fi
echo "Outer"
echo "${BASH_SOURCE[0]}" | entr "${BASH_SOURCE[0]}" --inner
Dec 07 17:03:46 computer1 systemd[3951]: Started GnuPG cryptographic agent and passphrase cache.
Dec 07 17:03:46 computer1 gpg-agent[1740396]: gpg-agent (GnuPG) 2.4.3 starting in supervised mode.
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 3 for extra socket (/run/user/1000/gnupg/S.gpg-agent.extra)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 4 for browser socket (/run/user/1000/gnupg/S.gpg-agent.browser)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 5 for std socket (/run/user/1000/gnupg/S.gpg-agent)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 6 for ssh socket (/run/user/1000/gnupg/S.gpg-agent.ssh)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: listening on: std=5 extra=3 browser=4 ssh=6
Dec 07 17:03:46 computer1 sway[4049]: 21:51:40.094 [DEBUG] [wlr] [types/wlr_text_input_v3.c:185] Text input commit received without focus
Dec 07 17:03:46 computer1 sway[4049]: 21:51:40.094 [DEBUG] [sway/input/text_input.c:159] Text input committed update
Dec 07 17:03:46 computer1 sway[
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
@b0o
b0o / README.md
Last active December 3, 2023 00:56
LSP support in injected code blocks with Otter.nvim

LSP support in injected code blocks with Otter.nvim

Otter.nvim makes it possible to attach LSPs to embedded code blocks. For example, inside JavaScript/TypeScript files, you can use tagged template literals:

const frag = glsl`
void main() {
  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
`;
// Ported from https://github.com/trpc/trpc/blob/main/packages/server/src/adapters/ws.ts
import type { ServeOptions, Server, ServerWebSocket } from 'bun'
import {
AnyRouter,
CombinedDataTransformer,
ProcedureType,
TRPCError,
callProcedure,