Compare commits
No commits in common. "df1af847b2403f8eccd2610d07eaaa2aa32e0581" and "609000db5b03aa26d2c1d69dc726b9879539200d" have entirely different histories.
df1af847b2
...
609000db5b
38
init.lua
38
init.lua
@ -1,5 +1,4 @@
|
||||
require "core"
|
||||
vim.api.nvim_set_var('mapleader', ';')
|
||||
|
||||
local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1]
|
||||
|
||||
@ -13,6 +12,7 @@ local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||
|
||||
-- bootstrap lazy.nvim!
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
require("core.bootstrap").base46()
|
||||
require("core.bootstrap").gen_chadrc_template()
|
||||
require("core.bootstrap").lazy(lazypath)
|
||||
end
|
||||
@ -20,39 +20,3 @@ end
|
||||
dofile(vim.g.base46_cache .. "defaults")
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
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, {})
|
||||
|
@ -1,33 +1,31 @@
|
||||
local M = {}
|
||||
|
||||
M.echo = function(str)
|
||||
vim.cmd "redraw"
|
||||
vim.api.nvim_echo({ { str, "Bold" } }, true, {})
|
||||
M.base46 = function()
|
||||
vim.notify " Compiling base46 theme to bytecode ..."
|
||||
|
||||
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
|
||||
|
||||
M.lazy = function(install_path)
|
||||
------------- base46 ---------------
|
||||
local lazy_path = vim.fn.stdpath "data" .. "/lazy/base46"
|
||||
vim.cmd "redraw|echo '' | echo ' Installing lazy.nvim & plugins ..'"
|
||||
|
||||
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"
|
||||
vim.fn.system { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path }
|
||||
|
||||
vim.opt.rtp:prepend(install_path)
|
||||
|
||||
-- install plugins
|
||||
-- install plugins + compile their configs
|
||||
require "plugins"
|
||||
vim.api.nvim_buf_delete(0, { force = true }) -- close lazy window
|
||||
|
||||
---------- mason packages -------------
|
||||
-- install mason packages
|
||||
vim.schedule(function()
|
||||
vim.cmd "MasonInstallAll"
|
||||
local packages = table.concat(vim.g.mason_binaries_list, " ")
|
||||
@ -38,7 +36,7 @@ M.lazy = function(install_path)
|
||||
if packages:match "%S" == nil then
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_buf_delete(0, { force = true })
|
||||
M.echo "Now please read the docs at nvchad.com!! "
|
||||
vim.api.nvim_echo({ { "Now please read the docs at nvchad.com!! ", "NvimInternalError" } }, true, {})
|
||||
end)
|
||||
end
|
||||
end)
|
||||
@ -47,19 +45,24 @@ end
|
||||
|
||||
M.gen_chadrc_template = function()
|
||||
if not vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1] then
|
||||
local path = vim.fn.stdpath "config" .. "/lua/custom/"
|
||||
local input = vim.fn.input "Do you want to install example custom config? (y/N) : "
|
||||
local input = vim.fn.input "Do you want to install chadrc template? (y/n) : "
|
||||
|
||||
if input == "y" then
|
||||
M.echo "cloning example custom config repo ..."
|
||||
vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path }
|
||||
vim.fn.delete(path .. ".git", "rf")
|
||||
else
|
||||
vim.fn.mkdir(path, "p")
|
||||
vim.cmd "redraw|echo '' | echo 'cloning chadrc starter template repo..'"
|
||||
|
||||
local file = io.open(path .. "chadrc.lua", "w")
|
||||
file:write "local M = {}\n M.ui = {theme = 'onedark'}\n return M"
|
||||
file:close()
|
||||
local repo = "https://github.com/NvChad/example_config"
|
||||
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
|
||||
local custom_dir = vim.fn.stdpath "config" .. "/lua/custom/"
|
||||
vim.fn.mkdir(custom_dir, "p")
|
||||
|
||||
local file = io.open(custom_dir .. "chadrc.lua", "w")
|
||||
file:write("local M = {}\n M.ui = {theme = 'onedark'}\n return M"):close()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -43,7 +43,6 @@ M.ui = {
|
||||
|
||||
-- lazyload it when there are 1+ buffers
|
||||
tabufline = {
|
||||
show_numbers = false,
|
||||
enabled = true,
|
||||
lazyload = true,
|
||||
overriden_modules = nil,
|
||||
@ -90,7 +89,7 @@ M.ui = {
|
||||
|
||||
M.plugins = "" -- path i.e "custom.plugins" -> custom/plugins.lua only and not custom/plugins/init.lua!!!!
|
||||
|
||||
M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options
|
||||
M.lazy_nvim = {} -- config for lazy.nvim startup options
|
||||
|
||||
-- these are default mappings, check core.mappings for table structure
|
||||
M.mappings = {}
|
||||
|
@ -186,7 +186,7 @@ M.lspconfig = {
|
||||
|
||||
["<leader>f"] = {
|
||||
function()
|
||||
vim.diagnostic.open_float { border = "rounded" }
|
||||
vim.diagnostic.open_float()
|
||||
end,
|
||||
"floating diagnostic",
|
||||
},
|
||||
@ -329,6 +329,7 @@ M.nvterm = {
|
||||
},
|
||||
|
||||
-- new
|
||||
|
||||
["<leader>h"] = {
|
||||
function()
|
||||
require("nvterm.terminal").new "horizontal"
|
||||
|
@ -105,8 +105,8 @@ local options = {
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
|
@ -1,5 +1,5 @@
|
||||
local options = {
|
||||
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
|
||||
ensure_installed = { "lua-language-server", "stylua" }, -- not an option from mason.nvim
|
||||
|
||||
PATH = "skip",
|
||||
|
||||
|
@ -19,8 +19,8 @@ local options = {
|
||||
hide_root_folder = true,
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = false,
|
||||
enable = false,
|
||||
ignore = true,
|
||||
},
|
||||
filesystem_watchers = {
|
||||
enable = true,
|
||||
@ -73,4 +73,6 @@ local options = {
|
||||
},
|
||||
}
|
||||
|
||||
vim.g.nvimtree_side = options.view.side
|
||||
|
||||
return options
|
||||
|
@ -26,9 +26,7 @@ local default_plugins = {
|
||||
|
||||
{
|
||||
"NvChad/nvterm",
|
||||
init = function()
|
||||
require("core.utils").load_mappings "nvterm"
|
||||
end,
|
||||
init = require("core.utils").load_mappings "nvterm",
|
||||
config = function(_, opts)
|
||||
require "base46.term"
|
||||
require("nvterm").setup(opts)
|
||||
@ -37,9 +35,7 @@ local default_plugins = {
|
||||
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-colorizer.lua"
|
||||
end,
|
||||
init = require("core.utils").lazy_load "nvim-colorizer.lua",
|
||||
config = function(_, opts)
|
||||
require("colorizer").setup(opts)
|
||||
|
||||
@ -78,9 +74,7 @@ local default_plugins = {
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-treesitter"
|
||||
end,
|
||||
init = require("core.utils").lazy_load "nvim-treesitter",
|
||||
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
|
||||
build = ":TSUpdate",
|
||||
opts = function()
|
||||
@ -142,9 +136,7 @@ local default_plugins = {
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
init = function()
|
||||
require("core.utils").lazy_load "nvim-lspconfig"
|
||||
end,
|
||||
init = require("core.utils").lazy_load "nvim-lspconfig",
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
end,
|
||||
@ -202,9 +194,7 @@ local default_plugins = {
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
-- keys = { "gc", "gb" },
|
||||
init = function()
|
||||
require("core.utils").load_mappings "comment"
|
||||
end,
|
||||
init = require("core.utils").load_mappings "comment",
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
end,
|
||||
@ -214,25 +204,20 @@ local default_plugins = {
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
|
||||
init = function()
|
||||
require("core.utils").load_mappings "nvimtree"
|
||||
end,
|
||||
init = require("core.utils").load_mappings "nvimtree",
|
||||
opts = function()
|
||||
return require "plugins.configs.nvimtree"
|
||||
end,
|
||||
config = function(_, opts)
|
||||
dofile(vim.g.base46_cache .. "nvimtree")
|
||||
require("nvim-tree").setup(opts)
|
||||
vim.g.nvimtree_side = opts.view.side
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
init = function()
|
||||
require("core.utils").load_mappings "telescope"
|
||||
end,
|
||||
init = require("core.utils").load_mappings "telescope",
|
||||
|
||||
opts = function()
|
||||
return require "plugins.configs.telescope"
|
||||
@ -254,9 +239,7 @@ local default_plugins = {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
keys = { "<leader>", '"', "'", "`" },
|
||||
init = function()
|
||||
require("core.utils").load_mappings "whichkey"
|
||||
end,
|
||||
init = require("core.utils").load_mappings "whichkey",
|
||||
opts = function()
|
||||
return require "plugins.configs.whichkey"
|
||||
end,
|
||||
@ -273,4 +256,7 @@ if #config.plugins > 0 then
|
||||
table.insert(default_plugins, { import = config.plugins })
|
||||
end
|
||||
|
||||
require("lazy").setup(default_plugins, config.lazy_nvim)
|
||||
-- lazy_nvim startup opts
|
||||
local lazy_config = vim.tbl_deep_extend("force", require "plugins.configs.lazy_nvim", config.lazy_nvim)
|
||||
|
||||
require("lazy").setup(default_plugins, lazy_config)
|
||||
|
Loading…
Reference in New Issue
Block a user