mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-11 11:52:09 +00:00
chore(nvim): cleanup, formatting, fixes
This commit is contained in:
@@ -2,8 +2,8 @@ column_width = 120
|
|||||||
line_endings = "Unix"
|
line_endings = "Unix"
|
||||||
indent_type = "Spaces"
|
indent_type = "Spaces"
|
||||||
indent_width = 2
|
indent_width = 2
|
||||||
quote_style = "AutoPreferDouble"
|
quote_style = "AutoPreferSingle"
|
||||||
call_parentheses = "Always"
|
call_parentheses = "None"
|
||||||
collapse_simple_statement = "Always"
|
collapse_simple_statement = "Always"
|
||||||
|
|
||||||
[sort_requires]
|
[sort_requires]
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ insert_final_newline = true
|
|||||||
charset = utf-8
|
charset = utf-8
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
max_line_length = 100
|
max_line_length = 120
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
column_width = 160
|
column_width = 120
|
||||||
line_endings = "Unix"
|
line_endings = "Unix"
|
||||||
indent_type = "Spaces"
|
indent_type = "Spaces"
|
||||||
indent_width = 2
|
indent_width = 2
|
||||||
quote_style = "AutoPreferSingle"
|
quote_style = "AutoPreferSingle"
|
||||||
call_parentheses = "None"
|
call_parentheses = "None"
|
||||||
|
collapse_simple_statement = "Always"
|
||||||
|
|
||||||
|
[sort_requires]
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
|||||||
@@ -9,18 +9,14 @@ local autocmd = vim.api.nvim_create_autocmd -- Create autocommand
|
|||||||
-- See `:help vim.highlight.on_yank()`
|
-- See `:help vim.highlight.on_yank()`
|
||||||
local highlight_group = augroup('YankHighlight', { clear = true })
|
local highlight_group = augroup('YankHighlight', { clear = true })
|
||||||
autocmd('TextYankPost', {
|
autocmd('TextYankPost', {
|
||||||
callback = function()
|
callback = function() vim.highlight.on_yank() end,
|
||||||
vim.highlight.on_yank()
|
|
||||||
end,
|
|
||||||
group = highlight_group,
|
group = highlight_group,
|
||||||
pattern = '*',
|
pattern = '*',
|
||||||
})
|
})
|
||||||
|
|
||||||
-- ── Windows to close with "q" ───────────────────────────────────────
|
-- ── Windows to close with "q" ───────────────────────────────────────
|
||||||
autocmd('FileType', {
|
autocmd('FileType', {
|
||||||
callback = function()
|
callback = function() vim.keymap.set('n', '<esc>', ':bd<CR>', { buffer = true, silent = true }) end,
|
||||||
vim.keymap.set('n', '<esc>', ':bd<CR>', { buffer = true, silent = true })
|
|
||||||
end,
|
|
||||||
pattern = {
|
pattern = {
|
||||||
'help',
|
'help',
|
||||||
'startuptime',
|
'startuptime',
|
||||||
|
|||||||
@@ -32,9 +32,7 @@ vim.opt.showmode = false
|
|||||||
-- Sync clipboard between OS and Neovim.
|
-- Sync clipboard between OS and Neovim.
|
||||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||||
-- See `:help 'clipboard'`
|
-- See `:help 'clipboard'`
|
||||||
vim.schedule(function()
|
vim.schedule(function() vim.opt.clipboard = 'unnamedplus' end)
|
||||||
vim.opt.clipboard = 'unnamedplus'
|
|
||||||
end)
|
|
||||||
|
|
||||||
vim.opt.breakindent = true -- Enable break indent
|
vim.opt.breakindent = true -- Enable break indent
|
||||||
vim.opt.smartindent = true -- Insert indents automatically
|
vim.opt.smartindent = true -- Insert indents automatically
|
||||||
@@ -103,6 +101,14 @@ vim.o.winwidth = 15
|
|||||||
vim.o.winminwidth = 10
|
vim.o.winminwidth = 10
|
||||||
vim.o.equalalways = false
|
vim.o.equalalways = false
|
||||||
|
|
||||||
|
-- folke/noice.nvim settings
|
||||||
|
vim.g.noice_ignored_filetypes = {
|
||||||
|
'fugitiveblame',
|
||||||
|
'fugitive',
|
||||||
|
'gitcommit',
|
||||||
|
'noice',
|
||||||
|
}
|
||||||
|
|
||||||
-- ── Deal with word wrap ───────────────────────────────────────────────────────
|
-- ── Deal with word wrap ───────────────────────────────────────────────────────
|
||||||
local m = vim.api.nvim_set_keymap
|
local m = vim.api.nvim_set_keymap
|
||||||
m('n', 'k', "v:count == 0 ? 'gk' : 'k'", { desc = 'Move up', noremap = true, expr = true })
|
m('n', 'k', "v:count == 0 ? 'gk' : 'k'", { desc = 'Move up', noremap = true, expr = true })
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
-- Autoformat
|
|
||||||
-- https://github.com/stevearc/conform.nvim
|
|
||||||
return {
|
|
||||||
'stevearc/conform.nvim',
|
|
||||||
event = { 'BufWritePre' },
|
|
||||||
cmd = { 'ConformInfo' },
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
'<leader>cf',
|
|
||||||
'<cmd>lua require("conform").format({ async = true, lsp_fallback = true })<cr>',
|
|
||||||
mode = '',
|
|
||||||
desc = 'Format buffer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
notify_on_error = false,
|
|
||||||
format_on_save = function(bufnr)
|
|
||||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
|
||||||
-- have a well standardized coding style. You can add additional
|
|
||||||
-- languages here or re-enable it for the disabled ones.
|
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
|
||||||
return {
|
|
||||||
timeout_ms = 500,
|
|
||||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
formatters_by_ft = {
|
|
||||||
lua = { 'stylua' },
|
|
||||||
-- Conform can also run multiple formatters sequentially
|
|
||||||
-- python = { "isort", "black" },
|
|
||||||
--
|
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
|
||||||
javascript = { 'prettierd', 'prettier', stop_after_first = true },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -20,6 +20,7 @@ return {
|
|||||||
{ 'hrsh7th/cmp-nvim-lsp' },
|
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||||
{ 'hrsh7th/cmp-buffer' },
|
{ 'hrsh7th/cmp-buffer' },
|
||||||
{ 'hrsh7th/cmp-path' },
|
{ 'hrsh7th/cmp-path' },
|
||||||
|
-- cmp import and use all environment variables from .env.* and system
|
||||||
-- https://github.com/SergioRibera/cmp-dotenv
|
-- https://github.com/SergioRibera/cmp-dotenv
|
||||||
{ 'SergioRibera/cmp-dotenv' },
|
{ 'SergioRibera/cmp-dotenv' },
|
||||||
-- ── Other deps ──────────────────────────────────────────────────────
|
-- ── Other deps ──────────────────────────────────────────────────────
|
||||||
@@ -39,8 +40,8 @@ return {
|
|||||||
cmd = 'Copilot',
|
cmd = 'Copilot',
|
||||||
build = ':Copilot setup',
|
build = ':Copilot setup',
|
||||||
event = { 'InsertEnter', 'LspAttach' },
|
event = { 'InsertEnter', 'LspAttach' },
|
||||||
fix_pairs = true,
|
|
||||||
opts = {
|
opts = {
|
||||||
|
fix_pairs = true,
|
||||||
suggestion = { enabled = false },
|
suggestion = { enabled = false },
|
||||||
panel = { enabled = false },
|
panel = { enabled = false },
|
||||||
filetypes = {
|
filetypes = {
|
||||||
@@ -50,9 +51,7 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = function()
|
config = function() require('copilot_cmp').setup() end,
|
||||||
require('copilot_cmp').setup()
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
@@ -63,10 +62,8 @@ return {
|
|||||||
require('copilot_cmp').setup()
|
require('copilot_cmp').setup()
|
||||||
|
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
if vim.api.nvim_get_option_value('buftype', {}) == 'prompt' then
|
if vim.api.nvim_get_option_value('buftype', {}) == 'prompt' then return false end
|
||||||
return false
|
local line, col = table.unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
end
|
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match '^%s*$' == nil
|
return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match '^%s*$' == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -74,9 +71,7 @@ return {
|
|||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format {
|
format = lspkind.cmp_format {
|
||||||
mode = 'symbol',
|
mode = 'symbol',
|
||||||
max_width = function()
|
max_width = function() return math.floor(0.45 * vim.o.columns) end,
|
||||||
return math.floor(0.45 * vim.o.columns)
|
|
||||||
end,
|
|
||||||
show_labelDetails = true,
|
show_labelDetails = true,
|
||||||
symbol_map = {
|
symbol_map = {
|
||||||
Copilot = '',
|
Copilot = '',
|
||||||
@@ -84,18 +79,14 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
view = {
|
view = {
|
||||||
width = function(_, _)
|
width = function(_, _) return math.min(80, vim.o.columns) end,
|
||||||
return math.min(80, vim.o.columns)
|
|
||||||
end,
|
|
||||||
entries = {
|
entries = {
|
||||||
name = 'custom',
|
name = 'custom',
|
||||||
selection_order = 'near_cursor',
|
selection_order = 'near_cursor',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args) luasnip.lsp_expand(args.body) end,
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert {
|
mapping = cmp.mapping.preset.insert {
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
|||||||
@@ -3,28 +3,57 @@ return {
|
|||||||
-- A better annotation generator.
|
-- A better annotation generator.
|
||||||
-- Supports multiple languages and annotation conventions.
|
-- Supports multiple languages and annotation conventions.
|
||||||
-- https://github.com/danymat/neogen
|
-- https://github.com/danymat/neogen
|
||||||
{ 'danymat/neogen', version = '*', opts = { enabled = true, snippet_engine = 'luasnip' } },
|
{
|
||||||
|
'danymat/neogen',
|
||||||
|
version = '*',
|
||||||
|
opts = { enabled = true, snippet_engine = 'luasnip' },
|
||||||
|
},
|
||||||
|
|
||||||
-- The Refactoring library based off the Refactoring book by Martin Fowler
|
-- The Refactoring library based off the Refactoring book by Martin Fowler
|
||||||
-- https://github.com/ThePrimeagen/refactoring.nvim
|
-- https://github.com/ThePrimeagen/refactoring.nvim
|
||||||
{ 'ThePrimeagen/refactoring.nvim', dependencies = { 'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter' }, opts = {} },
|
{
|
||||||
|
'ThePrimeagen/refactoring.nvim',
|
||||||
|
version = '*',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim', 'nvim-treesitter/nvim-treesitter' },
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
-- All the npm/yarn/pnpm commands I don't want to type
|
-- All the npm/yarn/pnpm commands I don't want to type
|
||||||
-- https://github.com/vuki656/package-info.nvim
|
-- https://github.com/vuki656/package-info.nvim
|
||||||
{ 'vuki656/package-info.nvim', dependencies = { 'MunifTanjim/nui.nvim' } },
|
{
|
||||||
|
'vuki656/package-info.nvim',
|
||||||
|
version = '*',
|
||||||
|
dependencies = { 'MunifTanjim/nui.nvim' },
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
-- Add/change/delete surrounding delimiter pairs with ease. Written with ❤️ in Lua.
|
-- Add/change/delete surrounding delimiter pairs with ease. Written with ❤️ in Lua.
|
||||||
-- https://github.com/kylechui/nvim-surround
|
-- https://github.com/kylechui/nvim-surround
|
||||||
{ 'kylechui/nvim-surround', version = '*', event = 'VeryLazy' },
|
{
|
||||||
|
'kylechui/nvim-surround',
|
||||||
|
version = '*',
|
||||||
|
event = 'VeryLazy',
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
-- Highlight, list and search todo comments in your projects
|
-- Highlight, list and search todo comments in your projects
|
||||||
-- https://github.com/folke/todo-comments.nvim
|
-- https://github.com/folke/todo-comments.nvim
|
||||||
{ 'folke/todo-comments.nvim', dependencies = { 'nvim-lua/plenary.nvim' }, opts = {} },
|
{
|
||||||
|
'folke/todo-comments.nvim',
|
||||||
|
version = '*',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
-- Commenting
|
-- Commenting
|
||||||
-- "gc" to comment visual regions/lines
|
-- "gc" to comment visual regions/lines
|
||||||
-- https://github.com/numToStr/Comment.nvim
|
-- https://github.com/numToStr/Comment.nvim
|
||||||
{ 'numToStr/Comment.nvim', event = { 'BufRead', 'BufNewFile' }, opts = {} },
|
{
|
||||||
|
'numToStr/Comment.nvim',
|
||||||
|
version = '*',
|
||||||
|
event = { 'BufRead', 'BufNewFile' },
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
-- Detect tabstop and shiftwidth automatically
|
-- Detect tabstop and shiftwidth automatically
|
||||||
-- https://github.com/tpope/vim-sleuth
|
-- https://github.com/tpope/vim-sleuth
|
||||||
|
|||||||
@@ -1,62 +1,62 @@
|
|||||||
-- Quickstart configs for Nvim LSP
|
-- Quick start configs for Nvim LSP
|
||||||
-- https://github.com/neovim/nvim-lspconfig
|
-- https://github.com/neovim/nvim-lspconfig
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
lazy = false,
|
lazy = false,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Garbage collector that stops inactive LSP clients to free RAM
|
|
||||||
-- https://github.com/Zeioth/garbage-day.nvim
|
|
||||||
{
|
|
||||||
'zeioth/garbage-day.nvim',
|
|
||||||
dependencies = 'neovim/nvim-lspconfig',
|
|
||||||
event = 'VeryLazy',
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- improve neovim lsp experience
|
|
||||||
-- https://github.com/nvimdev/lspsaga.nvim
|
|
||||||
{
|
|
||||||
'nvimdev/lspsaga.nvim',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-treesitter/nvim-treesitter', -- optional
|
|
||||||
'nvim-tree/nvim-web-devicons', -- optional
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
code_action = {
|
|
||||||
show_server_name = true,
|
|
||||||
},
|
|
||||||
diagnostic = {
|
|
||||||
keys = {
|
|
||||||
quit = { 'q', '<ESC>' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- ── Mason and LSPConfig integration ─────────────────────────────────
|
-- ── Mason and LSPConfig integration ─────────────────────────────────
|
||||||
-- Automatically install LSPs to stdpath for neovim
|
-- Automatically install LSPs to stdpath for neovim
|
||||||
|
|
||||||
-- Portable package manager for Neovim that runs everywhere Neovim runs.
|
-- Portable package manager for Neovim that runs everywhere Neovim runs.
|
||||||
-- Easily install and manage LSP servers, DAP servers, linters,
|
-- Easily install and manage LSP servers, DAP servers, linters, and formatters.
|
||||||
-- and formatters.
|
|
||||||
-- https://github.com/williamboman/mason.nvim
|
-- https://github.com/williamboman/mason.nvim
|
||||||
{ 'williamboman/mason.nvim' },
|
{
|
||||||
|
'williamboman/mason.nvim',
|
||||||
|
cmd = 'Mason',
|
||||||
|
run = ':MasonUpdate',
|
||||||
|
},
|
||||||
|
-- Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim.
|
||||||
|
-- https://github.com/williamboman/mason-lspconfig.nvim
|
||||||
{ 'williamboman/mason-lspconfig.nvim' },
|
{ 'williamboman/mason-lspconfig.nvim' },
|
||||||
|
-- Install and upgrade third party tools automatically
|
||||||
|
-- https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim
|
||||||
{ 'WhoIsSethDaniel/mason-tool-installer.nvim' },
|
{ 'WhoIsSethDaniel/mason-tool-installer.nvim' },
|
||||||
|
|
||||||
-- ── Linting ─────────────────────────────────────────────────────────
|
-- ── Formatting ──────────────────────────────────────────────────────
|
||||||
-- An asynchronous linter plugin for Neovim complementary to the
|
-- Lightweight yet powerful formatter plugin for Neovim
|
||||||
-- built-in Language Server Protocol support.
|
-- https://github.com/stevearc/conform.nvim
|
||||||
-- https://github.com/mfussenegger/nvim-lint
|
|
||||||
{
|
{
|
||||||
'mfussenegger/nvim-lint',
|
'stevearc/conform.nvim',
|
||||||
event = { 'BufReadPre', 'BufNewFile' },
|
event = { 'BufWritePre' },
|
||||||
|
cmd = { 'ConformInfo' },
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { 'stylua' },
|
||||||
|
-- Conform will run multiple formatters sequentially
|
||||||
|
-- python = { 'isort', 'black', lsp_format = 'fallback' },
|
||||||
|
-- You can customize some of the format options for the filetype (:help conform.format)
|
||||||
|
-- rust = { 'rustfmt', lsp_format = 'fallback' },
|
||||||
|
-- Conform will run the first available formatter
|
||||||
|
javascript = { 'prettier', 'eslint', stop_after_first = true },
|
||||||
|
},
|
||||||
|
notify_on_error = true,
|
||||||
|
format_on_save = function(bufnr)
|
||||||
|
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||||
|
-- have a well standardized coding style. You can add additional
|
||||||
|
-- languages here or re-enable it for the disabled ones.
|
||||||
|
local disable_filetypes = { c = true, cpp = true }
|
||||||
|
return {
|
||||||
|
-- formatters = { 'injected' },
|
||||||
|
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||||
|
timeout_ms = 500,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
-- Extension to mason.nvim that makes it
|
-- Automatically install formatters registered with conform.nvim via mason.nvim
|
||||||
-- easier to use nvim-lint with mason.nvim
|
-- https://github.com/zapling/mason-conform.nvim
|
||||||
-- https://github.com/rshkarin/mason-nvim-lint
|
{ 'zapling/mason-conform.nvim' },
|
||||||
{ 'rshkarin/mason-nvim-lint' },
|
|
||||||
|
|
||||||
-- ── Misc ────────────────────────────────────────────────────────────
|
-- ── Misc ────────────────────────────────────────────────────────────
|
||||||
-- vscode-like pictograms for neovim lsp completion items
|
-- vscode-like pictograms for neovim lsp completion items
|
||||||
@@ -83,13 +83,13 @@ return {
|
|||||||
local on_attach = function(_, bufnr)
|
local on_attach = function(_, bufnr)
|
||||||
-- Create a command `:Format` local to the LSP buffer
|
-- Create a command `:Format` local to the LSP buffer
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||||
if vim.lsp.buf.format then
|
require('conform').format { formatters = { 'injected' }, async = true, lsp_fallback = true }
|
||||||
vim.lsp.buf.format()
|
|
||||||
elseif vim.lsp.buf.formatting then
|
-- if vim.lsp.buf.format then
|
||||||
vim.lsp.buf.formatting()
|
-- vim.lsp.buf.format()
|
||||||
else
|
-- elseif vim.lsp.buf.formatting then
|
||||||
require('conform').format { async = true, lsp_fallback = true }
|
-- vim.lsp.buf.formatting()
|
||||||
end
|
-- end
|
||||||
end, { desc = 'Format current buffer with LSP' })
|
end, { desc = 'Format current buffer with LSP' })
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -99,37 +99,13 @@ return {
|
|||||||
-- ── Enable the following language servers ───────────────────────────
|
-- ── Enable the following language servers ───────────────────────────
|
||||||
-- :help lspconfig-all for all pre-configured LSPs
|
-- :help lspconfig-all for all pre-configured LSPs
|
||||||
local servers = {
|
local servers = {
|
||||||
ast_grep = {},
|
|
||||||
|
|
||||||
actionlint = {}, -- GitHub Actions
|
|
||||||
ansiblels = {}, -- Ansible
|
|
||||||
bashls = {}, -- Bash
|
bashls = {}, -- Bash
|
||||||
-- csharp_ls = {}, -- C#, requires dotnet executable
|
-- csharp_ls = {}, -- C#, requires dotnet executable
|
||||||
css_variables = {}, -- CSS
|
|
||||||
cssls = {}, -- CSS
|
|
||||||
docker_compose_language_service = {}, -- Docker compose
|
|
||||||
dockerls = {}, -- Docker
|
|
||||||
eslint = {}, -- ESLint
|
|
||||||
gitlab_ci_ls = {}, -- GitLab CI
|
|
||||||
gopls = {}, -- Go
|
gopls = {}, -- Go
|
||||||
html = {}, -- HTML
|
html = {}, -- HTML
|
||||||
intelephense = {}, -- PHP
|
intelephense = {}, -- PHP
|
||||||
pest_ls = {}, -- Pest (PHP)
|
|
||||||
phpactor = {}, -- PHP
|
|
||||||
psalm = {}, -- PHP
|
|
||||||
pyright = {}, -- Python
|
|
||||||
semgrep = {}, -- Security
|
|
||||||
shellcheck = {}, -- Shell scripts
|
|
||||||
shfmt = {}, -- Shell scripts formatting
|
|
||||||
stylelint_lsp = {}, -- Stylelint for S/CSS
|
|
||||||
stylua = {}, -- Used to format Lua code
|
|
||||||
tailwindcss = {}, -- Tailwind CSS
|
tailwindcss = {}, -- Tailwind CSS
|
||||||
terraformls = {}, -- Terraform
|
ts_ls = {}, -- TypeScript
|
||||||
tflint = {}, -- Terraform
|
|
||||||
ts_ls = {}, -- TypeScript/JS
|
|
||||||
typos_lsp = {}, -- Better writing
|
|
||||||
volar = {}, -- Vue
|
|
||||||
yamlls = {}, -- YAML
|
|
||||||
|
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
settings = {
|
settings = {
|
||||||
@@ -184,31 +160,24 @@ return {
|
|||||||
-- Mason servers should be it's own variable for mason-nvim-lint
|
-- Mason servers should be it's own variable for mason-nvim-lint
|
||||||
-- See: https://mason-registry.dev/registry/list
|
-- See: https://mason-registry.dev/registry/list
|
||||||
local mason_servers = {
|
local mason_servers = {
|
||||||
'actionlint',
|
|
||||||
'ansible-language-server',
|
|
||||||
'ansible-lint',
|
|
||||||
'bash-language-server',
|
'bash-language-server',
|
||||||
'blade-formatter',
|
|
||||||
'clang-format',
|
'clang-format',
|
||||||
|
'codespell',
|
||||||
'commitlint',
|
'commitlint',
|
||||||
'diagnostic-languageserver',
|
'diagnostic-languageserver',
|
||||||
'docker-compose-language-service',
|
|
||||||
'dockerfile-language-server',
|
|
||||||
'editorconfig-checker',
|
'editorconfig-checker',
|
||||||
'fixjson',
|
'fixjson',
|
||||||
'flake8',
|
|
||||||
'html-lsp',
|
|
||||||
'jq',
|
|
||||||
'jsonlint',
|
'jsonlint',
|
||||||
|
'lua-language-server',
|
||||||
'luacheck',
|
'luacheck',
|
||||||
'php-cs-fixer',
|
'phpcbf',
|
||||||
'phpcs',
|
'phpcs',
|
||||||
'phpmd',
|
'phpmd',
|
||||||
'semgrep',
|
'prettier',
|
||||||
'shellcheck',
|
'shellcheck',
|
||||||
'shfmt',
|
'shfmt',
|
||||||
'stylelint',
|
|
||||||
'stylua',
|
'stylua',
|
||||||
|
'vim-language-server',
|
||||||
'vue-language-server',
|
'vue-language-server',
|
||||||
'yamllint',
|
'yamllint',
|
||||||
}
|
}
|
||||||
@@ -221,43 +190,35 @@ return {
|
|||||||
auto_update = true,
|
auto_update = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ── Ensure the servers above are installed ──────────────────────────
|
|
||||||
require('mason-lspconfig').setup {
|
|
||||||
automatic_installation = true,
|
|
||||||
ensure_installed = servers,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- nvim-cmp supports additional completion capabilities
|
-- nvim-cmp supports additional completion capabilities
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||||
|
-- Tell the server the capability of foldingRange,
|
||||||
|
-- Neovim hasn't added foldingRange to default capabilities, users must add it manually
|
||||||
|
capabilities.textDocument.foldingRange = {
|
||||||
|
dynamicRegistration = true,
|
||||||
|
lineFoldingOnly = true,
|
||||||
|
}
|
||||||
|
|
||||||
require('mason-lspconfig').setup_handlers {
|
local lspconfig_handlers = {
|
||||||
-- The first entry (without a key) will be the default handler
|
-- The first entry (without a key) will be the default handler
|
||||||
-- and will be called for each installed server that doesn't have
|
-- and will be called for each installed server that doesn't have
|
||||||
-- a dedicated handler.
|
-- a dedicated handler.
|
||||||
function(server_name) -- default handler (optional)
|
function(server_name) -- default handler (optional)
|
||||||
require('lspconfig')[server_name].setup {}
|
require('lspconfig')[server_name].setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
-- Next, you can provide a dedicated handler for specific servers.
|
-- Next, you can provide targeted overrides for specific servers.
|
||||||
-- For example, a handler override for the `rust_analyzer`:
|
['lua_ls'] = function() require('lspconfig')['lua_ls'].setup { settings = servers.lua_ls } end,
|
||||||
-- ['rust_analyzer'] = function()
|
['jsonls'] = function() require('lspconfig')['jsonls'].setup { settings = servers.jsonls } end,
|
||||||
-- require('rust-tools').setup {}
|
|
||||||
-- end,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, lsp in ipairs(servers) do
|
require('mason-lspconfig').setup {
|
||||||
require('lspconfig')[lsp].setup {
|
ensure_installed = vim.tbl_keys(servers or {}),
|
||||||
on_attach = on_attach,
|
automatic_installation = true,
|
||||||
capabilities = capabilities,
|
handlers = lspconfig_handlers,
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
require('lspconfig').lua_ls.setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
|
||||||
Lua = servers.lua_ls.settings.Lua,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
@@ -270,19 +231,158 @@ return {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- ── Setup linting ───────────────────────────────────────────────────
|
-- ── Setup formatting ────────────────────────────────────────────────
|
||||||
require('mason-nvim-lint').setup {
|
require('mason-conform').setup {
|
||||||
ensure_installed = mason_servers or {},
|
-- ignore_install = { 'prettier' }, -- List of formatters to ignore during install
|
||||||
quiet_mode = true,
|
|
||||||
}
|
}
|
||||||
local lint = require 'lint'
|
end,
|
||||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
},
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
|
||||||
group = lint_augroup,
|
-- Garbage collector that stops inactive LSP clients to free RAM
|
||||||
callback = function()
|
-- https://github.com/Zeioth/garbage-day.nvim
|
||||||
lint.try_lint()
|
{
|
||||||
|
'zeioth/garbage-day.nvim',
|
||||||
|
dependencies = 'neovim/nvim-lspconfig',
|
||||||
|
event = 'VeryLazy',
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- improve neovim lsp experience
|
||||||
|
-- https://github.com/nvimdev/lspsaga.nvim
|
||||||
|
-- https://nvimdev.github.io/lspsaga/
|
||||||
|
{
|
||||||
|
'nvimdev/lspsaga.nvim',
|
||||||
|
event = 'LspAttach',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-treesitter/nvim-treesitter', -- optional
|
||||||
|
'nvim-tree/nvim-web-devicons', -- optional
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
code_action = {
|
||||||
|
show_server_name = true,
|
||||||
|
},
|
||||||
|
diagnostic = {
|
||||||
|
keys = {
|
||||||
|
quit = { 'q', '<ESC>' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Not UFO in the sky, but an ultra fold in Neovim.
|
||||||
|
-- https://github.com/kevinhwang91/nvim-ufo/
|
||||||
|
{
|
||||||
|
'kevinhwang91/nvim-ufo',
|
||||||
|
version = '*',
|
||||||
|
dependencies = {
|
||||||
|
{ 'neovim/nvim-lspconfig' },
|
||||||
|
{ 'kevinhwang91/promise-async' },
|
||||||
|
{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
|
||||||
|
{
|
||||||
|
-- Status column plugin that provides a configurable
|
||||||
|
-- 'statuscolumn' and click handlers.
|
||||||
|
-- https://github.com/luukvbaal/statuscol.nvim
|
||||||
|
'luukvbaal/statuscol.nvim',
|
||||||
|
config = function()
|
||||||
|
local builtin = require 'statuscol.builtin'
|
||||||
|
require('statuscol').setup {
|
||||||
|
relculright = true,
|
||||||
|
segments = {
|
||||||
|
{
|
||||||
|
text = { builtin.foldfunc },
|
||||||
|
click = 'v:lua.ScFa',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sign = {
|
||||||
|
namespace = { 'diagnostic/signs' },
|
||||||
|
maxwidth = 2,
|
||||||
|
-- auto = true,
|
||||||
|
},
|
||||||
|
click = 'v:lua.ScSa',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text = { builtin.lnumfunc, ' ' },
|
||||||
|
click = 'v:lua.ScLa',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
})
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities.textDocument.foldingRange = {
|
||||||
|
dynamicRegistration = false,
|
||||||
|
lineFoldingOnly = true,
|
||||||
|
}
|
||||||
|
local language_servers = require('lspconfig').util.available_servers() -- or list servers manually like {'gopls', 'clangd'}
|
||||||
|
for _, ls in ipairs(language_servers) do
|
||||||
|
require('lspconfig')[ls].setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
-- you can add other fields for setting up lsp server in this table
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
require('ufo').setup {
|
||||||
|
open_fold_hl_timeout = 150,
|
||||||
|
close_fold_kinds_for_ft = { 'imports', 'comment' },
|
||||||
|
preview = {
|
||||||
|
win_config = {
|
||||||
|
border = { '', '─', '', '', '', '─', '', '' },
|
||||||
|
winhighlight = 'Normal:Folded',
|
||||||
|
winblend = 0,
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
scrollU = '<C-u>',
|
||||||
|
scrollD = '<C-d>',
|
||||||
|
jumpTop = '[',
|
||||||
|
jumpBot = ']',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
provider_selector = function(_, _, _) -- bufnr, filetype, buftype
|
||||||
|
return { 'treesitter', 'indent' }
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- fold_virt_text_handler
|
||||||
|
--
|
||||||
|
-- This handler is called when the fold text is too long to fit in the window.
|
||||||
|
-- It is expected to truncate the text and return a new list of virtual text.
|
||||||
|
--
|
||||||
|
---@param virtText table The current virtual text list.
|
||||||
|
---@param lnum number The line number of the first line in the fold.
|
||||||
|
---@param endLnum number The line number of the last line in the fold.
|
||||||
|
---@param width number The width of the window.
|
||||||
|
---@param truncate function Truncate function
|
||||||
|
---@return table
|
||||||
|
fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate)
|
||||||
|
local newVirtText = {}
|
||||||
|
local suffix = (' %d '):format(endLnum - lnum)
|
||||||
|
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||||
|
local targetWidth = width - sufWidth
|
||||||
|
local curWidth = 0
|
||||||
|
for _, chunk in ipairs(virtText) do
|
||||||
|
local chunkText = chunk[1]
|
||||||
|
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||||
|
if targetWidth > curWidth + chunkWidth then
|
||||||
|
table.insert(newVirtText, chunk)
|
||||||
|
else
|
||||||
|
chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||||
|
local hlGroup = chunk[2]
|
||||||
|
table.insert(newVirtText, { chunkText, hlGroup })
|
||||||
|
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||||
|
-- str width returned from truncate() may less than 2nd argument, need padding
|
||||||
|
if curWidth + chunkWidth < targetWidth then
|
||||||
|
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
curWidth = curWidth + chunkWidth
|
||||||
|
end
|
||||||
|
table.insert(newVirtText, { suffix, 'MoreMsg' })
|
||||||
|
return newVirtText
|
||||||
|
end,
|
||||||
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,33 +6,67 @@ return {
|
|||||||
'kyazdani42/nvim-web-devicons',
|
'kyazdani42/nvim-web-devicons',
|
||||||
'folke/noice.nvim',
|
'folke/noice.nvim',
|
||||||
},
|
},
|
||||||
opts = {
|
config = function()
|
||||||
options = {
|
local function diff_source()
|
||||||
icons_enabled = true,
|
local gitsigns = vim.b.gitsigns_status_dict
|
||||||
component_separators = '|',
|
if gitsigns then
|
||||||
section_separators = '',
|
return {
|
||||||
},
|
added = gitsigns.added,
|
||||||
-- Sections
|
modified = gitsigns.changed,
|
||||||
-- +-------------------------------------------------+
|
removed = gitsigns.removed,
|
||||||
-- | A | B | C X | Y | Z |
|
}
|
||||||
-- +-------------------------------------------------+
|
end
|
||||||
sections = {
|
end
|
||||||
lualine_b = {
|
|
||||||
{
|
|
||||||
'buffers',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
lualine_x = {
|
require('lualine').setup {
|
||||||
{
|
options = {
|
||||||
require('noice').api.statusline.mode.get,
|
icons_enabled = true,
|
||||||
cond = require('noice').api.statusline.mode.has,
|
component_separators = '|',
|
||||||
|
section_separators = '',
|
||||||
|
},
|
||||||
|
-- Sections
|
||||||
|
-- +-------------------------------------------------+
|
||||||
|
-- | A | B | C X | Y | Z |
|
||||||
|
-- +-------------------------------------------------+
|
||||||
|
sections = {
|
||||||
|
lualine_a = {
|
||||||
|
'mode',
|
||||||
},
|
},
|
||||||
{
|
lualine_b = {
|
||||||
require('noice').api.status.command.get,
|
{ 'b:gitsigns_head', icon = '' },
|
||||||
cond = require('noice').api.status.command.has,
|
{ 'diff', source = diff_source },
|
||||||
|
'diagnostics',
|
||||||
|
},
|
||||||
|
lualine_c = {
|
||||||
|
'buffers',
|
||||||
|
-- 'filename',
|
||||||
|
},
|
||||||
|
lualine_x = {
|
||||||
|
-- 'fileformat',
|
||||||
|
'filetype',
|
||||||
|
},
|
||||||
|
lualine_y = {
|
||||||
|
-- 'progress'
|
||||||
|
},
|
||||||
|
lualine_z = {
|
||||||
|
{
|
||||||
|
require('noice').api.statusline.mode.get,
|
||||||
|
cond = require('noice').api.statusline.mode.has,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
require('noice').api.status.command.get,
|
||||||
|
cond = require('noice').api.status.command.has,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
inactive_sections = {
|
||||||
},
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { 'filename' },
|
||||||
|
lualine_x = { 'location' },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,6 @@
|
|||||||
-- for messages, cmdline and the popupmenu.
|
-- for messages, cmdline and the popupmenu.
|
||||||
-- https://github.com/folke/noice.nvim
|
-- https://github.com/folke/noice.nvim
|
||||||
|
|
||||||
vim.g.noice_ignored_filetypes = {
|
|
||||||
'fugitiveblame',
|
|
||||||
'fugitive',
|
|
||||||
'gitcommit',
|
|
||||||
'noice',
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'folke/noice.nvim',
|
'folke/noice.nvim',
|
||||||
lazy = false,
|
lazy = false,
|
||||||
|
|||||||
@@ -41,12 +41,18 @@ return {
|
|||||||
:find()
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>hw', function()
|
vim.keymap.set(
|
||||||
toggle_telescope(harpoon:list())
|
'n',
|
||||||
end, { desc = 'Open harpoon window with telescope' })
|
'<leader>hw',
|
||||||
vim.keymap.set('n', '<leader>ht', function()
|
function() toggle_telescope(harpoon:list()) end,
|
||||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
{ desc = 'Open harpoon window with telescope' }
|
||||||
end, { desc = 'Open Harpoon Quick menu' })
|
)
|
||||||
|
vim.keymap.set(
|
||||||
|
'n',
|
||||||
|
'<leader>ht',
|
||||||
|
function() harpoon.ui:toggle_quick_menu(harpoon:list()) end,
|
||||||
|
{ desc = 'Open Harpoon Quick menu' }
|
||||||
|
)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- A Telescope picker to quickly access configurations
|
-- A Telescope picker to quickly access configurations
|
||||||
@@ -86,6 +92,12 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
extensions = {
|
||||||
|
lazy_plugins = {
|
||||||
|
-- Must be a valid path to the file containing the lazy spec and setup() call.
|
||||||
|
lazy_config = vim.fn.stdpath 'config' .. '/init.lua',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Load extensions
|
-- Load extensions
|
||||||
|
|||||||
@@ -2,9 +2,7 @@
|
|||||||
-- https://github.com/nvim-treesitter/nvim-treesitter
|
-- https://github.com/nvim-treesitter/nvim-treesitter
|
||||||
return {
|
return {
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
build = function()
|
build = function() pcall(require('nvim-treesitter.install').update { with_sync = true }) end,
|
||||||
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
|
||||||
end,
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
-- Not UFO in the sky, but an ultra fold in Neovim.
|
|
||||||
-- https://github.com/kevinhwang91/nvim-ufo/
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
'kevinhwang91/nvim-ufo',
|
|
||||||
version = '*',
|
|
||||||
dependencies = {
|
|
||||||
{ 'kevinhwang91/promise-async' },
|
|
||||||
{ 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' },
|
|
||||||
{
|
|
||||||
-- Status column plugin that provides a configurable
|
|
||||||
-- 'statuscolumn' and click handlers.
|
|
||||||
-- https://github.com/luukvbaal/statuscol.nvim
|
|
||||||
'luukvbaal/statuscol.nvim',
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
open_fold_hl_timeout = 150,
|
|
||||||
close_fold_kinds_for_ft = { 'imports', 'comment' },
|
|
||||||
preview = {
|
|
||||||
win_config = {
|
|
||||||
border = { '', '─', '', '', '', '─', '', '' },
|
|
||||||
winhighlight = 'Normal:Folded',
|
|
||||||
winblend = 0,
|
|
||||||
},
|
|
||||||
mappings = {
|
|
||||||
scrollU = '<C-u>',
|
|
||||||
scrollD = '<C-d>',
|
|
||||||
jumpTop = '[',
|
|
||||||
jumpBot = ']',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
provider_selector = function(_, _, _) -- bufnr, filetype, buftype
|
|
||||||
return { 'treesitter', 'indent' }
|
|
||||||
end,
|
|
||||||
-- fold_virt_text_handler
|
|
||||||
--
|
|
||||||
-- This handler is called when the fold text is too long to fit in the window.
|
|
||||||
-- It is expected to truncate the text and return a new list of virtual text.
|
|
||||||
--
|
|
||||||
---@param virtText table The current virtual text list.
|
|
||||||
---@param lnum number The line number of the first line in the fold.
|
|
||||||
---@param endLnum number The line number of the last line in the fold.
|
|
||||||
---@param width number The width of the window.
|
|
||||||
---@param truncate function Truncate function
|
|
||||||
---@return table
|
|
||||||
fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate)
|
|
||||||
local newVirtText = {}
|
|
||||||
local suffix = (' %d '):format(endLnum - lnum)
|
|
||||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
|
||||||
local targetWidth = width - sufWidth
|
|
||||||
local curWidth = 0
|
|
||||||
for _, chunk in ipairs(virtText) do
|
|
||||||
local chunkText = chunk[1]
|
|
||||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
|
||||||
if targetWidth > curWidth + chunkWidth then
|
|
||||||
table.insert(newVirtText, chunk)
|
|
||||||
else
|
|
||||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
|
||||||
local hlGroup = chunk[2]
|
|
||||||
table.insert(newVirtText, { chunkText, hlGroup })
|
|
||||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
|
||||||
-- str width returned from truncate() may less than 2nd argument, need padding
|
|
||||||
if curWidth + chunkWidth < targetWidth then
|
|
||||||
suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth)
|
|
||||||
end
|
|
||||||
break
|
|
||||||
end
|
|
||||||
curWidth = curWidth + chunkWidth
|
|
||||||
end
|
|
||||||
table.insert(newVirtText, { suffix, 'MoreMsg' })
|
|
||||||
return newVirtText
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -4,9 +4,7 @@ return {
|
|||||||
{
|
{
|
||||||
'folke/tokyonight.nvim',
|
'folke/tokyonight.nvim',
|
||||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||||
init = function()
|
init = function() vim.cmd.colorscheme(vim.g.colors_theme) end,
|
||||||
vim.cmd.colorscheme(vim.g.colors_theme)
|
|
||||||
end,
|
|
||||||
opts = {
|
opts = {
|
||||||
transparent = true,
|
transparent = true,
|
||||||
},
|
},
|
||||||
@@ -29,6 +27,58 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- vim dashboard
|
||||||
|
-- https://github.com/nvimdev/dashboard-nvim
|
||||||
|
{
|
||||||
|
'nvimdev/dashboard-nvim',
|
||||||
|
event = 'VimEnter',
|
||||||
|
config = function()
|
||||||
|
require('dashboard').setup {
|
||||||
|
config = {
|
||||||
|
disable_move = true,
|
||||||
|
week_header = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
shortcut = {
|
||||||
|
{
|
||||||
|
desc = ' Lazy Update',
|
||||||
|
group = '@property',
|
||||||
|
action = 'Lazy update',
|
||||||
|
key = 'u',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon = ' ',
|
||||||
|
icon_hl = '@variable',
|
||||||
|
desc = 'Files',
|
||||||
|
group = 'Label',
|
||||||
|
action = 'Telescope find_files',
|
||||||
|
key = 'f',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
desc = ' Marks',
|
||||||
|
group = 'DiagnosticHint',
|
||||||
|
action = 'Telescope harpoon marks',
|
||||||
|
key = 'a',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
desc = '⚑ TODO',
|
||||||
|
group = 'DiagnosticOptions',
|
||||||
|
action = 'TodoTelescope',
|
||||||
|
key = 't',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
desc = '🔍 Search',
|
||||||
|
group = 'Number',
|
||||||
|
action = 'Telescope live_grep',
|
||||||
|
key = 's',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
dependencies = { { 'nvim-tree/nvim-web-devicons' } },
|
||||||
|
},
|
||||||
|
|
||||||
-- Remove all background colors to make nvim transparent
|
-- Remove all background colors to make nvim transparent
|
||||||
-- https://github.com/xiyaowong/nvim-transparent
|
-- https://github.com/xiyaowong/nvim-transparent
|
||||||
{ 'xiyaowong/nvim-transparent', opts = {} },
|
{ 'xiyaowong/nvim-transparent', opts = {} },
|
||||||
@@ -40,7 +90,21 @@ return {
|
|||||||
|
|
||||||
-- Indent guides for Neovim
|
-- Indent guides for Neovim
|
||||||
-- https://github.com/lukas-reineke/indent-blankline.nvim
|
-- https://github.com/lukas-reineke/indent-blankline.nvim
|
||||||
{ 'lukas-reineke/indent-blankline.nvim', main = 'ibl', opts = {} },
|
{
|
||||||
|
'lukas-reineke/indent-blankline.nvim',
|
||||||
|
main = 'ibl',
|
||||||
|
config = function()
|
||||||
|
require('ibl').setup {
|
||||||
|
indent = {
|
||||||
|
char = '│',
|
||||||
|
},
|
||||||
|
exclude = {
|
||||||
|
filetypes = { 'terminal', 'dashboard' },
|
||||||
|
buftypes = { 'dashboard' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- Git integration for buffers
|
-- Git integration for buffers
|
||||||
-- https://github.com/lewis6991/gitsigns.nvim
|
-- https://github.com/lewis6991/gitsigns.nvim
|
||||||
@@ -67,22 +131,14 @@ return {
|
|||||||
|
|
||||||
-- Navigation
|
-- Navigation
|
||||||
map('n', 'gn', function()
|
map('n', 'gn', function()
|
||||||
if vim.wo.diff then
|
if vim.wo.diff then return ']c' end
|
||||||
return ']c'
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
end
|
|
||||||
vim.schedule(function()
|
|
||||||
gs.next_hunk()
|
|
||||||
end)
|
|
||||||
return '<Ignore>'
|
return '<Ignore>'
|
||||||
end, { expr = true })
|
end, { expr = true })
|
||||||
|
|
||||||
map('n', 'gp', function()
|
map('n', 'gp', function()
|
||||||
if vim.wo.diff then
|
if vim.wo.diff then return '[c' end
|
||||||
return '[c'
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
end
|
|
||||||
vim.schedule(function()
|
|
||||||
gs.prev_hunk()
|
|
||||||
end)
|
|
||||||
return '<Ignore>'
|
return '<Ignore>'
|
||||||
end, { expr = true })
|
end, { expr = true })
|
||||||
end,
|
end,
|
||||||
@@ -142,7 +198,6 @@ return {
|
|||||||
{
|
{
|
||||||
'bennypowers/nvim-regexplainer',
|
'bennypowers/nvim-regexplainer',
|
||||||
event = 'BufEnter',
|
event = 'BufEnter',
|
||||||
lazy = false,
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
'MunifTanjim/nui.nvim',
|
'MunifTanjim/nui.nvim',
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ return {
|
|||||||
return require('which-key.extras').expand.buf()
|
return require('which-key.extras').expand.buf()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ '<leader>bk', '<cmd>blast<cr>', desc = 'Buffer: Last', mode = 'n' },
|
{ '<leader>bk', '<cmd>blast<cr>', desc = 'Buffer: Last' },
|
||||||
{ '<leader>bj', '<cmd>bfirst<cr>', desc = 'Buffer: First', mode = 'n' },
|
{ '<leader>bj', '<cmd>bfirst<cr>', desc = 'Buffer: First' },
|
||||||
{ '<leader>bh', '<cmd>bprev<cr>', desc = 'Buffer: Prev', mode = 'n' },
|
{ '<leader>bh', '<cmd>bprev<cr>', desc = 'Buffer: Prev' },
|
||||||
{ '<leader>bl', '<cmd>bnext<cr>', desc = 'Buffer: Next', mode = 'n' },
|
{ '<leader>bl', '<cmd>bnext<cr>', desc = 'Buffer: Next' },
|
||||||
{ '<leader>bd', '<cmd>Bdelete<cr>', desc = 'Buffer: Delete', mode = 'n' },
|
{ '<leader>bd', '<cmd>Bdelete<cr>', desc = 'Buffer: Delete' },
|
||||||
{ '<leader>bw', '<cmd>Bwipeout<cr>', desc = 'Buffer: Wipeout', mode = 'n' },
|
{ '<leader>bw', '<cmd>Bwipeout<cr>', desc = 'Buffer: Wipeout' },
|
||||||
|
|
||||||
-- ── Code ────────────────────────────────────────────────────────────
|
-- ── Code ────────────────────────────────────────────────────────────
|
||||||
{ '<leader>c', group = '[c] Code' },
|
{ '<leader>c', group = '[c] Code' },
|
||||||
@@ -52,26 +52,56 @@ return {
|
|||||||
{ '<leader>cni', '<cmd>lua require("package-info").install()<cr>', desc = 'Install package' },
|
{ '<leader>cni', '<cmd>lua require("package-info").install()<cr>', desc = 'Install package' },
|
||||||
{ '<leader>cns', '<cmd>lua require("package-info").show({ force = true })<cr>', desc = 'Show package info' },
|
{ '<leader>cns', '<cmd>lua require("package-info").show({ force = true })<cr>', desc = 'Show package info' },
|
||||||
{ '<leader>cnu', '<cmd>lua require("package-info").change_version()<cr>', desc = 'Change version' },
|
{ '<leader>cnu', '<cmd>lua require("package-info").change_version()<cr>', desc = 'Change version' },
|
||||||
|
|
||||||
-- ── Code: Refactoring ───────────────────────────────────────────────
|
-- ── Code: Refactoring ───────────────────────────────────────────────
|
||||||
{ '<leader>cx', group = '[x] Refactoring' },
|
{ '<leader>cx', group = '[x] Refactoring' },
|
||||||
{
|
{
|
||||||
mode = { 'x' },
|
mode = { 'x' },
|
||||||
-- Extract function supports only visual mode
|
-- Extract function supports only visual mode
|
||||||
{ '<leader>cxe', "<cmd>lua require('refactoring').refactor('Extract Function')<cr>", desc = 'Extract Function' },
|
{
|
||||||
{ '<leader>cxf', "<cmd>lua require('refactoring').refactor('Extract Function To File')<cr>", desc = 'Extract Function to File' },
|
'<leader>cxe',
|
||||||
|
"<cmd>lua require('refactoring').refactor('Extract Function')<cr>",
|
||||||
|
desc = 'Extract Function',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>cxf',
|
||||||
|
"<cmd>lua require('refactoring').refactor('Extract Function To File')<cr>",
|
||||||
|
desc = 'Extract Function to File',
|
||||||
|
},
|
||||||
-- Extract variable supports only visual mode
|
-- Extract variable supports only visual mode
|
||||||
{ '<leader>cxv', "<cmd>lua require('refactoring').refactor('Extract Variable')<cr>", desc = 'Extract Variable' },
|
{
|
||||||
|
'<leader>cxv',
|
||||||
|
"<cmd>lua require('refactoring').refactor('Extract Variable')<cr>",
|
||||||
|
desc = 'Extract Variable',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
-- Inline func supports only normal
|
-- Inline func supports only normal
|
||||||
{ '<leader>cxi', "<cmd>lua require('refactoring').refactor('Inline Function')<cr>", desc = 'Inline Function' },
|
{
|
||||||
|
'<leader>cxi',
|
||||||
|
"<cmd>lua require('refactoring').refactor('Inline Function')<cr>",
|
||||||
|
desc = 'Inline Function',
|
||||||
|
},
|
||||||
-- Extract block supports only normal mode
|
-- Extract block supports only normal mode
|
||||||
{ '<leader>cxb', "<cmd>lua require('refactoring').refactor('Extract Block')<cr>", desc = 'Extract Block' },
|
{
|
||||||
{ '<leader>cxbf', "<cmd>lua require('refactoring').refactor('Extract Block To File')<cr>", desc = 'Extract Block to File' },
|
'<leader>cxb',
|
||||||
|
"<cmd>lua require('refactoring').refactor('Extract Block')<cr>",
|
||||||
|
desc = 'Extract Block',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>cxbf',
|
||||||
|
"<cmd>lua require('refactoring').refactor('Extract Block To File')<cr>",
|
||||||
|
desc = 'Extract Block to File',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
mode = { 'n', 'x' },
|
mode = { 'n', 'x' },
|
||||||
-- Inline var supports both normal and visual mode
|
-- Inline var supports both normal and visual mode
|
||||||
{ '<leader>cxi', "<cmd>lua require('refactoring').refactor('Inline Variable')<cr>", desc = 'Inline Variable' },
|
{
|
||||||
|
'<leader>cxi',
|
||||||
|
"<cmd>lua require('refactoring').refactor('Inline Variable')<cr>",
|
||||||
|
desc = 'Inline Variable',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- ── Code: LSPSaga ───────────────────────────────────────────────────
|
-- ── Code: LSPSaga ───────────────────────────────────────────────────
|
||||||
-- See: lua/plugins/lsp.lua
|
-- See: lua/plugins/lsp.lua
|
||||||
{ '<C-a>', '<cmd>Lspsaga term_toggle<cr>', desc = 'LSPSaga: Open Floaterm' },
|
{ '<C-a>', '<cmd>Lspsaga term_toggle<cr>', desc = 'LSPSaga: Open Floaterm' },
|
||||||
@@ -79,7 +109,12 @@ return {
|
|||||||
{ '<leader>cci', '<cmd>Lspsaga incoming_calls<cr>', desc = 'LSPSaga: Incoming Calls' },
|
{ '<leader>cci', '<cmd>Lspsaga incoming_calls<cr>', desc = 'LSPSaga: Incoming Calls' },
|
||||||
{ '<leader>cco', '<cmd>Lspsaga outgoing_calls<cr>', desc = 'LSPSaga: Outgoing Calls' },
|
{ '<leader>cco', '<cmd>Lspsaga outgoing_calls<cr>', desc = 'LSPSaga: Outgoing Calls' },
|
||||||
{ '<leader>cd', '<cmd>Lspsaga show_line_diagnostics<cr>', desc = 'LSPSaga: Show Line Diagnostics' },
|
{ '<leader>cd', '<cmd>Lspsaga show_line_diagnostics<cr>', desc = 'LSPSaga: Show Line Diagnostics' },
|
||||||
-- <leader>cf = Code Format, see: lua/plugins/autoformat.lua
|
{
|
||||||
|
'<leader>cf',
|
||||||
|
'<cmd>lua require("conform").format({ async = true, lsp_fallback = true })<cr>',
|
||||||
|
mode = { 'n', 'v' },
|
||||||
|
desc = 'Format buffer',
|
||||||
|
},
|
||||||
{ '<leader>ci', '<cmd>Lspsaga implement<cr>', desc = 'LSPSaga: Implementations' },
|
{ '<leader>ci', '<cmd>Lspsaga implement<cr>', desc = 'LSPSaga: Implementations' },
|
||||||
{ '<leader>cl', '<cmd>Lspsaga show_cursor_diagnostics<cr>', desc = 'LSPSaga: Show Cursor Diagnostics' },
|
{ '<leader>cl', '<cmd>Lspsaga show_cursor_diagnostics<cr>', desc = 'LSPSaga: Show Cursor Diagnostics' },
|
||||||
{ '<leader>cp', '<cmd>Lspsaga peek_definition<cr>', desc = 'LSPSaga: Peek Definition' },
|
{ '<leader>cp', '<cmd>Lspsaga peek_definition<cr>', desc = 'LSPSaga: Peek Definition' },
|
||||||
@@ -98,7 +133,11 @@ return {
|
|||||||
{ '<leader>do', '<cmd>lua vim.diagnostic.open_float()<CR>', desc = 'Diagnostic: Open float' },
|
{ '<leader>do', '<cmd>lua vim.diagnostic.open_float()<CR>', desc = 'Diagnostic: Open float' },
|
||||||
{ '<leader>dq', '<cmd>lua vim.diagnostic.setloclist()<CR>', desc = 'Diagnostic: Set loc list' },
|
{ '<leader>dq', '<cmd>lua vim.diagnostic.setloclist()<CR>', desc = 'Diagnostic: Set loc list' },
|
||||||
{ '<leader>dr', "<cmd>lua require('dapui').open({reset = true})<CR>", desc = 'DAP: Reset' },
|
{ '<leader>dr', "<cmd>lua require('dapui').open({reset = true})<CR>", desc = 'DAP: Reset' },
|
||||||
{ '<leader>ds', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>', desc = 'LSP: Document Symbols' },
|
{
|
||||||
|
'<leader>ds',
|
||||||
|
'<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>',
|
||||||
|
desc = 'LSP: Document Symbols',
|
||||||
|
},
|
||||||
{ '<leader>dt', '<cmd>DapUiToggle', desc = 'DAP: Toggle UI' },
|
{ '<leader>dt', '<cmd>DapUiToggle', desc = 'DAP: Toggle UI' },
|
||||||
|
|
||||||
-- ── Harpoon ─────────────────────────────────────────────────────────
|
-- ── Harpoon ─────────────────────────────────────────────────────────
|
||||||
@@ -129,7 +168,11 @@ return {
|
|||||||
{ '<leader>sm', '<cmd>Telescope harpoon marks<CR>', desc = 'Harpoon Marks' },
|
{ '<leader>sm', '<cmd>Telescope harpoon marks<CR>', desc = 'Harpoon Marks' },
|
||||||
{ '<leader>sn', "<cmd>lua require('telescope').extensions.notify.notify()<CR>", desc = 'Notify' },
|
{ '<leader>sn', "<cmd>lua require('telescope').extensions.notify.notify()<CR>", desc = 'Notify' },
|
||||||
{ '<leader>so', "<cmd>lua require('telescope.builtin').oldfiles()<cr>", desc = 'Find recently Opened files' },
|
{ '<leader>so', "<cmd>lua require('telescope.builtin').oldfiles()<cr>", desc = 'Find recently Opened files' },
|
||||||
{ '<leader>sp', "<cmd>lua require('telescope').extensions.lazy_plugins.lazy_plugins()<cr>", desc = 'Find neovim/lazy configs' },
|
{
|
||||||
|
'<leader>sp',
|
||||||
|
"<cmd>lua require('telescope').extensions.lazy_plugins.lazy_plugins()<cr>",
|
||||||
|
desc = 'Find neovim/lazy configs',
|
||||||
|
},
|
||||||
{ '<leader>st', '<cmd>TodoTelescope<CR>', desc = 'Telescope: Todo' },
|
{ '<leader>st', '<cmd>TodoTelescope<CR>', desc = 'Telescope: Todo' },
|
||||||
{ '<leader>sw', "<cmd>lua require('telescope.builtin').grep_string()<cr>", desc = 'Search current Word' },
|
{ '<leader>sw', "<cmd>lua require('telescope.builtin').grep_string()<cr>", desc = 'Search current Word' },
|
||||||
|
|
||||||
@@ -144,9 +187,17 @@ return {
|
|||||||
-- ── Workspace ───────────────────────────────────────────────────────
|
-- ── Workspace ───────────────────────────────────────────────────────
|
||||||
{ '<leader>w', group = '[w] Workspace' },
|
{ '<leader>w', group = '[w] Workspace' },
|
||||||
{ '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', desc = 'LSP: Workspace Add Folder' },
|
{ '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', desc = 'LSP: Workspace Add Folder' },
|
||||||
{ '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', desc = 'LSP: Workspace List Folders' },
|
{
|
||||||
|
'<leader>wl',
|
||||||
|
'<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>',
|
||||||
|
desc = 'LSP: Workspace List Folders',
|
||||||
|
},
|
||||||
{ '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', desc = 'LSP: Workspace Remove Folder' },
|
{ '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', desc = 'LSP: Workspace Remove Folder' },
|
||||||
{ '<leader>ws', '<cmd>lua require("telescope.builtin").lsp_dynamic_workspace_symbols()<CR>', desc = 'LSP: Workspace Symbols' },
|
{
|
||||||
|
'<leader>ws',
|
||||||
|
'<cmd>lua require("telescope.builtin").lsp_dynamic_workspace_symbols()<CR>',
|
||||||
|
desc = 'LSP: Workspace Symbols',
|
||||||
|
},
|
||||||
|
|
||||||
-- ── Trouble ─────────────────────────────────────────────────────────
|
-- ── Trouble ─────────────────────────────────────────────────────────
|
||||||
{ '<leader>x', group = '[x] Trouble' },
|
{ '<leader>x', group = '[x] Trouble' },
|
||||||
@@ -156,14 +207,13 @@ return {
|
|||||||
{ '<leader>xl', '<cmd>Trouble loclist<cr>', desc = 'Toggle Loclist' },
|
{ '<leader>xl', '<cmd>Trouble loclist<cr>', desc = 'Toggle Loclist' },
|
||||||
{ '<leader>xq', '<cmd>Trouble quickfix<cr>', desc = 'Toggle Quickfix' },
|
{ '<leader>xq', '<cmd>Trouble quickfix<cr>', desc = 'Toggle Quickfix' },
|
||||||
|
|
||||||
-- ── Help & Neoconf ──────────────────────────────────────────────────
|
-- ── Help ────────────────────────────────────────────────────────────
|
||||||
{ '<leader>?', group = '[?] Help & neoconf' },
|
{ '<leader>?', group = '[?] Help & Cheat sheets' },
|
||||||
{ '<leader>?c', '<cmd>Neoconf<CR>', desc = 'Neoconf: Open' },
|
{
|
||||||
{ '<leader>?g', '<cmd>Neoconf global<CR>', desc = 'Neoconf: Global' },
|
'<leader>?w',
|
||||||
{ '<leader>?l', '<cmd>Neoconf local<CR>', desc = 'Neoconf: Local' },
|
'<cmd>lua require("which-key").show({global = false})<cr>',
|
||||||
{ '<leader>?m', '<cmd>Neoconf lsp<CR>', desc = 'Neoconf: Show merged LSP config' },
|
desc = 'Buffer Local Keymaps (which-key)',
|
||||||
{ '<leader>?s', '<cmd>Neoconf show<CR>', desc = 'Neoconf: Show merged config' },
|
},
|
||||||
{ '<leader>?w', '<cmd>lua require("which-key").show({global = false})<cr>', desc = 'Buffer Local Keymaps (which-key)' },
|
|
||||||
|
|
||||||
-- ── Misc ────────────────────────────────────────────────────────────
|
-- ── Misc ────────────────────────────────────────────────────────────
|
||||||
{ '<leader>1', '<cmd>lua require("harpoon"):list():select(1)<cr>', desc = 'harpoon to file 1' },
|
{ '<leader>1', '<cmd>lua require("harpoon"):list():select(1)<cr>', desc = 'harpoon to file 1' },
|
||||||
|
|||||||
Reference in New Issue
Block a user