Merge branch 'dev'
This commit is contained in:
commit
27c33790ef
27 changed files with 371 additions and 587 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
plugin
|
plugin
|
||||||
|
custom
|
||||||
|
|
13
examples/example_chadrc.lua
Normal file
13
examples/example_chadrc.lua
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
-- This is an example chadrc file , its supposed to be placed in /lua/custom dir
|
||||||
|
-- lua/custom/chadrc.lua
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
-- make sure you maintain the structure of `core/default_config.lua` here,
|
||||||
|
-- example of changing theme:
|
||||||
|
|
||||||
|
M.ui = {
|
||||||
|
theme = "gruvchad",
|
||||||
|
}
|
||||||
|
|
||||||
|
return M
|
39
examples/example_init.lua
Normal file
39
examples/example_init.lua
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
-- This is an example init file , its supposed to be placed in /lua/custom dir
|
||||||
|
-- lua/custom/init.lua
|
||||||
|
|
||||||
|
-- This is where your custom modules and plugins go.
|
||||||
|
-- Please check NvChad docs if you're totally new to nvchad + dont know lua!!
|
||||||
|
|
||||||
|
local hooks = require "core.hooks"
|
||||||
|
|
||||||
|
-- MAPPINGS
|
||||||
|
-- To add new plugins, use the "setup_mappings" hook,
|
||||||
|
|
||||||
|
hooks.add("setup_mappings", function(map)
|
||||||
|
map("n", "<leader>cc", ":Telescope <CR>", opt)
|
||||||
|
map("n", "<leader>q", ":q <CR>", opt)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- NOTE : opt is a variable there (most likely a table if you want multiple options),
|
||||||
|
-- you can remove it if you dont have any custom options
|
||||||
|
|
||||||
|
-- Install plugins
|
||||||
|
-- To add new plugins, use the "install_plugin" hook,
|
||||||
|
|
||||||
|
-- examples below:
|
||||||
|
|
||||||
|
hooks.add("install_plugins", function(use)
|
||||||
|
use {
|
||||||
|
"max397574/better-escape.nvim",
|
||||||
|
event = "InsertEnter",
|
||||||
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
"user or orgname/reponame",
|
||||||
|
--further packer options
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- NOTE: we heavily suggest using Packer's lazy loading (with the 'event' field)
|
||||||
|
-- see: https://github.com/wbthomason/packer.nvim
|
||||||
|
-- https://nvchad.github.io/config/walkthrough
|
22
init.lua
22
init.lua
|
@ -1,5 +1,21 @@
|
||||||
local ok, err = pcall(require, "core")
|
local userconf = pcall(require, "custom")
|
||||||
|
|
||||||
if not ok then
|
if userconf then
|
||||||
error("Error loading core" .. "\n\n" .. err)
|
require "custom"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local core_modules = {
|
||||||
|
"core.options",
|
||||||
|
"core.autocmds",
|
||||||
|
"core.mappings",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, module in ipairs(core_modules) do
|
||||||
|
local ok, err = pcall(require, module)
|
||||||
|
if not ok then
|
||||||
|
error("Error loading " .. module .. "\n\n" .. err)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- non plugin mappings
|
||||||
|
require("core.mappings").misc()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
local override = require("core.utils").load_config().ui.hl_override
|
|
||||||
|
|
||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
|
|
||||||
|
local override = require("core.utils").load_config().ui.hl_override
|
||||||
local colors = require("colors").get()
|
local colors = require("colors").get()
|
||||||
|
local ui = require("core.utils").load_config().ui
|
||||||
|
|
||||||
local black = colors.black
|
local black = colors.black
|
||||||
local black2 = colors.black2
|
local black2 = colors.black2
|
||||||
|
@ -21,10 +21,10 @@ local purple = colors.purple
|
||||||
local red = colors.red
|
local red = colors.red
|
||||||
local white = colors.white
|
local white = colors.white
|
||||||
local yellow = colors.yellow
|
local yellow = colors.yellow
|
||||||
|
local orange = colors.orange
|
||||||
local one_bg3 = colors.one_bg3
|
local one_bg3 = colors.one_bg3
|
||||||
|
|
||||||
local ui = require("core.utils").load_config().ui
|
-- functions for setting highlights
|
||||||
|
|
||||||
local fg = require("core.utils").fg
|
local fg = require("core.utils").fg
|
||||||
local fg_bg = require("core.utils").fg_bg
|
local fg_bg = require("core.utils").fg_bg
|
||||||
local bg = require("core.utils").bg
|
local bg = require("core.utils").bg
|
||||||
|
@ -46,7 +46,7 @@ fg("EndOfBuffer", black)
|
||||||
|
|
||||||
-- For floating windows
|
-- For floating windows
|
||||||
fg("FloatBorder", blue)
|
fg("FloatBorder", blue)
|
||||||
bg("NormalFloat", one_bg)
|
bg("NormalFloat", darker_black)
|
||||||
|
|
||||||
-- Pmenu
|
-- Pmenu
|
||||||
bg("Pmenu", one_bg)
|
bg("Pmenu", one_bg)
|
||||||
|
@ -83,32 +83,21 @@ fg("DashboardHeader", grey_fg)
|
||||||
fg("DashboardShortcut", grey_fg)
|
fg("DashboardShortcut", grey_fg)
|
||||||
|
|
||||||
-- Git signs
|
-- Git signs
|
||||||
fg_bg("DiffAdd", nord_blue, "none")
|
fg_bg("DiffAdd", blue, "NONE")
|
||||||
fg_bg("DiffChange", grey_fg, "none")
|
fg_bg("DiffChange", grey_fg, "NONE")
|
||||||
fg_bg("DiffModified", nord_blue, "none")
|
fg_bg("DiffChangeDelete", red, "NONE")
|
||||||
|
fg_bg("DiffModified", red, "NONE")
|
||||||
|
fg_bg("DiffDelete", red, "NONE")
|
||||||
|
|
||||||
-- Indent blankline plugin
|
-- Indent blankline plugin
|
||||||
fg("IndentBlanklineChar", line)
|
fg("IndentBlanklineChar", line)
|
||||||
|
|
||||||
-- ]]
|
-- Lsp diagnostics
|
||||||
|
|
||||||
-- [[ LspDiagnostics
|
fg("DiagnosticHint", purple)
|
||||||
|
fg("DiagnosticError", red)
|
||||||
-- Errors
|
fg("DiagnosticWarn", yellow)
|
||||||
fg("LspDiagnosticsSignError", red)
|
fg("DiagnosticInformation", green)
|
||||||
fg("LspDiagnosticsSignWarning", yellow)
|
|
||||||
fg("LspDiagnosticsVirtualTextError", red)
|
|
||||||
fg("LspDiagnosticsVirtualTextWarning", yellow)
|
|
||||||
|
|
||||||
-- Info
|
|
||||||
fg("LspDiagnosticsSignInformation", green)
|
|
||||||
fg("LspDiagnosticsVirtualTextInformation", green)
|
|
||||||
|
|
||||||
-- Hints
|
|
||||||
fg("LspDiagnosticsSignHint", purple)
|
|
||||||
fg("LspDiagnosticsVirtualTextHint", purple)
|
|
||||||
|
|
||||||
-- ]]
|
|
||||||
|
|
||||||
-- NvimTree
|
-- NvimTree
|
||||||
fg("NvimTreeEmptyFolderName", blue)
|
fg("NvimTreeEmptyFolderName", blue)
|
||||||
|
@ -126,19 +115,59 @@ fg("NvimTreeVertSplit", darker_black)
|
||||||
bg("NvimTreeVertSplit", darker_black)
|
bg("NvimTreeVertSplit", darker_black)
|
||||||
fg_bg("NvimTreeWindowPicker", red, black2)
|
fg_bg("NvimTreeWindowPicker", red, black2)
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
fg_bg("TelescopeBorder", darker_black, darker_black)
|
||||||
|
fg_bg("TelescopePromptBorder", black2, black2)
|
||||||
|
|
||||||
|
fg_bg("TelescopePromptNormal", white, black2)
|
||||||
|
fg_bg("TelescopePromptPrefix", red, black2)
|
||||||
|
|
||||||
|
bg("TelescopeNormal", darker_black)
|
||||||
|
|
||||||
|
fg_bg("TelescopePreviewTitle", black, green)
|
||||||
|
fg_bg("TelescopePromptTitle", black, red)
|
||||||
|
fg_bg("TelescopeResultsTitle", darker_black, darker_black)
|
||||||
|
|
||||||
|
bg("TelescopeSelection", black2)
|
||||||
|
|
||||||
|
-- keybinds cheatsheet
|
||||||
|
|
||||||
|
fg_bg("CheatsheetBorder", black, black)
|
||||||
|
bg("CheatsheetSectionContent", black)
|
||||||
|
fg("CheatsheetHeading", white)
|
||||||
|
|
||||||
|
local section_title_colors = {
|
||||||
|
white,
|
||||||
|
blue,
|
||||||
|
red,
|
||||||
|
green,
|
||||||
|
yellow,
|
||||||
|
purple,
|
||||||
|
orange,
|
||||||
|
}
|
||||||
|
for i, color in ipairs(section_title_colors) do
|
||||||
|
vim.cmd("highlight CheatsheetTitle" .. i .. " guibg = " .. color .. " guifg=" .. black)
|
||||||
|
end
|
||||||
|
|
||||||
-- Disable some highlight in nvim tree if transparency enabled
|
-- Disable some highlight in nvim tree if transparency enabled
|
||||||
if ui.transparency then
|
if ui.transparency then
|
||||||
|
bg("NormalFloat", "NONE")
|
||||||
bg("NvimTreeNormal", "NONE")
|
bg("NvimTreeNormal", "NONE")
|
||||||
|
bg("NvimTreeNormalNC", "NONE")
|
||||||
bg("NvimTreeStatusLineNC", "NONE")
|
bg("NvimTreeStatusLineNC", "NONE")
|
||||||
bg("NvimTreeVertSplit", "NONE")
|
bg("NvimTreeVertSplit", "NONE")
|
||||||
fg("NvimTreeVertSplit", grey)
|
fg("NvimTreeVertSplit", grey)
|
||||||
end
|
|
||||||
|
|
||||||
-- Telescope
|
-- telescope
|
||||||
|
bg("TelescopeBorder", "NONE")
|
||||||
|
bg("TelescopePrompt", "NONE")
|
||||||
|
bg("TelescopeResults", "NONE")
|
||||||
|
bg("TelescopePromptBorder", "NONE")
|
||||||
|
bg("TelescopePromptNormal", "NONE")
|
||||||
|
bg("TelescopeNormal", "NONE")
|
||||||
|
bg("TelescopePromptPrefix", "NONE")
|
||||||
fg("TelescopeBorder", one_bg)
|
fg("TelescopeBorder", one_bg)
|
||||||
fg_bg("TelescopePreviewTitle", green, one_bg)
|
end
|
||||||
fg_bg("TelescopePromptTitle", blue, one_bg)
|
|
||||||
fg_bg("TelescopeResultsTitle", red, one_bg)
|
|
||||||
|
|
||||||
if #override ~= 0 then
|
if #override ~= 0 then
|
||||||
require(override)
|
require(override)
|
||||||
|
|
|
@ -19,8 +19,6 @@ M.init = function(theme)
|
||||||
package.loaded["colors.highlights" or false] = nil
|
package.loaded["colors.highlights" or false] = nil
|
||||||
-- then load the highlights
|
-- then load the highlights
|
||||||
require "colors.highlights"
|
require "colors.highlights"
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
local function isModuleAvailable(name)
|
|
||||||
if package.loaded[name] then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
for _, searcher in ipairs(package.searchers or package.loaders) do
|
|
||||||
local loader = searcher(name)
|
|
||||||
if type(loader) == "function" then
|
|
||||||
package.preload[name] = loader
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local loadIfExists = function(module)
|
|
||||||
if isModuleAvailable(module) then
|
|
||||||
require(module)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
loadIfExists "custom"
|
|
|
@ -2,11 +2,11 @@
|
||||||
-- use custom/chadrc.lua instead
|
-- use custom/chadrc.lua instead
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
M.options, M.ui, M.mappings, M.plugins = {}, {}, {}, {}
|
|
||||||
|
|
||||||
-- non plugin normal, available without any plugins
|
|
||||||
M.options = {
|
M.options = {
|
||||||
-- NeoVim/Vim options
|
-- custom = {}
|
||||||
|
-- general nvim/vim options , check :h optionname to know more about an option
|
||||||
|
|
||||||
clipboard = "unnamedplus",
|
clipboard = "unnamedplus",
|
||||||
cmdheight = 1,
|
cmdheight = 1,
|
||||||
ruler = false,
|
ruler = false,
|
||||||
|
@ -16,17 +16,16 @@ M.options = {
|
||||||
mapleader = " ",
|
mapleader = " ",
|
||||||
mouse = "a",
|
mouse = "a",
|
||||||
number = true,
|
number = true,
|
||||||
-- relative numbers in normal mode tool at the bottom of options.lua
|
|
||||||
numberwidth = 2,
|
numberwidth = 2,
|
||||||
relativenumber = false,
|
relativenumber = false,
|
||||||
expandtab = true,
|
expandtab = true,
|
||||||
shiftwidth = 2,
|
shiftwidth = 2,
|
||||||
smartindent = true,
|
smartindent = true,
|
||||||
tabstop = 8, -- Number of spaces that a <Tab> in the file counts for
|
tabstop = 8,
|
||||||
timeoutlen = 400,
|
timeoutlen = 400,
|
||||||
-- interval for writing swap file to disk, also used by gitsigns
|
|
||||||
updatetime = 250,
|
updatetime = 250,
|
||||||
undofile = true, -- keep a permanent undo (across restarts)
|
undofile = true,
|
||||||
|
|
||||||
-- NvChad options
|
-- NvChad options
|
||||||
nvChad = {
|
nvChad = {
|
||||||
copy_cut = true, -- copy cut text ( x key ), visual and normal mode
|
copy_cut = true, -- copy cut text ( x key ), visual and normal mode
|
||||||
|
@ -34,43 +33,46 @@ M.options = {
|
||||||
insert_nav = true, -- navigation in insertmode
|
insert_nav = true, -- navigation in insertmode
|
||||||
window_nav = true,
|
window_nav = true,
|
||||||
theme_toggler = false,
|
theme_toggler = false,
|
||||||
-- used for updater
|
|
||||||
|
-- updater
|
||||||
update_url = "https://github.com/NvChad/NvChad",
|
update_url = "https://github.com/NvChad/NvChad",
|
||||||
update_branch = "main",
|
update_branch = "main",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ui configs
|
---- UI -----
|
||||||
|
|
||||||
M.ui = {
|
M.ui = {
|
||||||
hl_override = "", -- path of your file which contains highlight stuffs
|
hl_override = "", -- path of your file that contains highlights
|
||||||
italic_comments = false,
|
italic_comments = false,
|
||||||
-- theme to be used, check available themes with `<leader> + t + h`
|
theme = "onedark", -- default theme
|
||||||
theme = "onedark",
|
|
||||||
-- toggle between two themes, see theme_toggler mappings
|
-- toggle between two themes, see theme_toggler mappings
|
||||||
theme_toggler = {
|
theme_toggler = {
|
||||||
"onedark",
|
"onedark",
|
||||||
"gruvchad",
|
"gruvchad",
|
||||||
},
|
},
|
||||||
-- Enable this only if your terminal has the colorscheme set which nvchad uses
|
|
||||||
|
-- Change terminal bg to nvim theme's bg color so it'll match well
|
||||||
-- For Ex : if you have onedark set in nvchad, set onedark's bg color on your terminal
|
-- For Ex : if you have onedark set in nvchad, set onedark's bg color on your terminal
|
||||||
transparency = false,
|
transparency = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- these are plugin related options
|
---- PLUGIN OPTIONS ----
|
||||||
|
|
||||||
M.plugins = {
|
M.plugins = {
|
||||||
-- enable and disable plugins (false for disable)
|
-- enable/disable plugins (false for disable)
|
||||||
status = {
|
status = {
|
||||||
blankline = true, -- show code scope with symbols
|
blankline = true, -- indentline stuff
|
||||||
bufferline = true, -- list open buffers up the top, easy switching too
|
bufferline = true, -- manage and preview opened buffers
|
||||||
colorizer = false, -- color RGB, HEX, CSS, NAME color codes
|
colorizer = false, -- color RGB, HEX, CSS, NAME color codes
|
||||||
comment = true, -- easily (un)comment code, language aware
|
comment = true, -- easily (un)comment code, language aware
|
||||||
dashboard = false, -- NeoVim 'home screen' on open
|
dashboard = false,
|
||||||
esc_insertmode = true, -- map to <ESC> with no lag
|
esc_insertmode = true, -- map to <ESC> with no lag
|
||||||
feline = true, -- statusline
|
feline = true, -- statusline
|
||||||
gitsigns = true, -- gitsigns in statusline
|
gitsigns = true,
|
||||||
lspsignature = true, -- lsp enhancements
|
lspsignature = true, -- lsp enhancements
|
||||||
telescope_media = false, -- media previews within telescope finders
|
telescope_media = false,
|
||||||
vim_matchup = true, -- % operator enhancements
|
vim_matchup = true, -- improved matchit
|
||||||
cmp = true,
|
cmp = true,
|
||||||
nvimtree = true,
|
nvimtree = true,
|
||||||
autopairs = true,
|
autopairs = true,
|
||||||
|
@ -86,39 +88,47 @@ M.plugins = {
|
||||||
luasnip = {
|
luasnip = {
|
||||||
snippet_path = {},
|
snippet_path = {},
|
||||||
},
|
},
|
||||||
statusline = { -- statusline related options
|
statusline = {
|
||||||
-- these are filetypes, not pattern matched
|
-- hide, show on specific filetypes
|
||||||
-- shown filetypes will overrule hidden filetypes
|
|
||||||
hidden = {
|
hidden = {
|
||||||
"help",
|
"help",
|
||||||
"dashboard",
|
"dashboard",
|
||||||
"NvimTree",
|
"NvimTree",
|
||||||
"terminal",
|
"terminal",
|
||||||
},
|
},
|
||||||
-- show short statusline on small screens
|
|
||||||
shortline = true,
|
|
||||||
shown = {},
|
shown = {},
|
||||||
-- default, round , slant , block , arrow
|
|
||||||
style = "default",
|
-- truncate statusline on small screens
|
||||||
|
shortline = true,
|
||||||
|
style = "default", -- default, round , slant , block , arrow
|
||||||
},
|
},
|
||||||
esc_insertmode_timeout = 300,
|
esc_insertmode_timeout = 300,
|
||||||
},
|
},
|
||||||
default_plugin_config_replace = {},
|
default_plugin_config_replace = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- mappings -- don't use a single keymap twice --
|
-- Don't use a single keymap twice
|
||||||
-- non plugin mappings
|
|
||||||
|
--- MAPPINGS ----
|
||||||
|
|
||||||
|
-- non plugin
|
||||||
M.mappings = {
|
M.mappings = {
|
||||||
-- custom = {}, -- all custom user mappings
|
-- custom = {}, -- custom user mappings
|
||||||
-- close current focused buffer
|
|
||||||
|
misc = {
|
||||||
|
cheatsheet = "<leader>ch",
|
||||||
close_buffer = "<leader>x",
|
close_buffer = "<leader>x",
|
||||||
copy_whole_file = "<C-a>", -- copy all contents of the current buffer
|
copy_whole_file = "<C-a>", -- copy all contents of current buffer
|
||||||
line_number_toggle = "<leader>n", -- show or hide line number
|
line_number_toggle = "<leader>n", -- toggle line number
|
||||||
new_buffer = "<S-t>", -- open a new buffer
|
update_nvchad = "<leader>uu",
|
||||||
new_tab = "<C-t>b", -- open a new vim tab
|
new_buffer = "<S-t>",
|
||||||
|
new_tab = "<C-t>b",
|
||||||
save_file = "<C-s>", -- save file using :w
|
save_file = "<C-s>", -- save file using :w
|
||||||
theme_toggler = "<leader>tt", -- for theme toggler, see in ui.theme_toggler
|
theme_toggler = "<leader>tt", -- see in ui.theme_toggler
|
||||||
|
},
|
||||||
|
|
||||||
-- navigation in insert mode, only if enabled in options
|
-- navigation in insert mode, only if enabled in options
|
||||||
|
|
||||||
insert_nav = {
|
insert_nav = {
|
||||||
backward = "<C-h>",
|
backward = "<C-h>",
|
||||||
end_of_line = "<C-e>",
|
end_of_line = "<C-e>",
|
||||||
|
@ -127,6 +137,7 @@ M.mappings = {
|
||||||
prev_line = "<C-j>",
|
prev_line = "<C-j>",
|
||||||
beginning_of_line = "<C-a>",
|
beginning_of_line = "<C-a>",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- better window movement
|
-- better window movement
|
||||||
window_nav = {
|
window_nav = {
|
||||||
moveLeft = "<C-h>",
|
moveLeft = "<C-h>",
|
||||||
|
@ -134,53 +145,55 @@ M.mappings = {
|
||||||
moveUp = "<C-k>",
|
moveUp = "<C-k>",
|
||||||
moveDown = "<C-j>",
|
moveDown = "<C-j>",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- terminal related mappings
|
-- terminal related mappings
|
||||||
terminal = {
|
terminal = {
|
||||||
-- multiple mappings can be given for esc_termmode and esc_hide_termmode
|
-- multiple mappings can be given for esc_termmode, esc_hide_termmode
|
||||||
|
|
||||||
-- get out of terminal mode
|
-- get out of terminal mode
|
||||||
esc_termmode = { "jk" }, -- multiple mappings allowed
|
esc_termmode = { "jk" },
|
||||||
|
|
||||||
-- get out of terminal mode and hide it
|
-- get out of terminal mode and hide it
|
||||||
esc_hide_termmode = { "JK" }, -- multiple mappings allowed
|
esc_hide_termmode = { "JK" },
|
||||||
-- show & recover hidden terminal buffers in a telescope picker
|
-- show & recover hidden terminal buffers in a telescope picker
|
||||||
pick_term = "<leader>W",
|
pick_term = "<leader>W",
|
||||||
-- below three are for spawning terminals
|
|
||||||
|
-- spawn terminals
|
||||||
new_horizontal = "<leader>h",
|
new_horizontal = "<leader>h",
|
||||||
new_vertical = "<leader>v",
|
new_vertical = "<leader>v",
|
||||||
new_window = "<leader>w",
|
new_window = "<leader>w",
|
||||||
},
|
},
|
||||||
-- update nvchad from nvchad, chadness 101
|
|
||||||
update_nvchad = "<leader>uu",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- all plugins related mappings
|
-- plugins related mappings
|
||||||
|
|
||||||
M.mappings.plugins = {
|
M.mappings.plugins = {
|
||||||
-- list open buffers up the top, easy switching too
|
|
||||||
bufferline = {
|
bufferline = {
|
||||||
next_buffer = "<TAB>", -- next buffer
|
next_buffer = "<TAB>",
|
||||||
prev_buffer = "<S-Tab>", -- previous buffer
|
prev_buffer = "<S-Tab>",
|
||||||
},
|
},
|
||||||
-- easily (un)comment code, language aware
|
|
||||||
comment = {
|
comment = {
|
||||||
toggle = "<leader>/", -- toggle comment (works on multiple lines)
|
toggle = "<leader>/",
|
||||||
},
|
},
|
||||||
-- NeoVim 'home screen' on open
|
|
||||||
dashboard = {
|
dashboard = {
|
||||||
bookmarks = "<leader>bm",
|
bookmarks = "<leader>bm",
|
||||||
new_file = "<leader>fn", -- basically create a new buffer
|
new_file = "<leader>fn", -- basically create a new buffer
|
||||||
open = "<leader>db", -- open dashboard
|
open = "<leader>db", -- open dashboard
|
||||||
session_load = "<leader>l", -- load a saved session
|
session_load = "<leader>l",
|
||||||
session_save = "<leader>s", -- save a session
|
session_save = "<leader>s",
|
||||||
},
|
},
|
||||||
|
|
||||||
-- map to <ESC> with no lag
|
-- map to <ESC> with no lag
|
||||||
better_escape = { -- <ESC> will still work
|
better_escape = { -- <ESC> will still work
|
||||||
esc_insertmode = { "jk" }, -- multiple mappings allowed
|
esc_insertmode = { "jk" }, -- multiple mappings allowed
|
||||||
},
|
},
|
||||||
-- file explorer/tree
|
|
||||||
nvimtree = {
|
nvimtree = {
|
||||||
toggle = "<C-n>",
|
toggle = "<C-n>",
|
||||||
focus = "<leader>e",
|
focus = "<leader>e",
|
||||||
},
|
},
|
||||||
-- multitool for finding & picking things
|
|
||||||
telescope = {
|
telescope = {
|
||||||
buffers = "<leader>fb",
|
buffers = "<leader>fb",
|
||||||
find_files = "<leader>ff",
|
find_files = "<leader>ff",
|
||||||
|
@ -191,7 +204,7 @@ M.mappings.plugins = {
|
||||||
live_grep = "<leader>fw",
|
live_grep = "<leader>fw",
|
||||||
oldfiles = "<leader>fo",
|
oldfiles = "<leader>fo",
|
||||||
themes = "<leader>th", -- NvChad theme picker
|
themes = "<leader>th", -- NvChad theme picker
|
||||||
-- media previews within telescope finders
|
|
||||||
telescope_media = {
|
telescope_media = {
|
||||||
media_files = "<leader>fp",
|
media_files = "<leader>fp",
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
local hooks, overrides, M = {}, {}, {}
|
local hooks, M = {}, {}
|
||||||
|
|
||||||
local allowed_hooks = {
|
local allowed_hooks = {
|
||||||
"install_plugins",
|
"install_plugins",
|
||||||
"setup_mappings",
|
"setup_mappings",
|
||||||
|
@ -11,13 +12,11 @@ local function has_value(tab, val)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
M.add = function(name, fn)
|
M.add = function(name, fn)
|
||||||
if not (has_value(allowed_hooks, name)) then
|
if not (has_value(allowed_hooks, name)) then
|
||||||
error("Custom lua uses unallowed hook " .. name)
|
print("Custom lua uses unallowed hook " .. name)
|
||||||
end
|
end
|
||||||
if hooks[name] == nil then
|
if hooks[name] == nil then
|
||||||
hooks[name] = {}
|
hooks[name] = {}
|
||||||
|
@ -26,43 +25,11 @@ M.add = function(name, fn)
|
||||||
end
|
end
|
||||||
|
|
||||||
M.run = function(name, args)
|
M.run = function(name, args)
|
||||||
if hooks[name] == nil then
|
if hooks[name] ~= nil then
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, hook in pairs(hooks[name]) do
|
for _, hook in pairs(hooks[name]) do
|
||||||
hook(args)
|
hook(args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
M.createOverrides = function(module)
|
|
||||||
local O = {}
|
|
||||||
|
|
||||||
O.get = function(name, default)
|
|
||||||
local current = default
|
|
||||||
if overrides[module] and overrides[module][name] then
|
|
||||||
if type(overrides[module][name]) == "function" then
|
|
||||||
current = overrides[module][name]
|
|
||||||
elseif type(overrides[module][name]) == "table" then
|
|
||||||
for _, override in pairs(overrides[module][name]) do
|
|
||||||
current = override(current)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return current
|
|
||||||
end
|
|
||||||
|
|
||||||
return O
|
|
||||||
end
|
|
||||||
|
|
||||||
M.override = function(module, name, overwrite)
|
|
||||||
if overrides[module] == nil then
|
|
||||||
overrides[module] = {}
|
|
||||||
end
|
|
||||||
if overrides[module][name] == nil then
|
|
||||||
overrides[module][name] = {}
|
|
||||||
end
|
|
||||||
table.insert(overrides[module][name], overwrite)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
local core_modules = {
|
|
||||||
"core.custom",
|
|
||||||
"core.options",
|
|
||||||
"core.autocmds",
|
|
||||||
"core.mappings",
|
|
||||||
}
|
|
||||||
|
|
||||||
local hooks = require "core.hooks"
|
|
||||||
|
|
||||||
for _, module in ipairs(core_modules) do
|
|
||||||
local ok, err = pcall(require, module)
|
|
||||||
if not ok then
|
|
||||||
error("Error loading " .. module .. "\n\n" .. err)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- set all the non plugin mappings
|
|
||||||
require("core.mappings").misc()
|
|
||||||
|
|
||||||
hooks.run "ready"
|
|
|
@ -29,6 +29,11 @@ M.misc = function()
|
||||||
|
|
||||||
-- use ESC to turn off search highlighting
|
-- use ESC to turn off search highlighting
|
||||||
map("n", "<Esc>", ":noh <CR>")
|
map("n", "<Esc>", ":noh <CR>")
|
||||||
|
|
||||||
|
-- center cursor when moving (goto_definition)
|
||||||
|
|
||||||
|
-- yank from current cursor to end of line
|
||||||
|
map("n", "Y", "yg$")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function optional_mappings()
|
local function optional_mappings()
|
||||||
|
@ -68,19 +73,20 @@ M.misc = function()
|
||||||
if nvChad_options.theme_toggler then
|
if nvChad_options.theme_toggler then
|
||||||
map(
|
map(
|
||||||
"n",
|
"n",
|
||||||
maps.theme_toggler,
|
maps.misc.theme_toggler,
|
||||||
":lua require('nvchad').toggle_theme(require('core.utils').load_config().ui.theme_toggler) <CR>"
|
":lua require('nvchad').toggle_theme(require('core.utils').load_config().ui.theme_toggler) <CR>"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function required_mappings()
|
local function required_mappings()
|
||||||
map("n", maps.close_buffer, ":lua require('core.utils').close_buffer() <CR>") -- close buffer
|
map("n", maps.misc.cheatsheet, ":lua require('nvchad.cheatsheet').show() <CR>") -- show keybinds
|
||||||
map("n", maps.copy_whole_file, ":%y+ <CR>") -- copy whole file content
|
map("n", maps.misc.close_buffer, ":lua require('core.utils').close_buffer() <CR>") -- close buffer
|
||||||
map("n", maps.new_buffer, ":enew <CR>") -- new buffer
|
map("n", maps.misc.copy_whole_file, ":%y+ <CR>") -- copy whole file content
|
||||||
map("n", maps.new_tab, ":tabnew <CR>") -- new tabs
|
map("n", maps.misc.new_buffer, ":enew <CR>") -- new buffer
|
||||||
map("n", maps.line_number_toggle, ":set nu! <CR>") -- toggle numbers
|
map("n", maps.misc.new_tab, ":tabnew <CR>") -- new tabs
|
||||||
map("n", maps.save_file, ":w <CR>") -- ctrl + s to save file
|
map("n", maps.misc.line_number_toggle, ":set nu! <CR>") -- toggle numbers
|
||||||
|
map("n", maps.misc.save_file, ":w <CR>") -- ctrl + s to save file
|
||||||
|
|
||||||
-- terminal mappings --
|
-- terminal mappings --
|
||||||
local term_maps = maps.terminal
|
local term_maps = maps.terminal
|
||||||
|
@ -107,10 +113,7 @@ M.misc = function()
|
||||||
|
|
||||||
-- add NvChadUpdate command and mapping
|
-- add NvChadUpdate command and mapping
|
||||||
cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
|
cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
|
||||||
map("n", maps.update_nvchad, ":NvChadUpdate <CR>")
|
map("n", maps.misc.update_nvchad, ":NvChadUpdate <CR>")
|
||||||
|
|
||||||
-- add ChadReload command and maping
|
|
||||||
-- cmd "silent! command! NvChadReload lua require('nvchad').reload_config()"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
non_config_mappings()
|
non_config_mappings()
|
||||||
|
@ -153,7 +156,7 @@ M.telescope = function()
|
||||||
local m = plugin_maps.telescope
|
local m = plugin_maps.telescope
|
||||||
|
|
||||||
map("n", m.buffers, ":Telescope buffers <CR>")
|
map("n", m.buffers, ":Telescope buffers <CR>")
|
||||||
map("n", m.find_files, ":Telescope find_files <CR>")
|
map("n", m.find_files, ":Telescope find_files no_ignore=true <CR>")
|
||||||
map("n", m.find_hiddenfiles, ":Telescope find_files hidden=true <CR>")
|
map("n", m.find_hiddenfiles, ":Telescope find_files hidden=true <CR>")
|
||||||
map("n", m.git_commits, ":Telescope git_commits <CR>")
|
map("n", m.git_commits, ":Telescope git_commits <CR>")
|
||||||
map("n", m.git_status, ":Telescope git_status <CR>")
|
map("n", m.git_status, ":Telescope git_status <CR>")
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
-- export user config as a global varibale
|
|
||||||
g.nvchad_user_config = "chadrc"
|
|
||||||
|
|
||||||
local options = require("core.utils").load_config().options
|
local options = require("core.utils").load_config().options
|
||||||
|
|
||||||
opt.title = true
|
opt.title = true
|
||||||
|
|
|
@ -132,63 +132,26 @@ M.hide_statusline = function()
|
||||||
if vim.tbl_contains(hidden, buftype) then
|
if vim.tbl_contains(hidden, buftype) then
|
||||||
api.nvim_set_option("laststatus", 0)
|
api.nvim_set_option("laststatus", 0)
|
||||||
return
|
return
|
||||||
else
|
end
|
||||||
|
|
||||||
api.nvim_set_option("laststatus", 2)
|
api.nvim_set_option("laststatus", 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.load_config = function()
|
||||||
|
local conf = require "core.default_config"
|
||||||
|
|
||||||
|
local chadrcExists, _ = pcall(require, "custom.chadrc")
|
||||||
|
|
||||||
|
-- if chadrc exists , then merge its table into the default config's
|
||||||
|
|
||||||
|
if chadrcExists then
|
||||||
|
local change = require "custom.chadrc"
|
||||||
|
conf = vim.tbl_deep_extend("force", conf, change)
|
||||||
|
return conf
|
||||||
end
|
end
|
||||||
|
|
||||||
-- load config
|
-- or load default config
|
||||||
-- 1st arg = boolean - whether to force reload
|
return conf
|
||||||
-- Modifies _G._NVCHAD_CONFIG global variable
|
|
||||||
M.load_config = function(reload)
|
|
||||||
-- only do the stuff below one time, otherwise just return the set config
|
|
||||||
if _G._NVCHAD_CONFIG_CONTENTS ~= nil and not (reload or false) then
|
|
||||||
return _G._NVCHAD_CONFIG_CONTENTS
|
|
||||||
end
|
|
||||||
|
|
||||||
-- these are the table value which will be always prioritiezed to take user config value
|
|
||||||
local to_replace = {
|
|
||||||
"['mappings']['plugins']['esc_insertmode']",
|
|
||||||
"['mappings']['terminal']['esc_termmode']",
|
|
||||||
"['mappings']['terminal']['esc_hide_termmode']",
|
|
||||||
}
|
|
||||||
|
|
||||||
local default_config = "core.default_config"
|
|
||||||
local config_name = vim.g.nvchad_user_config or "chadrc"
|
|
||||||
local config_file = vim.fn.stdpath "config" .. "/lua/custom/" .. config_name .. ".lua"
|
|
||||||
|
|
||||||
-- unload the modules if force reload
|
|
||||||
if reload then
|
|
||||||
package.loaded[default_config or false] = nil
|
|
||||||
package.loaded[config_name or false] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- don't enclose in pcall, it better break when default config is faulty
|
|
||||||
_G._NVCHAD_CONFIG_CONTENTS = require(default_config)
|
|
||||||
|
|
||||||
-- user config is not required to run nvchad but a optional
|
|
||||||
-- Make sure the config doesn't break the whole system if user config is not present or in bad state or not a table
|
|
||||||
-- print warning texts if user config file is present
|
|
||||||
-- check if the user config is present
|
|
||||||
if vim.fn.filereadable(vim.fn.glob(config_file)) == 1 then
|
|
||||||
local present, config = pcall(require, "custom/" .. config_name)
|
|
||||||
if present then
|
|
||||||
-- make sure the returned value is table
|
|
||||||
if type(config) == "table" then
|
|
||||||
-- data = require(config_name)
|
|
||||||
_G._NVCHAD_CONFIG_CONTENTS = require("core.utils").merge_table(
|
|
||||||
_G._NVCHAD_CONFIG_CONTENTS,
|
|
||||||
config,
|
|
||||||
to_replace
|
|
||||||
)
|
|
||||||
else
|
|
||||||
print("Warning: " .. config_name .. " sourced successfully but did not return a lua table.")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
print("Warning: " .. config_file .. " is present but sourcing failed.")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return _G._NVCHAD_CONFIG_CONTENTS
|
|
||||||
end
|
end
|
||||||
|
|
||||||
M.map = function(mode, keys, cmd, opt)
|
M.map = function(mode, keys, cmd, opt)
|
||||||
|
@ -239,88 +202,6 @@ M.map = function(mode, keys, cmd, opt)
|
||||||
map_wrapper(mode, keys, cmd, options)
|
map_wrapper(mode, keys, cmd, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Base code: https://gist.github.com/revolucas/184aec7998a6be5d2f61b984fac1d7f7
|
|
||||||
-- Changes over it: preserving table 1 contents and also update with table b, without duplicating
|
|
||||||
-- 1st arg - base table
|
|
||||||
-- 2nd arg - table to merge
|
|
||||||
-- 3rg arg - list of nodes as a table, if the node is found replace the from table2 to result, rather than adding the value
|
|
||||||
-- e.g: merge_table(t1, t2, { ['mappings']['plugins']['bufferline'] })
|
|
||||||
M.merge_table = function(into, from, nodes_to_replace)
|
|
||||||
-- make sure both are table
|
|
||||||
if type(into) ~= "table" or type(from) ~= "table" then
|
|
||||||
return into
|
|
||||||
end
|
|
||||||
|
|
||||||
local stack, seen = {}, {}
|
|
||||||
local table1, table2 = into, from
|
|
||||||
|
|
||||||
if type(nodes_to_replace) == "table" then
|
|
||||||
-- function that will be executed with loadstring
|
|
||||||
local replace_fn = function(node)
|
|
||||||
local base_fn = [[
|
|
||||||
return function(table1, table2)
|
|
||||||
local t1, t2 = table1_node or false , table2_node or false
|
|
||||||
if t1 and t2 then
|
|
||||||
table1_node = table2_node
|
|
||||||
end
|
|
||||||
return table1
|
|
||||||
end]]
|
|
||||||
|
|
||||||
-- replace the _node in base_fn to actual given node value
|
|
||||||
local fn = base_fn:gsub("_node", node)
|
|
||||||
-- return the function created from the string base_fn
|
|
||||||
return loadstring(fn)()(table1, table2)
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, node in ipairs(nodes_to_replace) do
|
|
||||||
-- pcall() is a poor workaround for if "['mappings']['plugins']['esc_insertmode']" 'plugins' sub-table does not exist
|
|
||||||
local ok, result = pcall(replace_fn, node)
|
|
||||||
if ok then
|
|
||||||
-- if the node is found then replace
|
|
||||||
table1 = result
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
while true do
|
|
||||||
for k, v in pairs(table2) do
|
|
||||||
if type(v) == "table" and type(table1[k]) == "table" then
|
|
||||||
table.insert(stack, { table1[k], table2[k] })
|
|
||||||
else
|
|
||||||
local present = seen[v] or false
|
|
||||||
if not present then
|
|
||||||
if type(k) == "number" then
|
|
||||||
-- add the value to seen table until value is found
|
|
||||||
-- only do when key is number we just want to append to subtables
|
|
||||||
-- todo: maybe improve this
|
|
||||||
|
|
||||||
for _, value in pairs(table1) do
|
|
||||||
if value == v then
|
|
||||||
present = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
seen[v] = true
|
|
||||||
if not present then
|
|
||||||
table1[#table1 + 1] = v
|
|
||||||
end
|
|
||||||
else
|
|
||||||
table1[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if #stack > 0 then
|
|
||||||
local t = stack[#stack]
|
|
||||||
table1, table2 = t[1], t[2]
|
|
||||||
stack[#stack] = nil
|
|
||||||
else
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return into
|
|
||||||
end
|
|
||||||
|
|
||||||
-- load plugin after entering vim ui
|
-- load plugin after entering vim ui
|
||||||
M.packer_lazy_load = function(plugin, timer)
|
M.packer_lazy_load = function(plugin, timer)
|
||||||
if plugin then
|
if plugin then
|
||||||
|
@ -356,4 +237,27 @@ M.fg_bg = function(group, fgcol, bgcol)
|
||||||
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
cmd("hi " .. group .. " guifg=" .. fgcol .. " guibg=" .. bgcol)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Override default config of a plugin based on the path provided in the chadrc
|
||||||
|
|
||||||
|
-- FUNCTION: override_req, use `chadrc` plugin config override if present
|
||||||
|
-- name = name inside `default_config` / `chadrc`
|
||||||
|
-- default_req = run this if 'name' does not exist in `default_config` / `chadrc`
|
||||||
|
-- if override or default_req start with `(`, then strip that and assume override calls a function, not a whole file
|
||||||
|
M.override_req = function(name, default_req)
|
||||||
|
local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name]
|
||||||
|
local result = default_req
|
||||||
|
|
||||||
|
if override ~= nil then
|
||||||
|
result = override
|
||||||
|
end
|
||||||
|
|
||||||
|
if string.match(result, "^%(") then
|
||||||
|
result = result:sub(2)
|
||||||
|
result = result:gsub("%)%.", "').", 1)
|
||||||
|
return "require('" .. result
|
||||||
|
end
|
||||||
|
|
||||||
|
return "require('" .. result .. "')"
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
-- IMPORTANT NOTE : This is the user config, can be edited. Will be preserved if updated with internal updater
|
|
||||||
-- This file is for NvChad options & tools, custom settings are split between here and 'lua/custom/init.lua'
|
|
||||||
|
|
||||||
local M = {}
|
|
||||||
M.options, M.ui, M.mappings, M.plugins = {}, {}, {}, {}
|
|
||||||
|
|
||||||
-- NOTE: To use this, make a copy with `cp example_chadrc.lua chadrc.lua`
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- To use this file, copy the structure of `core/default_config.lua`,
|
|
||||||
-- examples of setting relative number & changing theme:
|
|
||||||
|
|
||||||
-- M.options = {
|
|
||||||
-- relativenumber = true,
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- M.ui = {
|
|
||||||
-- theme = "nord"
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- NvChad included plugin options & overrides
|
|
||||||
M.plugins = {
|
|
||||||
options = {
|
|
||||||
-- lspconfig = {
|
|
||||||
-- path of file containing setups of different lsps (ex : "custom.plugins.lspconfig"), read the docs for more info
|
|
||||||
-- setup_lspconf = "",
|
|
||||||
-- },
|
|
||||||
},
|
|
||||||
-- To change the Packer `config` of a plugin that comes with NvChad,
|
|
||||||
-- add a table entry below matching the plugin github name
|
|
||||||
-- '-' -> '_', remove any '.lua', '.nvim' extensions
|
|
||||||
-- this string will be called in a `require`
|
|
||||||
-- use "(custom.configs).my_func()" to call a function
|
|
||||||
-- use "custom.blankline" to call a file
|
|
||||||
default_plugin_config_replace = {},
|
|
||||||
}
|
|
||||||
|
|
||||||
return M
|
|
|
@ -1,44 +0,0 @@
|
||||||
-- This is where your custom modules and plugins go.
|
|
||||||
-- See the wiki for a guide on how to extend NvChad
|
|
||||||
|
|
||||||
local hooks = require "core.hooks"
|
|
||||||
|
|
||||||
-- NOTE: To use this, make a copy with `cp example_init.lua init.lua`
|
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- To modify packaged plugin configs, use the overrides functionality
|
|
||||||
-- if the override does not exist in the plugin config, make or request a PR,
|
|
||||||
-- or you can override the whole plugin config with 'chadrc' -> M.plugins.default_plugin_config_replace{}
|
|
||||||
-- this will run your config instead of the NvChad config for the given plugin
|
|
||||||
|
|
||||||
-- hooks.override("lsp", "publish_diagnostics", function(current)
|
|
||||||
-- current.virtual_text = false;
|
|
||||||
-- return current;
|
|
||||||
-- end)
|
|
||||||
|
|
||||||
-- To add new mappings, use the "setup_mappings" hook,
|
|
||||||
-- you can set one or many mappings
|
|
||||||
-- example below:
|
|
||||||
|
|
||||||
-- hooks.add("setup_mappings", function(map)
|
|
||||||
-- map("n", "<leader>cc", "gg0vG$d", opt) -- example to delete the buffer
|
|
||||||
-- .... many more mappings ....
|
|
||||||
-- end)
|
|
||||||
|
|
||||||
-- To add new plugins, use the "install_plugin" hook,
|
|
||||||
-- NOTE: we heavily suggest using Packer's lazy loading (with the 'event' field)
|
|
||||||
-- see: https://github.com/wbthomason/packer.nvim
|
|
||||||
-- examples below:
|
|
||||||
|
|
||||||
-- hooks.add("install_plugins", function(use)
|
|
||||||
-- use {
|
|
||||||
-- "max397574/better-escape.nvim",
|
|
||||||
-- event = "InsertEnter",
|
|
||||||
-- }
|
|
||||||
-- end)
|
|
||||||
|
|
||||||
-- alternatively, put this in a sub-folder like "lua/custom/plugins/mkdir"
|
|
||||||
-- then source it with
|
|
||||||
|
|
||||||
-- require "custom.plugins.mkdir"
|
|
|
@ -10,7 +10,6 @@ bufferline.setup {
|
||||||
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
||||||
buffer_close_icon = "",
|
buffer_close_icon = "",
|
||||||
modified_icon = "",
|
modified_icon = "",
|
||||||
-- close_icon = "%@NvChad_bufferline_quitvim@%X",
|
|
||||||
close_icon = "",
|
close_icon = "",
|
||||||
show_close_icon = true,
|
show_close_icon = true,
|
||||||
left_trunc_marker = "",
|
left_trunc_marker = "",
|
||||||
|
@ -24,7 +23,7 @@ bufferline.setup {
|
||||||
show_buffer_close_icons = true,
|
show_buffer_close_icons = true,
|
||||||
separator_style = "thin",
|
separator_style = "thin",
|
||||||
always_show_bufferline = true,
|
always_show_bufferline = true,
|
||||||
diagnostics = false, -- "or nvim_lsp"
|
diagnostics = false,
|
||||||
custom_filter = function(buf_number)
|
custom_filter = function(buf_number)
|
||||||
-- Func to filter out our managed/persistent split terms
|
-- Func to filter out our managed/persistent split terms
|
||||||
local present_type, type = pcall(function()
|
local present_type, type = pcall(function()
|
||||||
|
@ -36,12 +35,11 @@ bufferline.setup {
|
||||||
return false
|
return false
|
||||||
elseif type == "hori" then
|
elseif type == "hori" then
|
||||||
return false
|
return false
|
||||||
else
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
else
|
|
||||||
return true
|
return true
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -121,6 +119,7 @@ bufferline.setup {
|
||||||
guifg = colors.black2,
|
guifg = colors.black2,
|
||||||
guibg = colors.black2,
|
guibg = colors.black2,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- tabs
|
-- tabs
|
||||||
tab = {
|
tab = {
|
||||||
guifg = colors.light_grey,
|
guifg = colors.light_grey,
|
||||||
|
|
|
@ -6,7 +6,6 @@ end
|
||||||
|
|
||||||
vim.opt.completeopt = "menuone,noselect"
|
vim.opt.completeopt = "menuone,noselect"
|
||||||
|
|
||||||
-- nvim-cmp setup
|
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
|
@ -15,12 +14,8 @@ cmp.setup {
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
-- load lspkind icons
|
local icons = require "plugins.configs.lspkind_icons"
|
||||||
vim_item.kind = string.format(
|
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
||||||
"%s %s",
|
|
||||||
require("plugins.configs.lspkind_icons").icons[vim_item.kind],
|
|
||||||
vim_item.kind
|
|
||||||
)
|
|
||||||
|
|
||||||
vim_item.menu = ({
|
vim_item.menu = ({
|
||||||
nvim_lsp = "[LSP]",
|
nvim_lsp = "[LSP]",
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
local present, gitsigns = pcall(require, "gitsigns")
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
gitsigns.setup {
|
|
||||||
keymaps = {
|
|
||||||
-- Default keymap options
|
|
||||||
buffer = true,
|
|
||||||
noremap = true,
|
|
||||||
["n ]c"] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'" },
|
|
||||||
["n [c"] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'" },
|
|
||||||
["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
|
|
||||||
["n <leader>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
|
|
||||||
["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
|
|
||||||
["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
|
|
||||||
["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>',
|
|
||||||
},
|
|
||||||
numhl = false,
|
|
||||||
|
|
||||||
sign_priority = 5,
|
|
||||||
signs = {
|
|
||||||
add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
|
|
||||||
change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" },
|
|
||||||
changedelete = { hl = "DiffChange", text = "~", numhl = "GitSignsChangeNr" },
|
|
||||||
delete = { hl = "DiffDelete", text = "_", numhl = "GitSignsDeleteNr" },
|
|
||||||
topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" },
|
|
||||||
},
|
|
||||||
|
|
||||||
status_formatter = nil, -- Use default
|
|
||||||
watch_gitdir = {
|
|
||||||
interval = 100,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,5 +1,3 @@
|
||||||
local overrides = require("core.hooks").createOverrides "lsp"
|
|
||||||
|
|
||||||
local function on_attach(_, bufnr)
|
local function on_attach(_, bufnr)
|
||||||
local function buf_set_keymap(...)
|
local function buf_set_keymap(...)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
|
@ -52,52 +50,11 @@ capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- replace the default lsp diagnostic symbols
|
|
||||||
local function lspSymbol(name, icon)
|
|
||||||
vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefault" .. name })
|
|
||||||
end
|
|
||||||
|
|
||||||
lspSymbol("Error", "")
|
|
||||||
lspSymbol("Information", "")
|
|
||||||
lspSymbol("Hint", "")
|
|
||||||
lspSymbol("Warning", "")
|
|
||||||
|
|
||||||
local lsp_publish_diagnostics_options = overrides.get("publish_diagnostics", {
|
|
||||||
virtual_text = {
|
|
||||||
prefix = "",
|
|
||||||
spacing = 0,
|
|
||||||
},
|
|
||||||
signs = true,
|
|
||||||
underline = true,
|
|
||||||
update_in_insert = false, -- update diagnostics insert mode
|
|
||||||
})
|
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
|
||||||
lsp_publish_diagnostics_options
|
|
||||||
)
|
|
||||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
|
||||||
border = "single",
|
|
||||||
})
|
|
||||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
|
||||||
border = "single",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- suppress error messages from lang servers
|
|
||||||
vim.notify = function(msg, log_level, _opts)
|
|
||||||
if msg:match "exit code" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if log_level == vim.log.levels.ERROR then
|
|
||||||
vim.api.nvim_err_writeln(msg)
|
|
||||||
else
|
|
||||||
vim.api.nvim_echo({ { msg } }, true, {})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- requires a file containing user's lspconfigs
|
-- requires a file containing user's lspconfigs
|
||||||
|
|
||||||
local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf
|
local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf
|
||||||
|
|
||||||
if #addlsp_confs ~= 0 then
|
if #addlsp_confs ~= 0 then
|
||||||
require(addlsp_confs).setup_lsp(on_attach, capabilities)
|
require(addlsp_confs).setup_lsp(on_attach, capabilities)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require("plugins.configs.others").lsp_handlers()
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
local M = {}
|
local icons = {
|
||||||
|
|
||||||
M.icons = {
|
|
||||||
Text = "",
|
Text = "",
|
||||||
Method = "",
|
Method = "",
|
||||||
Function = "",
|
Function = "",
|
||||||
|
@ -28,4 +26,4 @@ M.icons = {
|
||||||
TypeParameter = "",
|
TypeParameter = "",
|
||||||
}
|
}
|
||||||
|
|
||||||
return M
|
return icons
|
||||||
|
|
|
@ -7,25 +7,20 @@ end
|
||||||
|
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
vim.o.termguicolors = true
|
|
||||||
|
|
||||||
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
|
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
|
||||||
g.nvim_tree_git_hl = git_status
|
g.nvim_tree_git_hl = git_status
|
||||||
g.nvim_tree_gitignore = 0
|
|
||||||
g.nvim_tree_highlight_opened_files = 0
|
g.nvim_tree_highlight_opened_files = 0
|
||||||
g.nvim_tree_indent_markers = 1
|
g.nvim_tree_indent_markers = 1
|
||||||
g.nvim_tree_ignore = { ".git", "node_modules", ".cache" }
|
|
||||||
g.nvim_tree_quit_on_open = 0 -- closes tree when file's opened
|
g.nvim_tree_quit_on_open = 0 -- closes tree when file's opened
|
||||||
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
|
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
|
||||||
|
|
||||||
g.nvim_tree_window_picker_exclude = {
|
g.nvim_tree_window_picker_exclude = {
|
||||||
filetype = { 'notify', 'packer', 'qf' },
|
filetype = { "notify", "packer", "qf" },
|
||||||
buftype = {'terminal' },
|
buftype = { "terminal" },
|
||||||
}
|
}
|
||||||
|
|
||||||
--
|
|
||||||
g.nvim_tree_show_icons = {
|
g.nvim_tree_show_icons = {
|
||||||
folders = 1,
|
folders = 1,
|
||||||
-- folder_arrows= 1
|
|
||||||
files = 1,
|
files = 1,
|
||||||
git = git_status,
|
git = git_status,
|
||||||
}
|
}
|
||||||
|
@ -43,11 +38,8 @@ g.nvim_tree_icons = {
|
||||||
untracked = "★",
|
untracked = "★",
|
||||||
},
|
},
|
||||||
folder = {
|
folder = {
|
||||||
-- disable indent_markers option to get arrows working or if you want both arrows and indent then just add the arrow icons in front ofthe default and opened folders below!
|
|
||||||
-- arrow_open = "",
|
|
||||||
-- arrow_closed = "",
|
|
||||||
default = "",
|
default = "",
|
||||||
empty = "", --
|
empty = "",
|
||||||
empty_open = "",
|
empty_open = "",
|
||||||
open = "",
|
open = "",
|
||||||
symlink = "",
|
symlink = "",
|
||||||
|
@ -56,15 +48,6 @@ g.nvim_tree_icons = {
|
||||||
}
|
}
|
||||||
|
|
||||||
nvimtree.setup {
|
nvimtree.setup {
|
||||||
diagnostics = {
|
|
||||||
enable = false,
|
|
||||||
icons = {
|
|
||||||
hint = "",
|
|
||||||
info = "",
|
|
||||||
warning = "",
|
|
||||||
error = "",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
filters = {
|
filters = {
|
||||||
dotfiles = false,
|
dotfiles = false,
|
||||||
},
|
},
|
||||||
|
@ -84,4 +67,8 @@ nvimtree.setup {
|
||||||
side = "left",
|
side = "left",
|
||||||
width = 25,
|
width = 25,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
git = {
|
||||||
|
ignore = false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local chadrc_config = require("core.utils").load_config()
|
local chadrc_config = require("core.utils").load_config()
|
||||||
|
|
||||||
M.autopairs = function()
|
M.autopairs = function()
|
||||||
local present1, autopairs = pcall(require, "nvim-autopairs")
|
local present1, autopairs = pcall(require, "nvim-autopairs")
|
||||||
local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
|
local present2, cmp_autopairs = pcall(require, "nvim-autopairs.completion.cmp")
|
||||||
|
|
||||||
if not (present1 or present2) then
|
if present1 and present2 then
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
autopairs.setup()
|
autopairs.setup()
|
||||||
|
|
||||||
-- not needed if you disable cmp, the above var related to cmp tooo! override default config for autopairs
|
|
||||||
local cmp = require "cmp"
|
local cmp = require "cmp"
|
||||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
M.better_escape = function()
|
M.better_escape = function()
|
||||||
require("better_escape").setup {
|
require("better_escape").setup {
|
||||||
|
@ -35,6 +33,7 @@ M.blankline = function()
|
||||||
"lspinfo",
|
"lspinfo",
|
||||||
"TelescopePrompt",
|
"TelescopePrompt",
|
||||||
"TelescopeResults",
|
"TelescopeResults",
|
||||||
|
"nvchad_cheatsheet",
|
||||||
},
|
},
|
||||||
buftype_exclude = { "terminal" },
|
buftype_exclude = { "terminal" },
|
||||||
show_trailing_blankline_indent = false,
|
show_trailing_blankline_indent = false,
|
||||||
|
@ -71,10 +70,7 @@ end
|
||||||
|
|
||||||
M.luasnip = function()
|
M.luasnip = function()
|
||||||
local present, luasnip = pcall(require, "luasnip")
|
local present, luasnip = pcall(require, "luasnip")
|
||||||
if not present then
|
if present then
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
luasnip.config.set_config {
|
luasnip.config.set_config {
|
||||||
history = true,
|
history = true,
|
||||||
updateevents = "TextChanged,TextChangedI",
|
updateevents = "TextChanged,TextChangedI",
|
||||||
|
@ -83,6 +79,7 @@ M.luasnip = function()
|
||||||
require("luasnip/loaders/from_vscode").load { paths = chadrc_config.plugins.options.luasnip.snippet_path }
|
require("luasnip/loaders/from_vscode").load { paths = chadrc_config.plugins.options.luasnip.snippet_path }
|
||||||
require("luasnip/loaders/from_vscode").load()
|
require("luasnip/loaders/from_vscode").load()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
M.signature = function()
|
M.signature = function()
|
||||||
local present, lspsignature = pcall(require, "lsp_signature")
|
local present, lspsignature = pcall(require, "lsp_signature")
|
||||||
|
@ -107,4 +104,59 @@ M.signature = function()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.lsp_handlers = function()
|
||||||
|
local function lspSymbol(name, icon)
|
||||||
|
local hl = "DiagnosticSign" .. name
|
||||||
|
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
|
||||||
|
end
|
||||||
|
|
||||||
|
lspSymbol("Error", "")
|
||||||
|
lspSymbol("Info", "")
|
||||||
|
lspSymbol("Hint", "")
|
||||||
|
lspSymbol("Warn", "")
|
||||||
|
|
||||||
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
virtual_text = {
|
||||||
|
prefix = "",
|
||||||
|
spacing = 0,
|
||||||
|
},
|
||||||
|
signs = true,
|
||||||
|
underline = true,
|
||||||
|
update_in_insert = false, -- update diagnostics insert mode
|
||||||
|
})
|
||||||
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||||
|
border = "single",
|
||||||
|
})
|
||||||
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||||
|
border = "single",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- suppress error messages from lang servers
|
||||||
|
vim.notify = function(msg, log_level, _opts)
|
||||||
|
if msg:match "exit code" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if log_level == vim.log.levels.ERROR then
|
||||||
|
vim.api.nvim_err_writeln(msg)
|
||||||
|
else
|
||||||
|
vim.api.nvim_echo({ { msg } }, true, {})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.gitsigns = function()
|
||||||
|
local present, gitsigns = pcall(require, "gitsigns")
|
||||||
|
if present then
|
||||||
|
gitsigns.setup {
|
||||||
|
signs = {
|
||||||
|
add = { hl = "DiffAdd", text = "│", numhl = "GitSignsAddNr" },
|
||||||
|
change = { hl = "DiffChange", text = "│", numhl = "GitSignsChangeNr" },
|
||||||
|
delete = { hl = "DiffDelete", text = "", numhl = "GitSignsDeleteNr" },
|
||||||
|
topdelete = { hl = "DiffDelete", text = "‾", numhl = "GitSignsDeleteNr" },
|
||||||
|
changedelete = { hl = "DiffChangeDelete", text = "~", numhl = "GitSignsChangeNr" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -43,10 +43,12 @@ local icon_styles = {
|
||||||
}
|
}
|
||||||
|
|
||||||
local config = require("core.utils").load_config().plugins.options.statusline
|
local config = require("core.utils").load_config().plugins.options.statusline
|
||||||
|
|
||||||
-- statusline style
|
-- statusline style
|
||||||
local user_statusline_style = config.style
|
local user_statusline_style = config.style
|
||||||
local statusline_style = icon_styles[user_statusline_style]
|
local statusline_style = icon_styles[user_statusline_style]
|
||||||
-- if show short statusline on small screens
|
|
||||||
|
-- show short statusline on small screens
|
||||||
local shortline = config.shortline == false and true
|
local shortline = config.shortline == false and true
|
||||||
|
|
||||||
-- Initialize the components table
|
-- Initialize the components table
|
||||||
|
@ -55,7 +57,6 @@ local components = {
|
||||||
inactive = {},
|
inactive = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Initialize left, mid and right
|
|
||||||
table.insert(components.active, {})
|
table.insert(components.active, {})
|
||||||
table.insert(components.active, {})
|
table.insert(components.active, {})
|
||||||
table.insert(components.active, {})
|
table.insert(components.active, {})
|
||||||
|
@ -186,6 +187,7 @@ components.active[1][10] = {
|
||||||
components.active[2][1] = {
|
components.active[2][1] = {
|
||||||
provider = function()
|
provider = function()
|
||||||
local Lsp = vim.lsp.util.get_progress_messages()[1]
|
local Lsp = vim.lsp.util.get_progress_messages()[1]
|
||||||
|
|
||||||
if Lsp then
|
if Lsp then
|
||||||
local msg = Lsp.message or ""
|
local msg = Lsp.message or ""
|
||||||
local percentage = Lsp.percentage or 0
|
local percentage = Lsp.percentage or 0
|
||||||
|
@ -207,10 +209,11 @@ components.active[2][1] = {
|
||||||
|
|
||||||
if percentage >= 70 then
|
if percentage >= 70 then
|
||||||
return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
|
return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
|
||||||
else
|
end
|
||||||
|
|
||||||
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
|
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
return ""
|
return ""
|
||||||
end,
|
end,
|
||||||
enabled = shortline or function(winid)
|
enabled = shortline or function(winid)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
local present, telescope = pcall(require, "telescope")
|
local present, telescope = pcall(require, "telescope")
|
||||||
|
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -37,7 +38,7 @@ telescope.setup {
|
||||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||||
file_ignore_patterns = { "node_modules" },
|
file_ignore_patterns = { "node_modules" },
|
||||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||||
path_display = { "absolute" },
|
path_display = { "truncate" },
|
||||||
winblend = 0,
|
winblend = 0,
|
||||||
border = {},
|
border = {},
|
||||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
local present, ts_config = pcall(require, "nvim-treesitter.configs")
|
local present, ts_config = pcall(require, "nvim-treesitter.configs")
|
||||||
|
|
||||||
if not present then
|
if not present then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -6,6 +7,7 @@ end
|
||||||
ts_config.setup {
|
ts_config.setup {
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"lua",
|
"lua",
|
||||||
|
"vim",
|
||||||
},
|
},
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|
|
@ -8,40 +8,13 @@ local use = packer.use
|
||||||
|
|
||||||
return packer.startup(function()
|
return packer.startup(function()
|
||||||
local plugin_settings = require("core.utils").load_config().plugins
|
local plugin_settings = require("core.utils").load_config().plugins
|
||||||
|
local override_req = require("core.utils").override_req
|
||||||
-- FUNCTION: override_req, use `chadrc` plugin config override if present
|
|
||||||
-- name = name inside `default_config` / `chadrc`
|
|
||||||
-- default_req = run this if 'name' does not exist in `default_config` / `chadrc`
|
|
||||||
-- if override or default_req start with `(`, then strip that and assume override calls a function, not a whole file
|
|
||||||
local override_req = function(name, default_req)
|
|
||||||
local override = require("core.utils").load_config().plugins.default_plugin_config_replace[name]
|
|
||||||
local result
|
|
||||||
|
|
||||||
if override == nil then
|
|
||||||
result = default_req
|
|
||||||
else
|
|
||||||
result = override
|
|
||||||
end
|
|
||||||
|
|
||||||
if string.match(result, "^%(") then
|
|
||||||
result = result:sub(2)
|
|
||||||
result = result:gsub("%)%.", "').", 1)
|
|
||||||
return "require('" .. result
|
|
||||||
else
|
|
||||||
return "require('" .. result .. "')"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- this is arranged on the basis of when a plugin starts
|
-- this is arranged on the basis of when a plugin starts
|
||||||
|
|
||||||
-- this is the nvchad core repo containing utilities for some features like theme swticher, no need to lazy load
|
-- this is the nvchad core repo containing utilities for some features like theme swticher, no need to lazy load
|
||||||
use {
|
use "Nvchad/extensions"
|
||||||
"Nvchad/extensions",
|
use "nvim-lua/plenary.nvim"
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"wbthomason/packer.nvim",
|
"wbthomason/packer.nvim",
|
||||||
|
@ -95,7 +68,6 @@ return packer.startup(function()
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
branch = "0.5-compat",
|
|
||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
config = override_req("nvim_treesitter", "plugins.configs.treesitter"),
|
config = override_req("nvim_treesitter", "plugins.configs.treesitter"),
|
||||||
}
|
}
|
||||||
|
@ -105,7 +77,7 @@ return packer.startup(function()
|
||||||
"lewis6991/gitsigns.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
disable = not plugin_settings.status.gitsigns,
|
disable = not plugin_settings.status.gitsigns,
|
||||||
opt = true,
|
opt = true,
|
||||||
config = override_req("gitsigns", "plugins.configs.gitsigns"),
|
config = override_req("gitsigns", "(plugins.configs.others).gitsigns()"),
|
||||||
setup = function()
|
setup = function()
|
||||||
require("core.utils").packer_lazy_load "gitsigns.nvim"
|
require("core.utils").packer_lazy_load "gitsigns.nvim"
|
||||||
end,
|
end,
|
||||||
|
@ -261,6 +233,6 @@ return packer.startup(function()
|
||||||
require("core.mappings").telescope()
|
require("core.mappings").telescope()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
-- load user defined plugins
|
||||||
require("core.hooks").run("install_plugins", use)
|
require("core.hooks").run("install_plugins", use)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
local cmd = vim.cmd
|
vim.cmd "packadd packer.nvim"
|
||||||
|
|
||||||
cmd "packadd packer.nvim"
|
|
||||||
|
|
||||||
local present, packer = pcall(require, "packer")
|
local present, packer = pcall(require, "packer")
|
||||||
|
|
||||||
|
@ -19,7 +17,7 @@ if not present then
|
||||||
packer_path,
|
packer_path,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd "packadd packer.nvim"
|
vim.cmd "packadd packer.nvim"
|
||||||
present, packer = pcall(require, "packer")
|
present, packer = pcall(require, "packer")
|
||||||
|
|
||||||
if present then
|
if present then
|
||||||
|
@ -37,11 +35,10 @@ packer.init {
|
||||||
prompt_border = "single",
|
prompt_border = "single",
|
||||||
},
|
},
|
||||||
git = {
|
git = {
|
||||||
clone_timeout = 600, -- Timeout, in seconds, for git clones
|
clone_timeout = 6000, -- seconds
|
||||||
},
|
},
|
||||||
auto_clean = true,
|
auto_clean = true,
|
||||||
compile_on_sync = true,
|
compile_on_sync = true,
|
||||||
-- auto_reload_compiled = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return packer
|
return packer
|
||||||
|
|
Loading…
Reference in a new issue