update nvim

This commit is contained in:
msevgi 2025-08-11 15:51:30 +03:00
parent 3338d39206
commit 786b0e0970
31 changed files with 2204 additions and 15 deletions

View file

@ -0,0 +1,112 @@
return {
{
-- Autocompletion
'hrsh7th/nvim-cmp',
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
-- Adds LSP completion capabilities
'hrsh7th/cmp-nvim-lsp',
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
'petertriho/cmp-git',
},
config = function()
-- [[ Configure nvim-cmp ]]
-- See `:help cmp`
local cmp = require 'cmp'
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
cmp.setup {
view = {
entries = { name = 'custom', selection_order = 'near_cursor' },
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm({ select = true }),
-- ['<CR>'] = cmp.mapping(function(fallback)
-- if cmp.visible() and cmp.get_active_entry() then
-- cmp.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true }
-- else
-- fallback()
-- end
-- end, { 'i', 's' }),
-- ['<Tab>'] = cmp.mapping(function(fallback)
-- if cmp.visible() and has_words_before() then
-- cmp.select_next_item()
-- elseif luasnip.expand_or_locally_jumpable() then
-- luasnip.expand_or_jump()
-- else
-- fallback()
-- end
-- end, { 'i', 's' }),
-- ['<S-Tab>'] = cmp.mapping(function(fallback)
-- if cmp.visible() then
-- cmp.select_prev_item()
-- elseif luasnip.locally_jumpable(-1) then
-- luasnip.jump(-1)
-- else
-- fallback()
-- end
-- end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp', priority = 100 },
-- { name = 'luasnip' },
{ name = 'buffer', keyword_length = 3 },
{ name = 'path' },
},
}
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
}, {
{ name = 'buffer' },
}),
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' },
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' },
}, {
{ name = 'cmdline' },
}),
})
end,
},
}

View file

@ -0,0 +1,6 @@
return {
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup {}
end,
}

View file

@ -0,0 +1,65 @@
return {
{
'zbirenbaum/copilot.lua',
cmd = 'Copilot',
event = "InsertEnter",
build = ':Copilot auth',
config = function()
require('copilot').setup {
-- panel = {
-- enabled = false, -- using nvim-cmp to do this
-- -- enabled = true,
-- -- keymap = { open = '<C-t>' },
-- -- layout = { position = "right", ratio = 0.2 }
-- },
suggestion = { enabled = true, auto_trigger = true, keymap = { accept = '<Tab>' } },
-- filetypes = { markdown = true, gitcommit = true, help = true },
}
end,
},
{
'CopilotC-Nvim/CopilotChat.nvim',
branch = 'canary',
dependencies = {
{ 'zbirenbaum/copilot.lua' }, -- or github/copilot.vim
{ 'nvim-lua/plenary.nvim' }, -- for curl, log wrapper
},
opts = {},
keys = {
-- lazy.nvim keys
-- Quick chat with Copilot
{
'<leader>ccq',
function()
local input = vim.fn.input 'Quick Chat: '
if input ~= '' then
require('CopilotChat').ask(input, { selection = require('CopilotChat.select').buffer })
end
end,
desc = 'CopilotChat - Quick chat',
},
-- lazy.nvim keys
-- Show help actions with telescope
{
'<leader>cch',
function()
local actions = require 'CopilotChat.actions'
require('CopilotChat.integrations.telescope').pick(actions.help_actions())
end,
desc = 'CopilotChat - Help actions',
},
-- Show prompts actions with telescope
{
'<leader>ccp',
function()
local actions = require 'CopilotChat.actions'
require('CopilotChat.integrations.telescope').pick(actions.prompt_actions())
end,
desc = 'CopilotChat - Prompt actions',
},
},
},
}

View file

@ -0,0 +1,9 @@
return {
"phaazon/hop.nvim",
config = function()
require("hop").setup {
keys = "arstgmneiodh",
}
vim.keymap.set("n", "<C-e>", "<cmd>lua require'hop'.hint_words()<cr>", { noremap = true, silent = true })
end
}

View file

@ -0,0 +1,12 @@
return {
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end
}
}

View file

@ -0,0 +1,38 @@
local keymap = require 'phoenix.utils.keymap'
return {
'nvimdev/lspsaga.nvim',
dependencies = {
'nvim-treesitter/nvim-treesitter',
'nvim-tree/nvim-web-devicons',
},
config = function()
require('lspsaga').setup {
symbol_in_winbar = {
enable = false,
separator = ' ',
hide_keyword = false,
show_file = true,
folder_level = 2,
color_mode = true,
delay = 300,
},
lightbulb = {
enable = false,
sign = true,
debounce = 10,
sign_priority = 40,
virtual_text = false,
enable_in_insert = true,
},
ui = {
code_action = "·",
devicon = false
}
}
keymap('n', '<leader>lo', ':Lspsaga outline<cr>')
keymap('n', '<leader>lf', ':Lspsaga finder<cr>')
end,
}

View file

@ -0,0 +1,138 @@
local colors = require('phoenix.bleed-purple.colors').dark
local fish_like_path = require 'phoenix.utils.fish_like_path'
local dark_theme = {
normal = {
a = { bg = colors.bmagenta, fg = colors.bblack, gui = 'bold' },
b = { bg = colors.bblack, fg = colors.black },
c = { bg = colors.status_bg, fg = colors.white },
},
insert = { a = { bg = colors.green, fg = colors.black, gui = 'bold' } },
visual = { a = { bg = colors.yellow, fg = colors.black, gui = 'bold' } },
replace = { a = { bg = colors.red, fg = colors.black, gui = 'bold' } },
command = { a = { bg = colors.bblue, fg = colors.black, gui = 'bold' } },
inactive = {
a = { bg = colors.status_bg, fg = colors.dimmed_text },
b = { bg = colors.status_bg, fg = colors.dimmed_text },
c = { bg = colors.status_bg, fg = colors.dimmed_text },
},
}
local light_theme = {
normal = {
a = { bg = colors.bmagenta, fg = colors.bblack, gui = 'bold' },
b = { bg = colors.bgreen, fg = colors.black },
c = { bg = colors.white, fg = colors.black },
},
insert = { a = { bg = colors.green, fg = colors.black, gui = 'bold' } },
visual = { a = { bg = colors.yellow, fg = colors.black, gui = 'bold' } },
replace = { a = { bg = colors.red, fg = colors.black, gui = 'bold' } },
command = { a = { bg = colors.bblue, fg = colors.black, gui = 'bold' } },
inactive = {
a = { bg = colors.white, fg = colors.dimmed_text },
b = { bg = colors.white, fg = colors.dimmed_text },
c = { bg = colors.white, fg = colors.dimmed_text },
},
}
local file_status = function(is_modified)
if is_modified then
return '·'
else
return ''
end
end
local fishpath = function(level)
return function()
local path = fish_like_path(vim.fn.expand '%:p', level)
local status = file_status(vim.bo.modified)
if #status == 0 then
return path
end
return path .. ' ' .. status
end
end
local get_theme = function(bg)
if bg == 'light' then
return light_theme
end
return dark_theme
end
vim.cmd [[
autocmd ColorScheme * lua require'phoenix.plugins.lualine'.config()
autocmd OptionSet background lua require'phoenix.plugins.lualine'.config()
]]
return {
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
config = function()
require('lualine').setup {
options = {
icons_enabled = false,
globalstatus = true,
-- theme = 'onedark',
component_separators = '|',
section_separators = '',
-- theme = get_theme(vim.o.background),
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'diff' },
lualine_c = { fishpath(4) },
lualine_x = { 'filetype' },
lualine_y = {},
lualine_z = { 'location' },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { fishpath(2) },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {},
},
winbar = {
lualine_a = {},
lualine_b = {},
lualine_c = { fishpath(3) },
lualine_x = {},
lualine_y = {},
lualine_z = {},
},
inactive_winbar = {
lualine_a = {},
lualine_b = {},
lualine_c = { fishpath(3) },
lualine_x = {},
lualine_y = {},
lualine_z = {},
},
tabline = {
lualine_a = {
{
'tabs',
mode = 1,
max_length = vim.o.columns / 3,
tabs_color = {
-- Same values as the general color option can be used here.
-- active = 'TabLineSel', -- Color for active tab.
-- inactive = 'TabLine', -- Color for inactive tab.
},
},
},
lualine_b = {},
lualine_c = {},
-- lualine_x = { "require'phoenix.utils.lsp'.get_attached_clients()" },
-- lualine_y = {"require'lsp-status'.status()"},
lualine_z = { { 'branch', icons_enabled = true } },
},
}
end,
}

View file

@ -0,0 +1,65 @@
local keymap = require 'phoenix.utils.keymap'
return {
'nvim-neo-tree/neo-tree.nvim',
branch = 'v3.x',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
'MunifTanjim/nui.nvim',
{
-- only needed if you want to use the commands with "_with_window_picker" suffix
's1n7ax/nvim-window-picker',
name = 'window-picker',
event = 'VeryLazy',
version = '2.*',
config = function()
require('window-picker').setup {
hint = 'statusline-winbar',
selection_chars = 'arstgmneiodh',
autoselect_one = true,
include_current_win = false,
filter_rules = {
bo = {
-- if the file type is one of following, the window will be ignored
filetype = { 'neo-tree', 'neo-tree-popup', 'notify' },
-- if the buffer type is one of following, the window will be ignored
buftype = { 'terminal', 'quickfix' },
},
},
-- other_win_hl_color = '#e35e4f',
}
end,
},
},
config = function()
-- Unless you are still migrating, remove the deprecated commands from v1.x
vim.cmd [[ let g:neo_tree_remove_legacy_commands = 1 ]]
require('neo-tree').setup {
window = {
position = 'left',
},
filesystem = {
bind_to_cwd = true,
cwd_target = {
sidebar = 'window',
current = 'window',
float = "window"
},
window = {
mappings = {
['o'] = 'open',
},
},
},
}
keymap('n', '<leader>kk', ':Neotree toggle reveal_force_cwd position=float<cr>')
keymap('n', '<leader>kc', ':Neotree toggle position=current<cr>')
keymap('n', '<leader>kb', ':Neotree toggle reveal position=left<cr>')
keymap('n', '<leader>kq', ':Neotree close<cr>')
end,
}

View file

@ -0,0 +1,3 @@
return {
"folke/neoconf.nvim"
}

View file

@ -0,0 +1,11 @@
local keymap = require 'phoenix.utils.keymap'
return {
'danymat/neogen',
dependencies = 'nvim-treesitter/nvim-treesitter',
config = function()
require("neogen").setup({})
keymap('n', '<leader>nf', ":lua require('neogen').generate()<CR>")
end,
}

View file

@ -0,0 +1,52 @@
return {
'nvimtools/none-ls.nvim',
config = function()
local null_ls = require 'null-ls'
local b = null_ls.builtins
local sources = {
-- formatting
-- b.formatting.prettierd,
b.formatting.biome.with {
condition = function(utils)
return utils.root_has_file { 'biome.jsonc' }
end,
filetypes = { 'javascript', 'javascriptreact', 'json', 'jsonc', 'typescript', 'typescriptreact' },
args = {
'check',
'--apply-unsafe',
'--formatter-enabled=true',
'--organize-imports-enabled=true',
'--skip-errors',
'--stdin-file-path=$FILENAME',
},
},
b.formatting.stylua.with {
condition = function(utils)
return utils.root_has_file { 'stylua.toml', '.stylua.toml' }
end,
},
-- b.formatting.goimports.with({
-- args = {
-- "-srcdir", "$DIRNAME", "-w", "cmd", "errorutils", "internal", "loaders", "resolvers"
-- }
-- }),
-- b.formatting.beautysh,
-- require("typescript.extensions.null-ls.code-actions"),
-- b.formatting.eslint_d,
-- b.diagnostics.eslint_d,
-- b.code_actions.eslint_d,
}
null_ls.setup {
-- debug = true,
sources = sources,
}
end,
}

View file

@ -0,0 +1,10 @@
return {
"dbakker/vim-projectroot",
config = function()
vim.keymap.set(
"n",
"<C-f>",
":<C-u>ProjectRootExe lua require('telescope.builtin').live_grep({debounce=100})<cr>",
{ noremap = true, silent = true })
end
}

View file

@ -0,0 +1,14 @@
local keymap = require 'phoenix.utils.keymap'
return {
'ThePrimeagen/refactoring.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-treesitter/nvim-treesitter',
},
config = function()
require('refactoring').setup {}
-- prompt for a refactor to apply when the remap is triggered
keymap({ 'n', 'x' }, '<leader>rr', require('refactoring').select_refactor)
end,
}

View file

@ -0,0 +1,6 @@
return {
"themaxmarchuk/tailwindcss-colors.nvim",
config = function()
require("tailwindcss-colors").setup()
end
}

View file

@ -0,0 +1,16 @@
local keymap = require 'phoenix.utils.keymap'
return {
'akinsho/toggleterm.nvim',
config = function()
require('toggleterm').setup {
open_mapping = [[<leader>tt]],
insert_mappings = false,
direction = 'float',
shade_terminals = false,
}
keymap('n', '<leader>tr', ':ToggleTerm 2 direction=vertical<cr>', { desc = 'Toggle terminal right' })
keymap('n', '<leader>tb', ':ToggleTerm 3 direction=horizontal<cr>', { desc = 'Toggle terminal bottom' })
end,
}

View file

@ -0,0 +1,38 @@
---@type function
---comment
---@param mode any
---@param keymap any
---@param trouble_fn any
---@param desc any
local map = function(mode, keymap, trouble_fn, desc)
vim.keymap.set(mode, keymap, function()
require('trouble').open(trouble_fn)
end, { desc = "Trouble: " .. desc })
end
return {
'folke/trouble.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
auto_preview = false,
icons = false,
fold_open = 'v', -- icon used for open folds
fold_closed = '>', -- icon used for closed folds
signs = {
-- icons / text used for a diagnostic
error = 'error',
warning = 'warn',
hint = 'hint',
information = 'info',
},
use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
},
config = function()
map('n', '<leader>xx', nil, "show window")
map('n', '<leader>xw', 'workspace_diagnostics', "show [w]orkspace diagnostics")
map('n', '<leader>xd', 'document_diagnostics', "show [d]ocument diagnostics")
map('n', '<leader>xq', 'quickfix', "show [q]uickfix list")
map('n', '<leader>xl', 'loclist', "show [l]ocation list")
map('n', 'gR', 'lsp_references', "")
end,
}

View file

@ -0,0 +1,13 @@
return {
{
'dmmulroy/tsc.nvim',
lazy = false,
ft = { 'typescript', 'typescriptreact' },
config = function()
require('tsc').setup {
auto_open_qflist = true,
pretty_errors = true,
}
end,
},
}

137
lua/phoenix/plugins/ui.lua Normal file
View file

@ -0,0 +1,137 @@
-- UI related plugins, mostly fancy stuff
return {
-- Better `vim.notify()`
-- {
-- 'rcarriga/nvim-notify',
-- keys = {
-- {
-- '<leader>un',
-- function()
-- require('notify').dismiss { silent = true, pending = true }
-- end,
-- desc = 'Dismiss all Notifications',
-- },
-- },
-- opts = {
-- timeout = 3000,
-- max_height = function()
-- return math.floor(vim.o.lines * 0.75)
-- end,
-- max_width = function()
-- return math.floor(vim.o.columns * 0.75)
-- end,
-- },
-- },
-- better vim.ui
{
'stevearc/dressing.nvim',
config = function()
require('dressing').setup {
input = {
enabled = true,
},
select = {
enabled = true,
backend = { 'telescope', 'builtin' },
telescope = require('telescope.themes').get_cursor(),
},
}
end,
},
-- noicer ui
-- {
-- 'folke/noice.nvim',
-- event = 'VeryLazy',
-- opts = {
-- cmdline = {
-- enabled = true,
-- },
-- lsp = {
-- override = {
-- ['vim.lsp.util.convert_input_to_markdown_lines'] = true,
-- ['vim.lsp.util.stylize_markdown'] = true,
-- ['cmp.entry.get_documentation'] = true,
-- },
-- },
-- routes = {
-- {
-- filter = {
-- event = 'msg_show',
-- find = '%d+L, %d+B',
-- },
-- view = 'mini',
-- },
-- },
-- presets = {
-- bottom_search = true,
-- -- command_palette = true,
-- long_message_to_split = true,
-- inc_rename = true,
-- },
-- },
-- keys = {
-- {
-- '<S-Enter>',
-- function()
-- require('noice').redirect(vim.fn.getcmdline())
-- end,
-- mode = 'c',
-- desc = 'Redirect Cmdline',
-- },
-- {
-- '<leader>snl',
-- function()
-- require('noice').cmd 'last'
-- end,
-- desc = 'Noice Last Message',
-- },
-- {
-- '<leader>snh',
-- function()
-- require('noice').cmd 'history'
-- end,
-- desc = 'Noice History',
-- },
-- {
-- '<leader>sna',
-- function()
-- require('noice').cmd 'all'
-- end,
-- desc = 'Noice All',
-- },
-- {
-- '<leader>snd',
-- function()
-- require('noice').cmd 'dismiss'
-- end,
-- desc = 'Dismiss All',
-- },
-- {
-- '<c-f>',
-- function()
-- if not require('noice.lsp').scroll(4) then
-- return '<c-f>'
-- end
-- end,
-- silent = true,
-- expr = true,
-- desc = 'Scroll forward',
-- mode = { 'i', 'n', 's' },
-- },
-- {
-- '<c-b>',
-- function()
-- if not require('noice.lsp').scroll(-4) then
-- return '<c-b>'
-- end
-- end,
-- silent = true,
-- expr = true,
-- desc = 'Scroll backward',
-- mode = { 'i', 'n', 's' },
-- },
-- },
-- },
}

View file

@ -0,0 +1,7 @@
-- this needs to be here because doing it in init.lua is late for this plugin to work
vim.o.undofile = true
vim.o.undodir = '/tmp/.phoenix/undo'
return {
'pixelastic/vim-undodir-tree',
}