From e8ff563a53306ef3f6344ccd197bf7d737cf851c Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sun, 6 Oct 2024 14:31:03 +0200 Subject: checkpoint --- after/ftplugin/markdown.lua | 3 +++ after/ftplugin/sql.lua | 1 + after/ftplugin/typescript.lua | 3 +++ after/plugin/luasnip.lua | 8 ++++++++ lua/config/set.lua | 6 ------ 5 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 after/ftplugin/markdown.lua create mode 100644 after/ftplugin/sql.lua create mode 100644 after/ftplugin/typescript.lua diff --git a/after/ftplugin/markdown.lua b/after/ftplugin/markdown.lua new file mode 100644 index 0000000..4d58eea --- /dev/null +++ b/after/ftplugin/markdown.lua @@ -0,0 +1,3 @@ +-- -- Custom highlight for markdown definitions +vim.cmd("hi mdDefs guifg=" .. require("nord.colors").palette.frost.ice) +vim.cmd("match mdDefs /^[[:space:]]*-[^:]\\+:/") diff --git a/after/ftplugin/sql.lua b/after/ftplugin/sql.lua new file mode 100644 index 0000000..34c50a9 --- /dev/null +++ b/after/ftplugin/sql.lua @@ -0,0 +1 @@ +vim.opt.commentstring = "-- %s" diff --git a/after/ftplugin/typescript.lua b/after/ftplugin/typescript.lua new file mode 100644 index 0000000..3eb1653 --- /dev/null +++ b/after/ftplugin/typescript.lua @@ -0,0 +1,3 @@ +local map = vim.keymap.set + +map("n", ",p", [[s/\(\s*\)\(.\+\)/\1console.log("\2:", \2);]], { desc = "Surround var with console.log" }) diff --git a/after/plugin/luasnip.lua b/after/plugin/luasnip.lua index 7959de9..9ff00de 100644 --- a/after/plugin/luasnip.lua +++ b/after/plugin/luasnip.lua @@ -23,6 +23,8 @@ map("n", " s", "source ~/.config/nvim/after/plugin/luasnip.lua") ls.config.set_config({ history = true, + -- Will update multiple nodes at the same time when in insert mode + update_events = { "TextChanged", "TextChangedI" }, }) ls.add_snippets("go", { @@ -39,3 +41,9 @@ ls.add_snippets("sh", { ls.add_snippets("c", { ls.parser.parse_snippet("main", "int main(void) {\n\t$0\n\treturn 0;\n}"), }) +ls.add_snippets("typescript", { + ls.parser.parse_snippet("cl", "console.log($0);"), +}) +ls.add_snippets("html", { + ls.parser.parse_snippet("t", [[<$1>$0]]), +}) diff --git a/lua/config/set.lua b/lua/config/set.lua index 05e3803..e921234 100644 --- a/lua/config/set.lua +++ b/lua/config/set.lua @@ -103,12 +103,6 @@ opt.title = true -- Highlighting vim.cmd("match Todo /\\(TODO\\|FIXME\\):/") --- -- Custom highlight for markdown definitions -if vim.filetype.match({ buf = 0 }) == "markdown" then - vim.cmd("hi mdDefs guifg=" .. require("nord.colors").palette.frost.ice) - vim.cmd("match mdDefs /^[[:space:]]*-[^:]\\+:/") -end - -- TODO: this is some text vim.cmd("syntax match matchURL /" .. "\\(https\\?\\|ftp\\|magnet\\):\\/\\/[[:alnum:]%\\/_#.-~:]*" .. "/") vim.cmd("hi matchURL guifg=" .. require("nord.colors").palette.aurora.yellow) -- cgit v1.2.3