Merge pull request #156 from Akianonymus/main

Major perf improvements | Handle errors | Better configs | Misc
This commit is contained in:
siduck76 2021-07-16 23:34:57 +05:30 committed by GitHub
commit 6f2b358d3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 1021 additions and 854 deletions

View File

@ -1,20 +1,28 @@
-- load all plugins -- load all options
require "pluginList"
require "options" require "options"
local g = vim.g -- only try to load stuff if atleast base16 is initialized
-- TODO: Find a better way to trigger PackerSync
g.mapleader = " " if require "theme" then
g.auto_save = false local async
async =
-- colorscheme related stuff vim.loop.new_async(
vim.schedule_wrap(
g.nvchad_theme = "onedark" function()
local base16 = require "base16" require "pluginList"
base16(base16.themes["onedark"], true) require "plugins.bufferline"
require "highlights" require "highlights"
require "mappings" require "mappings"
require "plugins.bufferline"
require("utils").hideStuff() require("utils").hideStuff()
async:close()
end
)
)
async:send()
else
-- otherwise run packer sync
require "pluginList"
print("Now PackerSync will be executed, after completion, restart neovim.\n")
vim.cmd("PackerSync")
end

View File

@ -33,36 +33,6 @@ _check_nvim_version() {
done done
} }
_setup_packer() {
_clone_packer() {
[ -d "${_PACKER_PATH}" ] && rm -rf "${_PACKER_PATH}"
printf "\n%s\n" "=> Cloning packer.."
if "${_GIT}" clone "${_PACKER_REPO_URL}" \
"${_PACKER_PATH}" --depth 20; then
printf "%s\n" "=> Packer Installed!"
else
printf "Error: Couldn't clone packer\n"
exit 1
fi
}
if [ "${_UPDATE}" = "true" ]; then
printf "%s\n" "Updating packer"
{ [ -d "${_PACKER_PATH}" ] \
&& "${_GIT}" -C "${_PACKER_PATH}" pull "${_PACKER_REPO_URL}"; } || _clone_packer
else
printf "%s\n" "Installing packer"
if [ -d ~/.local/share/nvim/site/pack/packer ]; then
printf "%s\n" "Clearing previous packer installs"
rm -rf ~/.local/share/nvim/site/pack
fi
_clone_packer
fi
printf "\n"
return 0
}
_copy_config() { _copy_config() {
printf "%s\n" "Linking config" printf "%s\n" "Linking config"
printf "%s\n" "Old nvim config will be changed to nvim.bak if exists! :0" printf "%s\n" "Old nvim config will be changed to nvim.bak if exists! :0"
@ -72,6 +42,7 @@ _copy_config() {
printf "%s\n" "Nvim Directory exists" printf "%s\n" "Nvim Directory exists"
if [ "${_NO_BACKUP}" = "true" ]; then if [ "${_NO_BACKUP}" = "true" ]; then
printf "%s\n" "Skipping backup as --no-backup flag was passed.." printf "%s\n" "Skipping backup as --no-backup flag was passed.."
[ "${_UPDATE}" = "false" ] && rm -rf "${_CONFIG_PATH}"
else else
printf "%s\n" "Taking backup of existing config.." printf "%s\n" "Taking backup of existing config.."
mv "${_CONFIG_PATH}" "${_BACKUP_PATH}" || { mv "${_CONFIG_PATH}" "${_BACKUP_PATH}" || {
@ -80,7 +51,6 @@ _copy_config() {
exit 1 exit 1
} }
fi fi
printf "%s\n" "Creating new nvim directory"
else else
printf "%s\n" "Nvim Config doesn't exist so creating one" printf "%s\n" "Nvim Config doesn't exist so creating one"
fi fi
@ -124,8 +94,6 @@ _setup_terminal_shell() {
_setup_arguments() { _setup_arguments() {
# default variables to be used # default variables to be used
_PACKER_PATH="${HOME}/.local/share/nvim/site/pack/packer/start/packer.nvim"
_PACKER_REPO_URL="https://github.com/wbthomason/packer.nvim"
_CONFIG_PATH="${HOME}/.config/nvim" _CONFIG_PATH="${HOME}/.config/nvim"
_UPDATE="" _UPDATE=""
_BACKUP_PATH="${_CONFIG_PATH}.bak" _BACKUP_PATH="${_CONFIG_PATH}.bak"
@ -133,9 +101,9 @@ _setup_arguments() {
_CURRENT_SHELL="${SHELL##*/}" _CURRENT_SHELL="${SHELL##*/}"
_check_longoptions() { _check_longoptions() {
[ -z "${2}" ] \ [ -z "${2}" ] &&
&& printf '%s: %s: option requires an argument\nTry '"%s -h/--help"' for more information.\n' "${0##*/}" "${1}" "${0##*/}" \ printf '%s: %s: option requires an argument\nTry '"%s -h/--help"' for more information.\n' "${0##*/}" "${1}" "${0##*/}" &&
&& exit 1 exit 1
return 0 return 0
} }
@ -178,22 +146,23 @@ main() {
_check_install_dependencies _check_install_dependencies
_setup_arguments "${@}" _setup_arguments "${@}"
_setup_packer
_copy_config _copy_config
_setup_terminal_shell [ "${_UPDATE}" = "false" ] && _setup_terminal_shell
# install all plugins + compile them # install all plugins + compile them
if _NVIM="$(command -v nvim)"; then if _NVIM="$(command -v nvim)"; then
if _check_nvim_version; then if _check_nvim_version; then
printf "\n%s\n" "=> Neovim will open with some errors, just press enter" && sleep 1 printf "\n%s\n" "=> Neovim will now open." && sleep 1
"${_NVIM}" +PackerSync if [ "${_UPDATE}" = "false" ]; then
"${_NVIM}" +":lua require 'pluginList' vim.cmd('PackerSync')"
else else
printf "Error: Neovim is installed, but version is lower than 0.5.x, install Neovim >= 5.x and then run the below command.\n" "${_NVIM}"
printf " nvim +PackerSync\n"
fi fi
else else
printf "Error: Neovim is not installed, install Neovim >= 5.x and then run the below command\n" printf "Error: Neovim is installed, but version is lower than 0.5.x, install Neovim >= 5.x and then run nvim & do :PackerSync\n."
printf " nvim +PackerSync\n" fi
else
printf "Error: Neovim is not installed, install Neovim >= 5.x and then run neovim & do :PackerSync.\n"
fi fi
} }

View File

@ -76,7 +76,17 @@ _G.s_tab_complete = function()
end end
function _G.completions() function _G.completions()
local npairs = require("nvim-autopairs") local npairs
if
not pcall(
function()
npairs = require "nvim-autopairs"
end
)
then
return
end
if vim.fn.pumvisible() == 1 then if vim.fn.pumvisible() == 1 then
if vim.fn.complete_info()["selected"] ~= -1 then if vim.fn.complete_info()["selected"] ~= -1 then
return vim.fn["compe#confirm"]("<CR>") return vim.fn["compe#confirm"]("<CR>")

View File

@ -1,4 +1,5 @@
local opt = vim.opt local opt = vim.opt
local g = vim.g
opt.ruler = false opt.ruler = false
opt.hidden = true opt.hidden = true
@ -14,6 +15,12 @@ opt.updatetime = 250 -- update interval for gitsigns
opt.timeoutlen = 400 opt.timeoutlen = 400
opt.clipboard = "unnamedplus" opt.clipboard = "unnamedplus"
-- disable nvim intro
opt.shortmess:append("sI")
-- disable tilde on end of buffer: https://github.com/ neovim/neovim/pull/8546#issuecomment-643643758
vim.cmd [[let &fcs='eob: ']]
-- Numbers -- Numbers
opt.number = true opt.number = true
opt.numberwidth = 2 opt.numberwidth = 2
@ -24,17 +31,20 @@ opt.expandtab = true
opt.shiftwidth = 2 opt.shiftwidth = 2
opt.smartindent = true opt.smartindent = true
g.mapleader = " "
g.auto_save = false
-- disable builtin vim plugins -- disable builtin vim plugins
vim.g.loaded_gzip = 0 g.loaded_gzip = 0
vim.g.loaded_tar = 0 g.loaded_tar = 0
vim.g.loaded_tarPlugin = 0 g.loaded_tarPlugin = 0
vim.g.loaded_zipPlugin = 0 g.loaded_zipPlugin = 0
vim.g.loaded_2html_plugin = 0 g.loaded_2html_plugin = 0
vim.g.loaded_netrw = 0 g.loaded_netrw = 0
vim.g.loaded_netrwPlugin = 0 g.loaded_netrwPlugin = 0
vim.g.loaded_matchit = 0 g.loaded_matchit = 0
vim.g.loaded_matchparen = 0 g.loaded_matchparen = 0
vim.g.loaded_spec = 0 g.loaded_spec = 0
local M = {} local M = {}

45
lua/packerInit.lua Normal file
View File

@ -0,0 +1,45 @@
local packer
if
not pcall(
function()
packer = require "packer"
end
)
then
local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/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
}
)
if pcall(
function()
packer = require "packer"
end
)
then
print("Packer cloned successfully.")
else
error("Couldn't clone packer !\nPacker path: " .. packer_path)
end
end
return packer.init {
display = {
open_fn = function()
return require("packer.util").float {border = "single"}
end
},
git = {
clone_timeout = 600 -- Timeout, in seconds, for git clones
}
}

View File

@ -1,16 +1,17 @@
local packer = require("packer") local packer
local use = packer.use if
pcall(
packer.init { function()
display = { require "packerInit"
open_fn = function()
return require("packer.util").float {border = "single"}
end end
}, )
git = { then
clone_timeout = 600 -- Timeout, in seconds, for git clones packer = require "packer"
} else
} return false
end
local use = packer.use
return packer.startup( return packer.startup(
function() function()
@ -21,7 +22,7 @@ return packer.startup(
use { use {
"glepnir/galaxyline.nvim", "glepnir/galaxyline.nvim",
config = function() config = function()
require("plugins.statusline").config() require "plugins.statusline"
end end
} }
@ -32,8 +33,7 @@ return packer.startup(
"norcalli/nvim-colorizer.lua", "norcalli/nvim-colorizer.lua",
event = "BufRead", event = "BufRead",
config = function() config = function()
require("colorizer").setup() require "plugins.colorizer"
vim.cmd("ColorizerReloadAllBuffers")
end end
} }
@ -42,7 +42,7 @@ return packer.startup(
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
event = "BufRead", event = "BufRead",
config = function() config = function()
require("plugins.treesitter").config() require "plugins.treesitter"
end end
} }
@ -55,7 +55,7 @@ return packer.startup(
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
after = "nvim-lspinstall", after = "nvim-lspinstall",
config = function() config = function()
require("plugins.lspconfig").config() require "plugins.lspconfig"
end end
} }
@ -63,7 +63,7 @@ return packer.startup(
"onsails/lspkind-nvim", "onsails/lspkind-nvim",
event = "BufRead", event = "BufRead",
config = function() config = function()
require("lspkind").init() require "plugins.lspkind"
end end
} }
@ -72,7 +72,7 @@ return packer.startup(
"hrsh7th/nvim-compe", "hrsh7th/nvim-compe",
event = "InsertEnter", event = "InsertEnter",
config = function() config = function()
require("plugins.compe").config() require "plugins.compe"
end, end,
wants = {"LuaSnip"}, wants = {"LuaSnip"},
requires = { requires = {
@ -81,7 +81,7 @@ return packer.startup(
wants = "friendly-snippets", wants = "friendly-snippets",
event = "InsertCharPre", event = "InsertCharPre",
config = function() config = function()
require("plugins.compe").snippets() require "plugins.luasnip"
end end
}, },
{ {
@ -98,14 +98,14 @@ return packer.startup(
"kyazdani42/nvim-tree.lua", "kyazdani42/nvim-tree.lua",
cmd = "NvimTreeToggle", cmd = "NvimTreeToggle",
config = function() config = function()
require("plugins.nvimtree").config() require "plugins.nvimtree"
end end
} }
use { use {
"kyazdani42/nvim-web-devicons", "kyazdani42/nvim-web-devicons",
config = function() config = function()
require("plugins.icons").config() require "plugins.icons"
end end
} }
@ -117,7 +117,7 @@ return packer.startup(
}, },
cmd = "Telescope", cmd = "Telescope",
config = function() config = function()
require("plugins.telescope").config() require "plugins.telescope"
end end
} }
@ -133,7 +133,7 @@ return packer.startup(
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
event = "BufRead", event = "BufRead",
config = function() config = function()
require("plugins.gitsigns").config() require "plugins.gitsigns"
end end
} }
@ -142,13 +142,7 @@ return packer.startup(
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
after = "nvim-compe", after = "nvim-compe",
config = function() config = function()
require("nvim-autopairs").setup() require "plugins.autopairs"
require("nvim-autopairs.completion.compe").setup(
{
map_cr = true,
map_complete = true -- insert () func completion
}
)
end end
} }
@ -158,7 +152,7 @@ return packer.startup(
"terrortylor/nvim-comment", "terrortylor/nvim-comment",
cmd = "CommentToggle", cmd = "CommentToggle",
config = function() config = function()
require("nvim_comment").setup() require "plugins.comment"
end end
} }
@ -172,7 +166,7 @@ return packer.startup(
"SessionSave" "SessionSave"
}, },
setup = function() setup = function()
require("plugins.dashboard").config() require "plugins.dashboard"
end end
} }
@ -182,7 +176,7 @@ return packer.startup(
use { use {
"Pocco81/AutoSave.nvim", "Pocco81/AutoSave.nvim",
config = function() config = function()
require("plugins.zenmode").autoSave() require "plugins.autosave"
end, end,
cond = function() cond = function()
return vim.g.auto_save == true return vim.g.auto_save == true
@ -194,7 +188,7 @@ return packer.startup(
"karb94/neoscroll.nvim", "karb94/neoscroll.nvim",
event = "WinScrolled", event = "WinScrolled",
config = function() config = function()
require("neoscroll").setup() require "plugins.neoscroll"
end end
} }
@ -202,7 +196,7 @@ return packer.startup(
"Pocco81/TrueZen.nvim", "Pocco81/TrueZen.nvim",
cmd = {"TZAtaraxis", "TZMinimalist", "TZFocus"}, cmd = {"TZAtaraxis", "TZMinimalist", "TZFocus"},
config = function() config = function()
require("plugins.zenmode").config() require "plugins.zenmode"
end end
} }
@ -212,7 +206,7 @@ return packer.startup(
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
event = "BufRead", event = "BufRead",
setup = function() setup = function()
require("utils").blankline() require "plugins.blankline"
end end
} }
end end

19
lua/plugins/autopairs.lua Normal file
View File

@ -0,0 +1,19 @@
local autopairs, autopairs_completion
if
not pcall(
function()
autopairs = require "nvim-autopairs"
autopairs_completion = require "nvim-autopairs.completion.compe"
end
)
then
return
end
autopairs.setup()
autopairs_completion.setup(
{
map_cr = true,
map_complete = true -- insert () func completion
}
)

27
lua/plugins/autosave.lua Normal file
View File

@ -0,0 +1,27 @@
-- autosave.nvim plugin disabled by default
local autosave
if
not pcall(
function()
func = require "autosave"
end
)
then
return
end
autosave.setup(
{
enabled = vim.g.auto_save, -- takes boolean value from init.lua
execution_message = "autosaved at : " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
modifiable = true
},
write_all_buffers = true,
on_off_commands = true,
clean_command_line_interval = 2500
}
)

View File

@ -0,0 +1,9 @@
-- blankline config
vim.g.indentLine_enabled = 1
vim.g.indent_blankline_char = ""
vim.g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard"}
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

View File

@ -1,7 +1,18 @@
local global_theme = "themes/" .. vim.g.nvchad_theme local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme) local colors = require(global_theme)
require "bufferline".setup { local bufferline
if
not pcall(
function()
bufferline = require "bufferline"
end
)
then
return
end
bufferline.setup {
options = { options = {
offsets = {{filetype = "NvimTree", text = "", padding = 1}}, offsets = {{filetype = "NvimTree", text = "", padding = 1}},
buffer_close_icon = "", buffer_close_icon = "",

13
lua/plugins/colorizer.lua Normal file
View File

@ -0,0 +1,13 @@
local colorizer
if
not pcall(
function()
colorizer = require("colorizer")
end
)
then
return
end
colorizer.setup()
vim.cmd("ColorizerReloadAllBuffers")

5
lua/plugins/comment.lua Normal file
View File

@ -0,0 +1,5 @@
pcall(
function()
require("nvim_comment").setup()
end
)

View File

@ -1,7 +1,15 @@
local M = {} local compe
if
not pcall(
function()
compe = require "compe"
end
)
then
return
end
M.config = function() compe.setup {
require "compe".setup {
enabled = true, enabled = true,
autocomplete = true, autocomplete = true,
debug = false, debug = false,
@ -21,18 +29,3 @@ M.config = function()
nvim_lua = true nvim_lua = true
} }
} }
end
M.snippets = function()
local ls = require("luasnip")
ls.config.set_config(
{
history = true,
updateevents = "TextChanged,TextChangedI"
}
)
require("luasnip/loaders/from_vscode").load()
end
return M

View File

@ -1,6 +1,3 @@
local M = {}
M.config = function()
local g = vim.g local g = vim.g
local fn = vim.fn local fn = vim.fn
@ -41,6 +38,3 @@ M.config = function()
-- "NvChad Loaded " .. plugins_count .. " plugins", -- "NvChad Loaded " .. plugins_count .. " plugins",
"NvChad v0.5" "NvChad v0.5"
} }
end
return M

View File

@ -1,7 +1,15 @@
local M = {} local gitsigns
if
not pcall(
function()
gitsigns = require "gitsigns"
end
)
then
return
end
M.config = function() gitsigns.setup {
require("gitsigns").setup {
signs = { signs = {
add = {hl = "DiffAdd", text = "", numhl = "GitSignsAddNr"}, add = {hl = "DiffAdd", text = "", numhl = "GitSignsAddNr"},
change = {hl = "DiffChange", text = "", numhl = "GitSignsChangeNr"}, change = {hl = "DiffChange", text = "", numhl = "GitSignsChangeNr"},
@ -28,6 +36,3 @@ M.config = function()
sign_priority = 5, sign_priority = 5,
status_formatter = nil -- Use default status_formatter = nil -- Use default
} }
end
return M

View File

@ -1,10 +1,18 @@
local M = {} local icons
if
not pcall(
function()
icons = require "nvim-web-devicons"
end
)
then
return
end
M.config = function()
local global_theme = "themes/" .. vim.g.nvchad_theme local global_theme = "themes/" .. vim.g.nvchad_theme
local colors = require(global_theme) local colors = require(global_theme)
require "nvim-web-devicons".setup { icons.setup {
override = { override = {
html = { html = {
icon = "", icon = "",
@ -118,6 +126,3 @@ M.config = function()
} }
} }
} }
end
return M

View File

@ -1,7 +1,14 @@
local M = {} local lspconfig, lspinstall
if
M.config = function() not pcall(
local lspconf = require("lspconfig") function()
lspconfig = require "lspconfig"
lspinstall = require "lspinstall"
end
)
then
return
end
local function on_attach(client, bufnr) local function on_attach(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
@ -44,18 +51,18 @@ M.config = function()
-- lspInstall + lspconfig stuff -- lspInstall + lspconfig stuff
local function setup_servers() local function setup_servers()
require "lspinstall".setup() lspinstall.setup()
local servers = require "lspinstall".installed_servers() local servers = lspinstall.installed_servers()
for _, lang in pairs(servers) do for _, lang in pairs(servers) do
if lang ~= "lua" then if lang ~= "lua" then
lspconf[lang].setup { lspconfig[lang].setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
root_dir = vim.loop.cwd root_dir = vim.loop.cwd
} }
elseif lang == "lua" then elseif lang == "lua" then
lspconf[lang].setup { lspconfig[lang].setup {
root_dir = vim.loop.cwd, root_dir = vim.loop.cwd,
settings = { settings = {
Lua = { Lua = {
@ -83,7 +90,7 @@ M.config = function()
setup_servers() setup_servers()
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim -- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
require "lspinstall".post_install_hook = function() lspinstall.post_install_hook = function()
setup_servers() -- reload installed servers setup_servers() -- reload installed servers
vim.cmd("bufdo e") -- triggers FileType autocmd that starts the server vim.cmd("bufdo e") -- triggers FileType autocmd that starts the server
end end
@ -93,6 +100,3 @@ M.config = function()
vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"}) vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"})
vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"}) vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"})
vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"}) vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"})
end
return M

5
lua/plugins/lspkind.lua Normal file
View File

@ -0,0 +1,5 @@
pcall(
function()
require("lspkind").init()
end
)

18
lua/plugins/luasnip.lua Normal file
View File

@ -0,0 +1,18 @@
local luasnip
if
not pcall(
function()
luasnip = require "luasnip"
end
)
then
return
end
luasnip.config.set_config(
{
history = true,
updateevents = "TextChanged,TextChangedI"
}
)
require("luasnip/loaders/from_vscode").load()

View File

@ -0,0 +1,5 @@
pcall(
function()
require("neoscroll").setup()
end
)

View File

@ -1,6 +1,14 @@
local M = {} local tree_cb
if
not pcall(
function()
tree_cb = require "nvim-tree.config".nvim_tree_callback
end
)
then
return
end
M.config = function()
local g = vim.g local g = vim.g
vim.o.termguicolors = true vim.o.termguicolors = true
@ -57,8 +65,6 @@ M.config = function()
} }
} }
local tree_cb = require "nvim-tree.config".nvim_tree_callback
g.nvim_tree_bindings = { g.nvim_tree_bindings = {
{key = {"<CR>", "o", "<2-LeftMouse>"}, cb = tree_cb("edit")}, {key = {"<CR>", "o", "<2-LeftMouse>"}, cb = tree_cb("edit")},
{key = {"<2-RightMouse>", "<C-}>"}, cb = tree_cb("cd")}, {key = {"<2-RightMouse>", "<C-}>"}, cb = tree_cb("cd")},
@ -92,6 +98,3 @@ M.config = function()
{key = "q", cb = tree_cb("close")}, {key = "q", cb = tree_cb("close")},
{key = "g?", cb = tree_cb("toggle_help")} {key = "g?", cb = tree_cb("toggle_help")}
} }
end
return M

View File

@ -1,9 +1,16 @@
local M = {} local gl, condition
if
not pcall(
function()
gl = require "galaxyline"
condition = require "galaxyline.condition"
end
)
then
return
end
M.config = function()
local gl = require("galaxyline")
local gls = gl.section local gls = gl.section
local condition = require("galaxyline.condition")
gl.short_line_list = {" "} gl.short_line_list = {" "}
@ -208,5 +215,3 @@ M.config = function()
highlight = {colors.green, colors.lightbg} highlight = {colors.green, colors.lightbg}
} }
} }
end
return M

View File

@ -1,7 +1,16 @@
local M = {} local telescope
if
not pcall(
function()
telescope = require("telescope")
end
)
then
return
end
M.config = function() telescope.setup(
require("telescope").setup { {
defaults = { defaults = {
vimgrep_arguments = { vimgrep_arguments = {
"rg", "rg",
@ -32,9 +41,9 @@ M.config = function()
height = 0.80, height = 0.80,
preview_cutoff = 120 preview_cutoff = 120
}, },
file_sorter = require "telescope.sorters".get_fuzzy_file, file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = {}, file_ignore_patterns = {},
generic_sorter = require "telescope.sorters".get_generic_fuzzy_sorter, generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = shorten, path_display = shorten,
winblend = 0, winblend = 0,
border = {}, border = {},
@ -42,11 +51,11 @@ M.config = function()
color_devicons = true, color_devicons = true,
use_less = true, use_less = true,
set_env = {["COLORTERM"] = "truecolor"}, -- default = nil, set_env = {["COLORTERM"] = "truecolor"}, -- default = nil,
file_previewer = require "telescope.previewers".vim_buffer_cat.new, file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require "telescope.previewers".vim_buffer_vimgrep.new, grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require "telescope.previewers".vim_buffer_qflist.new, qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-- Developer configurations: Not meant for general override -- Developer configurations: Not meant for general override
buffer_previewer_maker = require "telescope.previewers".buffer_previewer_maker buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker
}, },
extensions = { extensions = {
fzf = { fzf = {
@ -62,9 +71,16 @@ M.config = function()
} }
} }
} }
)
require("telescope").load_extension("fzf") if
require("telescope").load_extension("media_files") not pcall(
function()
telescope.load_extension("fzf")
telescope.load_extension("media_files")
end
)
then
-- This should only trigger when in need of PackerSync, so better do it
vim.cmd("PackerSync")
end end
return M

View File

@ -1,7 +1,13 @@
local M = {} local ts_config
if
M.config = function() not pcall(
local ts_config = require("nvim-treesitter.configs") function()
ts_config = require "nvim-treesitter.configs"
end
)
then
return
end
ts_config.setup { ts_config.setup {
ensure_installed = { ensure_installed = {
@ -20,6 +26,3 @@ M.config = function()
use_languagetree = true use_languagetree = true
} }
} }
end
return M

View File

@ -1,9 +1,15 @@
-- plugins made by @Pocco81 =) -- plugins made by @Pocco81 =)
local M = {} local true_zen
if
M.config = function() not pcall(
local true_zen = require("true-zen") function()
true_zen = require "true-zen"
end
)
then
return
end
true_zen.setup( true_zen.setup(
{ {
@ -55,27 +61,3 @@ M.config = function()
} }
} }
) )
end
-- autosave.nvim plugin disabled by default
M.autoSave = function()
local autosave = require("autosave")
autosave.setup(
{
enabled = vim.g.auto_save, -- takes boolean value from init.lua
execution_message = "autosaved at : " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
modifiable = true
},
write_all_buffers = true,
on_off_commands = true,
clean_command_line_interval = 2500
}
)
end
return M

21
lua/theme.lua Normal file
View File

@ -0,0 +1,21 @@
-- colorscheme related stuff
vim.g.nvchad_theme = "onedark"
local base16
if
not pcall(
function()
base16 = require "base16"
end
)
then
return false
else
base16(base16.themes["onedark"], true)
local cmd = vim.cmd
-- load bg color before async for smooth transition
local background = require("themes/" .. vim.g.nvchad_theme).black
vim.cmd("hi Normal guibg=" .. background)
return true
end

View File

@ -1,17 +1,5 @@
local M = {} local M = {}
-- blankline config
M.blankline = function()
vim.g.indentLine_enabled = 1
vim.g.indent_blankline_char = ""
vim.g.indent_blankline_filetype_exclude = {"help", "terminal", "dashboard"}
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
-- hide line numbers , statusline in specific buffers! -- hide line numbers , statusline in specific buffers!
M.hideStuff = function() M.hideStuff = function()
vim.api.nvim_exec( vim.api.nvim_exec(