Clean (#3006)
* refactor(cmp) : use cmp module from ui repo https://github.com/NvChad/ui/commit/c4576d8b5bbb6305de53ec017cd6ffad863c98ee I moved it to the ui repo so non nvchad users could achieve the CMP look from NvChad * remove: <leader>cc blankline mapping * replace: nvim-colorizer plugin with ui.colorify (BREAKING CHANGE) https://github.com/NvChad/ui/blob/v2.5/lua/nvconfig.lua#L106 * misc: load nvchad module in config func of ui instead of plugin/ in ui repo * clean up * remove un-needed configs/lazy_nvim.lua file * rm gitsigns mappings as it gets frustrating for users to override them * rm un-needed options var in plugin configs * add branch name for ui plugin * trim some loc! * feat: use modern theme picker for <leader>th * feat: add volt plugins
This commit is contained in:
@@ -1,73 +1,16 @@
|
|||||||
local cmp = require "cmp"
|
|
||||||
|
|
||||||
dofile(vim.g.base46_cache .. "cmp")
|
dofile(vim.g.base46_cache .. "cmp")
|
||||||
|
|
||||||
local cmp_ui = require("nvconfig").ui.cmp
|
local cmp = require "cmp"
|
||||||
local cmp_style = cmp_ui.style
|
|
||||||
|
|
||||||
local field_arrangement = {
|
|
||||||
atom = { "kind", "abbr", "menu" },
|
|
||||||
atom_colored = { "kind", "abbr", "menu" },
|
|
||||||
}
|
|
||||||
|
|
||||||
local formatting_style = {
|
|
||||||
-- default fields order i.e completion word + item.kind + item.kind icons
|
|
||||||
fields = field_arrangement[cmp_style] or { "abbr", "kind", "menu" },
|
|
||||||
|
|
||||||
format = function(_, item)
|
|
||||||
local icons = require "nvchad.icons.lspkind"
|
|
||||||
local icon = (cmp_ui.icons and icons[item.kind]) or ""
|
|
||||||
|
|
||||||
if cmp_style == "atom" or cmp_style == "atom_colored" then
|
|
||||||
icon = " " .. icon .. " "
|
|
||||||
item.menu = cmp_ui.lspkind_text and " (" .. item.kind .. ")" or ""
|
|
||||||
item.kind = icon
|
|
||||||
else
|
|
||||||
icon = cmp_ui.lspkind_text and (" " .. icon .. " ") or icon
|
|
||||||
item.kind = string.format("%s %s", icon, cmp_ui.lspkind_text and item.kind or "")
|
|
||||||
end
|
|
||||||
|
|
||||||
return item
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
local function border(hl_name)
|
|
||||||
return {
|
|
||||||
{ "╭", hl_name },
|
|
||||||
{ "─", hl_name },
|
|
||||||
{ "╮", hl_name },
|
|
||||||
{ "│", hl_name },
|
|
||||||
{ "╯", hl_name },
|
|
||||||
{ "─", hl_name },
|
|
||||||
{ "╰", hl_name },
|
|
||||||
{ "│", hl_name },
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
completion = {
|
completion = { completeopt = "menu,menuone" },
|
||||||
completeopt = "menu,menuone",
|
|
||||||
},
|
|
||||||
|
|
||||||
window = {
|
|
||||||
completion = {
|
|
||||||
side_padding = (cmp_style ~= "atom" and cmp_style ~= "atom_colored") and 1 or 0,
|
|
||||||
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:None",
|
|
||||||
scrollbar = false,
|
|
||||||
},
|
|
||||||
documentation = {
|
|
||||||
border = border "CmpDocBorder",
|
|
||||||
winhighlight = "Normal:CmpDoc",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
require("luasnip").lsp_expand(args.body)
|
require("luasnip").lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
formatting = formatting_style,
|
|
||||||
|
|
||||||
mapping = {
|
mapping = {
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
@@ -101,6 +44,7 @@ local options = {
|
|||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
},
|
},
|
||||||
|
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
{ name = "luasnip" },
|
{ name = "luasnip" },
|
||||||
@@ -110,8 +54,4 @@ local options = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if cmp_style ~= "atom" and cmp_style ~= "atom_colored" then
|
return vim.tbl_deep_extend("force", options, require "nvchad.cmp")
|
||||||
options.window.completion.border = border "CmpBorder"
|
|
||||||
end
|
|
||||||
|
|
||||||
return options
|
|
||||||
|
|||||||
@@ -1,24 +1,8 @@
|
|||||||
dofile(vim.g.base46_cache .. "git")
|
dofile(vim.g.base46_cache .. "git")
|
||||||
|
|
||||||
local options = {
|
return {
|
||||||
signs = {
|
signs = {
|
||||||
delete = { text = "" },
|
delete = { text = "" },
|
||||||
changedelete = { text = "" },
|
changedelete = { text = "" },
|
||||||
},
|
},
|
||||||
|
|
||||||
on_attach = function(bufnr)
|
|
||||||
local gs = package.loaded.gitsigns
|
|
||||||
|
|
||||||
local function opts(desc)
|
|
||||||
return { buffer = bufnr, desc = desc }
|
|
||||||
end
|
|
||||||
|
|
||||||
local map = vim.keymap.set
|
|
||||||
|
|
||||||
map("n", "<leader>rh", gs.reset_hunk, opts "Reset Hunk")
|
|
||||||
map("n", "<leader>ph", gs.preview_hunk, opts "Preview Hunk")
|
|
||||||
map("n", "<leader>gb", gs.blame_line, opts "Blame Line")
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return options
|
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
return {
|
|
||||||
defaults = { lazy = true },
|
|
||||||
install = { colorscheme = { "nvchad" } },
|
|
||||||
|
|
||||||
ui = {
|
|
||||||
icons = {
|
|
||||||
ft = "",
|
|
||||||
lazy = " ",
|
|
||||||
loaded = "",
|
|
||||||
not_loaded = "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
performance = {
|
|
||||||
rtp = {
|
|
||||||
disabled_plugins = {
|
|
||||||
"2html_plugin",
|
|
||||||
"tohtml",
|
|
||||||
"getscript",
|
|
||||||
"getscriptPlugin",
|
|
||||||
"gzip",
|
|
||||||
"logipat",
|
|
||||||
"netrw",
|
|
||||||
"netrwPlugin",
|
|
||||||
"netrwSettings",
|
|
||||||
"netrwFileHandlers",
|
|
||||||
"matchit",
|
|
||||||
"tar",
|
|
||||||
"tarPlugin",
|
|
||||||
"rrhelper",
|
|
||||||
"spellfile_plugin",
|
|
||||||
"vimball",
|
|
||||||
"vimballPlugin",
|
|
||||||
"zip",
|
|
||||||
"zipPlugin",
|
|
||||||
"tutor",
|
|
||||||
"rplugin",
|
|
||||||
"syntax",
|
|
||||||
"synmenu",
|
|
||||||
"optwin",
|
|
||||||
"compiler",
|
|
||||||
"bugreport",
|
|
||||||
"ftplugin",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -19,10 +19,7 @@ M.on_attach = function(_, bufnr)
|
|||||||
end, opts "List workspace folders")
|
end, opts "List workspace folders")
|
||||||
|
|
||||||
map("n", "<leader>D", vim.lsp.buf.type_definition, opts "Go to type definition")
|
map("n", "<leader>D", vim.lsp.buf.type_definition, opts "Go to type definition")
|
||||||
|
map("n", "<leader>ra", require "nvchad.lsp.renamer", opts "NvRenamer")
|
||||||
map("n", "<leader>ra", function()
|
|
||||||
require "nvchad.lsp.renamer"()
|
|
||||||
end, opts "NvRenamer")
|
|
||||||
|
|
||||||
map({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts "Code action")
|
map({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts "Code action")
|
||||||
map("n", "gr", vim.lsp.buf.references, opts "Show references")
|
map("n", "gr", vim.lsp.buf.references, opts "Show references")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
dofile(vim.g.base46_cache .. "mason")
|
dofile(vim.g.base46_cache .. "mason")
|
||||||
|
|
||||||
local options = {
|
return {
|
||||||
PATH = "skip",
|
PATH = "skip",
|
||||||
|
|
||||||
ui = {
|
ui = {
|
||||||
@@ -13,5 +13,3 @@ local options = {
|
|||||||
|
|
||||||
max_concurrent_installers = 10,
|
max_concurrent_installers = 10,
|
||||||
}
|
}
|
||||||
|
|
||||||
return options
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
dofile(vim.g.base46_cache .. "nvimtree")
|
dofile(vim.g.base46_cache .. "nvimtree")
|
||||||
|
|
||||||
local options = {
|
return {
|
||||||
filters = { dotfiles = false },
|
filters = { dotfiles = false },
|
||||||
disable_netrw = true,
|
disable_netrw = true,
|
||||||
hijack_cursor = true,
|
hijack_cursor = true,
|
||||||
@@ -32,5 +32,3 @@ local options = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return options
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
dofile(vim.g.base46_cache .. "telescope")
|
dofile(vim.g.base46_cache .. "telescope")
|
||||||
|
|
||||||
local options = {
|
return {
|
||||||
defaults = {
|
defaults = {
|
||||||
prompt_prefix = " ",
|
prompt_prefix = " ",
|
||||||
selection_caret = " ",
|
selection_caret = " ",
|
||||||
@@ -22,5 +22,3 @@ local options = {
|
|||||||
extensions_list = { "themes", "terms" },
|
extensions_list = { "themes", "terms" },
|
||||||
extensions = {},
|
extensions = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
return options
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ pcall(function()
|
|||||||
dofile(vim.g.base46_cache .. "treesitter")
|
dofile(vim.g.base46_cache .. "treesitter")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local options = {
|
return {
|
||||||
ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" },
|
ensure_installed = { "lua", "luadoc", "printf", "vim", "vimdoc" },
|
||||||
|
|
||||||
highlight = {
|
highlight = {
|
||||||
@@ -13,5 +13,3 @@ local options = {
|
|||||||
|
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
}
|
}
|
||||||
|
|
||||||
return options
|
|
||||||
|
|||||||
+5
-17
@@ -61,7 +61,11 @@ map("n", "<leader>fz", "<cmd>Telescope current_buffer_fuzzy_find<CR>", { desc =
|
|||||||
map("n", "<leader>cm", "<cmd>Telescope git_commits<CR>", { desc = "telescope git commits" })
|
map("n", "<leader>cm", "<cmd>Telescope git_commits<CR>", { desc = "telescope git commits" })
|
||||||
map("n", "<leader>gt", "<cmd>Telescope git_status<CR>", { desc = "telescope git status" })
|
map("n", "<leader>gt", "<cmd>Telescope git_status<CR>", { desc = "telescope git status" })
|
||||||
map("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "telescope pick hidden term" })
|
map("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "telescope pick hidden term" })
|
||||||
map("n", "<leader>th", "<cmd>Telescope themes<CR>", { desc = "telescope nvchad themes" })
|
|
||||||
|
map("n", "<leader>th", function()
|
||||||
|
require("nvchad.themes").open()
|
||||||
|
end, { desc = "telescope nvchad themes" })
|
||||||
|
|
||||||
map("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "telescope find files" })
|
map("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "telescope find files" })
|
||||||
map(
|
map(
|
||||||
"n",
|
"n",
|
||||||
@@ -101,19 +105,3 @@ map("n", "<leader>wK", "<cmd>WhichKey <CR>", { desc = "whichkey all keymaps" })
|
|||||||
map("n", "<leader>wk", function()
|
map("n", "<leader>wk", function()
|
||||||
vim.cmd("WhichKey " .. vim.fn.input "WhichKey: ")
|
vim.cmd("WhichKey " .. vim.fn.input "WhichKey: ")
|
||||||
end, { desc = "whichkey query lookup" })
|
end, { desc = "whichkey query lookup" })
|
||||||
|
|
||||||
-- blankline
|
|
||||||
map("n", "<leader>cc", function()
|
|
||||||
local config = { scope = {} }
|
|
||||||
config.scope.exclude = { language = {}, node_type = {} }
|
|
||||||
config.scope.include = { node_type = {} }
|
|
||||||
local node = require("ibl.scope").get(vim.api.nvim_get_current_buf(), config)
|
|
||||||
|
|
||||||
if node then
|
|
||||||
local start_row, _, end_row, _ = node:range()
|
|
||||||
if start_row ~= end_row then
|
|
||||||
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start_row + 1, 0 })
|
|
||||||
vim.api.nvim_feedkeys("_", "n", true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end, { desc = "blankline jump to current context" })
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ local opt = vim.opt
|
|||||||
local o = vim.o
|
local o = vim.o
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
-------------------------------------- globals -----------------------------------------
|
|
||||||
g.toggle_theme_icon = " "
|
|
||||||
|
|
||||||
-------------------------------------- options ------------------------------------------
|
-------------------------------------- options ------------------------------------------
|
||||||
o.laststatus = 3
|
o.laststatus = 3
|
||||||
o.showmode = false
|
o.showmode = false
|
||||||
@@ -46,8 +43,6 @@ o.updatetime = 250
|
|||||||
-- when cursor reaches end/beginning of line
|
-- when cursor reaches end/beginning of line
|
||||||
opt.whichwrap:append "<>[]hl"
|
opt.whichwrap:append "<>[]hl"
|
||||||
|
|
||||||
-- g.mapleader = " "
|
|
||||||
|
|
||||||
-- disable some default providers
|
-- disable some default providers
|
||||||
g.loaded_node_provider = 0
|
g.loaded_node_provider = 0
|
||||||
g.loaded_python3_provider = 0
|
g.loaded_python3_provider = 0
|
||||||
|
|||||||
+12
-36
@@ -2,17 +2,24 @@ return {
|
|||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
|
|
||||||
{
|
{
|
||||||
"NvChad/base46",
|
"nvchad/base46",
|
||||||
build = function()
|
build = function()
|
||||||
require("base46").load_all_highlights()
|
require("base46").load_all_highlights()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"NvChad/ui",
|
"nvchad/ui",
|
||||||
lazy = false,
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require "nvchad"
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"nvchad/volt",
|
||||||
|
"nvchad/minty",
|
||||||
|
"nvchad/menu",
|
||||||
|
|
||||||
{
|
{
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
opts = function()
|
opts = function()
|
||||||
@@ -52,9 +59,9 @@ return {
|
|||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
keys = { "<leader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
|
keys = { "<leader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
|
||||||
cmd = "WhichKey",
|
cmd = "WhichKey",
|
||||||
config = function(_, opts)
|
opts = function()
|
||||||
dofile(vim.g.base46_cache .. "whichkey")
|
dofile(vim.g.base46_cache .. "whichkey")
|
||||||
require("which-key").setup(opts)
|
return {}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -62,9 +69,7 @@ return {
|
|||||||
{
|
{
|
||||||
"stevearc/conform.nvim",
|
"stevearc/conform.nvim",
|
||||||
opts = {
|
opts = {
|
||||||
formatters_by_ft = {
|
formatters_by_ft = { lua = { "stylua" } },
|
||||||
lua = { "stylua" },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -163,35 +168,6 @@ return {
|
|||||||
opts = function()
|
opts = function()
|
||||||
return require "nvchad.configs.telescope"
|
return require "nvchad.configs.telescope"
|
||||||
end,
|
end,
|
||||||
config = function(_, opts)
|
|
||||||
local telescope = require "telescope"
|
|
||||||
telescope.setup(opts)
|
|
||||||
|
|
||||||
-- load extensions
|
|
||||||
for _, ext in ipairs(opts.extensions_list) do
|
|
||||||
telescope.load_extension(ext)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"NvChad/nvim-colorizer.lua",
|
|
||||||
event = "User FilePost",
|
|
||||||
opts = {
|
|
||||||
user_default_options = { names = false },
|
|
||||||
filetypes = {
|
|
||||||
"*",
|
|
||||||
"!lazy",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
require("colorizer").setup(opts)
|
|
||||||
|
|
||||||
-- execute colorizer as soon as possible
|
|
||||||
vim.defer_fn(function()
|
|
||||||
require("colorizer").attach_to_buffer(0)
|
|
||||||
end, 0)
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user