Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44a24e2fe5 | ||
|
|
1a98a451ea | ||
|
|
ccf6bc397f | ||
|
|
13cce81d99 | ||
|
|
8fe6a6560e | ||
|
|
0dcd8a91b6 | ||
|
|
e9f6957b99 | ||
|
|
8aec881517 | ||
|
|
f17e83010f | ||
|
|
282a23f446 | ||
|
|
c80f3f0501 | ||
|
|
c2ec317b1b | ||
|
|
2fedda14ed | ||
|
|
e121bde8d8 | ||
|
|
9bb7dcbaf4 | ||
|
|
c8777040fb |
@@ -40,13 +40,6 @@ M.gen_chadrc_template = function()
|
|||||||
local path = fn.stdpath "config" .. "/lua/custom"
|
local path = fn.stdpath "config" .. "/lua/custom"
|
||||||
|
|
||||||
if fn.isdirectory(path) ~= 1 then
|
if fn.isdirectory(path) ~= 1 then
|
||||||
local input = fn.input "Do you want to install example custom config? (y/N): "
|
|
||||||
|
|
||||||
if input:lower() == "y" then
|
|
||||||
M.echo "Cloning example custom config repo..."
|
|
||||||
shell_call { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path }
|
|
||||||
fn.delete(path .. "/.git", "rf")
|
|
||||||
else
|
|
||||||
-- use very minimal chadrc
|
-- use very minimal chadrc
|
||||||
fn.mkdir(path, "p")
|
fn.mkdir(path, "p")
|
||||||
|
|
||||||
@@ -57,6 +50,5 @@ M.gen_chadrc_template = function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
+27
-1
@@ -57,7 +57,7 @@ for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- add binaries installed by mason.nvim to path
|
-- add binaries installed by mason.nvim to path
|
||||||
local is_windows = vim.loop.os_uname().sysname == "Windows_NT"
|
local is_windows = vim.fn.has("win32") ~= 0
|
||||||
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
|
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
|
||||||
|
|
||||||
-------------------------------------- autocmds ------------------------------------------
|
-------------------------------------- autocmds ------------------------------------------
|
||||||
@@ -107,6 +107,32 @@ autocmd("BufWritePost", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- user event that loads after UIEnter + only if file buf is there
|
||||||
|
vim.api.nvim_create_autocmd({ "UIEnter", "BufReadPost", "BufNewFile" }, {
|
||||||
|
group = vim.api.nvim_create_augroup("NvFilePost", { clear = true }),
|
||||||
|
callback = function(args)
|
||||||
|
local file = vim.api.nvim_buf_get_name(args.buf)
|
||||||
|
local buftype = vim.api.nvim_buf_get_option(args.buf, "buftype")
|
||||||
|
|
||||||
|
if not vim.g.ui_entered and args.event == "UIEnter" then
|
||||||
|
vim.g.ui_entered = true
|
||||||
|
end
|
||||||
|
|
||||||
|
if file ~= "" and buftype ~= "nofile" and vim.g.ui_entered then
|
||||||
|
vim.api.nvim_exec_autocmds("User", { pattern = "FilePost", modeline = false })
|
||||||
|
vim.api.nvim_del_augroup_by_name "NvFilePost"
|
||||||
|
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_exec_autocmds("FileType", {})
|
||||||
|
|
||||||
|
if vim.g.editorconfig then
|
||||||
|
require("editorconfig").config(args.buf)
|
||||||
|
end
|
||||||
|
end, 0)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-------------------------------------- commands ------------------------------------------
|
-------------------------------------- commands ------------------------------------------
|
||||||
local new_cmd = vim.api.nvim_create_user_command
|
local new_cmd = vim.api.nvim_create_user_command
|
||||||
|
|
||||||
|
|||||||
@@ -5,17 +5,16 @@ local M = {}
|
|||||||
local utils = require "core.utils"
|
local utils = require "core.utils"
|
||||||
|
|
||||||
-- export on_attach & capabilities for custom lspconfigs
|
-- export on_attach & capabilities for custom lspconfigs
|
||||||
|
|
||||||
M.on_attach = function(client, bufnr)
|
M.on_attach = function(client, bufnr)
|
||||||
client.server_capabilities.documentFormattingProvider = false
|
|
||||||
client.server_capabilities.documentRangeFormattingProvider = false
|
|
||||||
|
|
||||||
utils.load_mappings("lspconfig", { buffer = bufnr })
|
utils.load_mappings("lspconfig", { buffer = bufnr })
|
||||||
|
|
||||||
if client.server_capabilities.signatureHelpProvider then
|
if client.server_capabilities.signatureHelpProvider then
|
||||||
require("nvchad.signature").setup(client)
|
require("nvchad.signature").setup(client)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- disable semantic tokens
|
||||||
|
M.on_init = function(client, _)
|
||||||
if not utils.load_config().ui.lsp_semantic_tokens and client.supports_method "textDocument/semanticTokens" then
|
if not utils.load_config().ui.lsp_semantic_tokens and client.supports_method "textDocument/semanticTokens" then
|
||||||
client.server_capabilities.semanticTokensProvider = nil
|
client.server_capabilities.semanticTokensProvider = nil
|
||||||
end
|
end
|
||||||
@@ -42,6 +41,7 @@ M.capabilities.textDocument.completion.completionItem = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
require("lspconfig").lua_ls.setup {
|
require("lspconfig").lua_ls.setup {
|
||||||
|
on_init = M.on_init,
|
||||||
on_attach = M.on_attach,
|
on_attach = M.on_attach,
|
||||||
capabilities = M.capabilities,
|
capabilities = M.capabilities,
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ local options = {
|
|||||||
horizontal = {
|
horizontal = {
|
||||||
prompt_position = "top",
|
prompt_position = "top",
|
||||||
preview_width = 0.55,
|
preview_width = 0.55,
|
||||||
results_width = 0.8,
|
|
||||||
},
|
},
|
||||||
vertical = {
|
vertical = {
|
||||||
mirror = false,
|
mirror = false,
|
||||||
@@ -49,15 +48,7 @@ local options = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
extensions_list = { "themes", "terms", "fzf" },
|
extensions_list = { "themes", "terms" },
|
||||||
extensions = {
|
|
||||||
fzf = {
|
|
||||||
fuzzy = true,
|
|
||||||
override_generic_sorter = true,
|
|
||||||
override_file_sorter = true,
|
|
||||||
case_mode = "smart_case",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return options
|
return options
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
local options = {
|
local options = {
|
||||||
ensure_installed = { "lua" },
|
ensure_installed = { "lua", "vim", "vimdoc" },
|
||||||
|
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|||||||
+9
-30
@@ -19,7 +19,7 @@ local default_plugins = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"NvChad/nvterm",
|
"zbirenbaum/nvterm",
|
||||||
init = function()
|
init = function()
|
||||||
require("core.utils").load_mappings "nvterm"
|
require("core.utils").load_mappings "nvterm"
|
||||||
end,
|
end,
|
||||||
@@ -31,9 +31,7 @@ local default_plugins = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"NvChad/nvim-colorizer.lua",
|
"NvChad/nvim-colorizer.lua",
|
||||||
init = function()
|
event = "User FilePost",
|
||||||
require("core.utils").lazy_load "nvim-colorizer.lua"
|
|
||||||
end,
|
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("colorizer").setup(opts)
|
require("colorizer").setup(opts)
|
||||||
|
|
||||||
@@ -58,9 +56,7 @@ local default_plugins = {
|
|||||||
{
|
{
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
version = "2.20.7",
|
version = "2.20.7",
|
||||||
init = function()
|
event = "User FilePost",
|
||||||
require("core.utils").lazy_load "indent-blankline.nvim"
|
|
||||||
end,
|
|
||||||
opts = function()
|
opts = function()
|
||||||
return require("plugins.configs.others").blankline
|
return require("plugins.configs.others").blankline
|
||||||
end,
|
end,
|
||||||
@@ -73,9 +69,7 @@ local default_plugins = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
init = function()
|
event = { "BufReadPost", "BufNewFile" },
|
||||||
require("core.utils").lazy_load "nvim-treesitter"
|
|
||||||
end,
|
|
||||||
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
|
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
opts = function()
|
opts = function()
|
||||||
@@ -90,22 +84,7 @@ local default_plugins = {
|
|||||||
-- git stuff
|
-- git stuff
|
||||||
{
|
{
|
||||||
"lewis6991/gitsigns.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
ft = { "gitcommit", "diff" },
|
event = "User FilePost",
|
||||||
init = function()
|
|
||||||
-- load gitsigns only when a git file is opened
|
|
||||||
vim.api.nvim_create_autocmd({ "BufRead" }, {
|
|
||||||
group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }),
|
|
||||||
callback = function()
|
|
||||||
vim.fn.system("git -C " .. '"' .. vim.fn.expand "%:p:h" .. '"' .. " rev-parse")
|
|
||||||
if vim.v.shell_error == 0 then
|
|
||||||
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
|
|
||||||
vim.schedule(function()
|
|
||||||
require("lazy").load { plugins = { "gitsigns.nvim" } }
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
opts = function()
|
opts = function()
|
||||||
return require("plugins.configs.others").gitsigns
|
return require("plugins.configs.others").gitsigns
|
||||||
end,
|
end,
|
||||||
@@ -128,7 +107,9 @@ local default_plugins = {
|
|||||||
|
|
||||||
-- custom nvchad cmd to install all mason binaries listed
|
-- custom nvchad cmd to install all mason binaries listed
|
||||||
vim.api.nvim_create_user_command("MasonInstallAll", function()
|
vim.api.nvim_create_user_command("MasonInstallAll", function()
|
||||||
|
if opts.ensure_installed and #opts.ensure_installed > 0 then
|
||||||
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
|
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
|
||||||
|
end
|
||||||
end, {})
|
end, {})
|
||||||
|
|
||||||
vim.g.mason_binaries_list = opts.ensure_installed
|
vim.g.mason_binaries_list = opts.ensure_installed
|
||||||
@@ -137,9 +118,7 @@ local default_plugins = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
init = function()
|
event = "User FilePost",
|
||||||
require("core.utils").lazy_load "nvim-lspconfig"
|
|
||||||
end,
|
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.lspconfig"
|
require "plugins.configs.lspconfig"
|
||||||
end,
|
end,
|
||||||
@@ -229,7 +208,7 @@ local default_plugins = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
dependencies = { "nvim-treesitter/nvim-treesitter", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" } },
|
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
init = function()
|
init = function()
|
||||||
require("core.utils").load_mappings "telescope"
|
require("core.utils").load_mappings "telescope"
|
||||||
|
|||||||
Reference in New Issue
Block a user