(nvim) nvim v0.12 migration
This commit is contained in:
parent
f0db0ada98
commit
7b2eb8c525
51 changed files with 1629 additions and 1627 deletions
47
nvim/lua/treesitter.lua
Normal file
47
nvim/lua/treesitter.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
local treesitter = require("nvim-treesitter")
|
||||
|
||||
treesitter.setup({
|
||||
install_dir = vim.fn.stdpath("data") .. "/site",
|
||||
autotag = {
|
||||
enable = false,
|
||||
enable_close_on_slash = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- Install parsers
|
||||
local ensured_installed = {
|
||||
"go",
|
||||
"gosum",
|
||||
"gomod",
|
||||
"rust",
|
||||
"c",
|
||||
"php",
|
||||
"blade",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"lua",
|
||||
"templ",
|
||||
}
|
||||
local already_installed = treesitter.get_installed()
|
||||
local parsers_to_install = vim.iter(ensured_installed)
|
||||
:filter(function(parser)
|
||||
return not vim.tbl_contains(already_installed, parser)
|
||||
end)
|
||||
:totable()
|
||||
treesitter.install(parsers_to_install)
|
||||
|
||||
-- highlighting and indentation
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function()
|
||||
-- Enable treesitter highlighting and disable regex syntax
|
||||
pcall(vim.treesitter.start)
|
||||
-- Enable treesitter-based indentation
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end,
|
||||
})
|
||||
|
||||
-- textobjects
|
||||
-- Disable entire built-in ftplugin mappings to avoid conflicts.
|
||||
-- See https://github.com/neovim/neovim/tree/master/runtime/ftplugin for built-in ftplugins.
|
||||
vim.g.no_plugin_maps = true
|
||||
require("nvim-treesitter-textobjects").setup({})
|
||||
Loading…
Add table
Add a link
Reference in a new issue