Public Access
treesitter fix
This commit is contained in:
@@ -58,23 +58,36 @@ end
|
|||||||
setup_plugin("oil")
|
setup_plugin("oil")
|
||||||
setup_plugin("mini.pick")
|
setup_plugin("mini.pick")
|
||||||
setup_plugin("blink.cmp", { keymap = { preset = "super-tab" } })
|
setup_plugin("blink.cmp", { keymap = { preset = "super-tab" } })
|
||||||
setup_plugin("nvim-treesitter.configs", {
|
-- nvim-treesitter main branch: no configs.setup, no auto_install,
|
||||||
auto_install = true,
|
-- no highlight.enable. You install parsers and start TS yourself.
|
||||||
highlight = { enable = true },
|
local ok_ts, ts = pcall(require, "nvim-treesitter")
|
||||||
indent = { enable = true },
|
if ok_ts then
|
||||||
textobjects = {
|
ts.install({
|
||||||
select = {
|
"lua", "vim", "vimdoc", "bash", "c", "cpp", "rust", "python",
|
||||||
enable = true,
|
"javascript", "typescript", "tsx", "svelte", "css", "html",
|
||||||
lookahead = true,
|
"json", "toml", "yaml", "markdown", "markdown_inline",
|
||||||
keymaps = {
|
"java", "typst", "vala",
|
||||||
["af"] = "@function.outer",
|
|
||||||
["if"] = "@function.inner",
|
|
||||||
["ac"] = "@class.outer",
|
|
||||||
["ic"] = "@class.inner",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "*",
|
||||||
|
callback = function()
|
||||||
|
pcall(vim.treesitter.start)
|
||||||
|
pcall(function()
|
||||||
|
vim.bo.indentexpr = "v:lua.vim.treesitter.indentexpr()"
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
local ok_tot, _ = pcall(require, "nvim-treesitter-textobjects")
|
||||||
|
if ok_tot then
|
||||||
|
local select = require("nvim-treesitter-textobjects.select")
|
||||||
|
vim.keymap.set({ "x", "o" }, "af", function() select.select_textobject("@function.outer", "textobjects") end)
|
||||||
|
vim.keymap.set({ "x", "o" }, "if", function() select.select_textobject("@function.inner", "textobjects") end)
|
||||||
|
vim.keymap.set({ "x", "o" }, "ac", function() select.select_textobject("@class.outer", "textobjects") end)
|
||||||
|
vim.keymap.set({ "x", "o" }, "ic", function() select.select_textobject("@class.inner", "textobjects") end)
|
||||||
|
end
|
||||||
|
|
||||||
setup_plugin("mason")
|
setup_plugin("mason")
|
||||||
-- Automatically install these tools via Mason
|
-- Automatically install these tools via Mason
|
||||||
@@ -93,7 +106,8 @@ local ensure_installed = {
|
|||||||
"taplo",
|
"taplo",
|
||||||
"typescript-language-server",
|
"typescript-language-server",
|
||||||
"pylsp",
|
"pylsp",
|
||||||
"black"
|
"black",
|
||||||
|
"vala"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Refresh the registry and install missing tools
|
-- Refresh the registry and install missing tools
|
||||||
@@ -133,9 +147,13 @@ end
|
|||||||
vim.lsp.enable({
|
vim.lsp.enable({
|
||||||
"lua_ls", "ts_ls", "svelte", "tailwindcss", "cssls", "bashls",
|
"lua_ls", "ts_ls", "svelte", "tailwindcss", "cssls", "bashls",
|
||||||
"rust_analyzer", "clangd", "clang-format", "taplo",
|
"rust_analyzer", "clangd", "clang-format", "taplo",
|
||||||
"sourcekit", "lemminx", "tinymist", "jsonls", "hls", "pylsp", "black"
|
"sourcekit", "lemminx", "tinymist", "jsonls", "hls", "ormolu", "pylsp", "black", "vala_ls"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.lsp.config["sourcekit"] = {
|
||||||
|
filetypes = { "swift", "objective-c", "objective-c++" }
|
||||||
|
}
|
||||||
|
|
||||||
vim.lsp.config["tinymist"] = {
|
vim.lsp.config["tinymist"] = {
|
||||||
cmd = { "tinymist" },
|
cmd = { "tinymist" },
|
||||||
filetypes = { "typst" },
|
filetypes = { "typst" },
|
||||||
|
|||||||
Reference in New Issue
Block a user