Public Access
treesitter fix
This commit is contained in:
@@ -58,24 +58,37 @@ end
|
||||
setup_plugin("oil")
|
||||
setup_plugin("mini.pick")
|
||||
setup_plugin("blink.cmp", { keymap = { preset = "super-tab" } })
|
||||
setup_plugin("nvim-treesitter.configs", {
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- nvim-treesitter main branch: no configs.setup, no auto_install,
|
||||
-- no highlight.enable. You install parsers and start TS yourself.
|
||||
local ok_ts, ts = pcall(require, "nvim-treesitter")
|
||||
if ok_ts then
|
||||
ts.install({
|
||||
"lua", "vim", "vimdoc", "bash", "c", "cpp", "rust", "python",
|
||||
"javascript", "typescript", "tsx", "svelte", "css", "html",
|
||||
"json", "toml", "yaml", "markdown", "markdown_inline",
|
||||
"java", "typst", "vala",
|
||||
})
|
||||
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")
|
||||
-- Automatically install these tools via Mason
|
||||
local registry = require("mason-registry")
|
||||
@@ -93,7 +106,8 @@ local ensure_installed = {
|
||||
"taplo",
|
||||
"typescript-language-server",
|
||||
"pylsp",
|
||||
"black"
|
||||
"black",
|
||||
"vala"
|
||||
}
|
||||
|
||||
-- Refresh the registry and install missing tools
|
||||
@@ -133,9 +147,13 @@ end
|
||||
vim.lsp.enable({
|
||||
"lua_ls", "ts_ls", "svelte", "tailwindcss", "cssls", "bashls",
|
||||
"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"] = {
|
||||
cmd = { "tinymist" },
|
||||
filetypes = { "typst" },
|
||||
|
||||
Reference in New Issue
Block a user