Dotfiles V1.5.2
This commit is contained in:
1 parent
1ec21e387a
commit
b5c9d585c1
51 files changed
+1356
-1082
No files matched your search
@@ -1,45 +1,55 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
"windwp/nvim-ts-autotag",
|
||||
},
|
||||
config = function()
|
||||
local treesitter = require("nvim-treesitter.configs")
|
||||
{
|
||||
"romus204/tree-sitter-manager.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local tsm = require("tree-sitter-manager")
|
||||
|
||||
treesitter.setup({
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { "latex" },
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
ensure_installed = {
|
||||
"python",
|
||||
"cpp",
|
||||
"lua",
|
||||
"markdown_inline",
|
||||
"html",
|
||||
"css",
|
||||
"bash",
|
||||
"latex",
|
||||
"r",
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
-- 1. Manage Parser Files
|
||||
tsm.setup({
|
||||
ensure_installed = {
|
||||
"python",
|
||||
"cpp",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"html",
|
||||
"css",
|
||||
"bash",
|
||||
"zsh",
|
||||
"latex",
|
||||
"r",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- 2. Enable Native Highlighting Engine
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
local ft = vim.bo[bufnr].filetype
|
||||
|
||||
-- Filter out common "non-code" or problematic filetypes
|
||||
local ignore_ft = { "noice", "prompt", "TelescopePrompt", "notify" }
|
||||
for _, v in ipairs(ignore_ft) do
|
||||
if ft == v then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Try to get the language for the filetype
|
||||
local lang = vim.treesitter.language.get_lang(ft)
|
||||
|
||||
-- ONLY start if we have a valid language AND the parser is actually installed
|
||||
if lang then
|
||||
-- pcall (protected call) prevents the "Parser could not be created" error
|
||||
-- from popping up in your face if the parser is missing/corrupted.
|
||||
local ok, _ = pcall(vim.treesitter.start, bufnr, lang)
|
||||
if ok then
|
||||
vim.opt_local.indentexpr = "v:lua.vim.treesitter.indentexpr()"
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
Reference in new issue
Block a user