my neovim configuration

add utilities for not loading certain plugins

+3 -2
init.lua
···
+
require "ptero.options"
require "ptero.plugins"
+
require "ptero.lsp"
require "ptero.keymaps"
-
require "ptero.options"
-
require "ptero.lsp"
+
require "ptero.theme"
+5 -5
lazy-lock.json
···
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
-
"cmp-tabnine": { "branch": "main", "commit": "ee1341c53e7b82f55c6e83287828f652c2ac35e1" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
-
"gitsigns.nvim": { "branch": "main", "commit": "114362a85e51918ab2965181ffa31932c181f32f" },
-
"lazy.nvim": { "branch": "main", "commit": "ef87c24e8ede2a94cbeaea1667eaeb7f8ed40dc0" },
+
"gitsigns.nvim": { "branch": "main", "commit": "d4f8c01280413919349f5df7daccd0c172143d7c" },
+
"lazy.nvim": { "branch": "main", "commit": "d2110278be136fd977d357ff49689352d58b2e83" },
"luasnip": { "branch": "master", "commit": "5d57303efde86fcb0959c52b1a6d40f923940f34" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "3751eb5c56c67b51e68a1f4a0da28ae74ab771c1" },
"mason.nvim": { "branch": "main", "commit": "a4ebe1f14ba31242cd09f9e0709d5b1f9d2bcecb" },
"nvim-cmp": { "branch": "main", "commit": "11a95792a5be0f5a40bab5fc5b670e5b1399a939" },
"nvim-lspconfig": { "branch": "master", "commit": "7b98aadc6e85db4fc3af6c1ec22c4774d965506e" },
-
"nvim-treesitter": { "branch": "master", "commit": "5b8b711926d1f3ef5c63fbe5db2d8f33b912025e" },
+
"nvim-notify": { "branch": "master", "commit": "b005821516f1f37801a73067afd1cef2dbc4dfe8" },
+
"nvim-treesitter": { "branch": "master", "commit": "3e316204f8ec8450bbaace69d0bf8fe332633fec" },
"plenary.nvim": { "branch": "master", "commit": "9d81624fbcedd3dd43b38d7e13a1e7b3f873d8cd" },
"telescope.nvim": { "branch": "master", "commit": "04af51dbfb17c2afa0b8d82b0e842e0638201ca9" },
-
"which-key.nvim": { "branch": "main", "commit": "85f69b07afce4ea77c58ae9a3aeb4e6c918b4d34" }
+
"which-key.nvim": { "branch": "main", "commit": "802219ba26409f325a5575e3b684b6cb054e2cc5" }
}
+5 -21
lua/ptero/configs/cmp.lua
···
-
local cmp_ok, cmp = pcall(require, "cmp")
-
if not cmp_ok then
-
vim.notify('cmp not loaded')
-
return
-
end
-
-
local compare_ok, compare = pcall(require, "cmp.config.compare")
-
if not compare_ok then
-
vim.notify('cmp.config.compare not loaded')
-
return
-
end
-
-
local compare_tabnine_ok, compare_tabnine = pcall(require, "cmp_tabnine.compare")
-
if not compare_tabnine_ok then
-
vim.notify('cmp_tabnine.compare not loaded')
-
return
-
end
+
local utils = require("ptero/utils")
-
local luasnip_ok, luasnip = pcall(require, "luasnip")
-
if not luasnip_ok then
-
vim.notify('luasnip not loaded')
-
end
+
local cmp = utils.Load("cmp")
+
local compare = utils.Load("cmp.config.compare")
+
local compare_tabnine = utils.Load("cmp_tabnine.compare")
+
local luasnip = utils.Load("luasnip")
require("luasnip.loaders.from_vscode").lazy_load()
+2 -4
lua/ptero/configs/gitsigns.lua
···
-
local ok, gitsigns = pcall(require, "gitsigns")
-
if not ok then
-
return
-
end
+
local utils = require("ptero/utils")
+
local gitsigns = utils.Load("gitsigns")
local icons = require("ptero.icons")
local border = require("ptero.borders").style
+2 -5
lua/ptero/configs/mason.lua
···
-
local ok, mason = pcall(require, "mason")
-
if not ok then
-
return
-
end
-
+
local utils = require("ptero/utils")
+
local mason = utils.Load("mason")
local border = require("ptero.borders").style
mason.setup({
+8
lua/ptero/configs/notify.lua
···
+
local utils = require("ptero/utils")
+
local notify = utils.Load("notify")
+
+
notify.setup({
+
background_colour = "#000000",
+
})
+
+
vim.notify = notify
+2 -5
lua/ptero/configs/tabnine.lua
···
-
local tabnine_ok, tabnine = pcall(require, "tabnine")
-
if not tabnine_ok then
-
return
-
end
-
+
local utils = require("ptero/utils")
+
local tabnine = utils.Load("tabnine")
tabnine:setup()
+2 -4
lua/ptero/configs/telescope.lua
···
-
local ok, telescope = pcall(require, "telescope")
-
if not ok then
-
return
-
end
+
local utils = require("ptero.utils")
+
local telescope = utils.Load("telescope")
local icons = require("ptero.icons")
local border = require("ptero.borders").telescope
+2 -4
lua/ptero/configs/treesitter.lua
···
-
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
-
if not status_ok then
-
return
-
end
+
local utils = require("ptero/utils")
+
local configs = utils.Load("nvim-treesitter.configs")
configs.setup {
ensure_installed = "all",
+1 -18
lua/ptero/options.lua
···
-
local colorscheme = "catppuccin"
-
-
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
-
if not status_ok then
-
vim.notify("colorscheme " .. colorscheme .. " not found")
-
return
-
end
-
-
require(colorscheme).setup({
-
flavour = "mocha",
-
transparent_background = true,
-
integrations = {
-
gitsigns=true,
-
treesitter=true,
-
which_key=true,
-
},
-
})
-
+
-- set termguicolors
vim.opt.termguicolors = true
-- search options
+11 -4
lua/ptero/plugins.lua
···
end
vim.opt.rtp:prepend(lazypath)
+
local utils = require("ptero/utils")
+
require("lazy").setup({
+
-- better notifications
+
{
+
"rcarriga/nvim-notify",
+
config=function() require("ptero.configs.notify") end
+
},
+
"nvim-lua/plenary.nvim",
-- color scheme
···
{
"tzachar/cmp-tabnine",
build="./install.sh",
-
config=function() require('ptero.configs.tabnine') end
+
config=function() require('ptero.configs.tabnine') end,
+
enabled=utils.CheckHostname(),
},
},
},
-- lsp
-
"neovim/nvim-lspconfig",
{
···
}
},
-
-- visual keybindings
-
"folke/which-key.nvim"
+
"folke/which-key.nvim",
})
+17
lua/ptero/theme.lua
···
+
local colorscheme = "catppuccin"
+
+
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
+
if not status_ok then
+
vim.notify("colorscheme " .. colorscheme .. " not found")
+
return
+
end
+
+
require(colorscheme).setup({
+
flavour = "mocha",
+
transparent_background = true,
+
integrations = {
+
gitsigns=true,
+
treesitter=true,
+
which_key=true,
+
},
+
})
+19
lua/ptero/utils.lua
···
+
local M = {}
+
+
function M.CheckHostname()
+
local hostname = vim.fn.hostname()
+
return hostname ~= "riptide"
+
end
+
+
function M.Load(name, level)
+
level = level or "warn"
+
+
local ok, mod = pcall(require, name)
+
if not ok then
+
vim.notify("error loading: " .. name, level)
+
return
+
end
+
return mod
+
end
+
+
return M