1
Fork 0

Move more neovim plugins to nix

This commit is contained in:
Matei Adriel 2023-12-21 16:21:14 +01:00
parent 40e0a096e8
commit 85ebcee9ba
No known key found for this signature in database
34 changed files with 882 additions and 961 deletions

View file

@ -1,99 +0,0 @@
local M = {
"echasnovski/mini.clue",
lazy = false,
}
function M.config()
local miniclue = require("mini.clue")
miniclue.setup({
triggers = {
-- Leader triggers
{ mode = "n", keys = "<leader>" },
{ mode = "x", keys = "<leader>" },
{ mode = "v", keys = "<leader>" },
},
clues = {
-- Enhance this by adding descriptions for <Leader> mapping groups
miniclue.gen_clues.builtin_completion(),
miniclue.gen_clues.g(),
miniclue.gen_clues.marks(),
miniclue.gen_clues.registers(),
miniclue.gen_clues.windows(),
miniclue.gen_clues.z(),
{
mode = "n",
keys = "<leader>f",
desc = "[F]iles",
},
{
mode = "n",
keys = "<leader>g",
desc = "[G]o to",
},
{
mode = "n",
keys = "<leader>r",
desc = "[R]ename / [R]eplace / [R]eload",
},
{
mode = "n",
keys = "<leader>l",
desc = "[L]ocal",
},
{
mode = "n",
keys = "<leader>w",
desc = "[W]orkspace",
},
{
mode = "n",
keys = "<leader>y",
desc = "[Y]ank",
},
{
mode = "n",
keys = "<leader>s",
desc = "[S]ettings",
},
{
mode = "n",
keys = "<leader>v",
desc = "[V]imux",
},
{
mode = "n",
keys = "<leader>h",
desc = "git [h]hunks",
},
{
mode = "n",
keys = "<leader>VH",
postkeys = "<leader>V",
},
{
mode = "n",
keys = "<leader>VJ",
postkeys = "<leader>V",
},
{
mode = "n",
keys = "<leader>VK",
postkeys = "<leader>V",
},
{
mode = "n",
keys = "<leader>VL",
postkeys = "<leader>V",
},
{
mode = "n",
keys = "<leader>Vf",
postkeys = "<leader>V",
},
},
})
require("my.keymaps").nmap("Q", ":wqa<cr>", "Save all files and [q]uit")
end
return {}

View file

@ -1,122 +0,0 @@
local env = require("my.helpers.env")
local M = {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"onsails/lspkind.nvim", -- show icons in lsp completion menus
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-emoji",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip",
"L3MON4D3/LuaSnip", -- snippeting engine
},
cond = env.vscode.not_active(),
}
local function has_words_before()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0
and vim.api
.nvim_buf_get_lines(0, line - 1, line, true)[1]
:sub(col, col)
:match("%s")
== nil
end
function M.config()
vim.o.completeopt = "menuone,noselect"
local cmp = require("cmp")
local lspkind = require("lspkind")
local options = {
window = {
documentation = cmp.config.window.bordered(),
completion = cmp.config.window.bordered({
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
col_offset = -3,
side_padding = 0,
completeopt = "menu,menuone,noinsert",
}),
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
local kind = lspkind.cmp_format({
mode = "symbol",
maxwidth = 50,
symbol_map = {
Text = ".",
},
})(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
-- Rust analyzer sometimes has this be nil when working with lifetime arguments.
if strings[1] ~= nil then
kind.kind = " " .. strings[1] .. " "
end
kind.menu = ""
return kind
end,
},
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-d>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<C-s>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { "i", "s" }),
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffers" },
{ name = "emoji" },
{ name = "path" },
-- { name = 'omni' },
}),
}
cmp.setup(options)
-- Use buffer source for `/`
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
-- Use cmdline & path source for ':'
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
{ name = "cmdline" },
}),
})
end
return M

View file

@ -1,4 +1,4 @@
local env = require("my.helpers.env")
local runtime = require("my.tempest")
local header_string = [[
@ -9,7 +9,7 @@ local header_string = [[
]]
local header = require("my.helpers.string").split(header_string, "\n")
local header = runtime.helpers.split(header_string, "\n")
local M = {
"goolord/alpha-nvim",
@ -23,23 +23,24 @@ local M = {
-- See [the header generator](https://patorjk.com/software/taag/#p=display&v=0&f=ANSI%20Shadow&t=NEOVim%20%3A3)
theme.section.header.opts.hl = "AlphaHeader"
theme.section.header.val = header
local version = vim.version()
local footer = function()
local version = "🚀 "
.. vim.version().major
local versionString = "🚀 "
.. version.major
.. "."
.. vim.version().minor
.. version.minor
.. "."
.. vim.version().patch
.. version.patch
local lazy_ok, lazy = pcall(require, "lazy")
if lazy_ok then
local total_plugins = lazy.stats().count .. " Plugins"
local startuptime = (
math.floor(lazy.stats().startuptime * 100 + 0.5) / 100
)
return version
.. " 🧰 "
return versionString
.. " 🧰 "
.. total_plugins
.. " 🕐 "
.. " 🕐 "
.. startuptime
.. "ms"
else
@ -63,7 +64,7 @@ local M = {
require("alpha").setup(theme.config)
end,
lazy = false,
cond = env.vscode.not_active() and env.firenvim.not_active(),
cond = runtime.blacklist({ "vscode", "firenvim" }),
}
return M

View file

@ -1,10 +1,10 @@
local env = require("my.helpers.env")
local runtime = require("my.tempest")
local K = require("my.keymaps")
local M = {
"glacambre/firenvim", -- vim inside chrome
lazy = false,
cond = env.firenvim.active(),
cond = runtime.whitelist("firenvim"),
}
M.localSettings = {}
@ -53,9 +53,4 @@ function M.config()
-- }}}
end
function M.setup()
M.config()
print(vim.inspect(M.localSettings))
end
return M

View file

@ -1,97 +0,0 @@
local env = require("my.helpers.env")
local M = {
"lewis6991/gitsigns.nvim",
event = "BufReadPost",
cond = env.firenvim.not_active() and env.vscode.not_active(),
opts = {
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
-- {{{ Helpers
local function map(mode, from, to, desc, expr)
vim.keymap.set(
mode,
from,
to,
{ expr = expr, silent = true, buffer = bufnr, desc = desc }
)
end
local function exprmap(from, to, desc)
map("n", from, to, desc, true)
end
-- }}}
-- {{{ Navigation
exprmap("]c", function()
if vim.wo.diff then
return "]c"
end
vim.schedule(function()
gs.next_hunk()
end)
return "<Ignore>"
end, "Navigate to next hunk")
exprmap("[c", function()
if vim.wo.diff then
return "[c"
end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, "Navigate to previous hunk")
-- }}}
-- {{{ Actions
local prefix = "<leader>h"
-- require("which-key").register({
-- ["<leader>"] = { h = { name = "gitsigns" } },
-- })
-- {{{ Normal mode
map("n", prefix .. "s", gs.stage_hunk, "[s]tage hunk")
map("n", prefix .. "r", gs.reset_hunk, "[r]eset hunk")
map("n", prefix .. "S", gs.stage_buffer, "[s]tage buffer")
map("n", prefix .. "u", gs.undo_stage_hunk, "[u]ndo hunk staging")
map("n", prefix .. "R", gs.reset_buffer, "[r]eset buffer")
map("n", prefix .. "p", gs.preview_hunk, "[p]review hunk")
map("n", prefix .. "b", function()
gs.blame_line({ full = true })
end, "[b]lame line")
map("n", prefix .. "d", gs.diffthis, "[d]iff this")
map("n", prefix .. "D", function()
gs.diffthis("~")
end, "[d]iff file (?)")
-- }}}
-- {{{ Toggles
map(
"n",
prefix .. "tb",
gs.toggle_current_line_blame,
"[t]oggle line [b]laming"
)
map("n", prefix .. "td", gs.toggle_deleted, "[t]oggle [d]eleted")
-- }}}
-- {{{ Visual
map("v", prefix .. "s", function()
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
end, "stage visual hunk")
map("v", prefix .. "r", function()
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
end, "reset visual hunk")
-- }}}
-- }}}
-- {{{ Text objects
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "Inside hunk")
-- }}}
end,
},
}
return M

View file

@ -1,72 +1,10 @@
local env = require("my.helpers.env")
local runtime = require("my.tempest")
if env.neovide.active() then
if runtime.whitelist("neovide") then
require("my.neovide").setup()
end
return {
--{{{ Language support
{
"purescript-contrib/purescript-vim",
ft = "purescript",
cond = env.vscode.not_active(),
},
{
"elkowar/yuck.vim",
ft = "yuck",
cond = env.vscode.not_active(),
},
{
"Fymyte/rasi.vim",
ft = "rasi",
cond = env.vscode.not_active(),
},
{
"teal-language/vim-teal",
ft = "teal",
cond = env.vscode.not_active(),
},
{
"udalov/kotlin-vim",
ft = "kotlin",
cond = env.vscode.not_active(),
},
{
"kmonad/kmonad-vim",
ft = "kbd",
cond = env.vscode.not_active(),
},
{
"vmchale/dhall-vim",
ft = "dhall",
cond = env.vscode.not_active(),
},
{
"yasuhiroki/github-actions-yaml.vim",
ft = { "yml", "yaml" },
cond = env.vscode.not_active(),
},
{
"kaarmu/typst.vim",
ft = "typst",
cond = env.vscode.not_active(),
},
{
"theRealCarneiro/hyprland-vim-syntax",
ft = "hypr",
cond = env.vscode.not_active(),
},
--}}}
{
-- Better ui for inputs/selects
"stevearc/dressing.nvim",
@ -84,7 +22,7 @@ return {
return vim.ui.input(...)
end
end,
cond = env.vscode.not_active(),
cond = runtime.blacklist("vscode"),
enabled = false,
},
@ -95,45 +33,4 @@ return {
require("nvim-autopairs").setup()
end,
},
{
"mateiadrielrafael/scrap.nvim",
event = "InsertEnter",
config = function()
require("my.abbreviations").setup()
end,
}, -- vim-abolish rewrite
{
-- easly switch between tmux and vim panes
"christoomey/vim-tmux-navigator",
keys = { "<C-h>", "<C-j>", "<C-k>", "<C-l>" },
cond = env.vscode.not_active()
and env.neovide.not_active()
and env.firenvim.not_active()
and false,
},
{
-- show progress for lsp stuff
"j-hui/fidget.nvim",
tag = "legacy",
event = "BufReadPre",
cond = env.vscode.not_active(),
config = true,
},
-- Live command preview for stuff like :norm
{
"smjonas/live-command.nvim",
config = function()
require("live-command").setup({
commands = {
Norm = { cmd = "norm" },
},
})
end,
event = "VeryLazy",
cond = false,
},
}

View file

@ -1,5 +1,4 @@
local helpers = require("my.helpers")
local env = require("my.helpers.env")
local runtime = require("my.tempest")
local lspconfig = {
"neovim/nvim-lspconfig",
@ -12,7 +11,7 @@ local lspconfig = {
},
"simrat39/rust-tools.nvim",
},
cond = env.vscode.not_active(),
cond = runtime.blacklist("vscode"),
}
local M = {
@ -23,7 +22,7 @@ local M = {
opts = {
input_buffer_type = "dressing",
},
cond = env.vscode.not_active(),
cond = runtime.blacklist("vscode"),
},
}
@ -53,9 +52,11 @@ function M.on_attach(client, bufnr)
nmap("<leader>c", vim.lsp.buf.code_action, "[C]ode actions")
nmap("<leader>li", "<cmd>LspInfo<cr>", "[L]sp [i]nfo")
local expropts = opts("[R]e[n]ame")
expropts.expr = true
vim.keymap.set("n", "<leader>rn", function()
return ":IncRename " .. vim.fn.expand("<cword>")
end, helpers.mergeTables(opts("[R]e[n]ame"), { expr = true }))
end, expropts)
vim.keymap.set(
"v",

View file

@ -1,35 +0,0 @@
local env = require("my.helpers.env")
local M = {
"L3MON4D3/LuaSnip", -- snippeting engine
version = "v2",
cond = env.vscode.not_active(),
}
local function reload()
require("luasnip.loaders.from_vscode").lazy_load()
end
function M.config()
local luasnip = require("luasnip")
vim.keymap.set("i", "<Tab>", function()
if luasnip.jumpable(1) then
return "<cmd>lua require('luasnip').jump(1)<cr>"
else
return "<Tab>"
end
end, { expr = true })
vim.keymap.set("i", "<S-Tab>", function()
luasnip.jump(-1)
end)
vim.keymap.set("n", "<leader>rs", reload, {
desc = "[R]eload [s]nippets",
})
reload()
end
return M

View file

@ -1,30 +0,0 @@
local env = require("my.helpers.env")
local M = {
"jose-elias-alvarez/null-ls.nvim", -- generic language server
event = "BufReadPre",
dependencies = "neovim/nvim-lspconfig",
cond = env.vscode.not_active(),
enable = false,
}
function M.config()
local lspconfig = require("my.plugins.lspconfig")
local null_ls = require("null-ls")
local sources = {
-- {{{ Python
-- Diagnostics
null_ls.builtins.diagnostics.ruff, -- Linting
-- null_ls.builtins.diagnostics.mypy, -- Type checking
-- }}}
}
null_ls.setup({
sources = sources,
on_attach = lspconfig.on_attach,
debug = true,
})
end
return M

View file

@ -1,5 +1,4 @@
local H = require("my.plugins.themes.helpers")
local T = require("nix.theme")
local H = require("my.helpers.theme")
local M = {
"uloco/bluloco.nvim",
@ -12,7 +11,7 @@ function M.config()
local bluloco = require("bluloco")
bluloco.setup({
transparent = T.opacity.terminal < 1.0,
transparent = H.theme.opacity.terminal < 1.0,
style = H.variant("Bluloco"),
})

View file

@ -1,5 +1,4 @@
local H = require("my.plugins.themes.helpers")
local T = require("nix.theme")
local H = require("my.helpers.theme")
local M = {
"catppuccin/nvim",
@ -13,7 +12,7 @@ function M.config()
vim.g.catppuccin_flavour = H.variant("Catppuccin")
catppuccin.setup({
transparent_background = T.transparent.terminal,
transparent_background = H.theme.transparent.terminal,
integrations = {
nvimtree = true,
telescope = true,
@ -26,7 +25,7 @@ function M.config()
vim.cmd("colorscheme catppuccin")
if T.transparent.terminal then
if H.theme.transparent.terminal then
vim.cmd([[highlight FloatBorder blend=0 guibg=NONE]])
-- vim.cmd([[highlight MiniStatuslineInactive blend=0 guibg=NONE]])
vim.cmd([[highlight MiniStatuslineFilename blend=0 guibg=NONE]])

View file

@ -1,14 +0,0 @@
local theme = require("nix.theme").name
local M = {}
function M.theme_contains(name)
return string.find(theme, name) ~= nil
end
function M.variant(name)
-- +1 for 1-indexed strings and +1 for the space between name and variant
return string.lower(string.sub(theme, string.len(name) + 2))
end
return M

View file

@ -1,5 +0,0 @@
return {
require("my.plugins.themes.catppuccin"),
require("my.plugins.themes.rosepine"),
require("my.plugins.themes.bluloco"),
}

View file

@ -1,4 +1,4 @@
local H = require("my.plugins.themes.helpers")
local H = require("my.helpers.theme")
local M = {
"rose-pine/neovim",

View file

@ -1,105 +0,0 @@
local env = require("my.helpers.env")
local M = {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
event = "BufReadPost",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
require("nvim-treesitter.configs").setup({
--{{{Languages
ensure_installed = {
"bash",
"c",
"cpp",
"css",
"dockerfile",
"elixir",
"fish",
"html",
"javascript",
"json",
"jsonc",
"latex",
"lua",
"markdown",
"markdown_inline",
"nix",
"python",
"rust",
"scss",
"toml",
"tsx",
"typescript",
"vim",
"yaml",
},
sync_install = false,
--}}}
--{{{ Highlighting
highlight = {
enable = true,
disable = { "kotlin" },
additional_vim_regex_highlighting = false,
},
--}}}
textobjects = {
--{{{ Select
select = {
enable = true,
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
--}}}
--{{{ Move
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]f"] = "@function.outer",
["]t"] = "@class.outer",
},
goto_next_end = {
["]F"] = "@function.outer",
["]T"] = "@class.outer",
},
goto_previous_start = {
["[f"] = "@function.outer",
["[t"] = "@class.outer",
},
goto_previous_end = {
["[F"] = "@function.outer",
["[T"] = "@class.outer",
},
},
--}}}
},
indent = { enable = true },
})
end,
},
{
-- show context on closing parenthesis
"haringsrob/nvim_context_vt",
event = "BufReadPost",
cond = env.vscode.not_active(),
},
{
-- show context at top of file
"nvim-treesitter/nvim-treesitter-context",
event = "BufReadPost",
cond = env.vscode.not_active(),
opts = { enable = true },
},
}
return M

View file

@ -28,46 +28,53 @@ local venn_hint = H.concat_many_h({
}, 3).value
function M.config()
local r = "<leader>V"
vim.keymap.set("n", r .. "H", "<C-v>h:VBox<CR>", { desc = "left" })
vim.keymap.set("n", r .. "J", "<C-v>j:VBox<CR>", { desc = "down" })
vim.keymap.set("n", r .. "K", "<C-v>k:VBox<CR>", { desc = "up" })
vim.keymap.set("n", r .. "L", "<C-v>l:VBox<CR>", { desc = "right" })
vim.keymap.set("v", r .. "f", ":VBox<CR>", { desc = "box" })
-- local r = "<leader>V"
-- vim.keymap.set("n", r .. "H", "<C-v>h:VBox<CR>", { desc = "left" })
-- vim.keymap.set("n", r .. "J", "<C-v>j:VBox<CR>", { desc = "down" })
-- vim.keymap.set("n", r .. "K", "<C-v>k:VBox<CR>", { desc = "up" })
-- vim.keymap.set("n", r .. "L", "<C-v>l:VBox<CR>", { desc = "right" })
-- vim.keymap.set("v", r .. "f", ":VBox<CR>", { desc = "box" })
-- local Hydra = require("hydra")
--
-- Hydra({
-- name = "Draw Diagram",
-- hint = venn_hint,
-- config = {
-- color = "pink",
-- invoke_on_body = true,
-- hint = {
-- border = "single",
-- },
-- on_enter = function()
-- vim.o.virtualedit = "all"
-- end,
-- },
-- mode = "n",
-- desc = "[V]enn mode",
-- body = "<leader>V",
-- heads = {
-- { "H", "<C-v>h:VBox<CR>" },
-- { "J", "<C-v>j:VBox<CR>" },
-- { "K", "<C-v>k:VBox<CR>" },
-- { "L", "<C-v>l:VBox<CR>" },
-- { "f", ":VBox<CR>", { mode = "v" } },
-- { "<Esc>", nil, { exit = true } },
-- },
-- })
local Hydra = require("hydra")
Hydra({
name = "Draw Diagram",
hint = venn_hint,
config = {
color = "pink",
invoke_on_body = true,
hint = {
border = "single",
},
on_enter = function()
vim.opt.virtualedit = "all"
vim.g.inside_venn = true
vim.opt.cmdheight = 1
end,
on_exit = function()
vim.opt.virtualedit = ""
vim.g.inside_venn = false
vim.opt.cmdheight = 0
end,
desc = "[V]enn mode",
},
mode = "n",
body = "<leader>V",
heads = {
{ "H", "<C-v>h:VBox<cr>", { silent = true, desc = "test description" } },
{ "J", "<C-v>j:VBox<cr>", { silent = true, desc = "test description" } },
{ "K", "<C-v>k:VBox<cr>", { silent = true, desc = "test description" } },
{ "L", "<C-v>l:VBox<cr>", { silent = true, desc = "test description" } },
{ "f", "<cmd>VBox<cr>", { mode = "v" } },
{ "<Esc>", nil, { exit = true } },
},
})
end
-- function M.init()
-- require("which-key").register({
-- ["<leader>V"] = { name = "[V]enn mode" },
-- })
-- end
function M.init()
require("which-key").register({
["<leader>V"] = { name = "[V]enn mode" },
})
end
return {}
return M

View file

@ -1,6 +1,9 @@
local runtime = require("my.tempest")
local M = {
"folke/which-key.nvim",
event = "VeryLazy",
cond = runtime.blacklist("vscode"),
}
function M.config()
@ -28,4 +31,4 @@ function M.config()
})
end
return {}
return M