Compare commits
4 Commits
30bd9ac528
...
613110fdce
Author | SHA1 | Date | |
---|---|---|---|
613110fdce | |||
4106e7fdc0 | |||
3b9aa845ca | |||
76e71ac03f |
|
@ -32,3 +32,23 @@ vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, {
|
|||
group = cursor_group,
|
||||
pattern = "*",
|
||||
})
|
||||
|
||||
-- Auto install treesitter parser and start them
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
desc = "Enable Treesitter",
|
||||
group = vim.api.nvim_create_augroup("enable_treesitter", {}),
|
||||
callback = function(event)
|
||||
local has_treesitter, treesitter = pcall(require, "nvim-treesitter")
|
||||
if has_treesitter then
|
||||
local language = vim.treesitter.language.get_lang(event.match)
|
||||
treesitter.install(language):await(function(a)
|
||||
if pcall(vim.treesitter.start) then
|
||||
-- Use Treesitter indentation and folds.
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
vim.wo.foldmethod = "expr"
|
||||
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
end
|
||||
end)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -61,3 +61,6 @@ vim.o.scrolloff = 10
|
|||
-- Highlight tabs and trailing whitespace
|
||||
vim.o.listchars = "trail:~,tab:¦⁃,nbsp:␣"
|
||||
vim.o.list = true
|
||||
|
||||
-- Fold settings
|
||||
vim.o.foldlevelstart = 99
|
||||
|
|
|
@ -4,30 +4,14 @@ return {
|
|||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
{ "nvim-treesitter/nvim-treesitter-textobjects", branch = "main" },
|
||||
"windwp/nvim-ts-autotag",
|
||||
},
|
||||
lazy = false,
|
||||
branch = "main",
|
||||
build = ":TSUpdate",
|
||||
opts = {
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = {
|
||||
"c",
|
||||
"cpp",
|
||||
"go",
|
||||
"lua",
|
||||
"python",
|
||||
"rust",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vimdoc",
|
||||
"vim",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"bash",
|
||||
"sql",
|
||||
},
|
||||
|
||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||
auto_install = true,
|
||||
ensure_installed = require("tools.highlight"),
|
||||
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
|
@ -91,17 +75,5 @@ return {
|
|||
enable = true,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
require("nvim-treesitter.install").update({ with_sync = true })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
opts = {
|
||||
multiwindow = true,
|
||||
mode = "topline",
|
||||
separator = require("symbols.window").borderchars[3],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
16
nvim/dot-config/nvim/lua/tools/highlight.lua
Normal file
16
nvim/dot-config/nvim/lua/tools/highlight.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
"c",
|
||||
"cpp",
|
||||
"go",
|
||||
"lua",
|
||||
"python",
|
||||
"rust",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vimdoc",
|
||||
"vim",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"bash",
|
||||
"sql",
|
||||
}
|
Loading…
Reference in New Issue
Block a user