Skip to content

Commit 1ee1f2d

Browse files
committed
updated formatting
1 parent 8295147 commit 1ee1f2d

4 files changed

Lines changed: 54 additions & 53 deletions

File tree

init.lua

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,24 @@ vim.api.nvim_create_autocmd('TextYankPost', {
133133
end,
134134
})
135135

136+
local formatting = require 'custom.formatting'
137+
138+
vim.api.nvim_create_autocmd('FileType', {
139+
desc = 'Apply per-filetype indentation settings',
140+
group = vim.api.nvim_create_augroup('kickstart-indent-rules', { clear = true }),
141+
callback = function()
142+
local width = formatting.indent_by_ft[vim.bo.filetype]
143+
if not width then
144+
return
145+
end
146+
147+
vim.opt_local.expandtab = true
148+
vim.opt_local.tabstop = width
149+
vim.opt_local.softtabstop = width
150+
vim.opt_local.shiftwidth = width
151+
end,
152+
})
153+
136154
-- [[ Install `lazy.nvim` plugin manager ]]
137155
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
138156
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
@@ -405,6 +423,7 @@ require('lazy').setup({
405423

406424
-- Allows extra capabilities provided by blink.cmp
407425
'saghen/blink.cmp',
426+
{ 'AstroNvim/astrolsp', opts = {} },
408427
},
409428
config = function()
410429
-- Brief aside: **What is LSP?**
@@ -648,12 +667,18 @@ require('lazy').setup({
648667
local ensure_installed = vim.tbl_keys(servers or {})
649668
vim.list_extend(ensure_installed, {
650669
'stylua', -- Used to format Lua code
670+
'prettierd', -- Used to format JavaScript and TypeScript
671+
'prettier', -- Fallback formatter when prettierd is unavailable
672+
'astro',
673+
'html',
674+
'cssls',
675+
'tailwindcss',
651676
})
652677
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
653678

654679
require('mason-lspconfig').setup {
655680
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
656-
automatic_installation = false,
681+
automatic_installation = true,
657682
handlers = {
658683
function(server_name)
659684
local server = servers[server_name] or {}
@@ -698,21 +723,7 @@ require('lazy').setup({
698723
}
699724
end
700725
end,
701-
formatters_by_ft = {
702-
lua = { 'stylua' },
703-
-- Conform can also run multiple formatters sequentially
704-
python = {
705-
-- To fix auto-fixable lint errors.
706-
'ruff_fix',
707-
-- To run the Ruff formatter.
708-
'ruff_format',
709-
-- To organize the imports.
710-
'ruff_organize_imports',
711-
},
712-
--
713-
-- You can use 'stop_after_first' to run the first available formatter from the list
714-
-- javascript = { "prettierd", "prettier", stop_after_first = true },
715-
},
726+
formatters_by_ft = formatting.formatters_by_ft,
716727
},
717728
},
718729

@@ -883,7 +894,7 @@ require('lazy').setup({
883894
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
884895
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
885896
opts = {
886-
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
897+
ensure_installed = { 'astro', 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
887898
-- Autoinstall languages that are not installed
888899
auto_install = true,
889900
highlight = {

lua/custom/formatting.lua

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
local M = {}
2+
3+
M.indent_by_ft = {
4+
javascript = 2,
5+
javascriptreact = 2,
6+
typescript = 2,
7+
typescriptreact = 2,
8+
json = 2,
9+
html = 2,
10+
css = 2,
11+
scss = 2,
12+
}
13+
14+
M.formatters_by_ft = {
15+
html = { 'prettier' },
16+
lua = { 'stylua' },
17+
python = {
18+
'ruff_fix',
19+
'ruff_format',
20+
'ruff_organize_imports',
21+
},
22+
javascript = { 'prettierd', 'prettier', stop_after_first = true },
23+
typescript = { 'prettierd', 'prettier', stop_after_first = true },
24+
}
25+
26+
return M

lua/custom/plugins/lsp_overrides.lua

Lines changed: 0 additions & 26 deletions
This file was deleted.

lua/custom/plugins/refactoring.lua

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)