mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2025-07-02 01:39:26 +00:00
[neovim] Reorganize lua packages
This commit is contained in:
31
.config/nvim/lua/plugins/autopairs.lua
Normal file
31
.config/nvim/lua/plugins/autopairs.lua
Normal file
@ -0,0 +1,31 @@
|
||||
-- Setup nvim-cmp.
|
||||
local status_ok, npairs = pcall(require, "nvim-autopairs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
npairs.setup({
|
||||
check_ts = true,
|
||||
disable_filetype = { "TelescopePrompt", "neo-tree" },
|
||||
ts_config = {
|
||||
lua = { "string", "source" },
|
||||
},
|
||||
fast_wrap = {
|
||||
map = "<M-e>",
|
||||
chars = { "{", "[", "(", '"', "'" },
|
||||
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
|
||||
offset = 0,
|
||||
end_key = "$",
|
||||
keys = "qwertyuiopzxcvbnmasdfghjkl",
|
||||
check_comma = true,
|
||||
highlight = "PmenuSel",
|
||||
highlight_grey = "LineNr",
|
||||
},
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({}))
|
12
.config/nvim/lua/plugins/autosave.lua
Normal file
12
.config/nvim/lua/plugins/autosave.lua
Normal file
@ -0,0 +1,12 @@
|
||||
local status_ok, autosave = pcall(require, "auto-save")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
autosave.setup({
|
||||
execution_message = {
|
||||
message = function()
|
||||
return ""
|
||||
end,
|
||||
},
|
||||
})
|
92
.config/nvim/lua/plugins/bufferline.lua
Normal file
92
.config/nvim/lua/plugins/bufferline.lua
Normal file
@ -0,0 +1,92 @@
|
||||
local status_ok, bufferline = pcall(require, "bufferline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
bufferline.setup({
|
||||
options = {
|
||||
close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
offsets = { { filetype = "neo-tree", text = "", padding = 1 } },
|
||||
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
|
||||
},
|
||||
highlights = {
|
||||
fill = {
|
||||
fg = { attribute = "fg", highlight = "#ff0000" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
background = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
buffer_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
close_button = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
close_button_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
tab_selected = {
|
||||
fg = { attribute = "fg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
tab = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
tab_close = {
|
||||
fg = { attribute = "fg", highlight = "TabLineSel" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
|
||||
duplicate_selected = {
|
||||
fg = { attribute = "fg", highlight = "TabLineSel" },
|
||||
bg = { attribute = "bg", highlight = "TabLineSel" },
|
||||
italic = true,
|
||||
},
|
||||
duplicate_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
italic = true,
|
||||
},
|
||||
duplicate = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
italic = true,
|
||||
},
|
||||
|
||||
modified = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
modified_selected = {
|
||||
fg = { attribute = "fg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
modified_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
separator = {
|
||||
fg = { attribute = "bg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
separator_selected = {
|
||||
fg = { attribute = "bg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
indicator_selected = {
|
||||
fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
},
|
||||
})
|
126
.config/nvim/lua/plugins/cmp.lua
Normal file
126
.config/nvim/lua/plugins/cmp.lua
Normal file
@ -0,0 +1,126 @@
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
if not snip_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
local check_backspace = function()
|
||||
local col = vim.fn.col(".") - 1
|
||||
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
|
||||
end
|
||||
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
}
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<C-e>"] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
-- Accept currently selected item. If none selected, `select` first item.
|
||||
-- Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif check_backspace() then
|
||||
fallback()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
}),
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
vim_item.kind = kind_icons[vim_item.kind]
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "",
|
||||
luasnip = "",
|
||||
buffer = "",
|
||||
path = "",
|
||||
emoji = "",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
},
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
})
|
6
.config/nvim/lua/plugins/comment.lua
Normal file
6
.config/nvim/lua/plugins/comment.lua
Normal file
@ -0,0 +1,6 @@
|
||||
local status_ok, comment = pcall(require, "Comment")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
comment.setup({})
|
33
.config/nvim/lua/plugins/dap.lua
Normal file
33
.config/nvim/lua/plugins/dap.lua
Normal file
@ -0,0 +1,33 @@
|
||||
local dap_status_ok, dap = pcall(require, "dap")
|
||||
if not dap_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local dap_ui_status_ok, dapui = pcall(require, "dapui")
|
||||
if not dap_ui_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local dap_install_status_ok, dap_install = pcall(require, "dap-install")
|
||||
if not dap_install_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
dap_install.config("python", {})
|
||||
-- add other configs here
|
||||
|
||||
-- dapui.setup({})
|
||||
|
||||
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" })
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
8
.config/nvim/lua/plugins/diffview.lua
Normal file
8
.config/nvim/lua/plugins/diffview.lua
Normal file
@ -0,0 +1,8 @@
|
||||
local status_ok, diffview = pcall(require, "diffview")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
diffview.setup({})
|
||||
|
||||
vim.opt.fillchars = "diff: "
|
44
.config/nvim/lua/plugins/gitsigns.lua
Normal file
44
.config/nvim/lua/plugins/gitsigns.lua
Normal file
@ -0,0 +1,44 @@
|
||||
local status_ok, gitsigns = pcall(require, "gitsigns")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
gitsigns.setup({
|
||||
signs = {
|
||||
add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
|
||||
change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
||||
delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||
topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||
changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
||||
},
|
||||
signcolumn = true,
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true,
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil,
|
||||
preview_config = {
|
||||
border = "rounded",
|
||||
style = "minimal",
|
||||
relative = "cursor",
|
||||
row = 0,
|
||||
col = 1,
|
||||
},
|
||||
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
map({ "n", "v" }, "<leader>hs", ":Gitsigns stage_hunk<CR>")
|
||||
map({ "n", "v" }, "<leader>hr", ":Gitsigns reset_hunk<CR>")
|
||||
map("n", "<leader>hR", gs.reset_buffer)
|
||||
end,
|
||||
})
|
12
.config/nvim/lua/plugins/go.lua
Normal file
12
.config/nvim/lua/plugins/go.lua
Normal file
@ -0,0 +1,12 @@
|
||||
local status_ok, go = pcall(require, "go")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
go.setup({
|
||||
icons = { breakpoint = "", currentpos = "🏃" },
|
||||
fillstruct = "fillstruct",
|
||||
})
|
||||
|
||||
vim.cmd("autocmd FileType go nmap <Leader>gf :lua require('go.format').goimport()<CR>")
|
||||
vim.api.nvim_exec([[ autocmd BufWritePre *.go :silent! lua require('go.format').goimport() ]], false)
|
32
.config/nvim/lua/plugins/illuminate.lua
Normal file
32
.config/nvim/lua/plugins/illuminate.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local status_ok, illuminate = pcall(require, "illuminate")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<a-n>", '<cmd>lua require"illuminate".next_reference{wrap=true}<cr>', { noremap = true })
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<a-p>",
|
||||
'<cmd>lua require"illuminate".next_reference{reverse=true,wrap=true}<cr>',
|
||||
{ noremap = true }
|
||||
)
|
||||
illuminate.configure({
|
||||
providers = {
|
||||
"lsp",
|
||||
"treesitter",
|
||||
"regex",
|
||||
},
|
||||
delay = 200,
|
||||
filetypes_denylist = {
|
||||
"neo-tree",
|
||||
"packer",
|
||||
"Trouble",
|
||||
"TelescopePrompt",
|
||||
},
|
||||
filetypes_allowlist = {},
|
||||
modes_denylist = {},
|
||||
modes_allowlist = {},
|
||||
providers_regex_syntax_denylist = {},
|
||||
providers_regex_syntax_allowlist = {},
|
||||
under_cursor = true,
|
||||
})
|
6
.config/nvim/lua/plugins/impatient.lua
Normal file
6
.config/nvim/lua/plugins/impatient.lua
Normal file
@ -0,0 +1,6 @@
|
||||
local status_ok, impatient = pcall(require, "impatient")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
impatient.enable_profile()
|
18
.config/nvim/lua/plugins/indentline.lua
Normal file
18
.config/nvim/lua/plugins/indentline.lua
Normal file
@ -0,0 +1,18 @@
|
||||
local status_ok, indent_blankline = pcall(require, "indent_blankline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
indent_blankline.setup({
|
||||
char = "▏",
|
||||
show_trailing_blankline_indent = false,
|
||||
show_first_indent_level = true,
|
||||
use_treesitter = true,
|
||||
show_current_context = true,
|
||||
buftype_exclude = { "terminal", "nofile" },
|
||||
filetype_exclude = {
|
||||
"help",
|
||||
"packer",
|
||||
"neo-tree",
|
||||
},
|
||||
})
|
23
.config/nvim/lua/plugins/init.lua
Normal file
23
.config/nvim/lua/plugins/init.lua
Normal file
@ -0,0 +1,23 @@
|
||||
require("plugins.cmp")
|
||||
require("plugins.telescope")
|
||||
require("plugins.treesitter")
|
||||
require("plugins.autopairs")
|
||||
require("plugins.comment")
|
||||
require("plugins.gitsigns")
|
||||
require("plugins.neo-tree")
|
||||
require("plugins.bufferline")
|
||||
require("plugins.lualine")
|
||||
require("plugins.impatient")
|
||||
require("plugins.illuminate")
|
||||
require("plugins.indentline")
|
||||
require("plugins.lsp")
|
||||
require("plugins.dap")
|
||||
require("plugins.go")
|
||||
require("plugins.outline")
|
||||
require("plugins.wilder")
|
||||
require("plugins.trouble")
|
||||
require("plugins.autosave")
|
||||
require("plugins.markdowntoc")
|
||||
require("plugins.session-manager")
|
||||
require("plugins.diffview")
|
||||
require("plugins.sad")
|
84
.config/nvim/lua/plugins/lsp/handlers.lua
Normal file
84
.config/nvim/lua/plugins/lsp/handlers.lua
Normal file
@ -0,0 +1,84 @@
|
||||
local M = {}
|
||||
|
||||
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if not status_cmp_ok then
|
||||
return
|
||||
end
|
||||
|
||||
M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
M.capabilities = cmp_nvim_lsp.update_capabilities(M.capabilities)
|
||||
|
||||
M.setup = function()
|
||||
local signs = {
|
||||
{ name = "DiagnosticSignError", text = "" },
|
||||
{ name = "DiagnosticSignWarn", text = "" },
|
||||
{ name = "DiagnosticSignHint", text = "" },
|
||||
{ name = "DiagnosticSignInfo", text = "" },
|
||||
}
|
||||
|
||||
for _, sign in ipairs(signs) do
|
||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
||||
end
|
||||
|
||||
local config = {
|
||||
virtual_text = false,
|
||||
signs = {
|
||||
active = signs,
|
||||
},
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = true,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
}
|
||||
|
||||
vim.diagnostic.config(config)
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "rounded",
|
||||
})
|
||||
end
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opts = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_buf_set_keymap
|
||||
|
||||
keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
keymap(bufnr, "n", "D", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
||||
keymap(bufnr, "n", "<leader>lf", "<cmd>lua vim.lsp.buf.format{ async=true }<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>lj", "<cmd>lua vim.diagnostic.goto_next({buffer=0})<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>lk", "<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>ls", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
end
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
if client.name == "tsserver" then
|
||||
client.server_capabilities.document_formatting = false
|
||||
end
|
||||
|
||||
if client.name == "sumneko_lua" then
|
||||
client.server_capabilities.document_formatting = false
|
||||
end
|
||||
|
||||
lsp_keymaps(bufnr)
|
||||
local status_ok, illuminate = pcall(require, "illuminate")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
illuminate.on_attach(client)
|
||||
end
|
||||
|
||||
return M
|
10
.config/nvim/lua/plugins/lsp/init.lua
Normal file
10
.config/nvim/lua/plugins/lsp/init.lua
Normal file
@ -0,0 +1,10 @@
|
||||
local status_ok, win = pcall(require, "lspconfig.ui.windows")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require("plugins.lsp.mason")
|
||||
require("plugins.lsp.handlers").setup()
|
||||
require("plugins.lsp.null-ls")
|
||||
|
||||
win.default_options.border = "rounded"
|
51
.config/nvim/lua/plugins/lsp/mason.lua
Normal file
51
.config/nvim/lua/plugins/lsp/mason.lua
Normal file
@ -0,0 +1,51 @@
|
||||
local servers = {
|
||||
"sumneko_lua",
|
||||
"gopls",
|
||||
"pyright",
|
||||
"bashls",
|
||||
"jsonls",
|
||||
"yamlls",
|
||||
"ansiblels",
|
||||
}
|
||||
|
||||
local settings = {
|
||||
ui = {
|
||||
border = "rounded",
|
||||
icons = {
|
||||
package_installed = "◍",
|
||||
package_pending = "◍",
|
||||
package_uninstalled = "◍",
|
||||
},
|
||||
},
|
||||
log_level = vim.log.levels.INFO,
|
||||
max_concurrent_installers = 4,
|
||||
}
|
||||
|
||||
require("mason").setup(settings)
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = servers,
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not lspconfig_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local opts = {}
|
||||
|
||||
for _, server in pairs(servers) do
|
||||
opts = {
|
||||
on_attach = require("plugins.lsp.handlers").on_attach,
|
||||
capabilities = require("plugins.lsp.handlers").capabilities,
|
||||
}
|
||||
|
||||
server = vim.split(server, "@")[1]
|
||||
|
||||
local require_ok, conf_opts = pcall(require, "plugins.lsp.settings." .. server)
|
||||
if require_ok then
|
||||
opts = vim.tbl_deep_extend("force", conf_opts, opts)
|
||||
end
|
||||
|
||||
lspconfig[server].setup(opts)
|
||||
end
|
21
.config/nvim/lua/plugins/lsp/null-ls.lua
Normal file
21
.config/nvim/lua/plugins/lsp/null-ls.lua
Normal file
@ -0,0 +1,21 @@
|
||||
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not null_ls_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
local formatting = null_ls.builtins.formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
formatting.black.with({ extra_args = { "--fast" } }),
|
||||
formatting.stylua,
|
||||
diagnostics.golangci_lint.with({ extra_args = { "--fast" } }),
|
||||
diagnostics.cfn_lint,
|
||||
diagnostics.hadolint,
|
||||
diagnostics.markdownlint,
|
||||
},
|
||||
})
|
18
.config/nvim/lua/plugins/lsp/settings/sumneko_lua.lua
Normal file
18
.config/nvim/lua/plugins/lsp/settings/sumneko_lua.lua
Normal file
@ -0,0 +1,18 @@
|
||||
return {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
89
.config/nvim/lua/plugins/lualine.lua
Normal file
89
.config/nvim/lua/plugins/lualine.lua
Normal file
@ -0,0 +1,89 @@
|
||||
local status_ok, lualine = pcall(require, "lualine")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 80
|
||||
end
|
||||
|
||||
local diagnostics = {
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
sections = { "error", "warn" },
|
||||
symbols = { error = " ", warn = " " },
|
||||
colored = false,
|
||||
always_visible = false,
|
||||
}
|
||||
|
||||
local diff = {
|
||||
"diff",
|
||||
colored = false,
|
||||
symbols = { added = "", modified = "", removed = "" }, -- changes diff symbols
|
||||
cond = hide_in_width,
|
||||
}
|
||||
|
||||
local filetype = {
|
||||
"filetype",
|
||||
icons_enabled = false,
|
||||
}
|
||||
|
||||
local location = {
|
||||
"location",
|
||||
padding = 0,
|
||||
}
|
||||
|
||||
local spaces = function()
|
||||
local expandtab = vim.api.nvim_buf_get_option(0, "expandtab")
|
||||
|
||||
local title = "spaces: "
|
||||
if not expandtab then
|
||||
title = "tab: "
|
||||
end
|
||||
|
||||
return title .. vim.api.nvim_buf_get_option(0, "shiftwidth")
|
||||
end
|
||||
|
||||
local venv = function()
|
||||
local venv = os.getenv("VIRTUAL_ENV")
|
||||
if venv then
|
||||
return string.format(" %s", string.match(venv, "[^/]+$"))
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
local gitblame_status_ok, gitblame = pcall(require, "gitblame")
|
||||
if not gitblame_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.g.gitblame_date_format = "%r"
|
||||
vim.g.gitblame_display_virtual_text = 0
|
||||
vim.g.gitblame_message_template = "<author>, <date>"
|
||||
|
||||
lualine.setup({
|
||||
options = {
|
||||
globalstatus = true,
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
component_separators = { left = "", right = " " },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = { "alpha", "dashboard" },
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch" },
|
||||
lualine_c = { diagnostics, venv, { "filename", path = 3 } },
|
||||
lualine_x = {
|
||||
{ gitblame.get_current_blame_text, cond = gitblame.is_blame_text_available },
|
||||
diff,
|
||||
spaces,
|
||||
"encoding",
|
||||
filetype,
|
||||
},
|
||||
lualine_y = { location },
|
||||
lualine_z = { "progress" },
|
||||
},
|
||||
})
|
3
.config/nvim/lua/plugins/markdowntoc.lua
Normal file
3
.config/nvim/lua/plugins/markdowntoc.lua
Normal file
@ -0,0 +1,3 @@
|
||||
vim.g.vmt_dont_insert_fence = true
|
||||
vim.g.vmt_list_item_char = "-"
|
||||
vim.g.vmt_include_headings_before = true
|
68
.config/nvim/lua/plugins/neo-tree.lua
Normal file
68
.config/nvim/lua/plugins/neo-tree.lua
Normal file
@ -0,0 +1,68 @@
|
||||
local status_ok, neotree = pcall(require, "neo-tree")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.g.neo_tree_remove_legacy_commands = true
|
||||
|
||||
neotree.setup({
|
||||
popup_border_style = "rounded",
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
padding = 0,
|
||||
with_expanders = false,
|
||||
},
|
||||
icon = {
|
||||
folder_closed = "",
|
||||
folder_open = "",
|
||||
folder_empty = "",
|
||||
default = "",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
added = "",
|
||||
deleted = "",
|
||||
modified = "",
|
||||
renamed = "➜",
|
||||
untracked = "★",
|
||||
ignored = "◌",
|
||||
unstaged = "✗",
|
||||
staged = "✓",
|
||||
conflict = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
window = {
|
||||
width = 40,
|
||||
mappings = {
|
||||
["o"] = "open",
|
||||
["Z"] = "expand_all_nodes",
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = false,
|
||||
hide_dotfiles = true,
|
||||
hide_gitignored = false,
|
||||
hide_by_name = {
|
||||
"__pycache__",
|
||||
},
|
||||
},
|
||||
follow_current_file = true,
|
||||
hijack_netrw_behavior = "open_current",
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
git_status = {
|
||||
window = {
|
||||
position = "float",
|
||||
},
|
||||
},
|
||||
event_handlers = {
|
||||
{
|
||||
event = "neo_tree_buffer_enter",
|
||||
handler = function(_)
|
||||
vim.opt_local.signcolumn = "auto"
|
||||
end,
|
||||
},
|
||||
},
|
||||
})
|
8
.config/nvim/lua/plugins/outline.lua
Normal file
8
.config/nvim/lua/plugins/outline.lua
Normal file
@ -0,0 +1,8 @@
|
||||
local status_ok, outline = pcall(require, "symbols-outline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
outline.setup({
|
||||
width = 20,
|
||||
})
|
13
.config/nvim/lua/plugins/sad.lua
Normal file
13
.config/nvim/lua/plugins/sad.lua
Normal file
@ -0,0 +1,13 @@
|
||||
local status_ok, sad = pcall(require, "sad")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
sad.setup({
|
||||
diff = "delta",
|
||||
ls_file = "fd",
|
||||
exact = false,
|
||||
vsplit = false,
|
||||
height_ratio = 0.7,
|
||||
width_ratio = 0.7,
|
||||
})
|
8
.config/nvim/lua/plugins/session-manager.lua
Normal file
8
.config/nvim/lua/plugins/session-manager.lua
Normal file
@ -0,0 +1,8 @@
|
||||
local status_ok, session_manager = pcall(require, "session_manager")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
session_manager.setup({
|
||||
autosave_only_in_session = false,
|
||||
})
|
45
.config/nvim/lua/plugins/telescope.lua
Normal file
45
.config/nvim/lua/plugins/telescope.lua
Normal file
@ -0,0 +1,45 @@
|
||||
local status_ok, telescope = pcall(require, "telescope")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
prompt_prefix = "> ",
|
||||
selection_caret = " ",
|
||||
path_display = { "smart" },
|
||||
file_ignore_patterns = { ".git/", "node_modules" },
|
||||
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-j>"] = actions.cycle_history_next,
|
||||
["<C-k>"] = actions.cycle_history_prev,
|
||||
["<Down>"] = actions.move_selection_next,
|
||||
["<Up>"] = actions.move_selection_previous,
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
find_command = { "fd", "--hidden", "--type=file", "--exclude=.git" },
|
||||
},
|
||||
live_grep = {
|
||||
additional_args = function()
|
||||
return { "--hidden", "-g", "!.git/" }
|
||||
end,
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown({}),
|
||||
},
|
||||
fzf = {
|
||||
case_mode = "ignore_case",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
telescope.load_extension("ui-select")
|
23
.config/nvim/lua/plugins/treesitter.lua
Normal file
23
.config/nvim/lua/plugins/treesitter.lua
Normal file
@ -0,0 +1,23 @@
|
||||
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
configs.setup({
|
||||
ensure_installed = { "lua", "markdown", "markdown_inline", "bash", "python", "go", "gomod", "gowork" },
|
||||
ignore_install = { "" },
|
||||
sync_install = false,
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "css" },
|
||||
},
|
||||
autopairs = {
|
||||
enable = true,
|
||||
},
|
||||
indent = { enable = true, disable = { "python", "css" } },
|
||||
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false,
|
||||
},
|
||||
})
|
6
.config/nvim/lua/plugins/trouble.lua
Normal file
6
.config/nvim/lua/plugins/trouble.lua
Normal file
@ -0,0 +1,6 @@
|
||||
local status_ok, trouble = pcall(require, "trouble")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
trouble.setup({})
|
67
.config/nvim/lua/plugins/wilder.lua
Normal file
67
.config/nvim/lua/plugins/wilder.lua
Normal file
@ -0,0 +1,67 @@
|
||||
local status_ok, wilder = pcall(require, "wilder")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
wilder.setup({
|
||||
modes = { ":" },
|
||||
})
|
||||
|
||||
wilder.set_option("use_python_remote_plugin", 1)
|
||||
|
||||
wilder.set_option("pipeline", {
|
||||
wilder.branch(
|
||||
wilder.python_file_finder_pipeline({
|
||||
file_command = { "fd", "--hidden", "--type=file", "--exclude=.git" },
|
||||
dir_command = { "fd", "--hidden", "--type=directory", "--exclude=.git" },
|
||||
filters = { "fuzzy_filter", "difflib_sorter" },
|
||||
}),
|
||||
wilder.cmdline_pipeline({
|
||||
fuzzy = 2,
|
||||
fuzzy_filter = wilder.lua_fzy_filter(),
|
||||
})
|
||||
),
|
||||
})
|
||||
|
||||
-- Better highlighting
|
||||
|
||||
local gradient = {
|
||||
"#f4468f",
|
||||
"#fd4a85",
|
||||
"#ff507a",
|
||||
"#ff566f",
|
||||
"#ff5e63",
|
||||
"#ff6658",
|
||||
"#ff704e",
|
||||
"#ff7a45",
|
||||
"#ff843d",
|
||||
"#ff9036",
|
||||
"#f89b31",
|
||||
"#efa72f",
|
||||
"#e6b32e",
|
||||
"#dcbe30",
|
||||
"#d2c934",
|
||||
"#c8d43a",
|
||||
"#bfde43",
|
||||
"#b6e84e",
|
||||
"#aff05b",
|
||||
}
|
||||
|
||||
for i, fg in ipairs(gradient) do
|
||||
gradient[i] = wilder.make_hl("WilderGradient" .. i, "Pmenu", { { a = 1 }, { a = 1 }, { foreground = fg } })
|
||||
end
|
||||
|
||||
wilder.set_option(
|
||||
"renderer",
|
||||
wilder.popupmenu_renderer({
|
||||
highlights = {
|
||||
border = "Normal",
|
||||
gradient = gradient,
|
||||
},
|
||||
|
||||
border = "rounded",
|
||||
highlighter = wilder.highlighter_with_gradient({
|
||||
wilder.lua_fzy_highlighter(),
|
||||
}),
|
||||
})
|
||||
)
|
Reference in New Issue
Block a user