Compare commits

...

10 Commits

Author SHA1 Message Date
df1af847b2 Merge branch 'v2.0' of https://github.com/NvChad/NvChad into pt 2023-04-02 02:06:22 -04:00
1c0a2345e0 show ignored diretories 2023-04-02 02:06:19 -04:00
siduck
a5906e48fb use function in init opts for all plugins
if this isnt done then disabling a plugin will still have its init opt called, read https://github.com/NvChad/NvChad/discussions/1879
2023-04-01 12:47:42 +05:30
waneon
8ec2cb3b76 feat: Increase visibility of floating diagnostic 2023-03-31 05:59:08 +05:30
Daniel Boll
800d066aab feat(bootstrap): indicate that no is the default answer
Indicates that the default answer would be *no* if the user provide any input other than `y`
2023-03-31 05:27:23 +05:30
siduck
ffdb4fc5e5 add show_numbers option to tabufline config
87525fa3cd
2023-03-30 18:23:16 +05:30
siduck
c77c086365 add nvimtree_side global in nvimtree config func https://github.com/NvChad/ui/issues/68
also clean some lazy.nvim related variables
2023-03-29 07:41:21 +05:30
Daniel Boll
55de4b9c85 fix(cmp): lsp suggestions before snippets 2023-03-28 19:33:17 +05:30
siduck
d7f91016a8 bootstrap.lua: rm useless variables 2023-03-27 05:34:12 +05:30
siduck
79805b7fea bootstrap: clone base46 to lazy path instead of tmpdir 2023-03-27 05:27:57 +05:30
8 changed files with 97 additions and 52 deletions

View File

@ -1,4 +1,5 @@
require "core" require "core"
vim.api.nvim_set_var('mapleader', ';')
local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1] local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1]
@ -12,7 +13,6 @@ local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
-- bootstrap lazy.nvim! -- bootstrap lazy.nvim!
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
require("core.bootstrap").base46()
require("core.bootstrap").gen_chadrc_template() require("core.bootstrap").gen_chadrc_template()
require("core.bootstrap").lazy(lazypath) require("core.bootstrap").lazy(lazypath)
end end
@ -20,3 +20,39 @@ end
dofile(vim.g.base46_cache .. "defaults") dofile(vim.g.base46_cache .. "defaults")
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require "plugins" require "plugins"
-- Configure Telescope to scroll files with ctrl+j/k
local actions = require('telescope.actions')
local sorters = require('telescope.sorters')
require('telescope').setup {
defaults = {
mappings = {
i = {
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
},
},
file_sorter = sorters.get_fzy_sorter,
file_ignore_patterns = { '.git/*', 'node_modules/*', 'vendor/*' },
generic_sorter = sorters.get_generic_fuzzy_sorter,
},
extensions = {
fzf = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
}
}
}
vim.api.nvim_set_keymap('n', '<leader>e', ':NvimTreeToggle<CR>', {noremap = true, silent = true})
-- Cycle through open buffers with leader+a
vim.api.nvim_set_keymap('n', '<leader>a', ':bprevious<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>f', ':bnext<CR>', {noremap = true, silent = true})
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})

View File

@ -1,31 +1,33 @@
local M = {} local M = {}
M.base46 = function() M.echo = function(str)
vim.notify " Compiling base46 theme to bytecode ..." vim.cmd "redraw"
vim.api.nvim_echo({ { str, "Bold" } }, true, {})
local repo = "https://github.com/NvChad/base46"
local tmp_path = vim.fn.stdpath "config" .. "/tmp_base46"
vim.fn.system { "git", "clone", "--depth", "1", "-b", "v2.0", repo, tmp_path }
vim.opt.rtp:prepend(tmp_path)
require("base46").compile()
vim.fn.delete(tmp_path, "rf")
end end
M.lazy = function(install_path) M.lazy = function(install_path)
vim.cmd "redraw|echo '' | echo ' Installing lazy.nvim & plugins ..'" ------------- base46 ---------------
local lazy_path = vim.fn.stdpath "data" .. "/lazy/base46"
M.echo " Compiling base46 theme to bytecode ..."
local base46_repo = "https://github.com/NvChad/base46"
vim.fn.system { "git", "clone", "--depth", "1", "-b", "v2.0", base46_repo, lazy_path }
vim.opt.rtp:prepend(lazy_path)
require("base46").compile()
--------- lazy.nvim ---------------
M.echo " Installing lazy.nvim & plugins ..."
local repo = "https://github.com/folke/lazy.nvim.git" local repo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path } vim.fn.system { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path }
vim.opt.rtp:prepend(install_path) vim.opt.rtp:prepend(install_path)
-- install plugins + compile their configs -- install plugins
require "plugins" require "plugins"
vim.api.nvim_buf_delete(0, { force = true }) -- close lazy window vim.api.nvim_buf_delete(0, { force = true }) -- close lazy window
-- install mason packages ---------- mason packages -------------
vim.schedule(function() vim.schedule(function()
vim.cmd "MasonInstallAll" vim.cmd "MasonInstallAll"
local packages = table.concat(vim.g.mason_binaries_list, " ") local packages = table.concat(vim.g.mason_binaries_list, " ")
@ -36,7 +38,7 @@ M.lazy = function(install_path)
if packages:match "%S" == nil then if packages:match "%S" == nil then
vim.schedule(function() vim.schedule(function()
vim.api.nvim_buf_delete(0, { force = true }) vim.api.nvim_buf_delete(0, { force = true })
vim.api.nvim_echo({ { "Now please read the docs at nvchad.com!! 󰕹 󰱬 ", "NvimInternalError" } }, true, {}) M.echo "Now please read the docs at nvchad.com!! 󰕹 󰱬"
end) end)
end end
end) end)
@ -45,24 +47,19 @@ end
M.gen_chadrc_template = function() M.gen_chadrc_template = function()
if not vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1] then if not vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1] then
local input = vim.fn.input "Do you want to install chadrc template? (y/n) : " local path = vim.fn.stdpath "config" .. "/lua/custom/"
local input = vim.fn.input "Do you want to install example custom config? (y/N) : "
if input == "y" then if input == "y" then
vim.cmd "redraw|echo '' | echo 'cloning chadrc starter template repo..'" M.echo "cloning example custom config repo ..."
vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path }
local repo = "https://github.com/NvChad/example_config" vim.fn.delete(path .. ".git", "rf")
local install_path = vim.fn.stdpath "config" .. "/lua/custom"
vim.fn.system { "git", "clone", "--depth", "1", repo, install_path }
-- delete .git from that repo
vim.fn.delete(vim.fn.stdpath "config" .. "/lua/custom/.git", "rf")
vim.cmd "redraw|echo '' | echo 'successfully installed chadrc template!'"
else else
local custom_dir = vim.fn.stdpath "config" .. "/lua/custom/" vim.fn.mkdir(path, "p")
vim.fn.mkdir(custom_dir, "p")
local file = io.open(custom_dir .. "chadrc.lua", "w") local file = io.open(path .. "chadrc.lua", "w")
file:write("local M = {}\n M.ui = {theme = 'onedark'}\n return M"):close() file:write "local M = {}\n M.ui = {theme = 'onedark'}\n return M"
file:close()
end end
end end
end end

View File

@ -43,6 +43,7 @@ M.ui = {
-- lazyload it when there are 1+ buffers -- lazyload it when there are 1+ buffers
tabufline = { tabufline = {
show_numbers = false,
enabled = true, enabled = true,
lazyload = true, lazyload = true,
overriden_modules = nil, overriden_modules = nil,
@ -89,7 +90,7 @@ M.ui = {
M.plugins = "" -- path i.e "custom.plugins" -> custom/plugins.lua only and not custom/plugins/init.lua!!!! M.plugins = "" -- path i.e "custom.plugins" -> custom/plugins.lua only and not custom/plugins/init.lua!!!!
M.lazy_nvim = {} -- config for lazy.nvim startup options M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options
-- these are default mappings, check core.mappings for table structure -- these are default mappings, check core.mappings for table structure
M.mappings = {} M.mappings = {}

View File

@ -186,7 +186,7 @@ M.lspconfig = {
["<leader>f"] = { ["<leader>f"] = {
function() function()
vim.diagnostic.open_float() vim.diagnostic.open_float { border = "rounded" }
end, end,
"floating diagnostic", "floating diagnostic",
}, },
@ -329,7 +329,6 @@ M.nvterm = {
}, },
-- new -- new
["<leader>h"] = { ["<leader>h"] = {
function() function()
require("nvterm.terminal").new "horizontal" require("nvterm.terminal").new "horizontal"

View File

@ -105,8 +105,8 @@ local options = {
}), }),
}, },
sources = { sources = {
{ name = "luasnip" },
{ name = "nvim_lsp" }, { name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" }, { name = "buffer" },
{ name = "nvim_lua" }, { name = "nvim_lua" },
{ name = "path" }, { name = "path" },

View File

@ -1,5 +1,5 @@
local options = { local options = {
ensure_installed = { "lua-language-server", "stylua" }, -- not an option from mason.nvim ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
PATH = "skip", PATH = "skip",

View File

@ -19,8 +19,8 @@ local options = {
hide_root_folder = true, hide_root_folder = true,
}, },
git = { git = {
enable = false, enable = true,
ignore = true, ignore = false,
}, },
filesystem_watchers = { filesystem_watchers = {
enable = true, enable = true,
@ -73,6 +73,4 @@ local options = {
}, },
} }
vim.g.nvimtree_side = options.view.side
return options return options

View File

@ -26,7 +26,9 @@ local default_plugins = {
{ {
"NvChad/nvterm", "NvChad/nvterm",
init = require("core.utils").load_mappings "nvterm", init = function()
require("core.utils").load_mappings "nvterm"
end,
config = function(_, opts) config = function(_, opts)
require "base46.term" require "base46.term"
require("nvterm").setup(opts) require("nvterm").setup(opts)
@ -35,7 +37,9 @@ local default_plugins = {
{ {
"NvChad/nvim-colorizer.lua", "NvChad/nvim-colorizer.lua",
init = require("core.utils").lazy_load "nvim-colorizer.lua", init = function()
require("core.utils").lazy_load "nvim-colorizer.lua"
end,
config = function(_, opts) config = function(_, opts)
require("colorizer").setup(opts) require("colorizer").setup(opts)
@ -74,7 +78,9 @@ local default_plugins = {
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
init = require("core.utils").lazy_load "nvim-treesitter", init = function()
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()
@ -136,7 +142,9 @@ local default_plugins = {
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
init = require("core.utils").lazy_load "nvim-lspconfig", init = function()
require("core.utils").lazy_load "nvim-lspconfig"
end,
config = function() config = function()
require "plugins.configs.lspconfig" require "plugins.configs.lspconfig"
end, end,
@ -194,7 +202,9 @@ local default_plugins = {
{ {
"numToStr/Comment.nvim", "numToStr/Comment.nvim",
-- keys = { "gc", "gb" }, -- keys = { "gc", "gb" },
init = require("core.utils").load_mappings "comment", init = function()
require("core.utils").load_mappings "comment"
end,
config = function() config = function()
require("Comment").setup() require("Comment").setup()
end, end,
@ -204,20 +214,25 @@ local default_plugins = {
{ {
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
cmd = { "NvimTreeToggle", "NvimTreeFocus" }, cmd = { "NvimTreeToggle", "NvimTreeFocus" },
init = require("core.utils").load_mappings "nvimtree", init = function()
require("core.utils").load_mappings "nvimtree"
end,
opts = function() opts = function()
return require "plugins.configs.nvimtree" return require "plugins.configs.nvimtree"
end, end,
config = function(_, opts) config = function(_, opts)
dofile(vim.g.base46_cache .. "nvimtree") dofile(vim.g.base46_cache .. "nvimtree")
require("nvim-tree").setup(opts) require("nvim-tree").setup(opts)
vim.g.nvimtree_side = opts.view.side
end, end,
}, },
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
cmd = "Telescope", cmd = "Telescope",
init = require("core.utils").load_mappings "telescope", init = function()
require("core.utils").load_mappings "telescope"
end,
opts = function() opts = function()
return require "plugins.configs.telescope" return require "plugins.configs.telescope"
@ -239,7 +254,9 @@ local default_plugins = {
{ {
"folke/which-key.nvim", "folke/which-key.nvim",
keys = { "<leader>", '"', "'", "`" }, keys = { "<leader>", '"', "'", "`" },
init = require("core.utils").load_mappings "whichkey", init = function()
require("core.utils").load_mappings "whichkey"
end,
opts = function() opts = function()
return require "plugins.configs.whichkey" return require "plugins.configs.whichkey"
end, end,
@ -256,7 +273,4 @@ if #config.plugins > 0 then
table.insert(default_plugins, { import = config.plugins }) table.insert(default_plugins, { import = config.plugins })
end end
-- lazy_nvim startup opts require("lazy").setup(default_plugins, config.lazy_nvim)
local lazy_config = vim.tbl_deep_extend("force", require "plugins.configs.lazy_nvim", config.lazy_nvim)
require("lazy").setup(default_plugins, lazy_config)