diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-09-18 00:58:26 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-09-18 00:58:28 +0200 |
commit | cb36ccfa8db66db953795fd8e22138ed1712b1cd (patch) | |
tree | fc0f8ef4e73c5fa7fb627d383a991aeb49a59bca /after/plugin | |
parent | 424ad679f861031485e2e2f0ca19f5b559db929b (diff) |
checkpoint
- added basic luasnip configuration
- added highlights for TODO and FIXME keywords
- added incremental selection of treesitter
- added prettier to conform formatters
- added when_disabled function to disable pairs in comments
- changed the hiding keybind to :Hide command
- only enable ` pairs in markdown
- removed <c-k> keybind
- removed cmp's calc source
- renamed keybinds for consistency
- reorganized plugins in lazy.lua
Diffstat (limited to 'after/plugin')
-rw-r--r-- | after/plugin/autoclose.lua | 14 | ||||
-rw-r--r-- | after/plugin/conform.lua | 1 | ||||
-rw-r--r-- | after/plugin/luasnip.lua | 31 | ||||
-rw-r--r-- | after/plugin/telescope.lua | 2 | ||||
-rw-r--r-- | after/plugin/treesitter.lua | 7 |
5 files changed, 53 insertions, 2 deletions
diff --git a/after/plugin/autoclose.lua b/after/plugin/autoclose.lua index b742fc6..1c912da 100644 --- a/after/plugin/autoclose.lua +++ b/after/plugin/autoclose.lua @@ -1,3 +1,14 @@ +local function in_comment() + if + require("cmp.config.context").in_treesitter_capture("comment") == true + or require("cmp.config.context").in_syntax_group("Comment") + then + return true + else + return false + end +end + local filetypes = require("autoclose").setup({ keys = { ["("] = { escape = false, close = true, pair = "()" }, @@ -18,12 +29,13 @@ local filetypes = require("autoclose").setup({ close = true, pair = "''", disabled_filetypes = { "text", "telekasten", "groff", "diff", "gitcommit", "fugitive", "markdown" }, + disabled_when = in_comment, }, ["`"] = { escape = true, close = true, pair = "``", - disabled_filetypes = { "text", "telekasten", "groff", "diff", "gitcommit", "fugitive" }, + enabled_fileptypes = { "markdown" }, }, ["*"] = { escape = true, close = true, pair = "**", enabled_filetypes = { "markdown" } }, ["_"] = { escape = true, close = true, pair = "__", enabled_filetypes = { "markdown" } }, diff --git a/after/plugin/conform.lua b/after/plugin/conform.lua index 13961b6..76f7dca 100644 --- a/after/plugin/conform.lua +++ b/after/plugin/conform.lua @@ -1,6 +1,7 @@ require("conform").setup({ formatters_by_ft = { lua = { "stylua" }, + html = { "prettier" }, }, format_on_save = { -- These options will be passed to conform.format() diff --git a/after/plugin/luasnip.lua b/after/plugin/luasnip.lua new file mode 100644 index 0000000..e14a1a5 --- /dev/null +++ b/after/plugin/luasnip.lua @@ -0,0 +1,31 @@ +local ls = require("luasnip") +local s = ls.snippet +local i = ls.insert_node +local t = ls.text_node + +local map = vim.keymap.set + +map("i", "<C-k>", function() + if ls.expand_or_locally_jumpable() then + ls.expand_or_jump() + end +end, { silent = true }) +map({ "i", "s" }, "<C-J>", function() + ls.locally_jumpable(-1) +end, { silent = true }) +map({ "i", "s" }, "<C-l>", function() + if ls.choice_active() then + ls.change_choice(1) + end +end, { silent = true }) + +-- temporary keybind to play around +map("n", " s", "<cmd>source ~/.config/nvim/after/plugin/luasnip.lua<cr>") + +ls.config.set_config({ + history = true, +}) + +ls.add_snippets("all", { + ls.parser.parse_snippet("expand", "-- this is $1 expanded $2 $3!"), +}) diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index c2d32a3..720e157 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -25,7 +25,7 @@ require("telescope").setup({ local builtin = require("telescope.builtin") map("n", " tf", builtin.find_files) -map("n", " tb", builtin.buffers) +map("n", " bl", builtin.buffers) map("n", "<C-p>", builtin.git_files) map("n", " tw", builtin.live_grep) map("n", " th", builtin.help_tags, { desc = "Find help tags" }) diff --git a/after/plugin/treesitter.lua b/after/plugin/treesitter.lua index 1eb6fa5..83eb7cf 100644 --- a/after/plugin/treesitter.lua +++ b/after/plugin/treesitter.lua @@ -7,4 +7,11 @@ require("nvim-treesitter.configs").setup({ enable = true, additional_vim_regex_highlighting = false, }, + incremental_selection = { + enable = true, + keymaps = { + node_incremental = "v", + node_decremental = "V", + }, + }, }) |