mirror of
https://github.com/dwinkler1/nvimConfig.git
synced 2026-10-07 13:57:55 -04:00
Moved pyarrow overlay to overlays, cleanup
This commit is contained in:
parent
b630932348
commit
a4bae164c3
14 changed files with 165 additions and 589 deletions
|
|
@ -119,3 +119,69 @@ Config.add = (function(pkg)
|
|||
end)
|
||||
|
||||
Config.now_if_args = vim.fn.argc(-1) > 0 and MiniDeps.now or MiniDeps.later
|
||||
|
||||
-- Checkbox
|
||||
local checked_character = "x"
|
||||
|
||||
local checked_checkbox = "%[" .. checked_character .. "%]"
|
||||
local unchecked_checkbox = "%[ %]"
|
||||
|
||||
local line_contains_unchecked = function(line)
|
||||
return line:find(unchecked_checkbox)
|
||||
end
|
||||
|
||||
local line_contains_checked = function(line)
|
||||
return line:find(checked_checkbox)
|
||||
end
|
||||
|
||||
local line_with_checkbox = function(line)
|
||||
return line:find("^%s*- " .. checked_checkbox)
|
||||
or line:find("^%s*- " .. unchecked_checkbox)
|
||||
or line:find("^%s*%d%. " .. checked_checkbox)
|
||||
or line:find("^%s*%d%. " .. unchecked_checkbox)
|
||||
end
|
||||
|
||||
local checkbox = {
|
||||
check = function(line)
|
||||
return line:gsub(unchecked_checkbox, checked_checkbox, 1)
|
||||
end,
|
||||
|
||||
uncheck = function(line)
|
||||
return line:gsub(checked_checkbox, unchecked_checkbox, 1)
|
||||
end,
|
||||
|
||||
make_checkbox = function(line)
|
||||
if not line:match("^%s*%-%s") and not line:match("^%s*%d%.%s") then
|
||||
-- "xxx" -> "- [ ] xxx"
|
||||
return line:gsub("(%S+)", "- [ ] %1", 1)
|
||||
else
|
||||
-- "- xxx" -> "- [ ] xxx", "3. xxx" -> "3. [ ] xxx"
|
||||
return line:gsub("(%s*- )(.*)", "%1[ ] %2", 1):gsub("(%s*%d%. )(.*)", "%1[ ] %2", 1)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
Config.togglecb = function()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local start_line = cursor[1] - 1
|
||||
local current_line = vim.api.nvim_buf_get_lines(bufnr, start_line, start_line + 1, false)[1] or ""
|
||||
|
||||
-- If the line contains a checked checkbox then uncheck it.
|
||||
-- Otherwise, if it contains an unchecked checkbox, check it.
|
||||
local new_line = ""
|
||||
|
||||
if not line_with_checkbox(current_line) then
|
||||
new_line = checkbox.make_checkbox(current_line)
|
||||
elseif line_contains_unchecked(current_line) then
|
||||
new_line = checkbox.check(current_line)
|
||||
elseif line_contains_checked(current_line) then
|
||||
new_line = checkbox.uncheck(current_line)
|
||||
end
|
||||
|
||||
vim.api.nvim_buf_set_lines(bufnr, start_line, start_line + 1, false, { new_line })
|
||||
vim.api.nvim_win_set_cursor(0, cursor)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("ToggleCheckbox", Config.togglecb, {})
|
||||
|
|
|
|||
|
|
@ -1,43 +0,0 @@
|
|||
-- Bloocky: timeblocking calendar (day/week/month views), persisted to JSON.
|
||||
-- Loaded via the `general` cat spec (nix mode) or MiniDeps (non-nix).
|
||||
-- Default global toggle is <leader>tb, which collides with the terminal map
|
||||
-- (toggle bracketed paste), so it is moved to the calendar/tasks group <leader>c.
|
||||
local Config = require('config')
|
||||
|
||||
if not Config.isNixCats then
|
||||
local later = MiniDeps.later
|
||||
later(function()
|
||||
MiniDeps.add({ source = 'atiladefreitas/bloocky' })
|
||||
end)
|
||||
end
|
||||
|
||||
local nix = require('config.nix')
|
||||
local later = MiniDeps.later
|
||||
|
||||
later(function()
|
||||
if not nix.get_cat('general', false) then
|
||||
return
|
||||
end
|
||||
require('bloocky').setup({
|
||||
week_start = "monday",
|
||||
window = {
|
||||
-- Width per view: fraction of the editor width (or absolute columns if > 1).
|
||||
-- A single number applies to every view.
|
||||
width = {
|
||||
month = 0.99,
|
||||
week = 0.99,
|
||||
day = 0.8,
|
||||
},
|
||||
border = "rounded",
|
||||
},
|
||||
integrations = {
|
||||
dooing = {
|
||||
enabled = true, -- show Dooing todos on their due date
|
||||
show_done = false, -- also show completed todos
|
||||
},
|
||||
},
|
||||
keymaps = {
|
||||
toggle = '<leader>cb',
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
-- Dooing: minimalist todo list manager with a floating window, persisted to JSON.
|
||||
-- Loaded via the `general` cat spec (nix mode) or MiniDeps (non-nix).
|
||||
-- Default globals <leader>td / <leader>tN occupy the terminal group, so the
|
||||
-- todo toggles are moved to the calendar/tasks group <leader>c.
|
||||
local Config = require('config')
|
||||
|
||||
if not Config.isNixCats then
|
||||
local later = MiniDeps.later
|
||||
later(function()
|
||||
MiniDeps.add({ source = 'atiladefreitas/dooing' })
|
||||
end)
|
||||
end
|
||||
|
||||
local nix = require('config.nix')
|
||||
local later = MiniDeps.later
|
||||
local now = MiniDeps.now
|
||||
later(function()
|
||||
if not nix.get_cat('general', false) then
|
||||
return
|
||||
end
|
||||
local dooing = require('dooing')
|
||||
require("dooing").setup({
|
||||
keymaps = {
|
||||
toggle_window = "<leader>cd",
|
||||
open_project_todo = "<leader>cD",
|
||||
show_due_notification = "<leader>cN",
|
||||
create_nested_task = "<leader>cn", -- Create nested subtask under current todo
|
||||
toggle_priority = "a",
|
||||
},
|
||||
calendar = {
|
||||
week_start_day = "monday",
|
||||
},
|
||||
})
|
||||
-- Remove Dooing's old defaults.
|
||||
vim.keymap.del("n", "<leader>td")
|
||||
vim.keymap.del("n", "<leader>tD")
|
||||
vim.keymap.del("n", "<leader>tN")
|
||||
|
||||
-- Restore mappings overwritten by Dooing.
|
||||
local helpers = require('keymap.helpers')
|
||||
local nmap_leader = helpers.nmap_leader
|
||||
-- t is for 'terminal'
|
||||
nmap_leader("td", '<Cmd>lua Config.terminal.open_duckdb();Config.terminal.toggle_bracket()<CR>', 'Open DuckDB')
|
||||
end)
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
-- omp bridge entrypoint: start the RPC socket as early as possible so the omp
|
||||
-- harness can read this instance's buffers on demand (see lua/nvim_omp/init.lua
|
||||
-- and .omp/tools/nvim_buffers.mjs). Safe to fail silently — the socket is a
|
||||
-- convenience, not a dependency of the editor.
|
||||
local ok, nvim_omp = pcall(require, "nvim_omp")
|
||||
if ok then
|
||||
nvim_omp.start()
|
||||
end
|
||||
71
plugin/32_checkbox.lua
Normal file
71
plugin/32_checkbox.lua
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
-- Minimal Markdown checkbox toggler: `:ToggleCheckbox` (mapped to <leader>mc).
|
||||
-- Toggles `- [ ]`/`- [x]` (and numbered `N. [ ]`/`N. [x]`) on the current line;
|
||||
-- creates a checkbox on lines without one.
|
||||
|
||||
local checked_character = "x"
|
||||
|
||||
local checked_checkbox = "%[" .. checked_character .. "%]"
|
||||
local unchecked_checkbox = "%[ %]"
|
||||
|
||||
local line_contains_unchecked = function(line)
|
||||
return line:find(unchecked_checkbox)
|
||||
end
|
||||
|
||||
local line_contains_checked = function(line)
|
||||
return line:find(checked_checkbox)
|
||||
end
|
||||
|
||||
local line_with_checkbox = function(line)
|
||||
return line:find("^%s*- " .. checked_checkbox)
|
||||
or line:find("^%s*- " .. unchecked_checkbox)
|
||||
or line:find("^%s*%d%. " .. checked_checkbox)
|
||||
or line:find("^%s*%d%. " .. unchecked_checkbox)
|
||||
end
|
||||
|
||||
local checkbox = {
|
||||
check = function(line)
|
||||
return line:gsub(unchecked_checkbox, checked_checkbox, 1)
|
||||
end,
|
||||
|
||||
uncheck = function(line)
|
||||
return line:gsub(checked_checkbox, unchecked_checkbox, 1)
|
||||
end,
|
||||
|
||||
make_checkbox = function(line)
|
||||
if not line:match("^%s*%-%s") and not line:match("^%s*%d%.%s") then
|
||||
-- "xxx" -> "- [ ] xxx"
|
||||
return line:gsub("(%S+)", "- [ ] %1", 1)
|
||||
else
|
||||
-- "- xxx" -> "- [ ] xxx", "3. xxx" -> "3. [ ] xxx"
|
||||
return line:gsub("(%s*- )(.*)", "%1[ ] %2", 1):gsub("(%s*%d%. )(.*)", "%1[ ] %2", 1)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
local M = {}
|
||||
|
||||
M.toggle = function()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local start_line = cursor[1] - 1
|
||||
local current_line = vim.api.nvim_buf_get_lines(bufnr, start_line, start_line + 1, false)[1] or ""
|
||||
|
||||
-- If the line contains a checked checkbox then uncheck it.
|
||||
-- Otherwise, if it contains an unchecked checkbox, check it.
|
||||
local new_line = ""
|
||||
|
||||
if not line_with_checkbox(current_line) then
|
||||
new_line = checkbox.make_checkbox(current_line)
|
||||
elseif line_contains_unchecked(current_line) then
|
||||
new_line = checkbox.check(current_line)
|
||||
elseif line_contains_checked(current_line) then
|
||||
new_line = checkbox.uncheck(current_line)
|
||||
end
|
||||
|
||||
vim.api.nvim_buf_set_lines(bufnr, start_line, start_line + 1, false, { new_line })
|
||||
vim.api.nvim_win_set_cursor(0, cursor)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("ToggleCheckbox", M.toggle, {})
|
||||
|
||||
return M
|
||||
Loading…
Reference in a new issue