mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-21 02:55:09 +02:00
wrap requires in pcall
This commit is contained in:
parent
0e2ad0c1fe
commit
716f127e95
12 changed files with 58 additions and 16 deletions
|
@ -1,6 +1,10 @@
|
||||||
-- if not package.loaded['nvim-autopairs'] then
|
-- if not package.loaded['nvim-autopairs'] then
|
||||||
-- return
|
-- return
|
||||||
-- end
|
-- end
|
||||||
|
local status_ok, autopairs = pcall(require, "nvim-autopairs")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
local npairs = require "nvim-autopairs"
|
local npairs = require "nvim-autopairs"
|
||||||
local Rule = require "nvim-autopairs.rule"
|
local Rule = require "nvim-autopairs.rule"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
require("colorizer").setup({ "*" }, {
|
local status_ok, colorizer = pcall(require, "colorizer")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
colorizer.setup({ "*" }, {
|
||||||
RGB = true, -- #RGB hex codes
|
RGB = true, -- #RGB hex codes
|
||||||
RRGGBB = true, -- #RRGGBB hex codes
|
RRGGBB = true, -- #RRGGBB hex codes
|
||||||
RRGGBBAA = true, -- #RRGGBBAA hex codes
|
RRGGBBAA = true, -- #RRGGBBAA hex codes
|
||||||
|
|
|
@ -7,7 +7,7 @@ local M = {}
|
||||||
vim.g.vsnip_snippet_dir = O.vnsip_dir
|
vim.g.vsnip_snippet_dir = O.vnsip_dir
|
||||||
|
|
||||||
M.config = function()
|
M.config = function()
|
||||||
opt = {
|
local opt = {
|
||||||
enabled = O.auto_complete,
|
enabled = O.auto_complete,
|
||||||
autocomplete = true,
|
autocomplete = true,
|
||||||
debug = false,
|
debug = false,
|
||||||
|
@ -39,8 +39,12 @@ M.config = function()
|
||||||
-- for emoji press : (idk if that in compe tho)
|
-- for emoji press : (idk if that in compe tho)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
local status_ok, compe = pcall(require, "compe")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require("compe").setup(opt)
|
compe.setup(opt)
|
||||||
|
|
||||||
local t = function(str)
|
local t = function(str)
|
||||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
-- if not package.loaded['galaxyline'] then
|
-- if not package.loaded['galaxyline'] then
|
||||||
-- return
|
-- return
|
||||||
-- end
|
-- end
|
||||||
|
local status_ok, gl = pcall(require, "galaxyline")
|
||||||
local gl = require "galaxyline"
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
-- get my theme in galaxyline repo
|
-- get my theme in galaxyline repo
|
||||||
-- local colors = require('galaxyline.theme').default
|
-- local colors = require('galaxyline.theme').default
|
||||||
local colors = {
|
local colors = {
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.config = function()
|
M.config = function()
|
||||||
require("gitsigns").setup {
|
local status_ok, gitsigns = pcall(require, "gitsigns ")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
gitsigns.setup {
|
||||||
signs = {
|
signs = {
|
||||||
-- TODO add hl to colorscheme
|
-- TODO add hl to colorscheme
|
||||||
add = {
|
add = {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
-- 1. get the config for this server from nvim-lspconfig and adjust the cmd path.
|
-- 1. get the config for this server from nvim-lspconfig and adjust the cmd path.
|
||||||
-- relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us!
|
-- relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us!
|
||||||
local config = require("lspconfig").jdtls.document_config
|
-- local config = require("lspconfig").jdtls.document_config
|
||||||
require("lspconfig/configs").jdtls = nil -- important, unset the loaded config again
|
-- require("lspconfig/configs").jdtls = nil -- important, unset the loaded config again
|
||||||
-- config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server"
|
-- config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server"
|
||||||
|
|
||||||
-- 2. extend the config with an install_script and (optionally) uninstall_script
|
-- 2. extend the config with an install_script and (optionally) uninstall_script
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
--end
|
--end
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
M.config = function()
|
M.config = function()
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
@ -52,7 +56,7 @@ M.config = function()
|
||||||
symlink = "",
|
symlink = "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
local tree_cb = require("nvim-tree.config").nvim_tree_callback
|
local tree_cb = nvim_tree_config.nvim_tree_callback
|
||||||
|
|
||||||
vim.g.nvim_tree_bindings = {
|
vim.g.nvim_tree_bindings = {
|
||||||
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
|
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
local status_ok, telescope = pcall(require, "telescope")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
local actions = require "telescope.actions"
|
local actions = require "telescope.actions"
|
||||||
-- if O.plugin.trouble.active then
|
-- if O.plugin.trouble.active then
|
||||||
-- local trouble = require("trouble.providers.telescope")
|
-- local trouble = require("trouble.providers.telescope")
|
||||||
|
@ -5,7 +9,7 @@ local actions = require "telescope.actions"
|
||||||
-- Global remapping
|
-- Global remapping
|
||||||
------------------------------
|
------------------------------
|
||||||
-- '--color=never',
|
-- '--color=never',
|
||||||
require("telescope").setup {
|
telescope.setup {
|
||||||
defaults = {
|
defaults = {
|
||||||
find_command = {
|
find_command = {
|
||||||
"rg",
|
"rg",
|
||||||
|
|
|
@ -80,8 +80,12 @@ if status then
|
||||||
wk.register(textobj_move_keymaps["goto_previous_start"], normal)
|
wk.register(textobj_move_keymaps["goto_previous_start"], normal)
|
||||||
wk.register(textobj_move_keymaps["goto_previous_end"], normal)
|
wk.register(textobj_move_keymaps["goto_previous_end"], normal)
|
||||||
end
|
end
|
||||||
|
local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require("nvim-treesitter.configs").setup {
|
treesitter_configs.setup {
|
||||||
ensure_installed = O.treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
ensure_installed = O.treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||||
ignore_install = O.treesitter.ignore_install,
|
ignore_install = O.treesitter.ignore_install,
|
||||||
matchup = {
|
matchup = {
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
-- if not package.loaded['which-key'] then
|
-- if not package.loaded['which-key'] then
|
||||||
-- return
|
-- return
|
||||||
-- end
|
-- end
|
||||||
|
local status_ok, which_key = pcall(require, "which-key")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
require("which-key").setup {
|
which_key.setup {
|
||||||
plugins = {
|
plugins = {
|
||||||
marks = true, -- shows a list of your marks on ' and `
|
marks = true, -- shows a list of your marks on ' and `
|
||||||
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
local status_ok, zen_mode = pcall(require, "zen-mode")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
M.config = function()
|
M.config = function()
|
||||||
require("zen-mode").setup {
|
zen_mode.setup {
|
||||||
window = {
|
window = {
|
||||||
backdrop = 1,
|
backdrop = 1,
|
||||||
height = 0.85, -- height of the Zen window
|
height = 0.85, -- height of the Zen window
|
||||||
|
|
|
@ -94,7 +94,11 @@ return require("packer").startup(function(use)
|
||||||
"terrortylor/nvim-comment",
|
"terrortylor/nvim-comment",
|
||||||
cmd = "CommentToggle",
|
cmd = "CommentToggle",
|
||||||
config = function()
|
config = function()
|
||||||
require("nvim_comment").setup()
|
local status_ok, nvim_comment = pcall(require, "nvim_comment")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
nvim_comment.setup()
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,8 +149,8 @@ return require("packer").startup(function(use)
|
||||||
"norcalli/nvim-colorizer.lua",
|
"norcalli/nvim-colorizer.lua",
|
||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
config = function()
|
config = function()
|
||||||
require("colorizer").setup()
|
require "lv-colorizer"
|
||||||
vim.cmd "ColorizerReloadAllBuffers"
|
-- vim.cmd "ColorizerReloadAllBuffers"
|
||||||
end,
|
end,
|
||||||
disable = not O.plugin.colorizer.active,
|
disable = not O.plugin.colorizer.active,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue