Fix formating of plugins

This commit is contained in:
Ori Perry 2026-03-10 19:00:43 +02:00
parent d132bd3e9f
commit 431cf2e881
3 changed files with 109 additions and 111 deletions

View File

@ -5,56 +5,54 @@
---@module 'lazy' ---@module 'lazy'
---@type LazySpec ---@type LazySpec
return { return {
{ 'lewis6991/gitsigns.nvim',
'lewis6991/gitsigns.nvim', ---@module 'gitsigns'
---@module 'gitsigns' ---@type Gitsigns.Config
---@type Gitsigns.Config ---@diagnostic disable-next-line: missing-fields
---@diagnostic disable-next-line: missing-fields opts = {
opts = { on_attach = function(bufnr)
on_attach = function(bufnr) local gitsigns = require 'gitsigns'
local gitsigns = require 'gitsigns'
local function map(mode, l, r, opts) local function map(mode, l, r, opts)
opts = opts or {} opts = opts or {}
opts.buffer = bufnr opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts) vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then
vim.cmd.normal { ']c', bang = true }
else
gitsigns.nav_hunk 'next'
end end
end, { desc = 'Jump to next git [c]hange' })
-- Navigation map('n', '[c', function()
map('n', ']c', function() if vim.wo.diff then
if vim.wo.diff then vim.cmd.normal { '[c', bang = true }
vim.cmd.normal { ']c', bang = true } else
else gitsigns.nav_hunk 'prev'
gitsigns.nav_hunk 'next' end
end end, { desc = 'Jump to previous git [c]hange' })
end, { desc = 'Jump to next git [c]hange' })
map('n', '[c', function() -- Actions
if vim.wo.diff then -- visual mode
vim.cmd.normal { '[c', bang = true } map('v', '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' })
else map('v', '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' })
gitsigns.nav_hunk 'prev' -- normal mode
end map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
end, { desc = 'Jump to previous git [c]hange' }) map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
-- Actions map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
-- visual mode map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
map('v', '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' }) map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('v', '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' }) map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
-- normal mode map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) map('n', '<leader>hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) -- Toggles
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) end,
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
-- Toggles
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
end,
},
}, },
} }

View File

@ -1,13 +1,13 @@
-- Add indentation guides even on blank lines
---@module 'lazy' ---@module 'lazy'
---@type LazySpec ---@type LazySpec
return { return {
{ -- Add indentation guides even on blank lines 'lukas-reineke/indent-blankline.nvim',
'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim`
-- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help ibl`
-- See `:help ibl` main = 'ibl',
main = 'ibl', ---@module 'ibl'
---@module 'ibl' ---@type ibl.config
---@type ibl.config opts = {},
opts = {},
},
} }

View File

@ -1,60 +1,60 @@
-- Linting
---@module 'lazy' ---@module 'lazy'
---@type LazySpec ---@type LazySpec
return { return
{
'mfussenegger/nvim-lint',
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
markdown = { 'markdownlint' },
}
{ -- Linting -- To allow other plugins to add linters to require('lint').linters_by_ft,
'mfussenegger/nvim-lint', -- instead set linters_by_ft like this:
event = { 'BufReadPre', 'BufNewFile' }, -- lint.linters_by_ft = lint.linters_by_ft or {}
config = function() -- lint.linters_by_ft['markdown'] = { 'markdownlint' }
local lint = require 'lint' --
lint.linters_by_ft = { -- However, note that this will enable a set of default linters,
markdown = { 'markdownlint' }, -- which will cause errors unless these tools are available:
} -- {
-- clojure = { "clj-kondo" },
-- dockerfile = { "hadolint" },
-- inko = { "inko" },
-- janet = { "janet" },
-- json = { "jsonlint" },
-- markdown = { "vale" },
-- rst = { "vale" },
-- ruby = { "ruby" },
-- terraform = { "tflint" },
-- text = { "vale" }
-- }
--
-- You can disable the default linters by setting their filetypes to nil:
-- lint.linters_by_ft['clojure'] = nil
-- lint.linters_by_ft['dockerfile'] = nil
-- lint.linters_by_ft['inko'] = nil
-- lint.linters_by_ft['janet'] = nil
-- lint.linters_by_ft['json'] = nil
-- lint.linters_by_ft['markdown'] = nil
-- lint.linters_by_ft['rst'] = nil
-- lint.linters_by_ft['ruby'] = nil
-- lint.linters_by_ft['terraform'] = nil
-- lint.linters_by_ft['text'] = nil
-- To allow other plugins to add linters to require('lint').linters_by_ft, -- Create autocommand which carries out the actual linting
-- instead set linters_by_ft like this: -- on the specified events.
-- lint.linters_by_ft = lint.linters_by_ft or {} local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
-- lint.linters_by_ft['markdown'] = { 'markdownlint' } vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
-- group = lint_augroup,
-- However, note that this will enable a set of default linters, callback = function()
-- which will cause errors unless these tools are available: -- Only run the linter in buffers that you can modify in order to
-- { -- avoid superfluous noise, notably within the handy LSP pop-ups that
-- clojure = { "clj-kondo" }, -- describe the hovered symbol using Markdown.
-- dockerfile = { "hadolint" }, if vim.bo.modifiable then lint.try_lint() end
-- inko = { "inko" }, end,
-- janet = { "janet" }, })
-- json = { "jsonlint" }, end,
-- markdown = { "vale" },
-- rst = { "vale" },
-- ruby = { "ruby" },
-- terraform = { "tflint" },
-- text = { "vale" }
-- }
--
-- You can disable the default linters by setting their filetypes to nil:
-- lint.linters_by_ft['clojure'] = nil
-- lint.linters_by_ft['dockerfile'] = nil
-- lint.linters_by_ft['inko'] = nil
-- lint.linters_by_ft['janet'] = nil
-- lint.linters_by_ft['json'] = nil
-- lint.linters_by_ft['markdown'] = nil
-- lint.linters_by_ft['rst'] = nil
-- lint.linters_by_ft['ruby'] = nil
-- lint.linters_by_ft['terraform'] = nil
-- lint.linters_by_ft['text'] = nil
-- Create autocommand which carries out the actual linting
-- on the specified events.
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
group = lint_augroup,
callback = function()
-- Only run the linter in buffers that you can modify in order to
-- avoid superfluous noise, notably within the handy LSP pop-ups that
-- describe the hovered symbol using Markdown.
if vim.bo.modifiable then lint.try_lint() end
end,
})
end,
},
} }