update, add none-ls

This commit is contained in:
Volodymyr Patuta 2024-05-31 11:03:10 +02:00
parent 972165d32b
commit 05d00e70e7
14 changed files with 207 additions and 178 deletions

View File

@ -13,9 +13,10 @@ vim.api.nvim_create_autocmd('User', {
local Terminal = require('toggleterm.terminal').Terminal local Terminal = require('toggleterm.terminal').Terminal
local lazygit = Terminal:new({ local lazygit = Terminal:new({
count = 5,
cmd = "lazygit", cmd = "lazygit",
dir = "git_dir", dir = "git_dir",
direction = "tab", direction = "float",
float_opts = { float_opts = {
border = "none", border = "none",
}, },

View File

@ -37,7 +37,7 @@ return {
}, },
experimental = { experimental = {
ghost_text = { ghost_text = {
hl_group = { "Comment" }, hl_group = { 'Comment' },
}, },
}, },
mapping = cmp.mapping.preset.insert { mapping = cmp.mapping.preset.insert {
@ -71,7 +71,7 @@ return {
{ name = 'buffer' }, { name = 'buffer' },
}), }),
formatting = { formatting = {
format = require 'lspkind'.cmp_format({ format = require('lspkind').cmp_format {
mode = 'symbol_text', -- show only symbol annotations mode = 'symbol_text', -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
-- can also be a function to dynamically calculate max width such as -- can also be a function to dynamically calculate max width such as
@ -83,8 +83,8 @@ return {
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
before = function(entry, vim_item) before = function(entry, vim_item)
return vim_item return vim_item
end end,
}) },
}, },
} }

View File

@ -9,10 +9,10 @@ return {
end end
return { return {
{ '<leader>dc', dap 'continue', desc = 'continue' }, { '<leader>dc', dap 'continue', desc = 'continue' },
{ '<leader>ds', dap 'step_into', desc = 'step into' }, { '<leader>ds', dap 'step_into', desc = 'step into' },
{ '<leader>dn', dap 'step_over', desc = 'step over (next)' }, { '<leader>dn', dap 'step_over', desc = 'step over (next)' },
{ '<leader>df', dap 'step_out', desc = 'step out (finish)' }, { '<leader>df', dap 'step_out', desc = 'step out (finish)' },
{ '<leader>db', dap 'toggle_breakpoint', desc = 'toggle breakpoint' }, { '<leader>db', dap 'toggle_breakpoint', desc = 'toggle breakpoint' },
{ {
'<leader>do', '<leader>do',
@ -27,7 +27,7 @@ return {
desc = 'set conditional breakpoint', desc = 'set conditional breakpoint',
}, },
{ '<leader>dl', dap 'clear_breakpoints', desc = 'clear breakpoints' }, { '<leader>dl', dap 'clear_breakpoints', desc = 'clear breakpoints' },
{ '<leader>dq', dap 'terminate', desc = 'quit' }, { '<leader>dq', dap 'terminate', desc = 'quit' },
} }
end, end,
}, },

View File

@ -2,7 +2,7 @@ return {
{ {
'echasnovski/mini.diff', 'echasnovski/mini.diff',
version = false, version = false,
event = "VeryLazy", event = 'VeryLazy',
opts = { opts = {
-- Options for how hunks are visualized -- Options for how hunks are visualized
view = { view = {
@ -59,7 +59,7 @@ return {
-- Whether to wrap around edges during hunk navigation -- Whether to wrap around edges during hunk navigation
wrap_goto = false, wrap_goto = false,
}, },
} },
}, },
{ {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
@ -88,10 +88,10 @@ return {
defaults = { defaults = {
mappings = { mappings = {
i = { i = {
["<Esc>"] = require('telescope.actions').close ['<Esc>'] = require('telescope.actions').close,
} },
}, },
} },
} }
telescope.load_extension 'fzf' telescope.load_extension 'fzf'
end, end,

View File

@ -3,6 +3,7 @@ return {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
event = { 'BufReadPre', 'BufNewFile' }, event = { 'BufReadPre', 'BufNewFile' },
dependencies = { dependencies = {
{ 'nvimtools/none-ls.nvim' },
{ 'williamboman/mason.nvim' }, { 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' }, { 'williamboman/mason-lspconfig.nvim' },
{ 'hrsh7th/cmp-nvim-lsp' }, { 'hrsh7th/cmp-nvim-lsp' },
@ -10,8 +11,7 @@ return {
{ 'simrat39/rust-tools.nvim' }, { 'simrat39/rust-tools.nvim' },
{ {
'j-hui/fidget.nvim', 'j-hui/fidget.nvim',
opts = { opts = {},
},
}, },
}, },
config = function() config = function()

View File

@ -1,53 +1,53 @@
local M = {} local M = {}
function M.setup() function M.setup()
-- Signs -- Signs
local signs = { Error = "", Warn = "", Hint = "", Info = "" } local signs = { Error = '', Warn = '', Hint = '', Info = '' }
for type, icon in pairs(signs) do for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type local hl = 'DiagnosticSign' .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end end
-- Floating window borders -- Floating window borders
local border = { local border = {
{ "", "FloatBorder" }, { '', 'FloatBorder' },
{ "", "FloatBorder" }, { '', 'FloatBorder' },
{ "", "FloatBorder" }, { '', 'FloatBorder' },
{ "", "FloatBorder" }, { '', 'FloatBorder' },
{ "", "FloatBorder" }, { '', 'FloatBorder' },
{ "", "FloatBorder" }, { '', 'FloatBorder' },
{ "", "FloatBorder" }, { '', 'FloatBorder' },
{ "", "FloatBorder" }, { '', 'FloatBorder' },
} }
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {} opts = opts or {}
opts.border = opts.border or border opts.border = opts.border or border
return orig_util_open_floating_preview(contents, syntax, opts, ...) return orig_util_open_floating_preview(contents, syntax, opts, ...)
end end
end end
function M.on_attach(client, bufnr) function M.on_attach(client, bufnr)
-- Highlight references -- Highlight references
if client.server_capabilities.documentHighlightProvider then if client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_augroup("lsp_document_highlight", { vim.api.nvim_create_augroup('lsp_document_highlight', {
clear = false, clear = false,
}) })
vim.api.nvim_clear_autocmds({ vim.api.nvim_clear_autocmds {
group = "lsp_document_highlight", group = 'lsp_document_highlight',
buffer = bufnr, buffer = bufnr,
}) }
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
group = "lsp_document_highlight", group = 'lsp_document_highlight',
buffer = bufnr, buffer = bufnr,
callback = vim.lsp.buf.document_highlight, callback = vim.lsp.buf.document_highlight,
}) })
vim.api.nvim_create_autocmd("CursorMoved", { vim.api.nvim_create_autocmd('CursorMoved', {
group = "lsp_document_highlight", group = 'lsp_document_highlight',
buffer = bufnr, buffer = bufnr,
callback = vim.lsp.buf.clear_references, callback = vim.lsp.buf.clear_references,
}) })
end end
end end
return M return M

View File

@ -1,76 +1,86 @@
return { return {
{ 'jghauser/mkdir.nvim', lazy = false }, { 'jghauser/mkdir.nvim', lazy = false },
{ {
"willothy/nvim-cokeline", 'willothy/nvim-cokeline',
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", -- Required for v0.4.0+ 'nvim-lua/plenary.nvim', -- Required for v0.4.0+
"nvim-tree/nvim-web-devicons", -- If you want devicons 'nvim-tree/nvim-web-devicons', -- If you want devicons
{ {
"stevearc/resession.nvim", 'stevearc/resession.nvim',
config = function() config = function()
local resession = require("resession") local resession = require 'resession'
resession.setup() resession.setup()
-- Resession does NOTHING automagically, so we have to set up some keymaps -- Resession does NOTHING automagically, so we have to set up some keymaps
vim.keymap.set("n", "<leader>ss", resession.save) vim.keymap.set('n', '<leader>ss', resession.save)
vim.keymap.set("n", "<leader>sl", resession.load) vim.keymap.set('n', '<leader>sl', resession.load)
vim.keymap.set("n", "<leader>sd", resession.delete) vim.keymap.set('n', '<leader>sd', resession.delete)
end end,
} -- Optional, for persistent history }, -- Optional, for persistent history
}, },
event = "VeryLazy", event = 'VeryLazy',
keys = { keys = {
{ 'gp', "<Plug>(cokeline-focus-prev)", desc = 'next buffer' }, { 'gp', '<Plug>(cokeline-focus-prev)', desc = 'next buffer' },
{ 'gn', "<Plug>(cokeline-focus-next)", desc = 'next buffer' }, { 'gn', '<Plug>(cokeline-focus-next)', desc = 'next buffer' },
}, },
-- opts = {}, -- opts = {},
config = function() config = function()
local get_hex = require('cokeline.hlgroups').get_hl_attr local get_hex = require('cokeline.hlgroups').get_hl_attr
require('cokeline').setup({ require('cokeline').setup {
default_hl = { default_hl = {
fg = function(buffer) fg = function(buffer)
return return buffer.is_focused and get_hex('Normal', 'fg') or
buffer.is_focused get_hex('Comment', 'fg')
and get_hex('Normal', 'fg')
or get_hex('Comment', 'fg')
end, end,
bg = 'NONE', bg = 'NONE',
}, },
components = { components = {
{ {
text = function(buffer) return (buffer.index ~= 1) and '' or '' end, text = function(buffer)
fg = function() return get_hex('Normal', 'fg') end return (buffer.index ~= 1) and '' or ''
end,
fg = function()
return get_hex('Normal', 'fg')
end,
}, },
{ {
text = function(buffer) return ' ' .. buffer.devicon.icon end, text = function(buffer)
fg = function(buffer) return buffer.devicon.color end, return ' ' .. buffer.devicon.icon
end,
fg = function(buffer)
return buffer.devicon.color
end,
}, },
{ {
text = function(buffer) return buffer.filename .. ' ' end, text = function(buffer)
bold = function(buffer) return buffer.is_focused end return buffer.filename .. ' '
end,
bold = function(buffer)
return buffer.is_focused
end,
}, },
{ {
text = '󰖭', text = '󰖭',
on_click = function(_, _, _, _, buffer) on_click = function(_, _, _, _, buffer)
buffer:delete() buffer:delete()
end end,
}, },
{ {
text = ' ', text = ' ',
}, },
}, },
}) }
end end,
}, },
{ {
"willothy/flatten.nvim", 'willothy/flatten.nvim',
opts = function() opts = function()
---@type Terminal? ---@type Terminal?
local saved_terminal local saved_terminal
return { return {
window = { window = {
open = "alternate", open = 'alternate',
}, },
callbacks = { callbacks = {
should_block = function(argv) should_block = function(argv)
@ -81,13 +91,13 @@ return {
-- In this case, we would block if we find the `-b` flag -- In this case, we would block if we find the `-b` flag
-- This allows you to use `nvim -b file1` instead of -- This allows you to use `nvim -b file1` instead of
-- `nvim --cmd 'let g:flatten_wait=1' file1` -- `nvim --cmd 'let g:flatten_wait=1' file1`
return vim.tbl_contains(argv, "-b") return vim.tbl_contains(argv, '-b')
-- Alternatively, we can block if we find the diff-mode option -- Alternatively, we can block if we find the diff-mode option
-- return vim.tbl_contains(argv, "-d") -- return vim.tbl_contains(argv, "-d")
end, end,
pre_open = function() pre_open = function()
local term = require("toggleterm.terminal") local term = require 'toggleterm.terminal'
local termid = term.get_focused_id() local termid = term.get_focused_id()
saved_terminal = term.get(termid) saved_terminal = term.get(termid)
end, end,
@ -109,8 +119,8 @@ return {
-- If the file is a git commit, create one-shot autocmd to delete its buffer on write -- If the file is a git commit, create one-shot autocmd to delete its buffer on write
-- If you just want the toggleable terminal integration, ignore this bit -- If you just want the toggleable terminal integration, ignore this bit
if ft == "gitcommit" or ft == "gitrebase" then if ft == 'gitcommit' or ft == 'gitrebase' then
vim.api.nvim_create_autocmd("BufWritePost", { vim.api.nvim_create_autocmd('BufWritePost', {
buffer = bufnr, buffer = bufnr,
once = true, once = true,
callback = vim.schedule_wrap(function() callback = vim.schedule_wrap(function()

View File

@ -6,6 +6,8 @@ return {
{ '<leader>.', '<cmd>Oil<cr>', desc = 'oil' }, { '<leader>.', '<cmd>Oil<cr>', desc = 'oil' },
}, },
opts = { opts = {
delete_to_trash = true,
columns = { columns = {
'mtime', 'mtime',
'size', 'size',
@ -30,10 +32,10 @@ return {
keymaps = { keymaps = {
['g?'] = 'actions.show_help', ['g?'] = 'actions.show_help',
-- ['<CR>'] = 'actions.select', -- ['<CR>'] = 'actions.select',
["<CR>"] = function() ['<CR>'] = function()
require("oil").select(nil, function(err) require('oil').select(nil, function(err)
if not err then if not err then
local curdir = require("oil").get_current_dir() local curdir = require('oil').get_current_dir()
if curdir then if curdir then
vim.cmd.lcd(curdir) vim.cmd.lcd(curdir)
end end
@ -49,14 +51,18 @@ return {
['<C-l>'] = 'actions.refresh', ['<C-l>'] = 'actions.refresh',
['-'] = 'actions.parent', ['-'] = 'actions.parent',
-- ['l'] = 'actions.parent', -- ['l'] = 'actions.parent',
["l"] = function() ['l'] = function()
require("oil.actions").parent.callback() require('oil.actions').parent.callback()
vim.cmd.lcd(require("oil").get_current_dir()) vim.cmd.lcd(require('oil').get_current_dir())
end, end,
['_'] = 'actions.open_cwd', ['_'] = 'actions.open_cwd',
['`'] = 'actions.cd', ['`'] = 'actions.cd',
['~'] = 'actions.tcd', ['~'] = 'actions.tcd',
['g.'] = 'actions.toggle_hidden', ['g.'] = 'actions.toggle_hidden',
['gh'] = function()
require('oil').open '~/'
vim.cmd.lcd(require('oil').get_current_dir())
end,
}, },
}, },
} }

View File

@ -1,53 +1,55 @@
return { return {
"L3MON4D3/LuaSnip", 'L3MON4D3/LuaSnip',
keys = { dependencies = { 'rafamadriz/friendly-snippets' },
{ keys = {
"<C-k>", {
function() '<C-k>',
if require("luasnip").jumpable(1) then function()
require("luasnip").jump(1) if require('luasnip').jumpable(1) then
end require('luasnip').jump(1)
end, end
mode = { "i", "s" }, end,
}, mode = { 'i', 's' },
{ },
"<C-l>", {
function() '<C-l>',
if require("luasnip").jumpable(-1) then function()
require("luasnip").jump(-1) if require('luasnip').jumpable(-1) then
end require('luasnip').jump(-1)
end, end
mode = { "i", "s" }, end,
}, mode = { 'i', 's' },
{ },
"<C-;>", {
function() '<C-;>',
if require("luasnip").choice_active() then function()
require("luasnip").change_choice(1) if require('luasnip').choice_active() then
end require('luasnip').change_choice(1)
end, end
mode = { "i", "s" }, end,
}, mode = { 'i', 's' },
{ },
"<C-j>", {
function() '<C-j>',
if require("luasnip").choice_active() then function()
require("luasnip").change_choice(-1) if require('luasnip').choice_active() then
end require('luasnip').change_choice(-1)
end, end
mode = { "i", "s" }, end,
}, mode = { 'i', 's' },
}, },
opts = { },
history = true, opts = {
update_events = { "TextChanged", "TextChangedI" }, history = true,
}, update_events = { 'TextChanged', 'TextChangedI' },
config = function(_, opts) },
local ls = require("luasnip") config = function(_, opts)
ls.setup(opts) local ls = require 'luasnip'
-- for _, lang in pairs({ "c", "make", "markdown", "tiger", "sh", "nix" }) do ls.setup(opts)
-- ls.add_snippets(lang, require("plugins.snippets." .. lang)) require('luasnip.loaders.from_vscode').lazy_load()
-- end -- for _, lang in pairs({ "c", "make", "markdown", "tiger", "sh", "nix" }) do
-- ls.add_snippets("cpp", require("plugins.snippets.c")) -- ls.add_snippets(lang, require("plugins.snippets." .. lang))
end, -- end
-- ls.add_snippets("cpp", require("plugins.snippets.c"))
end,
} }

View File

@ -2,8 +2,18 @@ return {
'akinsho/toggleterm.nvim', 'akinsho/toggleterm.nvim',
cmd = 'ToggleTerm', cmd = 'ToggleTerm',
keys = { keys = {
{ "<home>", '<cmd>ToggleTerm direction=horizontal<cr>', mode = { 'n', 't', 'v', 'i' }, desc = "Toggle Terminal" }, {
{ "<end>", '<cmd>ToggleTerm direction=float<cr>', mode = { 'n', 't', 'v', 'i' }, desc = "Toggle Terminal floating" }, '<home>',
'<cmd>ToggleTerm direction=horizontal<cr>',
mode = { 'n', 't', 'v', 'i' },
desc = 'Toggle Terminal',
},
{
'<end>',
'<cmd>ToggleTerm direction=float<cr>',
mode = { 'n', 't', 'v', 'i' },
desc = 'Toggle Terminal floating',
},
}, },
opts = { opts = {
-- size can be a number or function which is passed the current terminal -- size can be a number or function which is passed the current terminal

View File

@ -6,7 +6,7 @@ return {
event = 'VeryLazy', event = 'VeryLazy',
keys = { keys = {
{ '<leader>v', desc = 'start incremental selection' }, { '<leader>v', desc = 'start incremental selection' },
{ '<leader>h', '<cmd>TSBufToggle highlight<cr>', desc = 'toggle TS highlight' }, { '<leader>h', '<cmd>TSBufToggle highlight<cr>', desc = 'toggle TS highlight' },
}, },
-- init = function(plugin) -- init = function(plugin)
-- require('lazy.core.loader').add_to_rtp(plugin) -- require('lazy.core.loader').add_to_rtp(plugin)

View File

@ -1,6 +1,6 @@
return { return {
{ {
'blazkowolf/gruber-darker.nvim', url = 'https://git.filnar.com/fiplox/gruber-darker.nvim',
lazy = false, lazy = false,
opts = { opts = {
-- invert = { -- invert = {
@ -117,36 +117,36 @@ return {
end, end,
}, },
{ {
"lukas-reineke/indent-blankline.nvim", 'lukas-reineke/indent-blankline.nvim',
event = { "BufReadPost", "BufNewFile" }, event = { 'BufReadPost', 'BufNewFile' },
main = "ibl", main = 'ibl',
config = function() config = function()
local highlight = { local highlight = {
"RainbowRed", 'RainbowRed',
"RainbowYellow", 'RainbowYellow',
"RainbowBlue", 'RainbowBlue',
"RainbowOrange", 'RainbowOrange',
"RainbowGreen", 'RainbowGreen',
"RainbowViolet", 'RainbowViolet',
"RainbowCyan", 'RainbowCyan',
} }
local hooks = require "ibl.hooks" local hooks = require 'ibl.hooks'
-- create the highlight groups in the highlight setup hook, so they are reset -- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes -- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function() hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" }) vim.api.nvim_set_hl(0, 'RainbowRed', { fg = '#E06C75' })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" }) vim.api.nvim_set_hl(0, 'RainbowYellow', { fg = '#E5C07B' })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" }) vim.api.nvim_set_hl(0, 'RainbowBlue', { fg = '#61AFEF' })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" }) vim.api.nvim_set_hl(0, 'RainbowOrange', { fg = '#D19A66' })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" }) vim.api.nvim_set_hl(0, 'RainbowGreen', { fg = '#98C379' })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" }) vim.api.nvim_set_hl(0, 'RainbowViolet', { fg = '#C678DD' })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" }) vim.api.nvim_set_hl(0, 'RainbowCyan', { fg = '#56B6C2' })
end) end)
vim.g.rainbow_delimiters = { highlight = highlight } vim.g.rainbow_delimiters = { highlight = highlight }
require("ibl").setup { scope = { highlight = highlight, show_start = false, show_end = false } } require('ibl').setup { scope = { highlight = highlight, show_start = false, show_end = false } }
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark) hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
end end,
}, },
} }

View File

@ -31,12 +31,12 @@ return {
padding = { 1, 1, 1, 1 }, -- extra window padding [top, right, bottom, left] padding = { 1, 1, 1, 1 }, -- extra window padding [top, right, bottom, left]
}, },
layout = { layout = {
height = { min = 4, max = 25 }, -- min and max height of the columns height = { min = 4, max = 25 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 3, -- spacing between columns spacing = 3, -- spacing between columns
}, },
hidden = { '<silent>', '<cmd>', '<Cmd>', '<CR>', 'call', 'lua', '^:', '^ ' }, -- hide mapping boilerplate hidden = { '<silent>', '<cmd>', '<Cmd>', '<CR>', 'call', 'lua', '^:', '^ ' }, -- hide mapping boilerplate
show_help = true, -- show help message on the command line when the popup is visible show_help = true, -- show help message on the command line when the popup is visible
} }
local opts = { local opts = {
mode = 'n', -- NORMAL mode mode = 'n', -- NORMAL mode