better in many ways
This commit is contained in:
parent
212a138f5d
commit
8795ccaa29
@ -4,13 +4,13 @@ M.root_patterns = { ".git", "/lua" }
|
|||||||
|
|
||||||
---@param on_attach fun(client, buffer)
|
---@param on_attach fun(client, buffer)
|
||||||
function M.on_attach(on_attach)
|
function M.on_attach(on_attach)
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local buffer = args.buf
|
local buffer = args.buf
|
||||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
on_attach(client, buffer)
|
on_attach(client, buffer)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- returns the root directory based on:
|
-- returns the root directory based on:
|
||||||
@ -20,110 +20,113 @@ end
|
|||||||
-- * root pattern of cwd
|
-- * root pattern of cwd
|
||||||
---@return string
|
---@return string
|
||||||
function M.get_root()
|
function M.get_root()
|
||||||
---@type string?
|
---@type string?
|
||||||
local path = vim.api.nvim_buf_get_name(0)
|
local path = vim.api.nvim_buf_get_name(0)
|
||||||
path = path ~= "" and vim.loop.fs_realpath(path) or nil
|
path = path ~= "" and vim.loop.fs_realpath(path) or nil
|
||||||
---@type string[]
|
---@type string[]
|
||||||
local roots = {}
|
local roots = {}
|
||||||
if path then
|
if path then
|
||||||
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
|
for _, client in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
|
||||||
local workspace = client.config.workspace_folders
|
local workspace = client.config.workspace_folders
|
||||||
local paths = workspace and vim.tbl_map(function(ws)
|
local paths = workspace
|
||||||
return vim.uri_to_fname(ws.uri)
|
and vim.tbl_map(function(ws)
|
||||||
end, workspace) or client.config.root_dir and { client.config.root_dir } or {}
|
return vim.uri_to_fname(ws.uri)
|
||||||
for _, p in ipairs(paths) do
|
end, workspace)
|
||||||
local r = vim.loop.fs_realpath(p)
|
or client.config.root_dir and { client.config.root_dir }
|
||||||
if path:find(r, 1, true) then
|
or {}
|
||||||
roots[#roots + 1] = r
|
for _, p in ipairs(paths) do
|
||||||
end
|
local r = vim.loop.fs_realpath(p)
|
||||||
end
|
if path:find(r, 1, true) then
|
||||||
end
|
roots[#roots + 1] = r
|
||||||
end
|
end
|
||||||
table.sort(roots, function(a, b)
|
end
|
||||||
return #a > #b
|
end
|
||||||
end)
|
end
|
||||||
---@type string?
|
table.sort(roots, function(a, b)
|
||||||
local root = roots[1]
|
return #a > #b
|
||||||
if not root then
|
end)
|
||||||
path = path and vim.fs.dirname(path) or vim.loop.cwd()
|
---@type string?
|
||||||
---@type string?
|
local root = roots[1]
|
||||||
root = vim.fs.find(M.root_patterns, { path = path, upward = true })[1]
|
if not root then
|
||||||
root = root and vim.fs.dirname(root) or vim.loop.cwd()
|
path = path and vim.fs.dirname(path) or vim.loop.cwd()
|
||||||
end
|
---@type string?
|
||||||
---@cast root string
|
root = vim.fs.find(M.root_patterns, { path = path, upward = true })[1]
|
||||||
return root
|
root = root and vim.fs.dirname(root) or vim.loop.cwd()
|
||||||
|
end
|
||||||
|
---@cast root string
|
||||||
|
return root
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param silent boolean?
|
---@param silent boolean?
|
||||||
---@param values? {[1]:any, [2]:any}function
|
---@param values? {[1]:any, [2]:any}function
|
||||||
function M.toggle(option, silent, values)
|
function M.toggle(option, silent, values)
|
||||||
if values then
|
if values then
|
||||||
if vim.opt_local[option]:get() == values[1] then
|
if vim.opt_local[option]:get() == values[1] then
|
||||||
vim.opt_local[option] = values[2]
|
vim.opt_local[option] = values[2]
|
||||||
else
|
else
|
||||||
vim.opt_local[option] = values[1]
|
vim.opt_local[option] = values[1]
|
||||||
end
|
end
|
||||||
return vim.notify(
|
return vim.notify(
|
||||||
"Set " .. option .. " to " .. vim.opt_local[option]:get(),
|
"Set " .. option .. " to " .. vim.opt_local[option]:get(),
|
||||||
vim.log.levels.INFO,
|
vim.log.levels.INFO,
|
||||||
{ title = "Option" }
|
{ title = "Option" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
vim.opt_local[option] = not vim.opt_local[option]:get()
|
vim.opt_local[option] = not vim.opt_local[option]:get()
|
||||||
if not silent then
|
if not silent then
|
||||||
vim.notify(
|
vim.notify(
|
||||||
(vim.opt_local[option]:get() and "Enabled" or "Disabled") .. " " .. option,
|
(vim.opt_local[option]:get() and "Enabled" or "Disabled") .. " " .. option,
|
||||||
vim.log.levels.INFO,
|
vim.log.levels.INFO,
|
||||||
{ title = "Option" }
|
{ title = "Option" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local enabled = true
|
local enabled = true
|
||||||
function M.toggle_diagnostics()
|
function M.toggle_diagnostics()
|
||||||
enabled = not enabled
|
enabled = not enabled
|
||||||
if enabled then
|
if enabled then
|
||||||
vim.diagnostic.enable()
|
vim.diagnostic.enable()
|
||||||
vim.notify("Enabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
|
vim.notify("Enabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
|
||||||
else
|
else
|
||||||
vim.diagnostic.disable()
|
vim.diagnostic.disable()
|
||||||
vim.notify("Disabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
|
vim.notify("Disabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.smart_quit()
|
function M.smart_quit()
|
||||||
local bufnr = vim.api.nvim_get_current_buf()
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
local modified = vim.api.nvim_buf_get_option(bufnr, "modified")
|
local modified = vim.api.nvim_buf_get_option(bufnr, "modified")
|
||||||
if modified then
|
if modified then
|
||||||
vim.ui.input({
|
vim.ui.input({
|
||||||
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
|
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
|
||||||
}, function(input)
|
}, function(input)
|
||||||
if input == "y" then
|
if input == "y" then
|
||||||
vim.cmd "q!"
|
vim.cmd("q!")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
vim.cmd "q!"
|
vim.cmd("q!")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.isempty(s)
|
function M.isempty(s)
|
||||||
return s == nil or s == ""
|
return s == nil or s == ""
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_buf_option(opt)
|
function M.get_buf_option(opt)
|
||||||
local status_ok, buf_option = pcall(vim.api.nvim_buf_get_option, 0, opt)
|
local status_ok, buf_option = pcall(vim.api.nvim_buf_get_option, 0, opt)
|
||||||
if not status_ok then
|
if not status_ok then
|
||||||
return nil
|
return nil
|
||||||
else
|
else
|
||||||
return buf_option
|
return buf_option
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.telescope(builtin, opts)
|
function M.telescope(builtin, opts)
|
||||||
return function()
|
return function()
|
||||||
require("telescope.builtin")[builtin](vim.tbl_deep_extend("force", { cwd = M.get_root() }, opts or {}))
|
require("telescope.builtin")[builtin](vim.tbl_deep_extend("force", { cwd = M.get_root() }, opts or {}))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@ -2,22 +2,36 @@ return {
|
|||||||
{
|
{
|
||||||
"sainnhe/gruvbox-material",
|
"sainnhe/gruvbox-material",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"sainnhe/sonokai",
|
"sainnhe/sonokai",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"dracula/vim",
|
"dracula/vim",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"RRethy/nvim-base16",
|
"folke/tokyonight.nvim",
|
||||||
lazy = true,
|
lazy = true,
|
||||||
|
priority = 1000,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"echasnovski/mini.base16",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"chriskempson/base16-vim",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"NvChad/nvim-colorizer.lua",
|
"NvChad/nvim-colorizer.lua",
|
||||||
config = function()
|
opts = function()
|
||||||
require("colorizer").setup({})
|
require("colorizer").setup({})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -2,7 +2,7 @@ return {
|
|||||||
{
|
{
|
||||||
"lewis6991/gitsigns.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
event = "BufReadPre",
|
event = "BufReadPre",
|
||||||
config = {
|
opns = {
|
||||||
signs = {
|
signs = {
|
||||||
add = { text = "▎" },
|
add = { text = "▎" },
|
||||||
change = { text = "▎" },
|
change = { text = "▎" },
|
||||||
|
|||||||
@ -11,29 +11,27 @@ return {
|
|||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
},
|
},
|
||||||
---@type lspconfig.options
|
---@type lspconfig.options
|
||||||
servers = {
|
opts = {
|
||||||
jsonls = {},
|
servers = {
|
||||||
sumneko_lua = {
|
jsonls = {},
|
||||||
settings = {
|
sumneko_lua = {
|
||||||
Lua = {
|
settings = {
|
||||||
workspace = {
|
Lua = {
|
||||||
checkThirdParty = false,
|
workspace = {
|
||||||
},
|
checkThirdParty = false,
|
||||||
completion = {
|
},
|
||||||
callSnippet = "Replace",
|
completion = {
|
||||||
|
callSnippet = "Replace",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
setup = {
|
||||||
|
-- additional setup can be added here.
|
||||||
|
},
|
||||||
},
|
},
|
||||||
-- you can do any additional lsp server setup here
|
config = function(plugin, opts)
|
||||||
-- return true if you don't want this server to be setup with lspconfig
|
|
||||||
---@param server string lsp server name
|
|
||||||
---@param opts _.lspconfig.options any options set for the server
|
|
||||||
setup_server = function(server, opts)
|
|
||||||
return false
|
|
||||||
end,
|
|
||||||
config = function(plugin)
|
|
||||||
-- setup formatting and keymaps
|
-- setup formatting and keymaps
|
||||||
require("lazyvim.functions").on_attach(function(client, buffer)
|
require("lazyvim.functions").on_attach(function(client, buffer)
|
||||||
require("lazyvim.plugins.lsp.format").on_attach(client, buffer)
|
require("lazyvim.plugins.lsp.format").on_attach(client, buffer)
|
||||||
@ -53,18 +51,25 @@ return {
|
|||||||
})
|
})
|
||||||
|
|
||||||
---@type lspconfig.options
|
---@type lspconfig.options
|
||||||
local servers = plugin.servers or {}
|
local servers = opts.servers
|
||||||
local capabilities =
|
local capabilities =
|
||||||
require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
|
|
||||||
require("mason-lspconfig").setup({ ensure_installed = vim.tbl_keys(servers) })
|
require("mason-lspconfig").setup({ ensure_installed = vim.tbl_keys(servers) })
|
||||||
require("mason-lspconfig").setup_handlers({
|
require("mason-lspconfig").setup_handlers({
|
||||||
function(server)
|
function(server)
|
||||||
local opts = servers[server] or {}
|
local server_opts = servers[server] or {}
|
||||||
opts.capabilities = capabilities
|
server_opts.capabilities = capabilities
|
||||||
if not plugin.setup_server(server, opts) then
|
if opts.setup[server] then
|
||||||
require("lspconfig")[server].setup(opts)
|
if opts.setup[server](server, server_opts) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
elseif opts.setup["*"] then
|
||||||
|
if opts.setup["*"](server, server_opts) then
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
require("lspconfig")[server].setup(server_opts)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
@ -75,9 +80,9 @@ return {
|
|||||||
"jose-elias-alvarez/null-ls.nvim",
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
event = "BufReadPre",
|
event = "BufReadPre",
|
||||||
dependencies = { "mason.nvim" },
|
dependencies = { "mason.nvim" },
|
||||||
config = function()
|
opts = function()
|
||||||
local nls = require("null-ls")
|
local nls = require("null-ls")
|
||||||
nls.setup({
|
return {
|
||||||
debug = false,
|
debug = false,
|
||||||
sources = {
|
sources = {
|
||||||
nls.builtins.formatting.stylua,
|
nls.builtins.formatting.stylua,
|
||||||
@ -98,7 +103,7 @@ return {
|
|||||||
nls.builtins.formatting.beautysh,
|
nls.builtins.formatting.beautysh,
|
||||||
nls.builtins.diagnostics.shellcheck,
|
nls.builtins.diagnostics.shellcheck,
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -107,16 +112,18 @@ return {
|
|||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
cmd = "Mason",
|
cmd = "Mason",
|
||||||
keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } },
|
keys = { { "<leader>lM", "<cmd>Mason<cr>", desc = "Mason" } },
|
||||||
ensure_installed = {
|
opts = {
|
||||||
"stylua",
|
ensure_installed = {
|
||||||
"shellcheck",
|
"stylua",
|
||||||
"shfmt",
|
"shellcheck",
|
||||||
"flake8",
|
"shfmt",
|
||||||
|
"flake8",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
config = function(plugin)
|
config = function(plugin, opts)
|
||||||
require("mason").setup()
|
require("mason").setup()
|
||||||
local mr = require("mason-registry")
|
local mr = require("mason-registry")
|
||||||
for _, tool in ipairs(plugin.ensure_installed) do
|
for _, tool in ipairs(opts.ensure_installed) do
|
||||||
local p = mr.get_package(tool)
|
local p = mr.get_package(tool)
|
||||||
if not p:is_installed() then
|
if not p:is_installed() then
|
||||||
p:install()
|
p:install()
|
||||||
|
|||||||
@ -1,118 +1,119 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
config = function ()
|
event = "VeryLazy",
|
||||||
local colors = {
|
opts = function()
|
||||||
red = "#ca1243",
|
local colors = {
|
||||||
grey = "#a0a1a7",
|
red = "#ca1243",
|
||||||
black = "#383a42",
|
grey = "#a0a1a7",
|
||||||
white = "#f3f3f3",
|
black = "#383a42",
|
||||||
light_green = "#83a598",
|
white = "#f3f3f3",
|
||||||
orange = "#fe8019",
|
light_green = "#83a598",
|
||||||
green = "#8ec07c",
|
orange = "#fe8019",
|
||||||
}
|
green = "#8ec07c",
|
||||||
|
}
|
||||||
|
|
||||||
-- Put proper separators and gaps between components in sections
|
-- Put proper separators and gaps between components in sections
|
||||||
local function process_sections(sections)
|
local function process_sections(sections)
|
||||||
for name, section in pairs(sections) do
|
for name, section in pairs(sections) do
|
||||||
local left = name:sub(9, 10) < "x"
|
local left = name:sub(9, 10) < "x"
|
||||||
for pos = 1, name ~= "lualine_z" and #section or #section - 1 do
|
for pos = 1, name ~= "lualine_z" and #section or #section - 1 do
|
||||||
table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
|
table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
|
||||||
end
|
end
|
||||||
for id, comp in ipairs(section) do
|
for id, comp in ipairs(section) do
|
||||||
if type(comp) ~= "table" then
|
if type(comp) ~= "table" then
|
||||||
comp = { comp }
|
comp = { comp }
|
||||||
section[id] = comp
|
section[id] = comp
|
||||||
end
|
end
|
||||||
comp.separator = left and { right = "" } or { left = "" }
|
comp.separator = left and { right = "" } or { left = "" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return sections
|
return sections
|
||||||
end
|
end
|
||||||
|
|
||||||
local function search_result()
|
local function search_result()
|
||||||
if vim.v.hlsearch == 0 then
|
if vim.v.hlsearch == 0 then
|
||||||
return ''
|
return ""
|
||||||
end
|
end
|
||||||
local last_search = vim.fn.getreg('/')
|
local last_search = vim.fn.getreg("/")
|
||||||
if not last_search or last_search == '' then
|
if not last_search or last_search == "" then
|
||||||
return ''
|
return ""
|
||||||
end
|
end
|
||||||
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
local searchcount = vim.fn.searchcount({ maxcount = 9999 })
|
||||||
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")"
|
||||||
-- return ""
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local function modified()
|
local function modified()
|
||||||
if vim.bo.modified then
|
if vim.bo.modified then
|
||||||
return "+"
|
return "+"
|
||||||
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
||||||
return "-"
|
return "-"
|
||||||
end
|
end
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local status_ok, navic = pcall(require, "nvim-navic")
|
return {
|
||||||
if not status_ok then
|
options = {
|
||||||
print("navic error!")
|
theme = "auto",
|
||||||
return
|
globalstatus = true,
|
||||||
end
|
disabled_filetypes = { statusline = { "dashboard", "lazy", "alpha" } },
|
||||||
|
},
|
||||||
require("lualine").setup({
|
sections = process_sections({
|
||||||
options = {
|
lualine_a = { "mode" },
|
||||||
theme = "gruvbox",
|
lualine_b = {
|
||||||
component_separators = "",
|
"branch",
|
||||||
section_separators = { left = "", right = "" },
|
"diff",
|
||||||
},
|
{
|
||||||
sections = process_sections({
|
"diagnostics",
|
||||||
lualine_a = { "mode" },
|
source = { "nvim" },
|
||||||
lualine_b = {
|
sections = { "error" },
|
||||||
"branch",
|
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
||||||
"diff",
|
},
|
||||||
{
|
{
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
source = { "nvim" },
|
source = { "nvim" },
|
||||||
sections = { "error" },
|
sections = { "warn" },
|
||||||
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
||||||
},
|
},
|
||||||
{
|
{ "filename", file_status = false, path = 1 },
|
||||||
"diagnostics",
|
{ modified, color = { bg = colors.red } },
|
||||||
source = { "nvim" },
|
{
|
||||||
sections = { "warn" },
|
"%w",
|
||||||
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
cond = function()
|
||||||
},
|
return vim.wo.previewwindow
|
||||||
{ "filename", file_status = false, path = 1 },
|
end,
|
||||||
{ modified, color = { bg = colors.red } },
|
},
|
||||||
{
|
{
|
||||||
"%w",
|
"%r",
|
||||||
cond = function()
|
cond = function()
|
||||||
return vim.wo.previewwindow
|
return vim.bo.readonly
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"%r",
|
"%q",
|
||||||
cond = function()
|
cond = function()
|
||||||
return vim.bo.readonly
|
return vim.bo.buftype == "quickfix"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
"%q",
|
lualine_c = {
|
||||||
cond = function()
|
{
|
||||||
return vim.bo.buftype == "quickfix"
|
function()
|
||||||
end,
|
return require("nvim-navic").get_location()
|
||||||
},
|
end,
|
||||||
},
|
cond = function()
|
||||||
lualine_c = {
|
return package.loaded["nvim-navic"] and require("nvim-navic").is_available()
|
||||||
{ navic.get_location, cond = navic.is_available },
|
end,
|
||||||
},
|
},
|
||||||
lualine_x = {},
|
},
|
||||||
-- lualine_y = { search_result, 'filetype' },
|
lualine_x = {},
|
||||||
lualine_y = { "filetype " },
|
-- lualine_y = { search_result, 'filetype' },
|
||||||
lualine_z = { "%l:%c", "%p%%/%L" },
|
lualine_y = { "filetype " },
|
||||||
}),
|
lualine_z = { "%l:%c", "%p%%/%L" },
|
||||||
inactive_sections = {
|
}),
|
||||||
lualine_c = { "%f %y %m" },
|
inactive_sections = {
|
||||||
lualine_x = {},
|
lualine_c = { "%f %y %m" },
|
||||||
},
|
lualine_x = {},
|
||||||
})
|
},
|
||||||
end,
|
}
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ return {
|
|||||||
{
|
{
|
||||||
"folke/noice.nvim",
|
"folke/noice.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
config = {
|
opts = {
|
||||||
lsp = {
|
lsp = {
|
||||||
override = {
|
override = {
|
||||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||||
|
|||||||
@ -1,30 +1,41 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"rafamadriz/friendly-snippets",
|
"rafamadriz/friendly-snippets",
|
||||||
config = function()
|
config = function()
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
config = {
|
opts = {
|
||||||
history = true,
|
history = true,
|
||||||
delete_check_events = "TextChanged",
|
delete_check_events = "TextChanged",
|
||||||
},
|
},
|
||||||
-- stylua: ignore
|
keys = {
|
||||||
keys = {
|
{
|
||||||
{
|
"<tab>",
|
||||||
"<tab>",
|
function()
|
||||||
function()
|
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
|
||||||
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
|
end,
|
||||||
end,
|
expr = true,
|
||||||
expr = true, remap = true, silent = true, mode = "i",
|
remap = true,
|
||||||
},
|
silent = true,
|
||||||
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
|
mode = "i",
|
||||||
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
|
},
|
||||||
},
|
{
|
||||||
},
|
"<tab>",
|
||||||
{
|
function()
|
||||||
"rafamadriz/friendly-snippets", -- collection of useful snippets
|
require("luasnip").jump(1)
|
||||||
},
|
end,
|
||||||
|
mode = "s",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<s-tab>",
|
||||||
|
function()
|
||||||
|
require("luasnip").jump(-1)
|
||||||
|
end,
|
||||||
|
mode = { "i", "s" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,7 @@ return {
|
|||||||
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
||||||
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
||||||
},
|
},
|
||||||
config = {
|
opts = {
|
||||||
defaults = {
|
defaults = {
|
||||||
prompt_prefix = " ",
|
prompt_prefix = " ",
|
||||||
selection_caret = " ",
|
selection_caret = " ",
|
||||||
|
|||||||
@ -2,7 +2,7 @@ return {
|
|||||||
{
|
{
|
||||||
"folke/trouble.nvim",
|
"folke/trouble.nvim",
|
||||||
cmd = { "TroubleToggle", "Trouble" },
|
cmd = { "TroubleToggle", "Trouble" },
|
||||||
config = { use_diagnostic_signs = true },
|
opts = { use_diagnostic_signs = true },
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>lt", "<cmd>TroubleToggle document_diagnostics<cr>", desc = "Document Diagnostics (Trouble)" },
|
{ "<leader>lt", "<cmd>TroubleToggle document_diagnostics<cr>", desc = "Document Diagnostics (Trouble)" },
|
||||||
{ "<leader>lT", "<cmd>TroubleToggle workspace_diagnostics<cr>", desc = "Workspace Diagnostics (Trouble)" },
|
{ "<leader>lT", "<cmd>TroubleToggle workspace_diagnostics<cr>", desc = "Workspace Diagnostics (Trouble)" },
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
local icons = require("lazyvim.config.icons")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
@ -22,49 +24,40 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"rcarriga/nvim-notify",
|
"rcarriga/nvim-notify",
|
||||||
config = function()
|
opts = {
|
||||||
local icons = require("lazyvim.config.icons")
|
-- Animation style (see below for details)
|
||||||
require("notify").setup({
|
stages = "fade_in_slide_out",
|
||||||
-- Animation style (see below for details)
|
|
||||||
stages = "fade_in_slide_out",
|
|
||||||
|
|
||||||
-- Render function for notifications. See notify-render()
|
-- Render function for notifications. See notify-render()
|
||||||
render = "default",
|
render = "default",
|
||||||
|
|
||||||
-- Default timeout for notifications
|
-- Default timeout for notifications
|
||||||
timeout = 2000,
|
timeout = 2000,
|
||||||
|
|
||||||
-- For stages that change opacity this is treated as the highlight behind the window
|
-- For stages that change opacity this is treated as the highlight behind the window
|
||||||
-- Set this to either a highlight group or an RGB hex value e.g. "#000000"
|
-- Set this to either a highlight group or an RGB hex value e.g. "#000000"
|
||||||
background_colour = "Normal",
|
background_colour = "Normal",
|
||||||
|
|
||||||
-- Minimum width for notification windows
|
-- Minimum width for notification windows
|
||||||
minimum_width = 10,
|
minimum_width = 10,
|
||||||
|
|
||||||
-- Icons for the different levels
|
-- Icons for the different levels
|
||||||
icons = {
|
icons = {
|
||||||
ERROR = icons.diagnostics.Error,
|
ERROR = icons.diagnostics.Error,
|
||||||
WARN = icons.diagnostics.Warning,
|
WARN = icons.diagnostics.Warning,
|
||||||
INFO = icons.diagnostics.Information,
|
INFO = icons.diagnostics.Information,
|
||||||
DEBUG = icons.ui.Bug,
|
DEBUG = icons.ui.Bug,
|
||||||
TRACE = icons.ui.Pencil,
|
TRACE = icons.ui.Pencil,
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"echasnovski/mini.bufremove",
|
"echasnovski/mini.bufremove",
|
||||||
-- stylua: ignore
|
-- stylua: ignore
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" },
|
{ "<leader>bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" },
|
||||||
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
|
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
|
||||||
},
|
},
|
||||||
},
|
|
||||||
{
|
|
||||||
"lewis6991/impatient.nvim",
|
|
||||||
config = function()
|
|
||||||
require("impatient").enable_profile()
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ghillb/cybu.nvim",
|
"ghillb/cybu.nvim",
|
||||||
@ -111,6 +104,7 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
event = "BufReadPre",
|
||||||
config = function()
|
config = function()
|
||||||
vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" }
|
vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" }
|
||||||
vim.g.indent_blankline_filetype_exclude = {
|
vim.g.indent_blankline_filetype_exclude = {
|
||||||
@ -222,4 +216,16 @@ return {
|
|||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"SmiteshP/nvim-navic",
|
||||||
|
init = function()
|
||||||
|
vim.g.navic_silence = true
|
||||||
|
require("lazyvim.functions").on_attach(function(client, buffer)
|
||||||
|
if client.server_capabilities.documentSymbolProvider then
|
||||||
|
require("nvim-navic").attach(client, buffer)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
opts = { separator = " ", highlight = true, depth_limit = 5 },
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user