feat: convert to blink, major lsp changes, lualine
This commit is contained in:
parent
82102e5e29
commit
51ab444c0d
44 changed files with 1387 additions and 700 deletions
177
lua/plugins/autocomplete-blink.lua
Normal file
177
lua/plugins/autocomplete-blink.lua
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
-- TODO: blink is faster than nvim-cmp, but still missing integration
|
||||
-- with a good number of other plugins. fuzzy is still being improved.
|
||||
|
||||
return {
|
||||
{
|
||||
'saghen/blink.cmp',
|
||||
-- branch = 'fuzzy-scoring',
|
||||
-- commit = 'b9cca35c503f6d220b1162e604e06477db02a23c',
|
||||
version = 'v1.*',
|
||||
branch = 'main',
|
||||
commit = '2c3d276',
|
||||
event = 'InsertEnter',
|
||||
enabled = function()
|
||||
return vim.g.autocomplete_enable
|
||||
end,
|
||||
dependencies = {
|
||||
'saghen/blink.compat',
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
build = (function()
|
||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||
return
|
||||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
dependencies = {
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
-- {
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
-- config = function()
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
-- end,
|
||||
-- },
|
||||
},
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
--cmdline = { enabled = false },
|
||||
cmdline = {
|
||||
keymap = {
|
||||
-- recommended, as the default keymap will only show and select the next item
|
||||
['<Tab>'] = { 'show', 'accept' },
|
||||
['<down>'] = { 'select_next', 'fallback' },
|
||||
['<up>'] = { 'select_prev', 'fallback' },
|
||||
['<left>'] = { 'scroll_documentation_up', 'fallback' },
|
||||
['<right>'] = { 'scroll_documentation_down', 'fallback' },
|
||||
['<C-g>'] = { 'cancel', 'fallback' },
|
||||
['<C-h>'] = { 'show', 'fallback' },
|
||||
},
|
||||
completion = {
|
||||
menu = {
|
||||
auto_show = true,
|
||||
},
|
||||
list = {
|
||||
selection = {
|
||||
preselect = true,
|
||||
auto_insert = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
fuzzy = {
|
||||
implementation = 'lua', -- slower, more flexible, patchable
|
||||
sorts = { 'exact', 'score', 'sort_text' },
|
||||
use_frecency = false,
|
||||
use_proximity = false,
|
||||
max_typos = function()
|
||||
return 0
|
||||
end,
|
||||
},
|
||||
completion = {
|
||||
keyword = { range = 'full' },
|
||||
-- list = { selection = 'auto_insert' },
|
||||
trigger = {
|
||||
show_on_insert_on_trigger_character = false, -- Use C-Space
|
||||
},
|
||||
accept = {
|
||||
auto_brackets = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
menu = {
|
||||
border = 'single',
|
||||
draw = {
|
||||
columns = {
|
||||
{ 'kind_icon' },
|
||||
-- { 'source_name' },
|
||||
{ 'label', 'label_description', gap = 1 },
|
||||
},
|
||||
},
|
||||
},
|
||||
documentation = {
|
||||
window = {
|
||||
border = 'single',
|
||||
},
|
||||
},
|
||||
},
|
||||
keymap = {
|
||||
preset = 'default',
|
||||
-- Disable conflicting emacs keys - let neovimacs handle them
|
||||
['<C-k>'] = {}, -- Remove C-k (emacs: kill to end of line)
|
||||
['<C-b>'] = {}, -- Remove C-b (emacs: backward char)
|
||||
['<C-f>'] = {}, -- Remove C-f (emacs: forward char)
|
||||
['<C-p>'] = {}, -- Remove C-p (emacs: previous line)
|
||||
['<C-n>'] = {}, -- Remove C-n (emacs: next line)
|
||||
['<C-e>'] = {}, -- Remove C-e (emacs: end of line)
|
||||
['<C-y>'] = {}, -- Remove C-y (emacs: yank)
|
||||
['<C-Space>'] = {}, -- Remove C-Space (emacs: highlight)
|
||||
|
||||
-- Alternative completion navigation
|
||||
['<M-j>'] = { 'select_next', 'fallback' }, -- Alt-j for next
|
||||
['<M-k>'] = { 'select_prev', 'fallback' }, -- Alt-k for prev
|
||||
['<M-h>'] = { 'scroll_documentation_up', 'fallback' }, -- Alt-h for doc up
|
||||
['<M-l>'] = { 'scroll_documentation_down', 'fallback' }, -- Alt-l for doc down
|
||||
|
||||
-- Keep arrow keys and other non-conflicting bindings
|
||||
['<down>'] = { 'select_next', 'fallback' },
|
||||
['<up>'] = { 'select_prev', 'fallback' },
|
||||
['<left>'] = { 'scroll_documentation_up', 'fallback' },
|
||||
['<right>'] = { 'scroll_documentation_down', 'fallback' },
|
||||
['<Tab>'] = { 'accept', 'fallback' },
|
||||
['<C-g>'] = { 'cancel', 'fallback' },
|
||||
['<C-h>'] = { 'show', 'fallback' },
|
||||
['<C-right>'] = {
|
||||
function(cmp)
|
||||
local luasnip = require 'luasnip'
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
return cmp.fallback()
|
||||
end
|
||||
end,
|
||||
'fallback',
|
||||
},
|
||||
['<C-left>'] = {
|
||||
function(cmp)
|
||||
local luasnip = require 'luasnip'
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
return cmp.fallback()
|
||||
end
|
||||
end,
|
||||
'fallback',
|
||||
},
|
||||
},
|
||||
signature = {
|
||||
enabled = true,
|
||||
window = {
|
||||
border = 'single',
|
||||
},
|
||||
},
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
per_filetype = {},
|
||||
-- TODO: broken
|
||||
providers = {
|
||||
tabnine = {
|
||||
name = 'Tabnine',
|
||||
module = 'blink.compat.source',
|
||||
},
|
||||
},
|
||||
},
|
||||
snippets = {
|
||||
preset = 'luasnip',
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local luasnip = require 'luasnip'
|
||||
luasnip.config.setup {}
|
||||
|
||||
require('blink.cmp').setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
return {
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
dependencies = {
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
build = (function()
|
||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||
return
|
||||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
dependencies = {
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
-- {
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
-- config = function()
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
-- end,
|
||||
-- },
|
||||
},
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
-- Other completions
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
luasnip.config.setup {}
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = {
|
||||
autocomplete = false, -- Use C-Space
|
||||
completeopt = 'menu,menuone,noinsert',
|
||||
},
|
||||
-- `:help ins-completion`
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<down>'] = cmp.mapping.select_next_item(),
|
||||
['<up>'] = cmp.mapping.select_prev_item(),
|
||||
['<left>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<right>'] = cmp.mapping.scroll_docs(4),
|
||||
['<Tab>'] = cmp.mapping.confirm { select = true },
|
||||
['<C-g>'] = cmp.mapping.abort(),
|
||||
['<C-h>'] = cmp.mapping.complete {},
|
||||
['<C-right>'] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<C-left>'] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<C-n>'] = cmp.config.disable,
|
||||
['<C-p>'] = cmp.config.disable,
|
||||
},
|
||||
sources = {
|
||||
{
|
||||
name = 'lazydev',
|
||||
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||
group_index = 0,
|
||||
},
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
58
lua/plugins/avante.lua
Normal file
58
lua/plugins/avante.lua
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
return {
|
||||
{
|
||||
'yetone/avante.nvim',
|
||||
event = 'VeryLazy',
|
||||
lazy = false,
|
||||
version = false,
|
||||
opts = {
|
||||
-- Use ANTHROPIC_API_KEY=your-api-key
|
||||
providers = {
|
||||
claude = {
|
||||
auto_suggestions_provider = 'claude', -- high-frequency provider (free recommended)
|
||||
claude = {
|
||||
endpoint = 'https://api.anthropic.com',
|
||||
model = 'claude-3-5-sonnet-20241022',
|
||||
temperature = 0,
|
||||
max_tokens = 4096,
|
||||
},
|
||||
},
|
||||
},
|
||||
hints = { enabled = false },
|
||||
},
|
||||
build = 'make', -- BUILD_FROM_SOURCE=true
|
||||
dependencies = {
|
||||
'stevearc/dressing.nvim',
|
||||
'nvim-lua/plenary.nvim',
|
||||
'MunifTanjim/nui.nvim',
|
||||
--- The below dependencies are optional,
|
||||
'hrsh7th/nvim-cmp', -- autocompletion for avante commands and mentions
|
||||
'echasnovski/mini.icons',
|
||||
{
|
||||
-- support for image pasting
|
||||
'HakonHarnes/img-clip.nvim',
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
default = {
|
||||
embed_image_as_base64 = false,
|
||||
prompt_for_file_name = false,
|
||||
drag_and_drop = {
|
||||
insert_mode = true,
|
||||
},
|
||||
use_absolute_path = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
-- Make sure to set this up properly if you have lazy=true
|
||||
'MeanderingProgrammer/render-markdown.nvim',
|
||||
opts = {
|
||||
file_types = { 'markdown', 'Avante' },
|
||||
},
|
||||
ft = { 'markdown', 'Avante' },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ '<leader>la', '<cmd>AvanteChat<cr>', desc = '[A]vante Chat' },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1 +1,13 @@
|
|||
return {
'akinsho/bufferline.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
version = '*',
opts = {
options = {
always_show_bufferline = false,
mode = 'tabs',
},
},
}
|
||||
return {
|
||||
{
|
||||
'akinsho/bufferline.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
version = '*',
|
||||
opts = {
|
||||
options = {
|
||||
always_show_bufferline = false,
|
||||
mode = 'tabs',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
20
lua/plugins/claude-code.lua
Normal file
20
lua/plugins/claude-code.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
'greggh/claude-code.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim', -- Required for git operations
|
||||
},
|
||||
config = function()
|
||||
require('claude-code').setup {
|
||||
window = {
|
||||
split_ratio = 0.5,
|
||||
position = 'botright',
|
||||
enter_insert = true,
|
||||
hide_numbers = true,
|
||||
hide_signcolumn = true,
|
||||
},
|
||||
}
|
||||
end,
|
||||
keys = {
|
||||
{ '<leader>lc', '<cmd>ClaudeCode<cr>', desc = '[C]laude Code' },
|
||||
},
|
||||
}
|
||||
|
|
@ -2,9 +2,22 @@ return {
|
|||
{
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
init = function()
|
||||
config = function()
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('tokyonight').setup {
|
||||
styles = {
|
||||
comments = { italic = false }, -- Disable italics in comments
|
||||
},
|
||||
}
|
||||
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
-- vim.cmd.hi 'Comment gui=none'
|
||||
end,
|
||||
opts = {
|
||||
on_highlights = function(hl, c)
|
||||
hl.TelescopeNormal = {
|
||||
fg = c.fg_dark,
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,28 +12,63 @@ return {
|
|||
mode = '',
|
||||
desc = '[Fo]rmat Buffer',
|
||||
},
|
||||
{
|
||||
'<leader>tf',
|
||||
function()
|
||||
vim.g.format_on_save_enabled = not vim.g.format_on_save_enabled
|
||||
vim.notify('Format on save: ' .. (vim.g.format_on_save_enabled and 'enabled' or 'disabled'))
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[F]ormat on save',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
local disable_filetypes = { c = true, cpp = true, sh = true }
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||
}
|
||||
if not vim.g.format_on_save_enabled then
|
||||
return false
|
||||
end
|
||||
|
||||
local disable_filetypes = { c = true, cpp = true, sh = true, nix = true, md = true }
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
return nil
|
||||
else
|
||||
return {
|
||||
async = false,
|
||||
timeout_ms = 3000,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||
}
|
||||
end
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
c = { 'clangd-format', 'cpplint' },
|
||||
cs = { 'ast-grep' }, -- c#
|
||||
css = { 'prettier' },
|
||||
cmake = { 'cmakelang' },
|
||||
cpp = { 'clangd-format', 'cpplint' },
|
||||
flow = { 'prettier' },
|
||||
go = { 'ast-grep', 'golangci-lint' }, -- gofumpt requires go
|
||||
html = { 'prettier' },
|
||||
h = { 'clangd-format', 'cpplint' },
|
||||
hpp = { 'clangd-format', 'cpplint' },
|
||||
java = { 'ast-grep' },
|
||||
javascript = { 'prettier' },
|
||||
javascriptreact = { 'prettier' },
|
||||
-- jinja = { 'djlint' },
|
||||
json = { 'prettier' },
|
||||
-- latex = { 'tex-fmt' },
|
||||
lua = { 'stylua' },
|
||||
python = {
|
||||
'black',
|
||||
'isort',
|
||||
'ruff_format',
|
||||
'pyright',
|
||||
},
|
||||
-- php = { 'php-cs-fixer' },
|
||||
markdown = { 'prettier' },
|
||||
md = { 'prettier' },
|
||||
nix = { 'nixfmt' },
|
||||
yaml = { 'yamlfmt' },
|
||||
nix = { 'alejandra' },
|
||||
python = { 'isort', 'ruff_format' },
|
||||
-- r = { 'air' },
|
||||
sh = { 'shfmt' },
|
||||
-- tf = { 'terraform' },
|
||||
typescript = { 'prettier' },
|
||||
typescriptreact = { 'prettier' },
|
||||
yaml = { 'prettier' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,5 +10,21 @@ return {
|
|||
changedelete = { text = '~' },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
'<leader>tB',
|
||||
function()
|
||||
require('gitsigns').toggle_current_line_blame()
|
||||
end,
|
||||
desc = 'Git [B]lame',
|
||||
},
|
||||
{
|
||||
'<leader>tD',
|
||||
function()
|
||||
require('gitsigns').toggle_deleted()
|
||||
end,
|
||||
desc = '[D]eleted git lines',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,153 +0,0 @@
|
|||
return {
|
||||
{ -- properly configures LuaLS
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
{ 'Bilal2453/luvit-meta', lazy = true },
|
||||
{
|
||||
-- Main LSP Configuration
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
|
||||
-- Useful status updates for LSP.
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- Allows extra capabilities provided by nvim-cmp
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc)
|
||||
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
|
||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
||||
-- :help CursorHold
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspDetach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
||||
callback = function(event2)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Inlay hints
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
map('<leader>th', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||
|
||||
local servers = {
|
||||
clangd = {},
|
||||
pyright = {},
|
||||
black = {},
|
||||
isort = {},
|
||||
taplo = {},
|
||||
-- rust_analyzer = {},
|
||||
lua_ls = {
|
||||
-- cmd = {...},
|
||||
-- filetypes = { ...},
|
||||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Ensure the servers and tools above are installed
|
||||
-- :Mason
|
||||
require('mason').setup()
|
||||
|
||||
-- You can add other tools here that you want Mason to install
|
||||
-- for you, so that they are available from within Neovim.
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'bashls', -- bash
|
||||
'black', -- python format
|
||||
'cmake', -- cmake
|
||||
'clangd', -- cpp
|
||||
'debugpy', -- debugger
|
||||
'dockerls', -- docker
|
||||
'golangci-lint', -- go
|
||||
'isort', -- python sorting
|
||||
'jedi-language-server', -- jedi completion
|
||||
'jsonls', -- json
|
||||
'lua_ls', -- lua
|
||||
'marksman', -- markdown
|
||||
'mypy', -- python checking
|
||||
'nixpkgs-fmt', -- Nix
|
||||
'prettier', -- md
|
||||
'pyright', -- python lsp
|
||||
'ruff', -- lint and format for python
|
||||
'rust-analyzer', -- rust
|
||||
'shfmt', -- shell
|
||||
'stylua', -- Used to format Lua code
|
||||
'taplo', -- LSP for toml files
|
||||
'tree-sitter-cli', -- treesitter
|
||||
'ts_ls', -- typescript
|
||||
'yamllint', -- yaml
|
||||
'yamlfmt', -- yaml
|
||||
'yamlls', -- yaml
|
||||
})
|
||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||
require('lspconfig')[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
94
lua/plugins/lualine.lua
Normal file
94
lua/plugins/lualine.lua
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
return {
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
local mode_map = {
|
||||
['NORMAL'] = 'N',
|
||||
['O-PENDING'] = 'N?',
|
||||
['INSERT'] = 'I',
|
||||
['VISUAL'] = 'V',
|
||||
['V-BLOCK'] = 'VB',
|
||||
['V-LINE'] = 'VL',
|
||||
['V-REPLACE'] = 'VR',
|
||||
['REPLACE'] = 'R',
|
||||
['COMMAND'] = '!',
|
||||
['SHELL'] = 'SH',
|
||||
['TERMINAL'] = 'T',
|
||||
['EX'] = 'X',
|
||||
['S-BLOCK'] = 'SB',
|
||||
['S-LINE'] = 'SL',
|
||||
['SELECT'] = 'S',
|
||||
['CONFIRM'] = 'Y?',
|
||||
['MORE'] = 'M',
|
||||
}
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
always_show_tabline = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 100,
|
||||
tabline = 100,
|
||||
winbar = 100,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { {
|
||||
'mode',
|
||||
fmt = function(s)
|
||||
return mode_map[s] or s
|
||||
end,
|
||||
} },
|
||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = {
|
||||
'encoding',
|
||||
'fileformat',
|
||||
'filetype',
|
||||
{
|
||||
'tabnine',
|
||||
fmt = function(s)
|
||||
if string.match(s, 'disabled') or s == '' then
|
||||
return '-'
|
||||
else
|
||||
return '⌬'
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
function()
|
||||
return vim.g.format_on_save_enabled and '' or ''
|
||||
end,
|
||||
color = { fg = '#98c379' },
|
||||
},
|
||||
},
|
||||
lualine_y = { 'progress' },
|
||||
lualine_z = { 'location' },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
-- '' or ''
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
128
lua/plugins/mason.lua
Normal file
128
lua/plugins/mason.lua
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
return {
|
||||
-- Mason: LSP/DAP/Linter/Formatter installer
|
||||
{
|
||||
'mason-org/mason.nvim',
|
||||
config = function()
|
||||
require('mason').setup()
|
||||
|
||||
-- Add Mason bin directory to PATH
|
||||
local mason_bin = vim.fn.stdpath 'data' .. '/mason/bin'
|
||||
local current_path = vim.env.PATH or ''
|
||||
if not string.find(current_path, mason_bin, 1, true) then
|
||||
vim.env.PATH = mason_bin .. ':' .. current_path
|
||||
end
|
||||
|
||||
-- Auto-cleanup unused packages (add when deprecating packages)
|
||||
--
|
||||
vim.defer_fn(function()
|
||||
local registry = require 'mason-registry'
|
||||
local unused_packages = {
|
||||
'black',
|
||||
'mypy',
|
||||
'pyright',
|
||||
'nixpkgs-fmt',
|
||||
'python-lsp-server',
|
||||
'pyflakes',
|
||||
'pylint',
|
||||
'pep8',
|
||||
}
|
||||
|
||||
for _, package_name in ipairs(unused_packages) do
|
||||
if registry.is_installed(package_name) then
|
||||
local package = registry.get_package(package_name)
|
||||
package:uninstall():once('closed', function()
|
||||
vim.notify('Removed unused package: ' .. package_name, vim.log.levels.INFO)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end, 1000)
|
||||
end,
|
||||
},
|
||||
|
||||
-- Mason tool installer for formatters/linters
|
||||
-- Note: mason-lspconfig.nvim is not used for LSP beyond installs, we use vim.lsp fot that
|
||||
{
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
dependencies = { 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim' },
|
||||
config = function()
|
||||
-- Function to translate LSP server names to Mason package names using mason-lspconfig
|
||||
local function translate_lsp_names(lsp_servers)
|
||||
local mason_packages = {}
|
||||
local ok, mason_lspconfig = pcall(require, 'mason-lspconfig')
|
||||
|
||||
if ok then
|
||||
for _, server in ipairs(lsp_servers) do
|
||||
local success, package_name = pcall(mason_lspconfig.get_mason_package, server)
|
||||
if success and package_name then
|
||||
table.insert(mason_packages, package_name.name)
|
||||
else
|
||||
-- Fallback to original name if no mapping found
|
||||
table.insert(mason_packages, server)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- If mason-lspconfig not available, use original names
|
||||
mason_packages = lsp_servers
|
||||
end
|
||||
|
||||
return mason_packages
|
||||
end
|
||||
|
||||
-- LSP servers to install (using mason-lspconfig names)
|
||||
local lsp_servers = {
|
||||
'clangd',
|
||||
'basedpyright',
|
||||
'bashls', -- bash-language-server
|
||||
'dockerls', -- dockerfile-language-server
|
||||
-- 'gopls', -- go
|
||||
'jedi_language_server',
|
||||
'lua_ls', -- lua-language-server
|
||||
'marksman',
|
||||
'rust_analyzer',
|
||||
'taplo',
|
||||
'ts_ls', -- typescript-language-server
|
||||
'yamlls', -- yaml-language-server
|
||||
}
|
||||
|
||||
-- Other tools
|
||||
local other_tools = {
|
||||
-- Formatters
|
||||
'alejandra', -- nix
|
||||
'ast-grep',
|
||||
'clang-format',
|
||||
'cmakelang',
|
||||
'isort', -- python
|
||||
'prettier',
|
||||
'ruff', -- python
|
||||
'shfmt',
|
||||
'stylua',
|
||||
|
||||
-- Linters
|
||||
'ast-grep',
|
||||
'cmakelint',
|
||||
'cpplint',
|
||||
'golangci-lint',
|
||||
'ruff', -- python
|
||||
'yamllint',
|
||||
'golangci-lint',
|
||||
|
||||
-- Debuggers
|
||||
'debugpy',
|
||||
|
||||
-- Additional tools
|
||||
'tree-sitter-cli',
|
||||
}
|
||||
|
||||
-- Combine translated LSP servers with other tools
|
||||
local all_tools = {}
|
||||
vim.list_extend(all_tools, translate_lsp_names(lsp_servers))
|
||||
vim.list_extend(all_tools, other_tools)
|
||||
|
||||
require('mason-tool-installer').setup {
|
||||
ensure_installed = all_tools,
|
||||
auto_update = false,
|
||||
run_on_start = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -16,13 +16,6 @@ return {
|
|||
-- - sd' - [S]urround [D]elete [']quotes
|
||||
-- - sr)' - [S]urround [R]eplace [)] [']
|
||||
require('mini.surround').setup()
|
||||
|
||||
local statusline = require 'mini.statusline'
|
||||
statusline.setup { use_icons = vim.g.have_nerd_font }
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_location = function()
|
||||
return '%2l:%-2v'
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
@ -1,6 +1,11 @@
|
|||
return {
|
||||
{ -- Emacs-style keybindings in insert mode
|
||||
{
|
||||
'millerjason/neovimacs.nvim',
|
||||
opts = {},
|
||||
opts = {
|
||||
VM_Enabled = vim.g.neovimacs_bindings,
|
||||
VM_StartInsert = vim.g.neovimacs_insert,
|
||||
VM_UnixConsoleMetaSendsEsc = false,
|
||||
TabIndentStyle = 'none', -- 'emacs', 'never', 'whitespace', 'startofline'
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,12 +13,17 @@ return {
|
|||
log_file_path = nil,
|
||||
ignore_certificate_errors = false,
|
||||
}
|
||||
require('tabnine.status').disable_tabnine()
|
||||
if vim.g.tabnine_enable then
|
||||
require('tabnine.status').enable_tabnine()
|
||||
else
|
||||
require('tabnine.status').disable_tabnine()
|
||||
end
|
||||
end,
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ '<leader>lc', '<cmd>TabnineChat<cr>', desc = '[L]LM [C]hat' },
|
||||
{ '<leader>lt', '<cmd>TabnineToggle<cr>', desc = '[L]LM [T]oggle' },
|
||||
{ '<leader>ls', '<cmd>TabnineStatus<cr>', desc = '[L]LM [S]tatus' },
|
||||
{ '<leader>t9', '<cmd>TabnineToggle<cr>', desc = '[T]oggle' },
|
||||
{ '<leader>l9e', '<cmd>TabnineEnable<cr>', desc = 'T9 [E]nable' },
|
||||
{ '<leader>l9c', '<cmd>TabnineChat<cr>', desc = 'T9 [C]hat' },
|
||||
{ '<leader>l9s', '<cmd>TabnineStatus<cr>', desc = 'T9 [S]tatus' },
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ return {
|
|||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Find [G]rep' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Find [B]uffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Find [H]elp tags' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
|
|
|
|||
33
lua/plugins/tiny-inline-diagnostics.lua
Normal file
33
lua/plugins/tiny-inline-diagnostics.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
return {
|
||||
{
|
||||
'rachartier/tiny-inline-diagnostic.nvim',
|
||||
event = 'VeryLazy',
|
||||
priority = 1000, -- needs to be loaded in first
|
||||
config = function(_, opts)
|
||||
vim.opt.updatetime = 100
|
||||
vim.api.nvim_set_hl(0, 'DiagnosticError', { fg = '#f76464' })
|
||||
vim.api.nvim_set_hl(0, 'DiagnosticWarn', { fg = '#f7bf64' })
|
||||
vim.api.nvim_set_hl(0, 'DiagnosticInfo', { fg = '#64bcf7' })
|
||||
vim.api.nvim_set_hl(0, 'DiagnosticHint', { fg = '#64f79d' })
|
||||
require('tiny-inline-diagnostic').setup(opts)
|
||||
end,
|
||||
opts = {
|
||||
enable_on_insert = true,
|
||||
multiple_diag_under_cursor = true,
|
||||
show_all_diags_on_cursorline = true,
|
||||
multilines = {
|
||||
enabled = false,
|
||||
always_show = true,
|
||||
},
|
||||
signs = {
|
||||
left = '',
|
||||
right = '',
|
||||
diag = '',
|
||||
arrow = ' ',
|
||||
up_arrow = ' ',
|
||||
vertical = ' │',
|
||||
vertical_end = ' └',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
return {
|
||||
'linux-cultist/venv-selector.nvim',
|
||||
'linux-cultist/venv-selector.nvim',
|
||||
branch = 'regexp',
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig',
|
||||
|
|
|
|||
|
|
@ -2,18 +2,26 @@ return {
|
|||
{ -- Shows keybindings as you go
|
||||
'folke/which-key.nvim',
|
||||
event = 'VimEnter',
|
||||
config = function()
|
||||
require('which-key').setup()
|
||||
-- Document existing key chains
|
||||
require('which-key').add {
|
||||
opts = {
|
||||
delay = 0,
|
||||
icons = {
|
||||
mappings = vim.g.have_nerd_font,
|
||||
},
|
||||
spec = {
|
||||
{ '<leader>a', group = '[A]vante' },
|
||||
{ '<leader>c', group = '[C]ode' },
|
||||
{ '<leader>d', group = '[D]ocument' },
|
||||
{ '<leader>r', group = '[R]ename' },
|
||||
{ '<leader>s', group = '[S]earch' },
|
||||
{ '<leader>w', group = '[W]orkspace' },
|
||||
{ '<leader>w', group = '[W]indow' },
|
||||
{ '<leader>t', group = '[T]oggle' },
|
||||
{ '<leader>l', group = '[L]LM Assist' },
|
||||
{ '<leader>l9', group = 'Tab[9]' },
|
||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||
}
|
||||
end,
|
||||
{ '<leader>p', group = '[P] Explore', mode = { 'n' } },
|
||||
{ '<leader>f', group = '[F]ind/Grep' },
|
||||
{ '<leader>i', group = '[I]ndent' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue