repos / dotfiles

my dotfiles

commit
6bbb4bd
parent
c9273e0
author
Eric Bower
date
2025-07-20 08:47:55 -0400 EDT
chore(nvim): stylua code formatting
1 files changed,  +163, -164
M dot_config/nvim/init.lua
+163, -164
  1@@ -1,205 +1,204 @@
  2 local o = vim.opt
  3-o.tabstop         = 2
  4-o.shiftwidth      = 2
  5-o.softtabstop     = 2
  6-o.expandtab       = true
  7-o.wrap            = false
  8-o.autoread        = true
  9-o.list            = true -- show trailing characters
 10-o.signcolumn      = "yes"
 11-o.backspace       = "indent,eol,start"
 12-o.shell           = "/bin/bash"
 13-o.colorcolumn     = '100'
 14-o.completeopt     = { "menuone", "noselect", "popup" }
 15-o.laststatus      = 0
 16-o.winborder       = 'rounded'
 17-o.undofile        = true
 18-o.ignorecase      = true
 19-o.smartcase       = true
 20+o.tabstop = 2
 21+o.shiftwidth = 2
 22+o.softtabstop = 2
 23+o.expandtab = true
 24+o.wrap = false
 25+o.autoread = true
 26+o.list = true -- show trailing characters
 27+o.signcolumn = "yes"
 28+o.backspace = "indent,eol,start"
 29+o.shell = "/bin/bash"
 30+o.colorcolumn = "101"
 31+o.completeopt = { "menuone", "noselect", "popup" }
 32+o.laststatus = 0
 33+o.winborder = "rounded"
 34+o.undofile = true
 35+o.ignorecase = true
 36+o.smartcase = true
 37 local g = vim.g
 38-g.mapleader       = ','
 39-g.maplocalleader  = ','
 40+g.mapleader = ","
 41+g.maplocalleader = ","
 42 
 43-local opts = { noremap=true, silent=true }
 44+local opts = { noremap = true, silent = true }
 45 local map = vim.keymap.set
 46-map('n', '<leader>b', '<C-O>', opts)          -- prev item in jumplist
 47-map('n', 'Q', '<nop>', opts)                  -- disable 'Q'
 48-map('n', '<leader>w', ':!make fmt<CR>', opts) -- code format command
 49-map('t', '<Esc>', [[<C-\><C-n>]], opts)       -- exit terminal mode
 50-map('n', '<C-k>', ':wincmd k<CR>', opts)      -- navigate splits
 51-map('n', '<C-j>', ':wincmd j<CR>', opts)
 52-map('n', '<C-h>', ':wincmd h<CR>', opts)
 53-map('n', '<C-l>', ':wincmd l<CR>', opts)
 54+map("n", "<leader>b", "<C-O>", opts) -- prev item in jumplist
 55+map("n", "Q", "<nop>", opts) -- disable "Q"
 56+map("n", "<leader>w", ":!make fmt<CR>", opts) -- code format command
 57+map("t", "<Esc>", [[<C-\><C-n>]], opts) -- exit terminal mode
 58+map("n", "<C-k>", ":wincmd k<CR>", opts) -- navigate splits
 59+map("n", "<C-j>", ":wincmd j<CR>", opts)
 60+map("n", "<C-h>", ":wincmd h<CR>", opts)
 61+map("n", "<C-l>", ":wincmd l<CR>", opts)
 62 -- https://github.com/shell-pool/shpool/issues/71#issuecomment-2632396805
 63 map({ "n", "v", "i", "t" }, "<C-space><C-d>", function()
 64-  vim.cmd("!shpool detach")
 65+	vim.cmd("!shpool detach")
 66 end)
 67 
 68 local autocmd = vim.api.nvim_create_autocmd
 69-autocmd('Filetype', { pattern = { 'qf' }, command = 'setlocal wrap' })
 70-autocmd('Filetype', { pattern = { 'make' }, command = 'setlocal tabstop=4 shiftwidth=4 softtabstop=4' })
 71-autocmd('Filetype', {
 72-  pattern = { 'markdown' },
 73-  command = 'setlocal wrap tw=79 formatoptions+=t tabstop=2 shiftwidth=2 softtabstop=2',
 74+autocmd("Filetype", { pattern = { "qf" }, command = "setlocal wrap" })
 75+autocmd("Filetype", { pattern = { "make" }, command = "setlocal tabstop=4 shiftwidth=4 softtabstop=4" })
 76+autocmd("Filetype", {
 77+	pattern = { "markdown" },
 78+	command = "setlocal wrap tw=79 formatoptions+=t tabstop=2 shiftwidth=2 softtabstop=2",
 79 })
 80-autocmd('FileType', {
 81-  group = vim.api.nvim_create_augroup('close_with_q', { clear = true }),
 82-  pattern = { 'help', 'man', 'qf', 'scratch', 'fugitive', 'nvim-pack' },
 83-  callback = function(args)
 84-    map('n', 'q', '<cmd>quit<cr>', { buffer = args.buf })
 85-  end,
 86+autocmd("FileType", {
 87+	group = vim.api.nvim_create_augroup("close_with_q", { clear = true }),
 88+	pattern = { "help", "man", "qf", "scratch", "fugitive", "nvim-pack" },
 89+	callback = function(args)
 90+		map("n", "q", "<cmd>quit<cr>", { buffer = args.buf })
 91+	end,
 92 })
 93 
 94 function setup_lsp()
 95-  map('n', '<leader>e', vim.diagnostic.open_float, opts)
 96-  map('n', '<leader>q', vim.diagnostic.setloclist, opts)
 97+	map("n", "<leader>e", vim.diagnostic.open_float, opts)
 98+	map("n", "<leader>q", vim.diagnostic.setloclist, opts)
 99 
100-  local on_attach = function(client, bufnr)
101-    local chars = {}
102-    for i = 32, 126 do
103-      table.insert(chars, string.char(i))
104-    end
105-    -- auto-complete for any char
106-    client.server_capabilities.completionProvider.triggerCharacters = chars
107-    vim.lsp.completion.enable(true, client.id, bufnr, { -- built-in auto-complete
108-      autotrigger = true,
109-      convert = function(item)
110-        return { abbr = item.label:gsub('%b()', '') }
111-      end,
112-    })
113-    local bufopts = { noremap=true, silent=true, buffer=bufnr }
114+	local on_attach = function(client, bufnr)
115+		local chars = {}
116+		for i = 32, 126 do
117+			table.insert(chars, string.char(i))
118+		end
119+		-- auto-complete for any char
120+		client.server_capabilities.completionProvider.triggerCharacters = chars
121+		vim.lsp.completion.enable(true, client.id, bufnr, { -- built-in auto-complete
122+			autotrigger = true,
123+			convert = function(item)
124+				return { abbr = item.label:gsub("%b()", "") }
125+			end,
126+		})
127+		local bufopts = { noremap = true, silent = true, buffer = bufnr }
128 
129-    -- See `:help vim.lsp.*` for documentation on any of the below functions
130-    map('n', '<leader>d', vim.lsp.buf.definition, bufopts)
131-    map('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
132-    map('n', '<leader>h', vim.lsp.buf.hover, bufopts)
133-    map('n', '<leader>r', vim.lsp.buf.references, bufopts)
134-    map('n', '<leader>i', vim.lsp.buf.implementation, bufopts)
135-    -- open completion menu manually
136-    map('i', '<C-k>', vim.lsp.completion.get, bufopts)
137-  end
138+		-- See `:help vim.lsp.*` for documentation on any of the below functions
139+		map("n", "<leader>d", vim.lsp.buf.definition, bufopts)
140+		map("n", "<leader>D", vim.lsp.buf.type_definition, bufopts)
141+		map("n", "<leader>h", vim.lsp.buf.hover, bufopts)
142+		map("n", "<leader>r", vim.lsp.buf.references, bufopts)
143+		map("n", "<leader>i", vim.lsp.buf.implementation, bufopts)
144+		map("i", "<C-k>", vim.lsp.completion.get, bufopts) -- open completion menu manually
145+	end
146 
147-  local nvim_lsp = require('lspconfig')
148-  function handler(server_name)
149-    local opts = {
150-      capabilities = capabilities,
151-      on_attach = on_attach,
152-    }
153-    if server_name == "denols" then
154-      opts.root_dir = nvim_lsp.util.root_pattern("deno.json", "deno.jsonc")
155-    elseif server_name == "ts_ls" then
156-      opts.root_dir = nvim_lsp.util.root_pattern("package.json")
157-      -- https://github.com/neovim/nvim-lspconfig/issues/2507#issuecomment-1471438640
158-      opts.single_file_support = false
159-    end
160-    nvim_lsp[server_name].setup(opts)
161-  end
162+	local nvim_lsp = require("lspconfig")
163+	function handler(server_name)
164+		local opts = {
165+			capabilities = capabilities,
166+			on_attach = on_attach,
167+		}
168+		if server_name == "denols" then
169+			opts.root_dir = nvim_lsp.util.root_pattern("deno.json", "deno.jsonc")
170+		elseif server_name == "ts_ls" then
171+			opts.root_dir = nvim_lsp.util.root_pattern("package.json")
172+			-- https://github.com/neovim/nvim-lspconfig/issues/2507#issuecomment-1471438640
173+			opts.single_file_support = false
174+		end
175+		nvim_lsp[server_name].setup(opts)
176+	end
177 
178-  -- npm i -g vscode-langservers-extracted
179-  handler("cssls")
180-  handler("denols")
181-  handler("gopls")
182-  handler("html")
183-  handler("jsonls")
184-  -- npm i -g pyright
185-  handler("pyright")
186-  -- npm i -g typescript typescript-language-server
187-  handler("ts_ls")
188-  handler("zls")
189+	-- npm i -g vscode-langservers-extracted
190+	handler("cssls")
191+	handler("denols")
192+	handler("gopls")
193+	handler("html")
194+	handler("jsonls")
195+	-- npm i -g pyright
196+	handler("pyright")
197+	-- npm i -g typescript typescript-language-server
198+	handler("ts_ls")
199+	handler("zls")
200 end
201 
202 function setup_fzf()
203-  local fzf = require("fzf-lua")
204-  fzf.setup({})
205-  local fzf_files = function()
206-    fzf.files({ winopts = { preview = { hidden = "hidden" } } })
207-  end
208-  local fzf_symbols = function()
209-    fzf.lsp_document_symbols({ winopts = { preview = { hidden = "hidden" } } })
210-  end
211-  map("n", "<leader>s", fzf_files, { desc = "Fzf Files", noremap=true, silent=true })
212-  map("n", "<leader>F", fzf_symbols, { desc = "Fzf Symbols", noremap=true, silent=true })
213-  map("n", "<leader>f", fzf.buffers, { desc = "Fzf Buffers", noremap=true, silent=true })
214-  map("n", "<leader>S", fzf.live_grep, { desc = "Fzf Grep", noremap=true, silent=true })
215-  fzf.setup({"max-perf"})
216+	local fzf = require("fzf-lua")
217+	local fzf_files = function()
218+		fzf.files({ winopts = { preview = { hidden = "hidden" } } })
219+	end
220+	local fzf_symbols = function()
221+		fzf.lsp_document_symbols({ winopts = { preview = { hidden = "hidden" } } })
222+	end
223+	map("n", "<leader>s", fzf_files, { desc = "Fzf Files", noremap = true, silent = true })
224+	map("n", "<leader>F", fzf_symbols, { desc = "Fzf Symbols", noremap = true, silent = true })
225+	map("n", "<leader>f", fzf.buffers, { desc = "Fzf Buffers", noremap = true, silent = true })
226+	map("n", "<leader>S", fzf.live_grep, { desc = "Fzf Grep", noremap = true, silent = true })
227+	fzf.setup({ "max-perf" })
228 end
229 
230 vim.pack.add({
231-  "https://github.com/nvim-lua/plenary.nvim",
232-  "https://github.com/Mofiqul/dracula.nvim",
233-  { src = "https://github.com/nvim-treesitter/nvim-treesitter", version = 'main' },
234-  "https://github.com/nvim-treesitter/nvim-treesitter-context",
235-  "https://github.com/neovim/nvim-lspconfig",
236-  "https://github.com/ibhagwan/fzf-lua",
237-  "https://github.com/karb94/neoscroll.nvim",
238-  "https://github.com/ruifm/gitlinker.nvim",
239-  "https://github.com/tpope/vim-fugitive",
240+	"https://github.com/nvim-lua/plenary.nvim",
241+	"https://github.com/Mofiqul/dracula.nvim",
242+	{ src = "https://github.com/nvim-treesitter/nvim-treesitter", version = "main" },
243+	"https://github.com/nvim-treesitter/nvim-treesitter-context",
244+	"https://github.com/neovim/nvim-lspconfig",
245+	"https://github.com/ibhagwan/fzf-lua",
246+	"https://github.com/karb94/neoscroll.nvim",
247+	"https://github.com/ruifm/gitlinker.nvim",
248+	"https://github.com/tpope/vim-fugitive",
249 })
250 require("dracula").setup({})
251-vim.cmd[[colorscheme dracula]]
252+vim.cmd([[colorscheme dracula]])
253 
254 local ts_parsers = {
255-  "bash",
256-  "c",
257-  "dockerfile",
258-  "fish",
259-  "git_config",
260-  "git_rebase",
261-  "gitattributes",
262-  "gitcommit",
263-  "gitignore",
264-  "go",
265-  "gomod",
266-  "gosum",
267-  "html",
268-  "javascript",
269-  "json",
270-  "lua",
271-  "make",
272-  "markdown",
273-  "python",
274-  "rust",
275-  "sql",
276-  "toml",
277-  "tsx",
278-  "typescript",
279-  "typst",
280-  "vim",
281-  "yaml",
282-  "zig",
283+	"bash",
284+	"c",
285+	"dockerfile",
286+	"fish",
287+	"git_config",
288+	"git_rebase",
289+	"gitattributes",
290+	"gitcommit",
291+	"gitignore",
292+	"go",
293+	"gomod",
294+	"gosum",
295+	"html",
296+	"javascript",
297+	"json",
298+	"lua",
299+	"make",
300+	"markdown",
301+	"python",
302+	"rust",
303+	"sql",
304+	"toml",
305+	"tsx",
306+	"typescript",
307+	"typst",
308+	"vim",
309+	"yaml",
310+	"zig",
311 }
312 local nts = require("nvim-treesitter")
313 nts.install(ts_parsers)
314-autocmd({ "PackChanged" }, {
315-  callback = function(args)
316-    local spec = args.data.spec
317-    if spec and spec.name == "nvim-treesitter" and args.data.kind == "update" then
318-      vim.notify("nvim-treesitter was updated, updating parsers", vim.log.levels.INFO)
319-      vim.schedule(function() nts.update() end)
320-    end
321-  end,
322+autocmd("PackChanged", {
323+	callback = function(args)
324+		local spec = args.data.spec
325+		if spec and spec.name == "nvim-treesitter" and args.data.kind == "update" then
326+			vim.notify("nvim-treesitter was updated, updating parsers", vim.log.levels.INFO)
327+			vim.schedule(function()
328+				nts.update()
329+			end)
330+		end
331+	end,
332 })
333 
334 setup_lsp()
335 setup_fzf()
336 require("treesitter-context").setup({
337-  max_lines = 3,
338-  multiline_threshold = 1,
339-  separator = '-',
340-  min_window_height = 20,
341-  line_numbers = true,
342+	max_lines = 3,
343+	multiline_threshold = 1,
344+	separator = "-",
345+	min_window_height = 20,
346+	line_numbers = true,
347 })
348 require("neoscroll").setup({ duration_multiplier = 0.4 })
349 require("gitlinker").setup({})
350 
351 autocmd("FileType", { -- enable treesitter highlighting and indents
352-  callback = function(args)
353-    local filetype = args.match
354-    local lang = vim.treesitter.language.get_lang(filetype)
355-    if vim.treesitter.language.add(lang) then
356-      -- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
357-      vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
358-      vim.treesitter.start()
359-    end
360-  end
361+	callback = function(args)
362+		local filetype = args.match
363+		local lang = vim.treesitter.language.get_lang(filetype)
364+		if vim.treesitter.language.add(lang) then
365+			vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
366+			vim.treesitter.start()
367+		end
368+	end,
369 })