Restructure config | Move some to a packer plugin | Lot of cleanup

* move teleacope files, updater and related utils to
  https://github.com/NvChad/core

* restructure config file and directory structure

* expose mappings for better escape

* allow multiple mappings for some

* improve merge table function for the same

* move autocommands to a seperate file

* rearrange everything alphabetically where sanely possible

* rearrange packer plugin list on the basis of trigerred state

config structure now

 .
├──  init.lua
├──  LICENSE
├──  lua
│  ├──  chadrc.lua
│  ├──  colors
│  │  ├──  highlights.lua
│  │  ├──  init.lua
│  │  └──  themes
│  │     ├──  chadracula.lua
│  │     ├──  everforest.lua
│  │     ├──  gruvchad.lua
│  │     ├──  javacafe.lua
│  │     ├──  mountain.lua
│  │     ├──  norchad.lua
│  │     ├──  one-light.lua
│  │     ├──  onedark.lua
│  │     ├──  tokyonight.lua
│  │     └──  tomorrow-night.lua
│  ├──  core
│  │  ├──  autocmds.lua
│  │  ├──  init.lua
│  │  ├──  mappings.lua
│  │  ├──  options.lua
│  │  └──  utils.lua
│  ├──  default_config.lua
│  └──  plugins
│     ├──  configs
│     │  ├──  autopairs.lua
│     │  ├──  autosave.lua
│     │  ├──  bufferline.lua
│     │  ├──  chadsheet.lua
│     │  ├──  compe.lua
│     │  ├──  dashboard.lua
│     │  ├──  gitsigns.lua
│     │  ├──  icons.lua
│     │  ├──  lspconfig.lua
│     │  ├──  luasnip.lua
│     │  ├──  nvimtree.lua
│     │  ├──  others.lua
│     │  ├──  statusline.lua
│     │  ├──  telescope.lua
│     │  ├──  treesitter.lua
│     │  └──  zenmode.lua
│     ├──  init.lua
│     └──  packerInit.lua
└──  README.md
This commit is contained in:
Akianonymus 2021-08-22 13:19:15 +05:30 committed by siduck76
parent 44ae0178f4
commit 9ffddb6b52
44 changed files with 1383 additions and 1789 deletions

View file

@ -1,25 +0,0 @@
local present, chadsheet = pcall(require, "cheatsheet")
if not present then
return
end
local mappings = require("utils").load_config().mappings
-- add user mappings to the cheetsheet
for section, data in pairs(mappings) do
for description, keymap in pairs(data) do
chadsheet.add_cheat(description, keymap, section)
end
end
require("cheatsheet").setup {
bundled_cheatsheets = {
enabled = { "default" },
disabled = { "unicode", "nerd-fonts" },
},
bundled_plugin_cheatsheets = false,
include_only_installed_plugins = true,
}

View file

@ -7,6 +7,6 @@ end
autopairs.setup()
autopairs_completion.setup {
map_cr = true,
map_complete = true, -- insert () func completion
map_cr = true,
}

View file

@ -5,7 +5,7 @@ if not present then
end
autosave.setup {
enabled = vim.g.auto_save, -- takes boolean value from init.lua
enabled = vim.g.auto_save or false, -- takes boolean value from init.lua
execution_message = "autosaved at : " .. vim.fn.strftime "%H:%M:%S",
events = { "InsertLeave", "TextChanged" },
conditions = {
@ -13,7 +13,7 @@ autosave.setup {
filetype_is_not = {},
modifiable = true,
},
write_all_buffers = false,
on_off_commands = true,
clean_command_line_interval = 2500,
on_off_commands = true,
write_all_buffers = false,
}

View file

@ -1,5 +1,4 @@
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
local colors = require("colors").get()
local present, bufferline = pcall(require, "bufferline")
if not present then
@ -43,24 +42,71 @@ bufferline.setup {
end,
},
highlights = {
fill = {
guifg = colors.grey_fg,
guibg = colors.black2,
},
background = {
guifg = colors.grey_fg,
guibg = colors.black2,
},
-- buffers
buffer_visible = {
guifg = colors.light_grey,
guibg = colors.black2,
},
buffer_selected = {
guifg = colors.white,
guibg = colors.black,
gui = "bold",
},
buffer_visible = {
guifg = colors.light_grey,
guibg = colors.black2,
},
-- close buttons
close_button = {
guifg = colors.light_grey,
guibg = colors.black2,
},
close_button_visible = {
guifg = colors.light_grey,
guibg = colors.black2,
},
close_button_selected = {
guifg = colors.red,
guibg = colors.black,
},
fill = {
guifg = colors.grey_fg,
guibg = colors.black2,
},
indicator_selected = {
guifg = colors.black,
guibg = colors.black,
},
-- modified
modified = {
guifg = colors.red,
guibg = colors.black2,
},
modified_visible = {
guifg = colors.red,
guibg = colors.black2,
},
modified_selected = {
guifg = colors.green,
guibg = colors.black,
},
-- separators
separator = {
guifg = colors.black2,
guibg = colors.black2,
},
separator_visible = {
guifg = colors.black2,
guibg = colors.black2,
},
separator_selected = {
guifg = colors.black2,
guibg = colors.black2,
},
-- tabs
tab = {
guifg = colors.light_grey,
@ -74,49 +120,5 @@ bufferline.setup {
guifg = colors.red,
guibg = colors.black,
},
indicator_selected = {
guifg = colors.black,
guibg = colors.black,
},
-- separators
separator = {
guifg = colors.black2,
guibg = colors.black2,
},
separator_visible = {
guifg = colors.black2,
guibg = colors.black2,
},
separator_selected = {
guifg = colors.black2,
guibg = colors.black2,
},
-- modified
modified = {
guifg = colors.red,
guibg = colors.black2,
},
modified_visible = {
guifg = colors.red,
guibg = colors.black2,
},
modified_selected = {
guifg = colors.green,
guibg = colors.black,
},
-- close buttons
close_button = {
guifg = colors.light_grey,
guibg = colors.black2,
},
close_button_visible = {
guifg = colors.light_grey,
guibg = colors.black2,
},
close_button_selected = {
guifg = colors.red,
guibg = colors.black,
},
},
}

View file

@ -0,0 +1,44 @@
local present, chadsheet = pcall(require, "cheatsheet")
if not present then
return
end
local mappings = require("core.utils").load_config().mappings
-- add user mappings to the cheetsheet
-- improve this function to not hardcode plugin
local function add_to_chadsheet(section, keymap, desc)
if section == "plugin" then
for sec, key in pairs(mappings.plugin) do
add_to_chadsheet(sec, key, sec)
end
else
if type(keymap) == "table" then
for sec, key in pairs(keymap) do
if type(sec) == "number" then
add_to_chadsheet(section, key, desc or section)
else
add_to_chadsheet(sec, key, desc or section)
end
end
else
chadsheet.add_cheat(section, keymap, desc or "Misc")
end
end
end
for section, keymap in pairs(mappings) do
add_to_chadsheet(section, keymap)
end
require("cheatsheet").setup {
bundled_cheatsheets = {
enabled = { "default" },
disabled = { "unicode", "nerd-fonts" },
},
bundled_plugin_cheatsheets = false,
include_only_installed_plugins = true,
}

View file

@ -5,21 +5,22 @@ end
compe.setup {
enabled = true,
autocomplete = true,
debug = false,
min_length = 1,
preselect = "enable",
throttle_time = 80,
source_timeout = 200,
documentation = true,
incomplete_delay = 400,
max_abbr_width = 100,
max_kind_width = 100,
max_menu_width = 100,
documentation = true,
min_length = 1,
preselect = "enable",
source_timeout = 200,
source = {
buffer = { kind = "", true },
luasnip = { kind = "", true },
nvim_lsp = true,
nvim_lua = true,
},
throttle_time = 80,
}

View file

@ -1,7 +1,7 @@
local g = vim.g
local fn = vim.fn
local plugins_count = fn.len(fn.globpath("~/.local/share/nvim/site/pack/packer/start", "*", 0, 1))
-- local plugins_count = fn.len(fn.globpath("~/.local/share/nvim/site/pack/packer/start", "*", 0, 1))
g.dashboard_disable_at_vimenter = 1 -- dashboard is disabled by default
g.dashboard_disable_statusline = 1

View file

@ -4,18 +4,10 @@ if not present then
end
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 = "DiffChange", text = "~", numhl = "GitSignsChangeNr" },
},
numhl = false,
keymaps = {
-- Default keymap options
noremap = true,
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>',
@ -24,9 +16,19 @@ gitsigns.setup {
["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_index = {
interval = 100,
},
sign_priority = 5,
status_formatter = nil, -- Use default
}

View file

@ -3,16 +3,10 @@ if not present then
return
end
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
local colors = require("colors").get()
icons.setup {
override = {
html = {
icon = "",
color = colors.baby_pink,
name = "html",
},
c = {
icon = "",
color = colors.blue,
@ -23,35 +17,50 @@ icons.setup {
color = colors.blue,
name = "css",
},
js = {
icon = "",
color = colors.sun,
name = "js",
deb = {
icon = "",
color = colors.cyan,
name = "deb",
},
ts = {
icon = "",
color = colors.teal,
name = "ts",
Dockerfile = {
icon = "",
color = colors.cyan,
name = "Dockerfile",
},
kt = {
icon = "󱈙",
color = colors.orange,
name = "kt",
html = {
icon = "",
color = colors.baby_pink,
name = "html",
},
png = {
jpeg = {
icon = "",
color = colors.dark_purple,
name = "png",
name = "jpeg",
},
jpg = {
icon = "",
color = colors.dark_purple,
name = "jpg",
},
jpeg = {
icon = "",
color = colors.dark_purple,
name = "jpeg",
js = {
icon = "",
color = colors.sun,
name = "js",
},
kt = {
icon = "󱈙",
color = colors.orange,
name = "kt",
},
lock = {
icon = "",
color = colors.red,
name = "lock",
},
lua = {
icon = "",
color = colors.blue,
name = "lua",
},
mp3 = {
icon = "",
@ -68,20 +77,10 @@ icons.setup {
color = colors.white,
name = "out",
},
Dockerfile = {
icon = "",
color = colors.cyan,
name = "Dockerfile",
},
rb = {
icon = "",
color = colors.pink,
name = "rb",
},
vue = {
icon = "",
color = colors.vibrant_green,
name = "vue",
png = {
icon = "",
color = colors.dark_purple,
name = "png",
},
py = {
icon = "",
@ -93,35 +92,35 @@ icons.setup {
color = colors.blue,
name = "toml",
},
lock = {
icon = "",
color = colors.red,
name = "lock",
ts = {
icon = "",
color = colors.teal,
name = "ts",
},
zip = {
icon = "",
color = colors.sun,
name = "zip",
},
xz = {
icon = "",
color = colors.sun,
name = "xz",
},
deb = {
icon = "",
color = colors.cyan,
name = "deb",
rb = {
icon = "",
color = colors.pink,
name = "rb",
},
rpm = {
icon = "",
color = colors.orange,
name = "rpm",
},
lua = {
icon = "",
color = colors.blue,
name = "lua",
vue = {
icon = "",
color = colors.vibrant_green,
name = "vue",
},
xz = {
icon = "",
color = colors.sun,
name = "xz",
},
zip = {
icon = "",
color = colors.sun,
name = "zip",
},
},
}

View file

@ -10,13 +10,13 @@ local function on_attach(client, bufnr)
local opts = { noremap = true, silent = true }
-- lsp Mappings.
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
vim.api.nvim_buf_set_keymap(
bufnr,
"n",
@ -24,13 +24,13 @@ local function on_attach(client, bufnr)
"<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>",
opts
)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
-- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then
@ -95,9 +95,9 @@ function lspSymbol(name, icon)
end
lspSymbol("Error", "")
lspSymbol("Warning", "")
lspSymbol("Information", "")
lspSymbol("Hint", "")
lspSymbol("Warning", "")
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = {

View file

@ -53,11 +53,11 @@ _G.completions = function()
return npairs.check_break_line_char()
end
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", { expr = true })
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", { expr = true })
vim.api.nvim_set_keymap("i", "<CR>", "v:lua.completions()", { expr = true })
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true })
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true })
vim.api.nvim_set_keymap("i", "<CR>", "v:lua.completions()", { expr = true })
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", { expr = true })
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", { expr = true })
luasnip.config.set_config {
history = true,

View file

@ -8,53 +8,54 @@ local g = vim.g
vim.o.termguicolors = true
g.nvim_tree_side = "left"
g.nvim_tree_width = 25
g.nvim_tree_ignore = { ".git", "node_modules", ".cache" }
g.nvim_tree_gitignore = 1
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
g.nvim_tree_allow_resize = 1
g.nvim_tree_auto_close = 0 -- closes tree when it's the last window
g.nvim_tree_auto_ignore_ft = { "dashboard" } -- don't open tree on specific fiypes.
g.nvim_tree_auto_open = 0
g.nvim_tree_auto_close = 0 -- closes tree when it's the last window
g.nvim_tree_quit_on_open = 0 -- closes tree when file's opened
g.nvim_tree_follow = 1
g.nvim_tree_indent_markers = 1
g.nvim_tree_hide_dotfiles = 1
g.nvim_tree_git_hl = 1
g.nvim_tree_highlight_opened_files = 0
g.nvim_tree_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
g.nvim_tree_tab_open = 0
g.nvim_tree_allow_resize = 1
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
g.nvim_tree_disable_netrw = 1
g.nvim_tree_follow = 1
g.nvim_tree_git_hl = 1
g.nvim_tree_gitignore = 1
g.nvim_tree_hide_dotfiles = 1
g.nvim_tree_highlight_opened_files = 0
g.nvim_tree_hijack_netrw = 0
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_root_folder_modifier = table.concat { ":t:gs?$?/..", string.rep(" ", 1000), "?:gs?^??" }
g.nvim_tree_side = "left"
g.nvim_tree_tab_open = 0
g.nvim_tree_update_cwd = 1
g.nvim_tree_width = 25
g.nvim_tree_show_icons = {
git = 1,
folders = 1,
files = 1,
-- folder_arrows= 1
files = 1,
git = 1,
}
g.nvim_tree_icons = {
default = "",
symlink = "",
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
renamed = "",
staged = "",
unmerged = "",
unstaged = "",
untracked = "",
},
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 = "",
open = "",
empty = "", -- 
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
},

View file

@ -1,5 +1,21 @@
local M = {}
M.better_escape = function()
local config = require("core.utils").load_config()
vim.g.better_escape_interval = config.options.plugin.esc_insertmode_timeout or 300
end
M.blankline = function()
vim.g.indentLine_enabled = 1
vim.g.indent_blankline_char = ""
vim.g.indent_blankline_filetype_exclude = { "help", "terminal", "dashboard", "packer" }
vim.g.indent_blankline_buftype_exclude = { "terminal" }
vim.g.indent_blankline_show_trailing_blankline_indent = false
vim.g.indent_blankline_show_first_indent_level = false
end
M.colorizer = function()
local present, colorizer = pcall(require, "colorizer")
if present then
@ -15,11 +31,6 @@ M.comment = function()
end
end
M.escape = function()
vim.g.better_escape_interval = 300
vim.g.better_escape_shortcut = { "jk" }
end
M.lspkind = function()
local present, lspkind = pcall(require, "lspkind")
if present then
@ -33,17 +44,6 @@ M.neoscroll = function()
end)
end
M.blankline = function()
vim.g.indentLine_enabled = 1
vim.g.indent_blankline_char = ""
vim.g.indent_blankline_filetype_exclude = { "help", "terminal", "dashboard", "packer" }
vim.g.indent_blankline_buftype_exclude = { "terminal" }
vim.g.indent_blankline_show_trailing_blankline_indent = false
vim.g.indent_blankline_show_first_indent_level = false
end
M.signature = function()
local present, lspsignature = pcall(require, "lsp_signature")
if present then

View file

@ -1,5 +1,4 @@
local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme)
local colors = require("colors").get()
local present1, gl = pcall(require, "galaxyline")
local present2, condition = pcall(require, "galaxyline.condition")
@ -20,6 +19,22 @@ local icon_styles = {
position_icon = "",
},
arrow = {
left = "",
right = "",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
block = {
left = " ",
right = " ",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
round = {
left = "",
right = "",
@ -35,25 +50,9 @@ local icon_styles = {
vi_mode_icon = "",
position_icon = "",
},
block = {
left = " ",
right = " ",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
arrow = {
left = "",
right = "",
main_icon = "",
vi_mode_icon = "",
position_icon = "",
},
}
local user_statusline_style = require("utils").load_config().ui.statusline.style
local user_statusline_style = require("core.utils").load_config().ui.plugin.statusline.style
local statusline_style = icon_styles[user_statusline_style]
local left_separator = statusline_style.left

View file

@ -65,21 +65,23 @@ telescope.setup {
},
}
-- NvChad pickers
-- load the theme_switcher extension
require("telescope").load_extension "themes"
-- load the term_picker extension
require("telescope").load_extension "terms"
if
not pcall(function()
-- NvChad pickers
-- load the theme_switcher extension
telescope.load_extension "themes"
-- load the term_picker extension
telescope.load_extension "terms"
if not pcall(function()
telescope.load_extension "fzf"
telescope.load_extension "media_files"
end) then
telescope.load_extension "fzf"
telescope.load_extension "media_files"
end)
then
-- This should only trigger when in need of PackerSync, so better do it
print "After completion of PackerCompile, restart neovim."
-- Trigger packer compile on PackerComplete, so it properly waits for PackerSync
vim.cmd 'autocmd User PackerComplete ++once lua print "Waiting for PackerCompile.." require("packer").compile()'
vim.cmd 'autocmd User PackerCompileDone ++once echo "Packer Compile done, restart neovim."'
require "pluginList"
require("packer").update("telescope-fzf-native.nvim", "telescope-media-files.nvim")
require "plugins"
require("packer").update("core", "telescope-fzf-native.nvim", "telescope-media-files.nvim")
end

View file

@ -6,11 +6,11 @@ end
true_zen.setup {
ui = {
bottom = {
cmdheight = 1,
laststatus = 0,
ruler = false,
showmode = false,
showcmd = false,
cmdheight = 1,
},
top = {
showtabline = 0,

320
lua/plugins/init.lua Normal file
View file

@ -0,0 +1,320 @@
local present, packer = pcall(require, "plugins.packerInit")
if not present then
return false
end
local use = packer.use
return packer.startup(function()
local plugin_status = require("core.utils").load_config().plugin_status
-- 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
use {
"Nvchad/core",
}
use {
"wbthomason/packer.nvim",
event = "VimEnter",
}
use {
"NvChad/nvim-base16.lua",
after = "packer.nvim",
config = function()
require("colors").init()
end,
}
use {
"kyazdani42/nvim-web-devicons",
after = "nvim-base16.lua",
config = function()
require "plugins.configs.icons"
end,
}
use {
"glepnir/galaxyline.nvim",
disable = not plugin_status.galaxyline,
after = "nvim-web-devicons",
config = function()
require "plugins.configs.statusline"
end,
}
use {
"akinsho/bufferline.nvim",
disable = not plugin_status.bufferline,
after = "galaxyline.nvim",
config = function()
require "plugins.configs.bufferline"
end,
setup = function()
require("core.mappings").bufferline()
end,
}
use {
"nvim-lua/plenary.nvim",
after = "bufferline.nvim",
}
-- git stuff
use {
"lewis6991/gitsigns.nvim",
disable = not plugin_status.gitsigns,
after = "plenary.nvim",
config = function()
require "plugins.configs.gitsigns"
end,
}
use {
"nvim-telescope/telescope.nvim",
after = "plenary.nvim",
requires = {
{
"sudormrfbin/cheatsheet.nvim",
disable = not plugin_status.cheatsheet,
after = "telescope.nvim",
config = function()
require "plugins.configs.chadsheet"
end,
setup = function()
require("core.mappings").chadsheet()
end,
},
{
"nvim-telescope/telescope-fzf-native.nvim",
run = "make",
},
{
"nvim-telescope/telescope-media-files.nvim",
disable = not plugin_status.telescope_media,
setup = function()
require("core.mappings").telescope_media()
end,
},
},
config = function()
require "plugins.configs.telescope"
end,
setup = function()
require("core.mappings").telescope()
end,
}
-- load autosave only if its globally enabled
use {
disable = not plugin_status.autosave,
"Pocco81/AutoSave.nvim",
config = function()
require "plugins.configs.autosave"
end,
cond = function()
return require("core.utils").load_config().options.plugin.autosave == true
end,
}
use {
"lukas-reineke/indent-blankline.nvim",
disable = not plugin_status.blankline,
event = "BufRead",
config = function()
require("plugins.configs.others").blankline()
end,
}
use {
"norcalli/nvim-colorizer.lua",
disable = not plugin_status.colorizer,
event = "BufRead",
config = function()
require("plugins.configs.others").colorizer()
end,
}
-- lsp stuff
use {
"nvim-treesitter/nvim-treesitter",
event = "BufRead",
config = function()
require "plugins.configs.treesitter"
end,
}
use {
"kabouzeid/nvim-lspinstall",
event = "BufRead",
}
use {
"neovim/nvim-lspconfig",
after = "nvim-lspinstall",
config = function()
require "plugins.configs.lspconfig"
end,
}
use {
"ray-x/lsp_signature.nvim",
disable = not plugin_status.lspsignature,
after = "nvim-lspconfig",
config = function()
require("plugins.configs.others").signature()
end,
}
use {
"onsails/lspkind-nvim",
disable = not plugin_status.lspkind,
event = "BufEnter",
config = function()
require("plugins.configs.others").lspkind()
end,
}
use {
"jdhao/better-escape.vim",
disable = not plugin_status.esc_insertmode,
event = "InsertEnter",
config = function()
require("plugins.configs.others").better_escape()
end,
setup = function()
require("core.mappings").better_escape()
end,
}
-- load compe in insert mode only
use {
"hrsh7th/nvim-compe",
event = "InsertEnter",
config = function()
require "plugins.configs.compe"
end,
wants = "LuaSnip",
requires = {
{
"L3MON4D3/LuaSnip",
wants = "friendly-snippets",
event = "InsertCharPre",
config = function()
require "plugins.configs.luasnip"
end,
},
{
"rafamadriz/friendly-snippets",
event = "InsertCharPre",
},
},
}
-- misc plugins
use {
"windwp/nvim-autopairs",
after = "nvim-compe",
config = function()
require "plugins.configs.autopairs"
end,
}
use {
"andymass/vim-matchup",
disable = not plugin_status.vim_matchup,
event = "CursorMoved",
}
-- smooth scroll
use {
"karb94/neoscroll.nvim",
disable = not plugin_status.neoscroll,
event = "WinScrolled",
config = function()
require("plugins.configs.others").neoscroll()
end,
}
use {
"glepnir/dashboard-nvim",
disable = not plugin_status.dashboard,
cmd = {
"Dashboard",
"DashboardNewFile",
"DashboardJumpMarks",
"SessionLoad",
"SessionSave",
},
config = function()
require "plugins.configs.dashboard"
end,
setup = function()
require("core.mappings").dashboard()
end,
}
use {
"sbdchd/neoformat",
disable = not plugin_status.neoformat,
cmd = "Neoformat",
setup = function()
require("core.mappings").neoformat()
end,
}
-- use "alvan/vim-closetag" -- for html autoclosing tag
use {
"terrortylor/nvim-comment",
disable = not plugin_status.comment,
cmd = "CommentToggle",
config = function()
require("plugins.configs.others").comment()
end,
setup = function()
require("core.mappings").comment()
end,
}
-- file managing , picker etc
use {
"kyazdani42/nvim-tree.lua",
cmd = "NvimTreeToggle",
config = function()
require "plugins.configs.nvimtree"
end,
setup = function()
require("core.mappings").nvimtree()
end,
}
use {
"Pocco81/TrueZen.nvim",
disable = not plugin_status.truezen,
cmd = {
"TZAtaraxis",
"TZMinimalist",
"TZFocus",
},
config = function()
require "plugins.configs.zenmode"
end,
setup = function()
require("core.mappings").truezen()
end,
}
use {
"tpope/vim-fugitive",
disable = not plugin_status.vim_fugitive,
cmd = {
"Git",
},
setup = function()
require("core.mappings").vim_fugitive()
end,
}
end)

View file

@ -0,0 +1,47 @@
local cmd = vim.cmd
cmd "packadd packer.nvim"
local present, packer = pcall(require, "packer")
if not present then
local packer_path = vim.fn.stdpath "data" .. "/site/pack/packer/opt/packer.nvim"
print "Cloning packer.."
-- remove the dir before cloning
vim.fn.delete(packer_path, "rf")
vim.fn.system {
"git",
"clone",
"https://github.com/wbthomason/packer.nvim",
"--depth",
"20",
packer_path,
}
cmd "packadd packer.nvim"
present, packer = pcall(require, "packer")
if present then
print "Packer cloned successfully."
else
error("Couldn't clone packer !\nPacker path: " .. packer_path)
end
end
packer.init {
display = {
open_fn = function()
return require("packer.util").float { border = "single" }
end,
prompt_border = "single",
},
git = {
clone_timeout = 600, -- Timeout, in seconds, for git clones
},
auto_clean = true,
compile_on_sync = true,
-- auto_reload_compiled = true
}
return packer