Made snippets better

This commit is contained in:
2025-02-03 13:02:06 +11:00
parent ad5c3a6579
commit 8bc6f4229f
9 changed files with 247 additions and 74 deletions

View File

@@ -1,6 +1,15 @@
return {
"neovim/nvim-lspconfig",
dependencies = {
{
"folke/lazydev.nvim",
ft = "lua",
opts = {
library = {
{ path = "luvit-meta/library", words = { "vim%.uv" } },
},
},
},
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
@@ -25,6 +34,7 @@ return {
require("fidget").setup({})
require("mason").setup()
require("mason-lspconfig").setup({
automatic_installation = false,
ensure_installed = {
"lua_ls",
"bashls",
@@ -103,7 +113,7 @@ return {
focusable = false,
style = "minimal",
border = "rounded",
source = "always",
source = true,
header = "",
prefix = "",
},

View File

@@ -17,10 +17,13 @@ return {
require("luasnip.loaders.from_" .. type).lazy_load()
vim.keymap.set("n", "<leader>ts", "<cmd>Telescope luasnip<CR>", { desc = "Search Snippets" })
end, { "vscode", "snipmate", "lua" })
local lua_snippets = require("haelnorr.snippets.lua")
ls.add_snippets("lua", lua_snippets)
local go_snippets = require("haelnorr.snippets.go")
ls.add_snippets("go", go_snippets)
for _, ft_path in ipairs(vim.api.nvim_get_runtime_file("lua/haelnorr/snippets/*.lua", true)) do
loadfile(ft_path)()
end
-- local lua_snippets = require("haelnorr.snippets.lua")
-- ls.add_snippets("lua", lua_snippets)
-- local go_snippets = require("haelnorr.snippets.go")
-- ls.add_snippets("go", go_snippets)
vim.keymap.set({ "i", "s" }, "<C-k>", function()
if ls.expand_or_jumpable() then
ls.expand_or_jump()

View File

@@ -6,7 +6,7 @@ return {
},
lazy = false,
config = function()
require("refactoring").setup()
require("refactoring").setup({})
vim.keymap.set("x", "<leader>re", ":Refactor extract ", { desc = "Extract selection" })
vim.keymap.set("x", "<leader>rf", ":Refactor extract_to_file ", { desc = "Extract selection to new file" })

View File

@@ -1,46 +1,51 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all"
ensure_installed = {
"vimdoc", "javascript", "typescript", "c", "lua", "rust",
"jsdoc", "bash",
},
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
---@diagnostic disable-next-line: missing-fields
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all"
ensure_installed = {
"vimdoc",
"javascript",
"typescript",
"c",
"lua",
"go",
"bash",
"templ",
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
auto_install = true,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
auto_install = true,
indent = {
enable = true
},
indent = {
enable = true,
},
highlight = {
-- `false` will disable the whole extension
enable = true,
highlight = {
-- `false` will disable the whole extension
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = { "markdown" },
},
})
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = { "markdown" },
},
})
local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs()
treesitter_parser_config.templ = {
install_info = {
url = "https://github.com/vrischmann/tree-sitter-templ.git",
files = {"src/parser.c", "src/scanner.c"},
branch = "master",
},
}
end
-- local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs()
-- treesitter_parser_config.templ = {
-- install_info = {
-- url = "https://github.com/vrischmann/tree-sitter-templ.git",
-- files = { "src/parser.c", "src/scanner.c" },
-- branch = "master",
-- },
-- }
end,
}

View File

@@ -22,7 +22,13 @@ return {
{ "<leader><leader>", group = "Reload Plugins", icon = { icon = "" } },
{ "<leader><leader>w", "<cmd>Lazy reload which-key.nvim<CR>", desc = "Reload Which-key" },
{ "<leader><leader>s", "<cmd>Lazy reload LuaSnip<CR>", desc = "Reload LuaSnip" },
{
"<leader><leader>s",
"<cmd>source ~/.config/nvim/lua/haelnorr/snippets/lua.lua<CR>\
<cmd>source ~/.config/nvim/lua/haelnorr/snippets/go.lua<CR>\
<cmd>Lazy reload LuaSnip<CR>",
desc = "Reload LuaSnip",
},
{ "<leader><leader>l", "<cmd>Lazy reload nvim-lspconfig<CR>", desc = "Reload LSP" },
-- Harpoon