- commit
- fed9dbe
- parent
- ff31267
- author
- Eric Bower
- date
- 2025-07-16 23:13:23 -0400 EDT
chore(nvim): `main` branch treesitter
2 files changed,
+83,
-70
+4,
-0
1@@ -35,6 +35,10 @@ abbr -a pp PA_DIR=/home/erock/dev/pico/pico-pass pa
2 abbr -a logs "ssh pipe sub /pico/log-drain -k | jq -r"
3 abbr -a ash "autossh -M 0"
4
5+if type -q zoxide
6+ zoxide init fish | source
7+end
8+
9 if type -q direnv
10 direnv hook fish | source
11 end
+79,
-70
1@@ -5,11 +5,11 @@ o.softtabstop = 2
2 o.expandtab = true
3 o.wrap = false
4 o.autoread = true
5-o.list = true
6+o.list = true -- show trailing characters
7 o.signcolumn = 'yes'
8 o.backspace = 'indent,eol,start'
9 o.shell = '/bin/bash'
10-o.colorcolumn = '80'
11+o.colorcolumn = '100'
12 o.completeopt = { "menuone", "noselect", "popup" }
13 o.laststatus = 0
14 o.winborder = 'rounded'
15@@ -53,59 +53,62 @@ autocmd('FileType', {
16 local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
17 if not (vim.uv or vim.loop).fs_stat(lazypath) then
18 local lazyrepo = "https://github.com/folke/lazy.nvim.git"
19- local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
20- if vim.v.shell_error ~= 0 then
21- vim.api.nvim_echo({
22- { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
23- { out, "WarningMsg" },
24- { "\nPress any key to exit..." },
25- }, true, {})
26- vim.fn.getchar()
27- os.exit(1)
28- end
29+ vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
30 end
31 vim.opt.rtp:prepend(lazypath)
32
33 function setup_treesitter()
34- require'nvim-treesitter.configs'.setup {
35- highlight = { enable = true },
36- indent = { enable = true },
37- ensure_installed = {
38- "bash",
39- "c",
40- "cmake",
41- "dockerfile",
42- "fish",
43- "git_config",
44- "git_rebase",
45- "gitattributes",
46- "gitcommit",
47- "gitignore",
48- "go",
49- "gomod",
50- "gosum",
51- "html",
52- "javascript",
53- "json",
54- "json5",
55- "lua",
56- "make",
57- "markdown",
58- "python",
59- "r",
60- "rust",
61- "sql",
62- "terraform",
63- "toml",
64- "tsx",
65- "typescript",
66- "typst",
67- "vim",
68- "vimdoc",
69- "yaml",
70- "zig",
71- },
72+ ft_opts = {
73+ "bash",
74+ "c",
75+ "dockerfile",
76+ "fish",
77+ "git_config",
78+ "git_rebase",
79+ "gitattributes",
80+ "gitcommit",
81+ "gitignore",
82+ "go",
83+ "gomod",
84+ "gosum",
85+ "html",
86+ "javascript",
87+ "json",
88+ "lua",
89+ "make",
90+ "markdown",
91+ "python",
92+ "rust",
93+ "sql",
94+ "toml",
95+ "tsx",
96+ "typescript",
97+ "typst",
98+ "vim",
99+ "yaml",
100+ "zig",
101 }
102+ require'nvim-treesitter'.install(ft_opts)
103+
104+ for _, ft in ipairs(ft_opts) do
105+ vim.treesitter.language.register(ft, ft)
106+
107+ vim.api.nvim_create_autocmd("FileType", {
108+ desc = "enable tree-sitter syntax highlighting",
109+ pattern = ft,
110+ callback = function(event)
111+ pcall(function() vim.treesitter.start(event.buf, parser) end)
112+ end,
113+ })
114+
115+ vim.api.nvim_create_autocmd("FileType", {
116+ desc = "enable tree-sitter indentation",
117+ pattern = ft,
118+ callback = function(event)
119+ vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
120+ end,
121+ })
122+ end
123 end
124
125 function setup_lsp()
126@@ -179,7 +182,25 @@ require("lazy").setup({
127 },
128 spec = {
129 { 'neovim/nvim-lspconfig', config = setup_lsp },
130- { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', config = setup_treesitter },
131+ {
132+ 'nvim-treesitter/nvim-treesitter',
133+ branch = 'main',
134+ lazy = false,
135+ build = ':TSUpdate',
136+ config = setup_treesitter,
137+ },
138+ {
139+ "nvim-treesitter/nvim-treesitter-context",
140+ config = function()
141+ require('treesitter-context').setup({
142+ max_lines = 3,
143+ multiline_threshold = 1,
144+ separator = '-',
145+ min_window_height = 20,
146+ line_numbers = true
147+ })
148+ end,
149+ },
150 {
151 "ibhagwan/fzf-lua",
152 config = function()
153@@ -197,13 +218,6 @@ require("lazy").setup({
154 fzf.setup({'max-perf'})
155 end
156 },
157- {
158- 'ruifm/gitlinker.nvim',
159- dependencies = 'nvim-lua/plenary.nvim',
160- config = function()
161- require"gitlinker".setup()
162- end,
163- },
164 {
165 'Mofiqul/dracula.nvim',
166 lazy = false,
167@@ -213,23 +227,18 @@ require("lazy").setup({
168 vim.cmd[[colorscheme dracula]]
169 end
170 },
171- {
172- "nvim-treesitter/nvim-treesitter-context",
173- config = function()
174- require('treesitter-context').setup({
175- max_lines = 3,
176- multiline_threshold = 1,
177- separator = '-',
178- min_window_height = 20,
179- line_numbers = true
180- })
181- end,
182- },
183 {
184 "karb94/neoscroll.nvim",
185 config = function()
186 require('neoscroll').setup({ duration_multiplier = 0.4 })
187 end
188 },
189+ {
190+ 'ruifm/gitlinker.nvim',
191+ dependencies = 'nvim-lua/plenary.nvim',
192+ config = function()
193+ require"gitlinker".setup()
194+ end,
195+ },
196 },
197 })