Skip to content

Commit e24935d

Browse files
authored
feat(nvim-treesitter): add "nvim-treesitter" and "ts-install" back as user plugins (#777)
1 parent e7dce62 commit e24935d

File tree

6 files changed

+53
-20
lines changed

6 files changed

+53
-20
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ jobs:
6666
commit_message: "chore(pr): auto-commit"
6767
ubuntu_installer:
6868
name: Ubuntu Installer
69-
strategy:
70-
matrix:
71-
os: [ubuntu-latest, ubuntu-24.04-arm]
72-
runs-on: ${{ matrix.os }}
69+
runs-on: ubuntu-latest
7370
steps:
7471
- uses: Swatinem/rust-cache@v2
7572
- uses: mozilla-actions/[email protected]
@@ -122,10 +119,7 @@ jobs:
122119
git clone --single-branch --branch ${{ steps.extract_branch.outputs.branch }} --depth=1 https://github.com/linrongbin16/lin.nvim ~/.nvim && cd ~/.nvim && bash -euxo pipefail ./install
123120
windows_installer:
124121
name: Windows Installer
125-
strategy:
126-
matrix:
127-
os: [windows-latest, windows-11-arm]
128-
runs-on: ${{ matrix.os }}
122+
runs-on: windows-latest
129123
steps:
130124
- uses: ilammy/msvc-dev-cmd@v1
131125
- uses: Swatinem/rust-cache@v2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
/lazy
99
/universal-ctags
1010
/go-installer
11+
/treesitter
12+
/ts-install
1113

1214
# hooks
1315
/preinit.vim
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
local stdpath_config = vim.fn.stdpath("config")
2+
3+
require("ts-install").setup({
4+
auto_install = true,
5+
install_dir = stdpath_config .. "/ts-install",
6+
})
7+
8+
local ts_install_augroup = vim.api.nvim_create_augroup("ts_install_augroup", { clear = true })
9+
vim.api.nvim_create_autocmd("FileType", {
10+
group = ts_install_augroup,
11+
pattern = { "<filetype>" },
12+
callback = function()
13+
vim.treesitter.start()
14+
end,
15+
})
16+
17+
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
18+
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
local bigfile = require("builtin.utils.bigfile")
1+
local stdpath_config = vim.fn.stdpath("config")
22

3-
---@diagnostic disable-next-line: missing-fields
4-
require("nvim-treesitter.configs").setup({
5-
auto_install = true,
6-
highlight = {
7-
enable = true,
8-
-- disable for super large file
9-
disable = function(lang, buf)
10-
return bigfile.is_too_big(buf)
11-
end,
12-
additional_vim_regex_highlighting = false,
13-
},
3+
require("nvim-treesitter").setup({
4+
install_dir = stdpath_config .. "/treesitter",
145
})
6+
7+
-- local nvim_treesitter_augroup =
8+
-- vim.api.nvim_create_augroup("nvim_treesitter_augroup", { clear = true })
9+
-- vim.api.nvim_create_autocmd("FileType", {
10+
-- group = nvim_treesitter_augroup,
11+
-- pattern = { "<filetype>" },
12+
-- callback = function()
13+
-- vim.treesitter.start()
14+
-- end,
15+
-- })
16+
--
17+
-- vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
18+
-- vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vim.g.loaded_nvim_treesitter = 1

lua/plugins/users_sample.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@
8989
-- version = "*",
9090
-- lazy = false,
9191
-- },
92+
-- {
93+
-- "nvim-treesitter/nvim-treesitter",
94+
-- lazy = false,
95+
-- branch = "main",
96+
-- build = ":TSUpdate",
97+
-- init = lua_init("nvim-treesitter/nvim-treesitter"),
98+
-- config = lua_config("nvim-treesitter/nvim-treesitter"),
99+
-- },
100+
-- {
101+
-- "lewis6991/ts-install.nvim",
102+
-- lazy = false,
103+
-- dependencies = { "nvim-treesitter/nvim-treesitter" },
104+
-- config = lua_config("lewis6991/ts-install.nvim"),
105+
-- },
92106
-- }
93107

94108
return {}

0 commit comments

Comments
 (0)