fix: Proper injection queries

This commit is contained in:
punkfairie 2024-11-26 20:50:32 -08:00
parent e3ef9e4716
commit 8efea03163
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
3 changed files with 104 additions and 124 deletions

View file

@ -23,9 +23,7 @@ in {
]; ];
autoCmd = [ autoCmd = [
(autocmds.mk' ["FocusGained" "TermClose" "TermLeave"] "checktime" (mkRaw (autocmds.mk' ["FocusGained" "TermClose" "TermLeave"] "checktime" (mkRaw ''
# lua
''
function() function()
if vim.o.buftype ~= "nofile" then if vim.o.buftype ~= "nofile" then
vim.cmd("checktime") vim.cmd("checktime")
@ -33,17 +31,13 @@ in {
end end
'') "Check if file needs to be reloaded when changed") '') "Check if file needs to be reloaded when changed")
(autocmds.mk' ["TextYankPost"] "highlight_yank" (mkRaw (autocmds.mk' ["TextYankPost"] "highlight_yank" (mkRaw ''
# lua
''
function() function()
(vim.hl or vim.highlight).on_yank() (vim.hl or vim.highlight).on_yank()
end end
'') "Highlight on yank") '') "Highlight on yank")
(autocmds.mk' ["VimResized"] "resize_splits" (mkRaw (autocmds.mk' ["VimResized"] "resize_splits" (mkRaw ''
# lua
''
function() function()
local current_tab = vim.fn.tabpagenr() local current_tab = vim.fn.tabpagenr()
vim.cmd("tabdo wincmd =") vim.cmd("tabdo wincmd =")
@ -51,9 +45,7 @@ in {
end end
'') "Resize splits on window resize") '') "Resize splits on window resize")
(autocmds.mk' ["BufReadPost"] "last_loc" (mkRaw (autocmds.mk' ["BufReadPost"] "last_loc" (mkRaw ''
# lua
''
function(event) function(event)
local exclude = { "gitcommit" } local exclude = { "gitcommit" }
local buf = event.buf local buf = event.buf
@ -86,9 +78,7 @@ in {
"spectre_panel" "spectre_panel"
"startuptime" "startuptime"
"tsplayground" "tsplayground"
] (mkRaw ] (mkRaw ''
# lua
''
function(event) function(event)
vim.bo[event.buf].buflisted = false vim.bo[event.buf].buflisted = false
vim.schedule(function() vim.schedule(function()
@ -104,9 +94,7 @@ in {
end end
'') "Close some filetypes with <q>") '') "Close some filetypes with <q>")
(autocmds.mk ["FileType"] "man_unlisted" ["man"] (mkRaw (autocmds.mk ["FileType"] "man_unlisted" ["man"] (mkRaw ''
# lua
''
function(event) function(event)
vim.bo[event.buf].buflisted = false vim.bo[event.buf].buflisted = false
end end
@ -118,26 +106,20 @@ in {
"typst" "typst"
"gitcommit" "gitcommit"
"markdown" "markdown"
] (mkRaw ] (mkRaw ''
# lua
''
function() function()
vim.opt_local.wrap = true vim.opt_local.wrap = true
vim.opt_local.spell = true vim.opt_local.spell = true
end end
'') "Wrap & check spelling in text files") '') "Wrap & check spelling in text files")
(autocmds.mk ["FileType"] "json_conceal" ["json" "jsonc" "json5"] (mkRaw (autocmds.mk ["FileType"] "json_conceal" ["json" "jsonc" "json5"] (mkRaw ''
# lua
''
function() function()
vim.opt_local.conceallevel = 0 vim.opt_local.conceallevel = 0
end end
'') "Fix conceallevel for json files") '') "Fix conceallevel for json files")
(autocmds.mk' ["BufWritePre"] "auto_create_dir" (mkRaw (autocmds.mk' ["BufWritePre"] "auto_create_dir" (mkRaw ''
# lua
''
function(event) function(event)
if event.match:match("^%w%w+:[\\/][\\/]") then if event.match:match("^%w%w+:[\\/][\\/]") then
return return

View file

@ -165,9 +165,9 @@ in {
# Diagnostics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Diagnostics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
++ [ ++ [
(keys.mk ["n"] "<LEADER>cd" ( (keys.mk ["n"] "<LEADER>cd" (
mkRaw mkRaw ''
# lua function() vim.diagnostic.open_float() end
"function() vim.diagnostic.open_float() end" ''
) "Line Diagnostics") ) "Line Diagnostics")
] ]
++ ( ++ (
@ -200,13 +200,11 @@ in {
cmd = toLower dir; cmd = toLower dir;
sev = sevs."${key}".key; sev = sevs."${key}".key;
in in
keys.mk ["n"] kmap keys.mk ["n"] kmap (
( mkRaw ''
mkRaw function() vim.diagnostic.goto_${cmd}({ severity = ${sev} }) end
# lua ''
"function() vim.diagnostic.goto_${cmd}({ severity = ${sev} }) end" ) "${dir} ${sevs."${key}".desc}"
)
"${dir} ${sevs."${key}".desc}"
) )
{ {
dir = ["Next" "Prev"]; dir = ["Next" "Prev"];

View file

@ -23,62 +23,62 @@ in {
keymaps = [ keymaps = [
(keys.mk ["n"] "<LEADER>un" ( (keys.mk ["n"] "<LEADER>un" (
mkRaw mkRaw ''
# lua function() Snacks.notifier.hide() end
"function() Snacks.notifier.hide() end" ''
) "Dismiss All Notifications") ) "Dismiss All Notifications")
(keys.mk ["n"] "<LEADER>bd" ( (keys.mk ["n"] "<LEADER>bd" (
mkRaw mkRaw ''
# lua function() Snacks.bufdelete() end
"function() Snacks.bufdelete() end" ''
) "Delete Buffer") ) "Delete Buffer")
(keys.mk ["n"] "<LEADER>bo" ( (keys.mk ["n"] "<LEADER>bo" (
mkRaw mkRaw ''
# lua function() Snacks.bufdelete.other() end
"function() Snacks.bufdelete.other() end" ''
) "Delete Other Buffers") ) "Delete Other Buffers")
# LazyGit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # LazyGit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(keys.mk ["n"] "<LEADER>gg" ( (keys.mk ["n"] "<LEADER>gg" (
mkRaw mkRaw ''
# lua function() Snacks.lazygit() end
"function() Snacks.lazygit() end" ''
) "Lazygit") ) "Lazygit")
(keys.mk ["n"] "<LEADER>gf" ( (keys.mk ["n"] "<LEADER>gf" (
mkRaw mkRaw ''
# lua function() Snacks.lazygit.log_file() end
"function() Snacks.lazygit.log_file() end" ''
) "Lazygit Current File History") ) "Lazygit Current File History")
(keys.mk ["n"] "<LEADER>gl" ( (keys.mk ["n"] "<LEADER>gl" (
mkRaw mkRaw ''
# lua function() Snacks.lazygit.log() end
"function() Snacks.lazygit.log() end" ''
) "Lazygit Log") ) "Lazygit Log")
# Git - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Git - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(keys.mk ["n"] "<LEADER>gb" ( (keys.mk ["n"] "<LEADER>gb" (
mkRaw mkRaw ''
# lua function() Snacks.git.blame_line() end
"function() Snacks.git.blame_line() end" ''
) "Git Blame Line") ) "Git Blame Line")
(keys.mk ["n" "x"] "<LEADER>gB" ( (keys.mk ["n" "x"] "<LEADER>gB" (
mkRaw mkRaw ''
# lua function() Snacks.gitbrowse() end
"function() Snacks.gitbrowse() end" ''
) "Git Browse (open)") ) "Git Browse (open)")
(keys.mk ["n" "x"] "<LEADER>gY" (mkRaw (keys.mk ["n" "x"] "<LEADER>gY" (
# lua mkRaw ''
''
function() function()
Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end }) Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end })
end end
'') "Git Browse (copy)") ''
) "Git Browse (copy)")
]; ];
# Toggles - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Toggles - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -