[1/4] Refactor: plugins: Add seperate config for each plugins

first commit of Refactor

handle require errors

move config from other places to proper files

don't create a pseudo config function for no reason

https://github.com/siduck76/NvChad/pull/156#issuecomment-881453546
This commit is contained in:
Akianonymus 2021-07-15 21:13:17 +05:30
parent 0d7345bc44
commit d16ffabcfd
19 changed files with 847 additions and 725 deletions

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,
@ -20,19 +28,4 @@ M.config = function()
nvim_lsp = true, nvim_lsp = true,
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,15 +1,12 @@
local M = {} local g = vim.g
local fn = vim.fn
M.config = function() local plugins_count = fn.len(fn.globpath("~/.local/share/nvim/site/pack/packer/start", "*", 0, 1))
local g = vim.g
local fn = vim.fn
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
g.dashboard_disable_at_vimenter = 1 -- dashboard is disabled by default g.dashboard_default_executive = "telescope"
g.dashboard_disable_statusline = 1 g.dashboard_custom_header = {
g.dashboard_default_executive = "telescope"
g.dashboard_custom_header = {
" ", " ",
" ", " ",
" ", " ",
@ -25,22 +22,19 @@ M.config = function()
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ", " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ", " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
" " " "
} }
g.dashboard_custom_section = { g.dashboard_custom_section = {
a = {description = {" Find File SPC f f"}, command = "Telescope find_files"}, a = {description = {" Find File SPC f f"}, command = "Telescope find_files"},
b = {description = {" Recents SPC f o"}, command = "Telescope oldfiles"}, b = {description = {" Recents SPC f o"}, command = "Telescope oldfiles"},
c = {description = {" Find Word SPC f w"}, command = "Telescope live_grep"}, c = {description = {" Find Word SPC f w"}, command = "Telescope live_grep"},
d = {description = {"洛 New File SPC f n"}, command = "DashboardNewFile"}, d = {description = {"洛 New File SPC f n"}, command = "DashboardNewFile"},
e = {description = {" Bookmarks SPC b m"}, command = "Telescope marks"}, e = {description = {" Bookmarks SPC b m"}, command = "Telescope marks"},
f = {description = {" Load Last Session SPC s l"}, command = "SessionLoad"} f = {description = {" Load Last Session SPC s l"}, command = "SessionLoad"}
} }
g.dashboard_custom_footer = { g.dashboard_custom_footer = {
" ", " ",
-- "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"},
@ -27,7 +35,4 @@ 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 = "",
@ -117,7 +125,4 @@ M.config = function()
name = "lua" name = "lua"
} }
} }
} }
end
return M

View File

@ -1,9 +1,16 @@
local M = {} local lspconfig, lspinstall
if
not pcall(
function()
lspconfig = require "lspconfig"
lspinstall = require "lspinstall"
end
)
then
return
end
M.config = function() local function on_attach(client, bufnr)
local lspconf = require("lspconfig")
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")
local opts = {noremap = true, silent = true} local opts = {noremap = true, silent = true}
@ -36,26 +43,26 @@ M.config = function()
elseif client.resolved_capabilities.document_range_formatting then elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts) buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end end
end end
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
-- 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 = {
@ -78,21 +85,18 @@ M.config = function()
} }
end end
end end
end
setup_servers()
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
require "lspinstall".post_install_hook = function()
setup_servers() -- reload installed servers
vim.cmd("bufdo e") -- triggers FileType autocmd that starts the server
end
-- replace the default lsp diagnostic letters with prettier symbols
vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"})
vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"})
vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"})
vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"})
end end
return M setup_servers()
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
lspinstall.post_install_hook = function()
setup_servers() -- reload installed servers
vim.cmd("bufdo e") -- triggers FileType autocmd that starts the server
end
-- replace the default lsp diagnostic letters with prettier symbols
vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"})
vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"})
vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"})
vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"})

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,38 +1,46 @@
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
g.nvim_tree_side = "left" g.nvim_tree_side = "left"
g.nvim_tree_width = 25 g.nvim_tree_width = 25
g.nvim_tree_ignore = {".git", "node_modules", ".cache"} g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
g.nvim_tree_gitignore = 1 g.nvim_tree_gitignore = 1
g.nvim_tree_auto_ignore_ft = {"dashboard"} -- don't open tree on specific fiypes. g.nvim_tree_auto_ignore_ft = {"dashboard"} -- don't open tree on specific fiypes.
g.nvim_tree_auto_open = 0 g.nvim_tree_auto_open = 0
g.nvim_tree_auto_close = 0 -- closes tree when it's the last window 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_quit_on_open = 0 -- closes tree when file's opened
g.nvim_tree_follow = 1 g.nvim_tree_follow = 1
g.nvim_tree_indent_markers = 1 g.nvim_tree_indent_markers = 1
g.nvim_tree_hide_dotfiles = 1 g.nvim_tree_hide_dotfiles = 1
g.nvim_tree_git_hl = 1 g.nvim_tree_git_hl = 1
g.nvim_tree_highlight_opened_files = 0 g.nvim_tree_highlight_opened_files = 0
g.nvim_tree_root_folder_modifier = ":t" g.nvim_tree_root_folder_modifier = ":t"
g.nvim_tree_tab_open = 0 g.nvim_tree_tab_open = 0
g.nvim_tree_allow_resize = 1 g.nvim_tree_allow_resize = 1
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
g.nvim_tree_disable_netrw = 1 g.nvim_tree_disable_netrw = 1
g.nvim_tree_hijack_netrw = 0 g.nvim_tree_hijack_netrw = 0
g.nvim_tree_update_cwd = 1 g.nvim_tree_update_cwd = 1
g.nvim_tree_show_icons = { g.nvim_tree_show_icons = {
git = 1, git = 1,
folders = 1, folders = 1,
files = 1 files = 1
-- folder_arrows= 1 -- folder_arrows= 1
} }
g.nvim_tree_icons = { g.nvim_tree_icons = {
default = "", default = "",
symlink = "", symlink = "",
git = { git = {
@ -55,11 +63,9 @@ M.config = function()
symlink = "", symlink = "",
symlink_open = "" symlink_open = ""
} }
} }
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")},
{key = "<C-v>", cb = tree_cb("vsplit")}, {key = "<C-v>", cb = tree_cb("vsplit")},
@ -91,7 +97,4 @@ M.config = function()
{key = "-", cb = tree_cb("dir_up")}, {key = "-", cb = tree_cb("dir_up")},
{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,25 +1,32 @@
local M = {} local gl, condition
if
not pcall(
function()
gl = require "galaxyline"
condition = require "galaxyline.condition"
end
)
then
return
end
M.config = function() local gls = gl.section
local gl = require("galaxyline")
local gls = gl.section
local condition = require("galaxyline.condition")
gl.short_line_list = {" "} gl.short_line_list = {" "}
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)
gls.left[1] = { gls.left[1] = {
FirstElement = { FirstElement = {
provider = function() provider = function()
return "" return ""
end, end,
highlight = {colors.nord_blue, colors.nord_blue} highlight = {colors.nord_blue, colors.nord_blue}
} }
} }
gls.left[2] = { gls.left[2] = {
statusIcon = { statusIcon = {
provider = function() provider = function()
return "" return ""
@ -28,17 +35,17 @@ M.config = function()
separator = "", separator = "",
separator_highlight = {colors.nord_blue, colors.lightbg} separator_highlight = {colors.nord_blue, colors.lightbg}
} }
} }
gls.left[3] = { gls.left[3] = {
FileIcon = { FileIcon = {
provider = "FileIcon", provider = "FileIcon",
condition = condition.buffer_not_empty, condition = condition.buffer_not_empty,
highlight = {colors.white, colors.lightbg} highlight = {colors.white, colors.lightbg}
} }
} }
gls.left[4] = { gls.left[4] = {
FileName = { FileName = {
provider = {"FileName"}, provider = {"FileName"},
condition = condition.buffer_not_empty, condition = condition.buffer_not_empty,
@ -46,9 +53,9 @@ M.config = function()
separator = "", separator = "",
separator_highlight = {colors.lightbg, colors.lightbg2} separator_highlight = {colors.lightbg, colors.lightbg2}
} }
} }
gls.left[5] = { gls.left[5] = {
current_dir = { current_dir = {
provider = function() provider = function()
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t") local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
@ -58,60 +65,60 @@ M.config = function()
separator = "", separator = "",
separator_highlight = {colors.lightbg2, colors.statusline_bg} separator_highlight = {colors.lightbg2, colors.statusline_bg}
} }
} }
local checkwidth = function() local checkwidth = function()
local squeeze_width = vim.fn.winwidth(0) / 2 local squeeze_width = vim.fn.winwidth(0) / 2
if squeeze_width > 30 then if squeeze_width > 30 then
return true return true
end end
return false return false
end end
gls.left[6] = { gls.left[6] = {
DiffAdd = { DiffAdd = {
provider = "DiffAdd", provider = "DiffAdd",
condition = checkwidth, condition = checkwidth,
icon = "", icon = "",
highlight = {colors.white, colors.statusline_bg} highlight = {colors.white, colors.statusline_bg}
} }
} }
gls.left[7] = { gls.left[7] = {
DiffModified = { DiffModified = {
provider = "DiffModified", provider = "DiffModified",
condition = checkwidth, condition = checkwidth,
icon = "", icon = "",
highlight = {colors.grey_fg2, colors.statusline_bg} highlight = {colors.grey_fg2, colors.statusline_bg}
} }
} }
gls.left[8] = { gls.left[8] = {
DiffRemove = { DiffRemove = {
provider = "DiffRemove", provider = "DiffRemove",
condition = checkwidth, condition = checkwidth,
icon = "", icon = "",
highlight = {colors.grey_fg2, colors.statusline_bg} highlight = {colors.grey_fg2, colors.statusline_bg}
} }
} }
gls.left[9] = { gls.left[9] = {
DiagnosticError = { DiagnosticError = {
provider = "DiagnosticError", provider = "DiagnosticError",
icon = "", icon = "",
highlight = {colors.red, colors.statusline_bg} highlight = {colors.red, colors.statusline_bg}
} }
} }
gls.left[10] = { gls.left[10] = {
DiagnosticWarn = { DiagnosticWarn = {
provider = "DiagnosticWarn", provider = "DiagnosticWarn",
icon = "", icon = "",
highlight = {colors.yellow, colors.statusline_bg} highlight = {colors.yellow, colors.statusline_bg}
} }
} }
gls.right[1] = { gls.right[1] = {
lsp_status = { lsp_status = {
provider = function() provider = function()
local clients = vim.lsp.get_active_clients() local clients = vim.lsp.get_active_clients()
@ -123,9 +130,9 @@ M.config = function()
end, end,
highlight = {colors.grey_fg2, colors.statusline_bg} highlight = {colors.grey_fg2, colors.statusline_bg}
} }
} }
gls.right[2] = { gls.right[2] = {
GitIcon = { GitIcon = {
provider = function() provider = function()
return "" return ""
@ -135,17 +142,17 @@ M.config = function()
separator = " ", separator = " ",
separator_highlight = {colors.statusline_bg, colors.statusline_bg} separator_highlight = {colors.statusline_bg, colors.statusline_bg}
} }
} }
gls.right[3] = { gls.right[3] = {
GitBranch = { GitBranch = {
provider = "GitBranch", provider = "GitBranch",
condition = require("galaxyline.condition").check_git_workspace, condition = require("galaxyline.condition").check_git_workspace,
highlight = {colors.grey_fg2, colors.statusline_bg} highlight = {colors.grey_fg2, colors.statusline_bg}
} }
} }
gls.right[4] = { gls.right[4] = {
viMode_icon = { viMode_icon = {
provider = function() provider = function()
return "" return ""
@ -154,9 +161,9 @@ M.config = function()
separator = "", separator = "",
separator_highlight = {colors.red, colors.statusline_bg} separator_highlight = {colors.red, colors.statusline_bg}
} }
} }
gls.right[5] = { gls.right[5] = {
ViMode = { ViMode = {
provider = function() provider = function()
local alias = { local alias = {
@ -178,9 +185,9 @@ M.config = function()
end, end,
highlight = {colors.red, colors.lightbg} highlight = {colors.red, colors.lightbg}
} }
} }
gls.right[6] = { gls.right[6] = {
some_icon = { some_icon = {
provider = function() provider = function()
return "" return ""
@ -189,9 +196,9 @@ M.config = function()
separator_highlight = {colors.green, colors.lightbg}, separator_highlight = {colors.green, colors.lightbg},
highlight = {colors.lightbg, colors.green} highlight = {colors.lightbg, colors.green}
} }
} }
gls.right[7] = { gls.right[7] = {
line_percentage = { line_percentage = {
provider = function() provider = function()
local current_line = vim.fn.line(".") local current_line = vim.fn.line(".")
@ -207,6 +214,4 @@ M.config = function()
end, end,
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,9 +1,15 @@
local M = {} local ts_config
if
not pcall(
function()
ts_config = require "nvim-treesitter.configs"
end
)
then
return
end
M.config = function() ts_config.setup {
local ts_config = require("nvim-treesitter.configs")
ts_config.setup {
ensure_installed = { ensure_installed = {
"javascript", "javascript",
"html", "html",
@ -19,7 +25,4 @@ M.config = function()
enable = true, enable = true,
use_languagetree = true use_languagetree = true
} }
} }
end
return M

View File

@ -1,11 +1,17 @@
-- plugins made by @Pocco81 =) -- plugins made by @Pocco81 =)
local M = {} local true_zen
if
not pcall(
function()
true_zen = require "true-zen"
end
)
then
return
end
M.config = function() true_zen.setup(
local true_zen = require("true-zen")
true_zen.setup(
{ {
misc = { misc = {
on_off_commands = false, on_off_commands = false,
@ -54,28 +60,4 @@ M.config = function()
nvim_bufferline = true nvim_bufferline = true
} }
} }
) )
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