Fix sshfs intricacies; Add todo cycle for markdown

This commit is contained in:
Martin Pander
2026-07-10 09:02:17 +02:00
parent 653ec4e4af
commit 5e0ebe4406
6 changed files with 131 additions and 62 deletions

View File

@@ -39,6 +39,16 @@ in
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
stdlib = ''
: ''${XDG_CACHE_HOME:=$HOME/.cache}
declare -A direnv_layout_dirs
direnv_layout_dir() {
echo "''${direnv_layout_dirs[$PWD]:=$(
echo -n "$XDG_CACHE_HOME"/direnv/layouts/
echo -n "$PWD" | sha1sum | cut -d ' ' -f 1
)}"
}
'';
};
home.packages = with pkgs; [

View File

@@ -123,6 +123,9 @@ in
set -s set-clipboard on
set -g extended-keys on
set -g extended-keys-format csi-u
set -g renumber-windows on
set -g base-index 1
set -g pane-base-index 1
unbind S
bind S command-prompt "switch -t %1"
@@ -168,10 +171,8 @@ in
set -g status-right "#[bg=#BCBCBC] %H:%M #[bg=#808080,fg=#ffffff] %d.%m.%y "
# setw -g window-status-format " #W#F "
# setw -g window-status-current-format " #W#F "
setw -g window-status-format " #W "
setw -g window-status-current-format " #W "
setw -g window-status-format "#W:#I "
setw -g window-status-current-format " #W:#I "
setw -g window-status-separator ""
#######################################

View File

@@ -80,18 +80,24 @@ vim.g.clipboard = {
}
if vim.fn.has("wsl") == 1 then
vim.g.clipboard = {
name = 'WslClipboard',
copy = {
["+"] = 'win32yank.exe -i --crlf',
["*"] = 'win32yank.exe -i --crlf',
},
paste = {
["+"] = 'win32yank.exe -o --lf',
["*"] = 'win32yank.exe -o --lf',
},
cache_enabled = 0,
}
local function win32yank_works()
return os.execute("win32yank.exe -o >/dev/null 2>&1") == 0
end
if win32yank_works() then
vim.g.clipboard = {
name = 'WslClipboard',
copy = {
["+"] = 'win32yank.exe -i --crlf',
["*"] = 'win32yank.exe -i --crlf',
},
paste = {
["+"] = 'win32yank.exe -o --lf',
["*"] = 'win32yank.exe -o --lf',
},
cache_enabled = 0,
}
end
end
vim.opt.clipboard = 'unnamedplus'

View File

@@ -89,6 +89,63 @@ vim.api.nvim_create_autocmd('FileType', {
end,
})
local function cycle_todo()
local line = vim.api.nvim_get_current_line()
-- 0. STRICT CHECK: If the line doesn't start with a list marker (-), fall back to normal Enter behavior
if not line:match("^%s*%-") then
-- This simulates a normal carriage return if mapped to <CR>
local keys = vim.api.nvim_replace_termcodes("<CR>", true, false, true)
vim.api.nvim_feedkeys(keys, "n", false)
return
end
-- The sequence of checkbox states we want to cycle through
local states = { " ", ">", "x", "!", "~", "c" }
-- 1. If it's a cancelled todo [c], strip the brackets but KEEP the list item (- )
if line:match("^%s*%-%s*%[c%]") then
local clean_line = line:gsub("(%s*%-%s*)%[c%]%s*", "%1")
vim.api.nvim_set_current_line(clean_line)
return
end
-- 2. If it's a standard list item without a checkbox, turn it into `- [ ]`
if not line:match("^%s*%-%s*%[.%]") then
-- Matches the list prefix (e.g., "- " or " - ") and appends "[ ] "
local new_line = line:gsub("^(%s*%-%s*)", "%1[ ] ")
vim.api.nvim_set_current_line(new_line)
return
end
-- 3. Cycle through the custom states natively
for i, state in ipairs(states) do
-- Escape special Lua magic characters like !, >, ~, c
local escaped_state = state:gsub("([^%w])", "%%%1")
local pattern = "^(%s*%-%s*%[)" .. escaped_state .. "(%])"
if line:match(pattern) then
local next_state = states[(i % #states) + 1]
local new_line = line:gsub(pattern, "%1" .. next_state .. "%2", 1)
vim.api.nvim_set_current_line(new_line)
return
end
end
end
vim.api.nvim_create_autocmd('FileType', {
group = vim.api.nvim_create_augroup('FileTypeConfigs', { clear = true }),
pattern = 'markdown',
once = true,
callback = function()
vim.keymap.set('n', '<CR>', cycle_todo, {
buffer = true,
desc = 'Cycle todo state'
})
end,
})
-- vim.api.nvim_create_autocmd('FileType', {
-- group = vim.api.nvim_create_augroup('FileTypeConfigs', { clear = true }),
-- pattern = 'proto',
@@ -97,13 +154,6 @@ vim.api.nvim_create_autocmd('FileType', {
-- end,
-- })
--
-- vim.api.nvim_create_autocmd('FileType', {
-- group = vim.api.nvim_create_augroup('FileTypeConfigs', { clear = true }),
-- pattern = 'markdown',
-- once = true,
-- callback = function()
-- end,
-- })
--
-- vim.api.nvim_create_autocmd('FileType', {
-- group = vim.api.nvim_create_augroup('FileTypeConfigs', { clear = true }),

View File

@@ -465,7 +465,7 @@ require("obsidian").setup({
time_format = "%H:%M",
},
checkbox = {
order = { " ", ">", "x", "!", "~", "" },
order = { " ", ">", "x", "!", "~", "c", "" },
},
frontmatter = {
enabled = true,
@@ -505,19 +505,21 @@ require('render-markdown').setup({
bullet = false,
right_pad = 1,
unchecked = {
icon = '󰄱 ',
icon = '󰄱',
highlight = 'RenderMarkdownUnchecked',
scope_highlight = nil,
},
checked = {
icon = '󰱒 ',
icon = '󰱒',
highlight = 'RenderMarkdownChecked',
scope_highlight = nil,
},
custom = {
next = { raw = '[!]', rendered = ' ', highlight = 'RenderMarkdownNext', scope_highlight = nil },
ongoing = { raw = '[>]', rendered = '', highlight = 'RenderMarkdownOngoing', scope_highlight = nil },
waiting = { raw = '[~]', rendered = '󰥔 ', highlight = 'RenderMarkdownWaiting', scope_highlight = nil },
next = { raw = '[!]', rendered = '', highlight = 'RenderMarkdownNext', scope_highlight = nil },
in_progress = { raw = '[>]', rendered = '', highlight = 'RenderMarkdownOngoing', scope_highlight = nil },
waiting = { raw = '[~]', rendered = '󰥔', highlight = 'RenderMarkdownWaiting', scope_highlight = nil },
cancelled = { raw = '[c]', rendered = 'x', highlight = 'RenderMarkdownCancelled', scope_highlight = nil },
},
},
})