Merge pull request #24 from nbur4556/format-on-save

Format on save
This commit is contained in:
Nick Burt 2026-07-01 15:01:11 -05:00 committed by GitHub
commit 1015fc9e5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 2 deletions

View File

@ -112,6 +112,9 @@ do
-- Experiment for yourself to see if you like it!
vim.o.relativenumber = true
-- Set to nowrap //TODO: can this be in a separate file than the init.lua to avoid conflicts with upstream?
vim.o.wrap = false
-- Enable mouse mode, can be useful for resizing splits for example!
vim.o.mouse = 'a'
@ -796,8 +799,13 @@ do
format_on_save = function(bufnr)
-- You can specify filetypes to autoformat on save here:
local enabled_filetypes = {
-- lua = true,
-- python = true,
lua = true,
javascript = true,
typescript = true,
typescriptreact = true,
cs = true,
--TODO: not getting any lsp completion for svelte files
svelte = true,
}
if enabled_filetypes[vim.bo[bufnr].filetype] then
return { timeout_ms = 500 }
@ -816,6 +824,11 @@ do
--
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
json = { 'prettierd', 'prettier', stop_after_first = true },
javascript = { 'prettierd', 'prettier', stop_after_first = true },
typescript = { 'prettierd', 'prettier', stop_after_first = true },
typescriptreact = { 'prettierd', 'prettier', stop_after_first = true },
svelte = { 'prettierd', 'prettier', stop_after_first = true },
},
}