feat: Sync complete config - Fish, Ghostty, Neovim Scratch
- Add missing Fish configs (direnv, ssh function) - Add Tokyo Night theme for Ghostty - Complete Neovim scratch config sync - Rewrite install.sh for new structure - Add comprehensive README.md
This commit is contained in:
77
.config/nvim/lua/plugins/formatting.lua
Normal file
77
.config/nvim/lua/plugins/formatting.lua
Normal file
@@ -0,0 +1,77 @@
|
||||
-- ============================================================================
|
||||
-- Formatting - conform.nvim
|
||||
-- ============================================================================
|
||||
|
||||
return {
|
||||
{
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
cmd = { 'ConformInfo' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>cf',
|
||||
function()
|
||||
require('conform').format({ async = true, lsp_fallback = true })
|
||||
end,
|
||||
mode = '',
|
||||
desc = 'Format buffer',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable with a global or buffer-local variable
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true,
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
-- TypeScript/JavaScript
|
||||
javascript = { 'prettier' },
|
||||
typescript = { 'prettier' },
|
||||
javascriptreact = { 'prettier' },
|
||||
typescriptreact = { 'prettier' },
|
||||
|
||||
-- Go
|
||||
go = { 'gofumpt', 'goimports' },
|
||||
|
||||
-- Web
|
||||
html = { 'prettier' },
|
||||
css = { 'prettier' },
|
||||
json = { 'prettier' },
|
||||
yaml = { 'prettier' },
|
||||
markdown = { 'prettier' },
|
||||
|
||||
-- Lua
|
||||
lua = { 'stylua' },
|
||||
|
||||
-- Shell
|
||||
sh = { 'shfmt' },
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
-- Autoformat toggle commands
|
||||
vim.api.nvim_create_user_command('FormatDisable', function(args)
|
||||
if args.bang then
|
||||
vim.b.disable_autoformat = true
|
||||
else
|
||||
vim.g.disable_autoformat = true
|
||||
end
|
||||
end, {
|
||||
desc = 'Disable autoformat-on-save',
|
||||
bang = true,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_user_command('FormatEnable', function()
|
||||
vim.b.disable_autoformat = false
|
||||
vim.g.disable_autoformat = false
|
||||
end, {
|
||||
desc = 'Re-enable autoformat-on-save',
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user