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"
|
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]
|
||||||
|
|
||||||
@ -13,6 +12,7 @@ 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,39 +20,3 @@ 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, {})
|
|
||||||
|
@ -1,33 +1,31 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.echo = function(str)
|
M.base46 = function()
|
||||||
vim.cmd "redraw"
|
vim.notify " Compiling base46 theme to bytecode ..."
|
||||||
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)
|
||||||
------------- base46 ---------------
|
vim.cmd "redraw|echo '' | echo ' Installing lazy.nvim & plugins ..'"
|
||||||
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
|
-- install plugins + compile their configs
|
||||||
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
|
||||||
|
|
||||||
---------- mason packages -------------
|
-- install 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, " ")
|
||||||
@ -38,7 +36,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 })
|
||||||
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
|
end
|
||||||
end)
|
end)
|
||||||
@ -47,19 +45,24 @@ 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 path = vim.fn.stdpath "config" .. "/lua/custom/"
|
local input = vim.fn.input "Do you want to install chadrc template? (y/n) : "
|
||||||
local input = vim.fn.input "Do you want to install example custom config? (y/N) : "
|
|
||||||
|
|
||||||
if input == "y" then
|
if input == "y" then
|
||||||
M.echo "cloning example custom config repo ..."
|
vim.cmd "redraw|echo '' | echo 'cloning chadrc starter template 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")
|
|
||||||
|
|
||||||
local file = io.open(path .. "chadrc.lua", "w")
|
local repo = "https://github.com/NvChad/example_config"
|
||||||
file:write "local M = {}\n M.ui = {theme = 'onedark'}\n return M"
|
local install_path = vim.fn.stdpath "config" .. "/lua/custom"
|
||||||
file:close()
|
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
|
end
|
||||||
end
|
end
|
||||||
|
@ -43,7 +43,6 @@ 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,
|
||||||
@ -90,7 +89,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 = 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
|
-- these are default mappings, check core.mappings for table structure
|
||||||
M.mappings = {}
|
M.mappings = {}
|
||||||
|
@ -186,7 +186,7 @@ M.lspconfig = {
|
|||||||
|
|
||||||
["<leader>f"] = {
|
["<leader>f"] = {
|
||||||
function()
|
function()
|
||||||
vim.diagnostic.open_float { border = "rounded" }
|
vim.diagnostic.open_float()
|
||||||
end,
|
end,
|
||||||
"floating diagnostic",
|
"floating diagnostic",
|
||||||
},
|
},
|
||||||
@ -329,6 +329,7 @@ M.nvterm = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- new
|
-- new
|
||||||
|
|
||||||
["<leader>h"] = {
|
["<leader>h"] = {
|
||||||
function()
|
function()
|
||||||
require("nvterm.terminal").new "horizontal"
|
require("nvterm.terminal").new "horizontal"
|
||||||
|
@ -105,8 +105,8 @@ local options = {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "luasnip" },
|
{ name = "luasnip" },
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
{ name = "nvim_lua" },
|
{ name = "nvim_lua" },
|
||||||
{ name = "path" },
|
{ name = "path" },
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
local options = {
|
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",
|
PATH = "skip",
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ local options = {
|
|||||||
hide_root_folder = true,
|
hide_root_folder = true,
|
||||||
},
|
},
|
||||||
git = {
|
git = {
|
||||||
enable = true,
|
enable = false,
|
||||||
ignore = false,
|
ignore = true,
|
||||||
},
|
},
|
||||||
filesystem_watchers = {
|
filesystem_watchers = {
|
||||||
enable = true,
|
enable = true,
|
||||||
@ -73,4 +73,6 @@ local options = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vim.g.nvimtree_side = options.view.side
|
||||||
|
|
||||||
return options
|
return options
|
||||||
|
@ -26,9 +26,7 @@ local default_plugins = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"NvChad/nvterm",
|
"NvChad/nvterm",
|
||||||
init = function()
|
init = require("core.utils").load_mappings "nvterm",
|
||||||
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)
|
||||||
@ -37,9 +35,7 @@ local default_plugins = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"NvChad/nvim-colorizer.lua",
|
"NvChad/nvim-colorizer.lua",
|
||||||
init = function()
|
init = require("core.utils").lazy_load "nvim-colorizer.lua",
|
||||||
require("core.utils").lazy_load "nvim-colorizer.lua"
|
|
||||||
end,
|
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("colorizer").setup(opts)
|
require("colorizer").setup(opts)
|
||||||
|
|
||||||
@ -78,9 +74,7 @@ local default_plugins = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
init = function()
|
init = require("core.utils").lazy_load "nvim-treesitter",
|
||||||
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()
|
||||||
@ -142,9 +136,7 @@ local default_plugins = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
init = function()
|
init = require("core.utils").lazy_load "nvim-lspconfig",
|
||||||
require("core.utils").lazy_load "nvim-lspconfig"
|
|
||||||
end,
|
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.lspconfig"
|
require "plugins.configs.lspconfig"
|
||||||
end,
|
end,
|
||||||
@ -202,9 +194,7 @@ local default_plugins = {
|
|||||||
{
|
{
|
||||||
"numToStr/Comment.nvim",
|
"numToStr/Comment.nvim",
|
||||||
-- keys = { "gc", "gb" },
|
-- keys = { "gc", "gb" },
|
||||||
init = function()
|
init = require("core.utils").load_mappings "comment",
|
||||||
require("core.utils").load_mappings "comment"
|
|
||||||
end,
|
|
||||||
config = function()
|
config = function()
|
||||||
require("Comment").setup()
|
require("Comment").setup()
|
||||||
end,
|
end,
|
||||||
@ -214,25 +204,20 @@ local default_plugins = {
|
|||||||
{
|
{
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
|
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
|
||||||
init = function()
|
init = require("core.utils").load_mappings "nvimtree",
|
||||||
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 = function()
|
init = require("core.utils").load_mappings "telescope",
|
||||||
require("core.utils").load_mappings "telescope"
|
|
||||||
end,
|
|
||||||
|
|
||||||
opts = function()
|
opts = function()
|
||||||
return require "plugins.configs.telescope"
|
return require "plugins.configs.telescope"
|
||||||
@ -254,9 +239,7 @@ local default_plugins = {
|
|||||||
{
|
{
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
keys = { "<leader>", '"', "'", "`" },
|
keys = { "<leader>", '"', "'", "`" },
|
||||||
init = function()
|
init = require("core.utils").load_mappings "whichkey",
|
||||||
require("core.utils").load_mappings "whichkey"
|
|
||||||
end,
|
|
||||||
opts = function()
|
opts = function()
|
||||||
return require "plugins.configs.whichkey"
|
return require "plugins.configs.whichkey"
|
||||||
end,
|
end,
|
||||||
@ -273,4 +256,7 @@ if #config.plugins > 0 then
|
|||||||
table.insert(default_plugins, { import = config.plugins })
|
table.insert(default_plugins, { import = config.plugins })
|
||||||
end
|
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