refactor(nvim-treesitter.lua): improve code formatting and indentation for better readability and maintainability

This commit is contained in:
David Ibia
2024-07-30 23:49:57 +01:00
parent 7e033dc750
commit 318c2a2421

View File

@@ -1,69 +1,69 @@
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed) -- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { ensure_installed = {
"rust", "rust",
"javascript", "javascript",
"typescript", "typescript",
"python", "python",
"c", "c",
"lua", "lua",
"vim", "vim",
"vimdoc", "vimdoc",
"query", "query",
"markdown_inline", "markdown_inline",
"markdown", "markdown",
}, },
-- Install parsers synchronously (only applied to `ensure_installed`) -- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false, sync_install = false,
-- Automatically install missing parsers when entering buffer -- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true, auto_install = true,
---- If you need to change the installation directory of the parsers (see -> Advanced Setup) ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = { highlight = {
enable = true, enable = true,
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights. -- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages -- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
textobjects = { textobjects = {
move = { move = {
enable = true, enable = true,
set_jumps = false, -- you can change this if you want. set_jumps = false, -- you can change this if you want.
goto_next_start = { goto_next_start = {
--- ... other keymaps --- ... other keymaps
["]b"] = { query = "@code_cell.inner", desc = "next code block" }, ["]b"] = { query = "@code_cell.inner", desc = "next code block" },
}, },
goto_previous_start = { goto_previous_start = {
--- ... other keymaps --- ... other keymaps
["[b"] = { query = "@code_cell.inner", desc = "previous code block" }, ["[b"] = { query = "@code_cell.inner", desc = "previous code block" },
}, },
}, },
select = { select = {
enable = true, enable = true,
lookahead = true, -- you can change this if you want lookahead = true, -- you can change this if you want
keymaps = { keymaps = {
--- ... other keymaps --- ... other keymaps
["ib"] = { query = "@code_cell.inner", desc = "in block" }, ["ib"] = { query = "@code_cell.inner", desc = "in block" },
["ab"] = { query = "@code_cell.outer", desc = "around block" }, ["ab"] = { query = "@code_cell.outer", desc = "around block" },
}, },
}, },
swap = { -- Swap only works with code blocks that are under the same swap = { -- Swap only works with code blocks that are under the same
-- markdown header -- markdown header
enable = true, enable = true,
swap_next = { swap_next = {
--- ... other keymap --- ... other keymap
["<leader>sbl"] = "@code_cell.outer", ["<leader>sbl"] = "@code_cell.outer",
}, },
swap_previous = { swap_previous = {
--- ... other keymap --- ... other keymap
["<leader>sbh"] = "@code_cell.outer", ["<leader>sbh"] = "@code_cell.outer",
}, },
}, },
}, },
}) })