Compare commits

..

No commits in common. "58170c7ae38e5d8461c2e55ad07d95f0af161685" and "d132bd3e9f58ac2d6bdd226a657fc52a257744cc" have entirely different histories.

3 changed files with 110 additions and 107 deletions

View File

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

View File

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