Add keymaps for questions and problems
This commit is contained in:
parent
ca59b47f48
commit
d623d74c5d
3 changed files with 76 additions and 5 deletions
|
|
@ -105,7 +105,7 @@ end
|
||||||
-- Function for getting filename and copy it to + buffer
|
-- Function for getting filename and copy it to + buffer
|
||||||
local function copy_filename()
|
local function copy_filename()
|
||||||
local filepath = vim.fn.expand('%:t')
|
local filepath = vim.fn.expand('%:t')
|
||||||
local output = string.format("%s", filepath)
|
local output = string.format("[[%s]]", filepath)
|
||||||
vim.fn.setreg("+", output)
|
vim.fn.setreg("+", output)
|
||||||
print("Copied: " .. output)
|
print("Copied: " .. output)
|
||||||
end
|
end
|
||||||
|
|
@ -159,3 +159,17 @@ keymap("n", "<leader>fn", function()
|
||||||
no_esc = true,
|
no_esc = true,
|
||||||
})
|
})
|
||||||
end, { desc = "FZF: display TODO comments" })
|
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" })
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,16 @@ local fmt = require("luasnip.extras.fmt").fmt
|
||||||
ls.add_snippets(
|
ls.add_snippets(
|
||||||
"markdown",
|
"markdown",
|
||||||
{
|
{
|
||||||
|
s({ trig = "imh", dscr = "Insert markdown task heading" },
|
||||||
|
fmt(
|
||||||
|
[==[
|
||||||
|
→ [[#{} ✗]]
|
||||||
|
]==],
|
||||||
|
{
|
||||||
|
i(0),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
),
|
||||||
s("link", {
|
s("link", {
|
||||||
t("["), i(1, "description"), t("]("),
|
t("["), i(1, "description"), t("]("),
|
||||||
f(function()
|
f(function()
|
||||||
|
|
@ -40,16 +50,63 @@ ls.add_snippets(
|
||||||
s({ trig = "iq", dscr = "Insert question" },
|
s({ trig = "iq", dscr = "Insert question" },
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
┏━━━━━━━━━━ Question ━━━━━━━━━━━
|
┏━━━━━━━━━━━━━━ Question ✗ ━━━━━━━━━━━━━━━
|
||||||
? - #Question {}
|
**Question**
|
||||||
|
{}
|
||||||
|
|
||||||
**Answer**:
|
**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),
|
i(0),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ end
|
||||||
-- Function for getting filename and copy it to + buffer
|
-- Function for getting filename and copy it to + buffer
|
||||||
local function copy_filename()
|
local function copy_filename()
|
||||||
local filepath = vim.fn.expand('%:t')
|
local filepath = vim.fn.expand('%:t')
|
||||||
local output = string.format("%s", filepath)
|
local output = string.format("[[%s]]", filepath)
|
||||||
vim.fn.setreg("+", output)
|
vim.fn.setreg("+", output)
|
||||||
print("Copied: " .. output)
|
print("Copied: " .. output)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue