Add keymaps for questions and problems

This commit is contained in:
t0xa 2026-07-10 09:19:41 +03:00
parent ca59b47f48
commit d623d74c5d
3 changed files with 76 additions and 5 deletions

View file

@ -105,7 +105,7 @@ end
-- Function for getting filename and copy it to + buffer
local function copy_filename()
local filepath = vim.fn.expand('%:t')
local output = string.format("%s", filepath)
local output = string.format("[[%s]]", filepath)
vim.fn.setreg("+", output)
print("Copied: " .. output)
end
@ -159,3 +159,17 @@ keymap("n", "<leader>fn", function()
no_esc = true,
})
end, { desc = "FZF: display TODO comments" })
keymap("n", "<leader>fap", function()
fzf_lua.grep_curbuf({
prompt = 'Problems (file) ',
search = '━ Problem',
})
end, { desc = "FZF: find problems in current file" })
keymap("n", "<leader>faq", function()
fzf_lua.grep_curbuf({
prompt = 'Questions (file) ',
search = '━ Question',
})
end, { desc = "FZF: find questions in current file" })

View file

@ -13,6 +13,16 @@ local fmt = require("luasnip.extras.fmt").fmt
ls.add_snippets(
"markdown",
{
s({ trig = "imh", dscr = "Insert markdown task heading" },
fmt(
[==[
[[#{} ✗]]
]==],
{
i(0),
}
)
),
s("link", {
t("["), i(1, "description"), t("]("),
f(function()
@ -40,16 +50,63 @@ ls.add_snippets(
s({ trig = "iq", dscr = "Insert question" },
fmt(
[[
Question
? - #Question {}
Question
**Question**
{}
**Answer**:
]],
{
i(0),
}
)
),
s({ trig = "ip", dscr = "Insert problem" },
fmt(
[[
Problem
**Problem**:
{}
**Solution**:
]],
{
i(0),
}
)
),
s({ trig = "isn", dscr = "Insert side notes" },
fmt(
[[
Замтеки на полях
**Тема**: {}
{}
]],
{
i(1),
i(2),
}
)
),
s({ trig = "ip", dscr = "Insert side notes" },
fmt(
[[
Проблема
- [ ] **Решена**
{}
]],
{
i(0),
}
)
)
}
)

View file

@ -74,7 +74,7 @@ end
-- Function for getting filename and copy it to + buffer
local function copy_filename()
local filepath = vim.fn.expand('%:t')
local output = string.format("%s", filepath)
local output = string.format("[[%s]]", filepath)
vim.fn.setreg("+", output)
print("Copied: " .. output)
end