summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorbh <qn+git@excalibur.computer>2025-11-13 18:06:32 +0800
committerbh <qn+git@excalibur.computer>2025-11-13 18:06:32 +0800
commit1b9eb7cde7cf88b3afda6c6e11ae48f7d84eaca8 (patch)
tree3a6a7abf88bb6471bac3abb7af1da360d9523534 /lua
parent8c60360313bd35dd9a01c89e6b4dfd4cf7dbd61d (diff)
Tried Treesitter. This is for backup of old config.
Diffstat (limited to 'lua')
-rw-r--r--lua/config/lsp.lua8
-rw-r--r--lua/config/test.c5
-rw-r--r--lua/config/treesitter.lua56
3 files changed, 65 insertions, 4 deletions
diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua
index 5e1197a..436d2e6 100644
--- a/lua/config/lsp.lua
+++ b/lua/config/lsp.lua
@@ -74,10 +74,10 @@ return function()
end
-- Use Nerd Font symbols for diagnostics
- vim.fn.sign_define("DiagnosticSignError", {text = "✖", texthl = "DiagnosticError"}) -- x-mark
- vim.fn.sign_define("DiagnosticSignWarn", {text = "", texthl = "DiagnosticWarn"}) -- warning triangle
- vim.fn.sign_define("DiagnosticSignInfo", {text = "", texthl = "DiagnosticInfo"}) -- info circle
- vim.fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticHint"}) -- lightbulb
+ -- vim.fn.sign_define("DiagnosticSignError", {text = "✖", texthl = "DiagnosticError"}) -- x-mark
+ -- vim.fn.sign_define("DiagnosticSignWarn", {text = "", texthl = "DiagnosticWarn"}) -- warning triangle
+ -- vim.fn.sign_define("DiagnosticSignInfo", {text = "", texthl = "DiagnosticInfo"}) -- info circle
+ -- vim.fn.sign_define("DiagnosticSignHint", {text = "", texthl = "DiagnosticHint"}) -- lightbulb
vim.diagnostic.config({
diff --git a/lua/config/test.c b/lua/config/test.c
new file mode 100644
index 0000000..514ad15
--- /dev/null
+++ b/lua/config/test.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+int add(){
+ return 5 + 5;
+}
diff --git a/lua/config/treesitter.lua b/lua/config/treesitter.lua
new file mode 100644
index 0000000..d852bee
--- /dev/null
+++ b/lua/config/treesitter.lua
@@ -0,0 +1,56 @@
+-- ~/.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`)
+ 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,
+ },
+ -- incremental_selection = {
+ -- enable = true,
+ -- keymaps = {
+ -- init_selection = "gnn",
+ -- node_incremental = "grn",
+ -- scope_incremental = "grc",
+ -- node_decremental = "grm",
+ -- },
+ -- },
+ textobjects = {
+ enable = true,
+ keymaps = {
+ ["af"] = "@function.outer",
+ ["if"] = "@function.inner",
+ ["ac"] = "@class.outer",
+ ["ic"] = "@class.inner",
+ },
+ },
+ fold = {
+ enable = true,
+ },
+
+ }
+end
+