summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/config/lsp.lua42
-rw-r--r--lua/config/luasnips.lua21
-rw-r--r--lua/config/treesitter.lua75
3 files changed, 92 insertions, 46 deletions
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua
index 436d2e6..5d7aa3e 100644
--- a/lua/config/lsp.lua
+++ b/lua/config/lsp.lua
@@ -67,11 +67,33 @@ return function()
vim.lsp.enable(name)
-- Diagnostic Icons
- local signs = { Error = "✖", Warn = "", Hint = "", Info = "" }
- for type, icon in pairs(signs) do
- local hl = "DiagnosticSign" .. type
- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
- end
+ vim.diagnostic.config({
+ signs = {
+ active = true, -- enable signs
+ text = {
+ [vim.diagnostic.severity.ERROR] = "✖",
+ [vim.diagnostic.severity.WARN] = "",
+ [vim.diagnostic.severity.INFO] = "",
+ [vim.diagnostic.severity.HINT] = "", -- lightbulb for hint
+ },
+ },
+ -- virtual_text = {
+ -- prefix = "●GAY●",
+ -- },
+ underline = true,
+ severity_sort = true,
+ virtual_text = true, -- inline messages
+ signs = true, -- show signs in the gutter
+ underline = true, -- underline errors/warnings
+ update_in_insert = false,
+ -- severity_sort = true,
+ })
+
+ -- local signs = { Error = "✖", Warn = "", Hint = "", Info = "" }
+ -- for type, icon in pairs(signs) do
+ -- local hl = "DiagnosticSign" .. type
+ -- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
+ -- end
-- Use Nerd Font symbols for diagnostics
-- vim.fn.sign_define("DiagnosticSignError", {text = "✖", texthl = "DiagnosticError"}) -- x-mark
@@ -80,14 +102,6 @@ return function()
-- vim.fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticHint"}) -- lightbulb
- vim.diagnostic.config({
- virtual_text = true, -- inline messages
- signs = true, -- show signs in the gutter
- underline = true, -- underline errors/warnings
- update_in_insert = false,
- severity_sort = true,
- })
-
lualine_x = {
{
"diagnostics",
@@ -97,8 +111,6 @@ return function()
}
}
-
-
end
end
diff --git a/lua/config/luasnips.lua b/lua/config/luasnips.lua
new file mode 100644
index 0000000..22fc94f
--- /dev/null
+++ b/lua/config/luasnips.lua
@@ -0,0 +1,21 @@
+return function()
+ local ls = require("luasnip")
+
+ -- Expand snippet
+ vim.keymap.set("i", "<C-K>", function() ls.expand() end, { silent = true })
+
+ -- Jump forward/backward
+ vim.keymap.set({ "i", "s" }, "<C-L>", function() ls.jump(1) end, { silent = true })
+ vim.keymap.set({ "i", "s" }, "<C-J>", function() ls.jump(-1) end, { silent = true })
+
+ -- Change choice in choice node
+ vim.keymap.set({ "i", "s" }, "<C-E>", function()
+ if ls.choice_active() then
+ ls.change_choice(1)
+ end
+ end, { silent = true })
+
+ -- Optionally, load snippets here if you have them
+ -- require("luasnip.loaders.from_vscode").lazy_load()
+end
+
diff --git a/lua/config/treesitter.lua b/lua/config/treesitter.lua
index d852bee..a38d5c0 100644
--- a/lua/config/treesitter.lua
+++ b/lua/config/treesitter.lua
@@ -1,33 +1,29 @@
-- ~/.config/nvim/lua/config/treesitter.lua
return function()
- require'nvim-treesitter.configs'.setup {
- -- A list of parser names, or "all"
- ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "cpp", "rust", "haskell", "python" },
-
- -- Install parsers synchronously (only applied to `ensure_installed`)
+ require("nvim-treesitter.configs").setup {
+ ensure_installed = {
+ "c",
+ "lua",
+ "vim",
+ "vimdoc",
+ "query",
+ "markdown",
+ "markdown_inline",
+ "python",
+ "javascript",
+ "cpp",
+ "rust",
+ "haskell",
+ },
sync_install = false,
-
- -- Automatically install missing parsers when entering buffer
auto_install = true,
-
- -- List of parsers to ignore installing
- -- ignore_install = { "javascript" },
-
highlight = {
enable = true,
- -- disable = { "c", "rust" }, -- parsers to disable
-
- -- Disable for large files
- -- disable = function(lang, buf)
- -- local max_filesize = 100 * 1024 -- 100 KB
- -- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
- -- if ok and stats and stats.size > max_filesize then
- -- return true
- -- end
- -- end,
-
- -- Run 'syntax' and tree-sitter at the same time
- -- additional_vim_regex_highlighting = false,
+ disable = {},
+ additional_vim_regex_highlighting = false,
+ },
+ indent = {
+ enable = true,
},
-- incremental_selection = {
-- enable = true,
@@ -39,12 +35,14 @@ return function()
-- },
-- },
textobjects = {
- enable = true,
- keymaps = {
- ["af"] = "@function.outer",
- ["if"] = "@function.inner",
- ["ac"] = "@class.outer",
- ["ic"] = "@class.inner",
+ select = {
+ enable = true,
+ keymaps = {
+ ["af"] = "@function.outer",
+ ["if"] = "@function.inner",
+ ["ac"] = "@class.outer",
+ ["ic"] = "@class.inner",
+ },
},
},
fold = {
@@ -52,5 +50,20 @@ return function()
},
}
-end
+ -- Add folding settings here
+ vim.opt.foldmethod = "expr"
+ vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
+ vim.opt.foldlevelstart = 99
+ vim.api.nvim_create_autocmd("FileType", {
+ callback = function()
+ if require("nvim-treesitter.parsers").has_parser() then
+ vim.opt.foldmethod = "expr"
+ vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()"
+ else
+ vim.opt.foldmethod = "indent" -- or whatever you prefer
+ end
+ end,
+})
+
+end