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 lazygit = Terminal:new({
count = 5,
cmd = "lazygit",
dir = "git_dir",
direction = "tab",
direction = "float",
float_opts = {
border = "none",
},

View File

@ -37,7 +37,7 @@ return {
},
experimental = {
ghost_text = {
hl_group = { "Comment" },
hl_group = { 'Comment' },
},
},
mapping = cmp.mapping.preset.insert {
@ -71,7 +71,7 @@ return {
{ name = 'buffer' },
}),
formatting = {
format = require 'lspkind'.cmp_format({
format = require('lspkind').cmp_format {
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)
-- 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))
before = function(entry, vim_item)
return vim_item
end
})
end,
},
},
}

View File

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

View File

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

View File

@ -2,22 +2,22 @@ local M = {}
function M.setup()
-- Signs
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
local signs = { Error = '', Warn = '', Hint = '', Info = '' }
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 })
end
-- Floating window borders
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
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
@ -30,20 +30,20 @@ end
function M.on_attach(client, bufnr)
-- Highlight references
if client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_augroup("lsp_document_highlight", {
vim.api.nvim_create_augroup('lsp_document_highlight', {
clear = false,
})
vim.api.nvim_clear_autocmds({
group = "lsp_document_highlight",
vim.api.nvim_clear_autocmds {
group = 'lsp_document_highlight',
buffer = bufnr,
})
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
group = "lsp_document_highlight",
}
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
group = 'lsp_document_highlight',
buffer = bufnr,
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd("CursorMoved", {
group = "lsp_document_highlight",
vim.api.nvim_create_autocmd('CursorMoved', {
group = 'lsp_document_highlight',
buffer = bufnr,
callback = vim.lsp.buf.clear_references,
})

View File

@ -1,76 +1,86 @@
return {
{ 'jghauser/mkdir.nvim', lazy = false },
{
"willothy/nvim-cokeline",
'willothy/nvim-cokeline',
dependencies = {
"nvim-lua/plenary.nvim", -- Required for v0.4.0+
"nvim-tree/nvim-web-devicons", -- If you want devicons
'nvim-lua/plenary.nvim', -- Required for v0.4.0+
'nvim-tree/nvim-web-devicons', -- If you want devicons
{
"stevearc/resession.nvim",
'stevearc/resession.nvim',
config = function()
local resession = require("resession")
local resession = require 'resession'
resession.setup()
-- 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>sl", resession.load)
vim.keymap.set("n", "<leader>sd", resession.delete)
end
} -- Optional, for persistent history
vim.keymap.set('n', '<leader>ss', resession.save)
vim.keymap.set('n', '<leader>sl', resession.load)
vim.keymap.set('n', '<leader>sd', resession.delete)
end,
}, -- Optional, for persistent history
},
event = "VeryLazy",
event = 'VeryLazy',
keys = {
{ 'gp', "<Plug>(cokeline-focus-prev)", desc = 'next buffer' },
{ 'gn', "<Plug>(cokeline-focus-next)", desc = 'next buffer' },
{ 'gp', '<Plug>(cokeline-focus-prev)', desc = 'next buffer' },
{ 'gn', '<Plug>(cokeline-focus-next)', desc = 'next buffer' },
},
-- opts = {},
config = function()
local get_hex = require('cokeline.hlgroups').get_hl_attr
require('cokeline').setup({
require('cokeline').setup {
default_hl = {
fg = function(buffer)
return
buffer.is_focused
and get_hex('Normal', 'fg')
or get_hex('Comment', 'fg')
return buffer.is_focused and get_hex('Normal', 'fg') or
get_hex('Comment', 'fg')
end,
bg = 'NONE',
},
components = {
{
text = function(buffer) return (buffer.index ~= 1) and '' or '' end,
fg = function() return get_hex('Normal', 'fg') end
text = function(buffer)
return (buffer.index ~= 1) and '' or ''
end,
fg = function()
return get_hex('Normal', 'fg')
end,
},
{
text = function(buffer) return ' ' .. buffer.devicon.icon end,
fg = function(buffer) return buffer.devicon.color end,
text = function(buffer)
return ' ' .. buffer.devicon.icon
end,
fg = function(buffer)
return buffer.devicon.color
end,
},
{
text = function(buffer) return buffer.filename .. ' ' end,
bold = function(buffer) return buffer.is_focused end
text = function(buffer)
return buffer.filename .. ' '
end,
bold = function(buffer)
return buffer.is_focused
end,
},
{
text = '󰖭',
on_click = function(_, _, _, _, buffer)
buffer:delete()
end
end,
},
{
text = ' ',
},
},
})
end
}
end,
},
{
"willothy/flatten.nvim",
'willothy/flatten.nvim',
opts = function()
---@type Terminal?
local saved_terminal
return {
window = {
open = "alternate",
open = 'alternate',
},
callbacks = {
should_block = function(argv)
@ -81,13 +91,13 @@ return {
-- In this case, we would block if we find the `-b` flag
-- This allows you to use `nvim -b file1` instead of
-- `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
-- return vim.tbl_contains(argv, "-d")
end,
pre_open = function()
local term = require("toggleterm.terminal")
local term = require 'toggleterm.terminal'
local termid = term.get_focused_id()
saved_terminal = term.get(termid)
end,
@ -109,8 +119,8 @@ return {
-- 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 ft == "gitcommit" or ft == "gitrebase" then
vim.api.nvim_create_autocmd("BufWritePost", {
if ft == 'gitcommit' or ft == 'gitrebase' then
vim.api.nvim_create_autocmd('BufWritePost', {
buffer = bufnr,
once = true,
callback = vim.schedule_wrap(function()

View File

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

View File

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

View File

@ -2,8 +2,18 @@ return {
'akinsho/toggleterm.nvim',
cmd = 'ToggleTerm',
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 = {
-- size can be a number or function which is passed the current terminal

View File

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