commit b456e0ed76d88067c8f99359a4ddc9bde9840f71
parent 555e85f7b13ff41291ba85c95256e8447d4eae66
Author: Tomas Nemec <owl@gtms.dev>
Date: Tue, 12 Mar 2024 21:21:38 +0100
update
Diffstat:
5 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/after/plugin/conform.lua b/after/plugin/conform.lua
@@ -0,0 +1,37 @@
+if not pcall(require, 'conform') then
+ return
+end
+
+local prettier = { { --[[ 'prettierd', ]] 'prettier' } }
+-- local util = require 'conform.util'
+require'conform'.setup {
+ formatters_by_ft = { html = prettier, css = prettier, scss = prettier },
+ formatters = {
+ prettier = {
+ prepend_args = {
+ '--plugin=/home/tms/.local/share/npm/lib/node_modules/prettier-plugin-organize-attributes/lib/index.js',
+ },
+ },
+ -- prettierd = {
+ -- args = {
+ -- '$FILENAME',
+ -- '--plugin=/home/tms/.local/share/npm/lib/node_modules/prettier-plugin-organize-attributes/lib/index.js',
+ -- },
+ -- range_args = function(_, ctx)
+ -- local start_offset, end_offset = util.get_offsets_from_range(ctx.buf, ctx.range)
+ -- return {
+ -- '$FILENAME',
+ -- '--range-start=' .. start_offset,
+ -- '--range-end=' .. end_offset,
+ -- '--plugin=/home/tms/.local/share/npm/lib/node_modules/prettier-plugin-organize-attributes/lib/index.js',
+ -- }
+ -- end,
+ -- },
+ },
+}
+
+vim.o.formatexpr = 'v:lua.require"conform".formatexpr()'
+
+vim.keymap.set('n', 'gQ', function()
+ require'conform'.format { lsp_fallback = true }
+end, { desc = 'Format' })
diff --git a/after/plugin/hardtime.lua b/after/plugin/hardtime.lua
@@ -2,4 +2,4 @@ if not pcall(require, 'hardtime') then
return
end
-require('hardtime').setup { disabled_filetypes = { 'qf', 'fugitiveblame', 'netrw', 'dirbuf', 'mason', 'query' } }
+require('hardtime').setup { disabled_filetypes = { 'qf', 'fugitiveblame', 'fugitive', 'netrw', 'dirbuf', 'mason', 'query' } }
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua
@@ -57,13 +57,13 @@ local function keymap(client, buf)
end
if client.supports_method('textDocument/formatting') then
- vim.keymap.set('n', 'gQ', function()
- vim.lsp.buf.format()
+ -- vim.keymap.set('n', 'gQ', function()
+ -- vim.lsp.buf.format()
- -- if vim.api.nvim_get_option_value('ft', { buf = buf }) == 'dart' then
- -- vim.cmd.NgHtmlFormat()
- -- end
- end, { buffer = buf, desc = 'LSP Format' })
+ -- -- if vim.api.nvim_get_option_value('ft', { buf = buf }) == 'dart' then
+ -- -- vim.cmd.NgHtmlFormat()
+ -- -- end
+ -- end, { buffer = buf, desc = 'LSP Format' })
end
end
diff --git a/lua/plugins.lua b/lua/plugins.lua
@@ -65,7 +65,8 @@ return require('paq') {
'b0o/schemastore.nvim',
-- can we get rid of this?
'folke/neodev.nvim',
- { 'jose-elias-alvarez/null-ls.nvim', requires = { 'nvim-lua/plenary.nvim' } },
+ -- { 'jose-elias-alvarez/null-ls.nvim', requires = { 'nvim-lua/plenary.nvim' } },
+ 'stevearc/conform.nvim',
'Exafunction/codeium.vim',
'mfussenegger/nvim-dap',
'leoluz/nvim-dap-go',
diff --git a/lua/tms/keymap.lua b/lua/tms/keymap.lua
@@ -1,4 +1,4 @@
-vim.keymap.set('n', 'Q', '<nop>', {}) -- forget visual
+-- vim.keymap.set('n', 'gQ', '<nop>', {}) -- forget visual
vim.keymap.set('n', '<esc>', '<cmd>nohl<cr>', { silent = true })
vim.keymap.set('n', 'gA', 'ga', {})
vim.keymap.set('n', 'Y', 'y$', {})