summaryrefslogtreecommitdiff
path: root/lua/ben
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2023-09-26 13:50:22 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2023-09-26 13:50:22 -0400
commit71d3ea0a3652a07ca4d007e451183586486c42ba (patch)
treebfd8bfd74c8e0e04c544980adfe1db4267fa4d3f /lua/ben
parentca6e5aa0b97fb708bcdbe42aa5170c53f1e2b0ec (diff)
Binary based loading + more efficient lazy loading
Diffstat (limited to 'lua/ben')
-rw-r--r--lua/ben/plugins/blamer.lua8
-rw-r--r--lua/ben/plugins/colorscheme.lua9
-rw-r--r--lua/ben/plugins/fugitive.lua4
-rw-r--r--lua/ben/plugins/gitsigns.lua4
-rw-r--r--lua/ben/plugins/go.lua26
-rw-r--r--lua/ben/plugins/gutentags.lua4
-rw-r--r--lua/ben/plugins/nvim-r.lua4
-rw-r--r--lua/ben/plugins/telescope.lua58
-rw-r--r--lua/ben/plugins/treesitter.lua4
-rw-r--r--lua/ben/plugins/yadm.lua12
10 files changed, 83 insertions, 50 deletions
diff --git a/lua/ben/plugins/blamer.lua b/lua/ben/plugins/blamer.lua
index 1a8217a..9779c3a 100644
--- a/lua/ben/plugins/blamer.lua
+++ b/lua/ben/plugins/blamer.lua
@@ -1,13 +1,13 @@
return {
- enabled = false,
"APZelos/blamer.nvim",
+ -- Only load if linux is the os AND git is installed
+ cond = function()
+ return (vim.fn.has("linux") == 1) and vim.fn.executable("git")
+ end,
config = function()
vim.g.blamer_enabled = 1
vim.g.blamer_delay = 500
vim.g.blamer_template = "<committer>, <committer-time> • <summary>"
vim.g.blamer_prefix = ">"
end,
- cond = function()
- return vim.fn.has("linux") == 1
- end,
}
diff --git a/lua/ben/plugins/colorscheme.lua b/lua/ben/plugins/colorscheme.lua
index 4caaa52..17f89bb 100644
--- a/lua/ben/plugins/colorscheme.lua
+++ b/lua/ben/plugins/colorscheme.lua
@@ -1,6 +1,5 @@
return {
- -- Treesitter optimized colorscheme
- {
+ { -- Treesitter-optimized colorscheme:
"neanias/everforest-nvim",
version = false,
priority = 1000,
@@ -13,8 +12,7 @@ return {
require("everforest").load()
end,
},
- -- My very own colorscheme
- {
+ { -- My very own colorscheme
"ChausseBenjamin/friffle-vim",
lazy = true,
config = function()
@@ -33,8 +31,7 @@ return {
vim.cmd([[hi Search guifg='#810002' guibg='#738c9c']])
end,
},
- -- Backup retro colorscheme
- {
+ { -- Backup retro colorscheme
"djpohly/elly.vim",
lazy = true,
},
diff --git a/lua/ben/plugins/fugitive.lua b/lua/ben/plugins/fugitive.lua
index e6cf21d..3957d95 100644
--- a/lua/ben/plugins/fugitive.lua
+++ b/lua/ben/plugins/fugitive.lua
@@ -1,5 +1,9 @@
return {
"tpope/vim-fugitive",
+ -- Only load if git is installed
+ cond = function()
+ return vim.fn.executable("git")
+ end,
dependencies = "tpope/vim-rhubarb",
-- Only enable when in a git repo
keys = {
diff --git a/lua/ben/plugins/gitsigns.lua b/lua/ben/plugins/gitsigns.lua
index a3576c8..242f95c 100644
--- a/lua/ben/plugins/gitsigns.lua
+++ b/lua/ben/plugins/gitsigns.lua
@@ -1,5 +1,9 @@
return {
"lewis6991/gitsigns.nvim",
+ -- Only load if git is installed
+ cond = function()
+ return vim.fn.executable("git")
+ end,
event = { "BufReadPre", "BufNewFile" },
config = true,
}
diff --git a/lua/ben/plugins/go.lua b/lua/ben/plugins/go.lua
index a2610c8..0e1511f 100644
--- a/lua/ben/plugins/go.lua
+++ b/lua/ben/plugins/go.lua
@@ -1,5 +1,9 @@
return {
"ray-x/go.nvim",
+ -- Only load if go is installed
+ cond = function()
+ return vim.fn.executable("go")
+ end,
dependencies = { -- optional packages
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
@@ -12,17 +16,17 @@ return {
vim.api.nvim_set_keymap("n", "<Space>gr", "<cmd>GoRun<cr>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<Space>gd", "<cmd>GoDoc<cr>", { noremap = true, silent = true })
-- Commands to run on save:
- -- local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {})
- -- vim.api.nvim_create_autocmd("BufWritePre", {
- -- pattern = "*.go",
- -- callback = function()
- -- -- Go format:
- -- require("go.format").gofmt()
- -- -- Goimports:
- -- require("go.format").goimport()
- -- end,
- -- group = format_sync_grp,
- -- })
+ local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {})
+ vim.api.nvim_create_autocmd("BufWritePre", {
+ pattern = "*.go",
+ callback = function()
+ -- Go format:
+ require("go.format").gofmt()
+ -- Goimports:
+ require("go.format").goimport()
+ end,
+ group = format_sync_grp,
+ })
end,
ft = { "go", "gomod", "gowork", "gosum" },
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
diff --git a/lua/ben/plugins/gutentags.lua b/lua/ben/plugins/gutentags.lua
index 76223cf..a97f2a9 100644
--- a/lua/ben/plugins/gutentags.lua
+++ b/lua/ben/plugins/gutentags.lua
@@ -1,4 +1,8 @@
return {
"ludovicchabant/vim-gutentags",
+ -- Only load if ctags are installed
+ cond = function()
+ return vim.fn.executable("ctags")
+ end,
event = { "BufReadPre", "BufNewFile" },
}
diff --git a/lua/ben/plugins/nvim-r.lua b/lua/ben/plugins/nvim-r.lua
index fa93005..3978d1e 100644
--- a/lua/ben/plugins/nvim-r.lua
+++ b/lua/ben/plugins/nvim-r.lua
@@ -1,5 +1,9 @@
return {
"jalvesaq/Nvim-R",
+ -- Only load if R is installed
+ cond = function()
+ return vim.fn.executable("R")
+ end,
ft = { "R", "Rnoweb", "tex", "aux", "bib" },
config = function()
vim.g.r_syntax_folding = 1
diff --git a/lua/ben/plugins/telescope.lua b/lua/ben/plugins/telescope.lua
index 81e550d..1b091eb 100644
--- a/lua/ben/plugins/telescope.lua
+++ b/lua/ben/plugins/telescope.lua
@@ -1,37 +1,41 @@
return {
- "nvim-telescope/telescope.nvim",
- branch = "0.1.x",
- dependencies = {
- "nvim-lua/plenary.nvim",
- {
- "joaomsa/telescope-orgmode.nvim",
- lazy = true,
- config = function()
- require("telescope").load_extension("orgmode")
- end,
+ { -- Main plugin: Telescope
+ "nvim-telescope/telescope.nvim",
+ branch = "0.1.x",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
},
- },
- keys = { -- LazyLoad telescope when it's actually needed
-
- -- F.ind F.iles
- { "<leader>ff", '<cmd>lua require("telescope.builtin").find_files()<cr>' },
+ keys = { -- LazyLoad telescope when it's actually needed
- -- F.ind B.uffers
- { "<leader>fb", '<cmd>lua require("telescope.builtin").buffers()<cr>' },
+ -- F.ind F.iles
+ { "<leader>ff", '<cmd>lua require("telescope.builtin").find_files()<cr>' },
- -- F.ind G.it
- { "<leader>fg", '<cmd>lua require("telescope.builtin").git_files()<cr>' },
+ -- F.ind B.uffers
+ { "<leader>fb", '<cmd>lua require("telescope.builtin").buffers()<cr>' },
- -- F.ind H.elp
- { "<leader>fh", '<cmd>lua require("telescope.builtin").help_tags()<cr>' },
+ -- F.ind G.it
+ { "<leader>fg", '<cmd>lua require("telescope.builtin").git_files()<cr>' },
- -- F.ind Q.uick F.ix
- { "<leader>fqf", '<cmd>lua require("telescope.builtin").quickfix()<cr>' },
+ -- F.ind H.elp
+ { "<leader>fh", '<cmd>lua require("telescope.builtin").help_tags()<cr>' },
- -- F.ind C.olor S.cheme
- { "<leader>fcs", '<cmd>lua require("telescope.builtin").colorscheme()<cr>' },
+ -- F.ind Q.uick F.ix
+ { "<leader>fqf", '<cmd>lua require("telescope.builtin").quickfix()<cr>' },
- -- F.ing O.rgmode
- { "<leader>fo", '<cmd>lua require("telescope").extensions.orgmode.seach_headings()<cr>' },
+ -- F.ind C.olor S.cheme
+ { "<leader>fcs", '<cmd>lua require("telescope.builtin").colorscheme()<cr>' },
+ },
+ { -- Telescope extension for orgmode
+ "joaomsa/telescope-orgmode.nvim",
+ lazy = true,
+ config = function()
+ require("telescope").load_extension("orgmode")
+ end,
+ -- This way, telescope doesn't load the extension until it's actually needed
+ keys = {
+ -- F.ing O.rgmode
+ { "<leader>fo", '<cmd>lua require("telescope").extensions.orgmode.seach_headings()<cr>' },
+ },
+ },
},
}
diff --git a/lua/ben/plugins/treesitter.lua b/lua/ben/plugins/treesitter.lua
index b8f4ec0..ec3022b 100644
--- a/lua/ben/plugins/treesitter.lua
+++ b/lua/ben/plugins/treesitter.lua
@@ -1,11 +1,11 @@
return {
{
"nvim-treesitter/nvim-treesitter",
- event = { "BufReadPre", "BufNewFile" },
- build = ":TSUpdate",
dependencies = {
"windwp/nvim-ts-autotag",
},
+ event = { "BufReadPre", "BufNewFile" },
+ build = ":TSUpdate",
config = function()
-- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs")
diff --git a/lua/ben/plugins/yadm.lua b/lua/ben/plugins/yadm.lua
new file mode 100644
index 0000000..ae0fea7
--- /dev/null
+++ b/lua/ben/plugins/yadm.lua
@@ -0,0 +1,12 @@
+return {
+ "robstumborg/yadm.nvim",
+ -- Only load if yadm is installed
+ cond = function()
+ return vim.fn.executable("yadm")
+ end,
+ config = function()
+ require("yadm").setup({
+ yadm_dir = vim.fn.expand("$XDG_DATA_HOME/yadm/repo.git"),
+ })
+ end,
+}