format default plugins

This commit is contained in:
Buliway 2024-12-14 09:46:55 +03:00
parent 18cc18b5a1
commit 4e1fee8a43
7 changed files with 306 additions and 298 deletions

View file

@ -6,47 +6,47 @@
--]] --]]
local check_version = function() local check_version = function()
local verstr = tostring(vim.version()) local verstr = tostring(vim.version())
if not vim.version.ge then if not vim.version.ge then
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
return return
end end
if vim.version.ge(vim.version(), '0.10-dev') then if vim.version.ge(vim.version(), '0.10-dev') then
vim.health.ok(string.format("Neovim version is: '%s'", verstr)) vim.health.ok(string.format("Neovim version is: '%s'", verstr))
else else
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
end end
end end
local check_external_reqs = function() local check_external_reqs = function()
-- Basic utils: `git`, `make`, `unzip` -- Basic utils: `git`, `make`, `unzip`
for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
local is_executable = vim.fn.executable(exe) == 1 local is_executable = vim.fn.executable(exe) == 1
if is_executable then if is_executable then
vim.health.ok(string.format("Found executable: '%s'", exe)) vim.health.ok(string.format("Found executable: '%s'", exe))
else else
vim.health.warn(string.format("Could not find executable: '%s'", exe)) vim.health.warn(string.format("Could not find executable: '%s'", exe))
end
end end
end
return true return true
end end
return { return {
check = function() check = function()
vim.health.start 'kickstart.nvim' vim.health.start 'kickstart.nvim'
vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth` vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
Fix only warnings for plugins and languages you intend to use. Fix only warnings for plugins and languages you intend to use.
Mason will give warnings for languages that are not installed. Mason will give warnings for languages that are not installed.
You do not need to install, unless you want to use those languages!]] You do not need to install, unless you want to use those languages!]]
local uv = vim.uv or vim.loop local uv = vim.uv or vim.loop
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname())) vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
check_version() check_version()
check_external_reqs() check_external_reqs()
end, end,
} }

View file

@ -2,15 +2,15 @@
-- https://github.com/windwp/nvim-autopairs -- https://github.com/windwp/nvim-autopairs
return { return {
'windwp/nvim-autopairs', 'windwp/nvim-autopairs',
event = 'InsertEnter', event = 'InsertEnter',
-- Optional dependency -- Optional dependency
dependencies = { 'hrsh7th/nvim-cmp' }, dependencies = { 'hrsh7th/nvim-cmp' },
config = function() config = function()
require('nvim-autopairs').setup {} require('nvim-autopairs').setup {}
-- If you want to automatically add `(` after selecting a function or method -- If you want to automatically add `(` after selecting a function or method
local cmp_autopairs = require 'nvim-autopairs.completion.cmp' local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp = require 'cmp' local cmp = require 'cmp'
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end, end,
} }

View file

@ -7,142 +7,142 @@
-- kickstart.nvim and not kitchen-sink.nvim ;) -- kickstart.nvim and not kitchen-sink.nvim ;)
return { return {
-- NOTE: Yes, you can install new plugins here! -- NOTE: Yes, you can install new plugins here!
'mfussenegger/nvim-dap', 'mfussenegger/nvim-dap',
-- NOTE: And you can specify dependencies as well -- NOTE: And you can specify dependencies as well
dependencies = { dependencies = {
-- Creates a beautiful debugger UI -- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui', 'rcarriga/nvim-dap-ui',
-- Required dependency for nvim-dap-ui -- Required dependency for nvim-dap-ui
'nvim-neotest/nvim-nio', 'nvim-neotest/nvim-nio',
-- Installs the debug adapters for you -- Installs the debug adapters for you
'williamboman/mason.nvim', 'williamboman/mason.nvim',
'jay-babu/mason-nvim-dap.nvim', 'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here -- Add your own debuggers here
'leoluz/nvim-dap-go', 'leoluz/nvim-dap-go',
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
{
'<F5>',
function()
require('dap').continue()
end,
desc = 'Debug: Start/Continue',
}, },
{ keys = {
'<F1>', -- Basic debugging keymaps, feel free to change to your liking!
function() {
require('dap').step_into() '<F5>',
end, function()
desc = 'Debug: Step Into', require('dap').continue()
}, end,
{ desc = 'Debug: Start/Continue',
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations
automatic_installation = true,
-- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information
handlers = {},
-- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :)
ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want
'delve',
},
}
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
}, },
}, {
} '<F1>',
function()
require('dap').step_into()
end,
desc = 'Debug: Step Into',
},
{
'<F2>',
function()
require('dap').step_over()
end,
desc = 'Debug: Step Over',
},
{
'<F3>',
function()
require('dap').step_out()
end,
desc = 'Debug: Step Out',
},
{
'<leader>b',
function()
require('dap').toggle_breakpoint()
end,
desc = 'Debug: Toggle Breakpoint',
},
{
'<leader>B',
function()
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end,
desc = 'Debug: Set Breakpoint',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
function()
require('dapui').toggle()
end,
desc = 'Debug: See last session result.',
},
},
config = function()
local dap = require 'dap'
local dapui = require 'dapui'
-- Change breakpoint icons require('mason-nvim-dap').setup {
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) -- Makes a best effort to setup the various debuggers with
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) -- reasonable debug configurations
-- local breakpoint_icons = vim.g.have_nerd_font automatic_installation = true,
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end
dap.listeners.after.event_initialized['dapui_config'] = dapui.open -- You can provide additional configuration to the handlers,
dap.listeners.before.event_terminated['dapui_config'] = dapui.close -- see mason-nvim-dap README for more information
dap.listeners.before.event_exited['dapui_config'] = dapui.close handlers = {},
-- Install golang specific config -- You'll need to check that you have the required things installed
require('dap-go').setup { -- online, please don't ask me how to install them :)
delve = { ensure_installed = {
-- On Windows delve must be run attached or it crashes. -- Update this to ensure that you have the debuggers for the langs you want
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring 'delve',
detached = vim.fn.has 'win32' == 0, },
}, }
}
end, -- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
},
},
}
-- Change breakpoint icons
-- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' })
-- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' })
-- local breakpoint_icons = vim.g.have_nerd_font
-- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' }
-- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' }
-- for type, icon in pairs(breakpoint_icons) do
-- local tp = 'Dap' .. type
-- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak'
-- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl })
-- end
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Install golang specific config
require('dap-go').setup {
delve = {
-- On Windows delve must be run attached or it crashes.
-- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring
detached = vim.fn.has 'win32' == 0,
},
}
end,
} }

View file

@ -3,59 +3,66 @@
-- config. This will add also the recommended keymaps. -- config. This will add also the recommended keymaps.
return { return {
{ {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
opts = { opts = {
on_attach = function(bufnr) signs = {
local gitsigns = require 'gitsigns' add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
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 end
-- Navigation -- 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 'next' gitsigns.nav_hunk 'next'
end end
end, { desc = 'Jump to next git [c]hange' }) end, { desc = 'Jump to next git [c]hange' })
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 'prev'
end end
end, { desc = 'Jump to previous git [c]hange' }) end, { desc = 'Jump to previous git [c]hange' })
-- Actions -- Actions
-- visual mode -- visual mode
map('v', '<leader>hs', function() map('v', '<leader>hs', function()
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'stage git hunk' }) end, { desc = 'stage git hunk' })
map('v', '<leader>hr', function() map('v', '<leader>hr', function()
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
end, { desc = 'reset git hunk' }) end, { desc = 'reset git hunk' })
-- normal mode -- normal mode
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) 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>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) 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', gitsigns.diffthis, { desc = 'git [d]iff against index' })
map('n', '<leader>hD', function() map('n', '<leader>hD', function()
gitsigns.diffthis '@' gitsigns.diffthis '@'
end, { desc = 'git [D]iff against last commit' }) end, { desc = 'git [D]iff against last commit' })
-- Toggles -- Toggles
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
end, end,
},
}, },
},
} }

View file

@ -1,9 +1,9 @@
return { return {
{ -- Add indentation guides even on blank lines { -- 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',
opts = {}, opts = {},
}, },
} }

View file

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

View file

@ -2,24 +2,25 @@
-- https://github.com/nvim-neo-tree/neo-tree.nvim -- https://github.com/nvim-neo-tree/neo-tree.nvim
return { return {
'nvim-neo-tree/neo-tree.nvim', 'nvim-neo-tree/neo-tree.nvim',
version = '*', version = '*',
dependencies = { dependencies = {
'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim', 'MunifTanjim/nui.nvim',
}, '3rd/image.nvim', -- Optional image support in preview window: See `# Preview Mode` for more information
cmd = 'Neotree', },
keys = { cmd = 'Neotree',
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true }, keys = {
}, { '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
opts = { },
filesystem = { opts = {
window = { filesystem = {
mappings = { window = {
['\\'] = 'close_window', mappings = {
}, ['\\'] = 'close_window',
}, },
},
},
}, },
},
} }