nvim: migrate to paq package manager

This commit is contained in:
2025-11-23 08:59:27 +01:00
parent 195176678c
commit 389a5ad784
15 changed files with 255 additions and 322 deletions

View File

@@ -1,4 +1,57 @@
require("config.options") require("config.options")
require("config.remap") require("config.remap")
require("config.lazy")
require("config.lsp") require("config.lsp")
local ok, paq = pcall(require, "paq")
if ok then
paq({
"EdenEast/nightfox.nvim",
"stevearc/conform.nvim",
"otavioschwanck/arrow.nvim",
"folke/flash.nvim",
"folke/snacks.nvim",
"stevearc/oil.nvim",
{
"jake-stewart/multicursor.nvim",
branch = "1.0",
},
{
"nvim-treesitter/nvim-treesitter-textobjects",
branch = "master",
},
{
"nvim-treesitter/nvim-treesitter",
branch = "master",
build = ":TSUpdate",
},
})
else
print("plugin paq missing")
end
local function load_plugin(name, setup)
local cfg = require(setup)
name = cfg.main or name
local ok, plugin = pcall(require, name)
if ok then
if cfg.config then
cfg.config(cfg.opts)
else
plugin.setup(cfg.opts)
end
if cfg.init then
cfg.init(plugin)
end
else
print("plugin " .. name .. " missing")
end
end
load_plugin("arrow", "plugins.arrow")
load_plugin("nightfox", "plugins.colorscheme")
load_plugin("conform", "plugins.conform")
load_plugin("flash", "plugins.flash")
load_plugin("multicursor-nvim", "plugins.multicursor")
load_plugin("oil", "plugins.oil")
load_plugin("snacks", "plugins.snacks")
load_plugin("treesitter", "plugins.treesitter")

View File

@@ -1,5 +1,4 @@
return { return {
"otavioschwanck/arrow.nvim",
opts = { opts = {
show_icons = false, show_icons = false,
leader_key = "_", leader_key = "_",

View File

@@ -1,6 +1,4 @@
return { return {
{
"EdenEast/nightfox.nvim",
opts = { opts = {
specs = { specs = {
all = { all = {
@@ -15,5 +13,4 @@ return {
cs.set_colorschemes("nightfox", "dayfox") cs.set_colorschemes("nightfox", "dayfox")
cs.update_colorscheme() cs.update_colorscheme()
end, end,
},
} }

View File

@@ -1,5 +1,4 @@
return { return {
"stevearc/conform.nvim",
opts = { opts = {
formatters_by_ft = { formatters_by_ft = {
lua = { "stylua" }, lua = { "stylua" },

View File

@@ -1,7 +1,4 @@
return { return {
"folke/flash.nvim",
event = "VeryLazy",
---@type Flash.Config
opts = { opts = {
modes = { modes = {
char = { char = {
@@ -9,46 +6,19 @@ return {
}, },
}, },
}, },
keys = { init = function()
{ local set = vim.keymap.set
"\\", set({ "n", "x", "o" }, "\\", function()
mode = { "n", "x", "o" },
function()
require("flash").jump() require("flash").jump()
end, end, { desc = "Flash" })
desc = "Flash", set({ "n", "x", "o" }, "=", function()
},
{
"=",
mode = { "n", "x", "o" },
function()
require("flash").treesitter() require("flash").treesitter()
end, end, { desc = "Flash Treesitter" })
desc = "Flash Treesitter", set({ "o" }, "r", function()
},
{
" r",
mode = "o",
function()
require("flash").remote() require("flash").remote()
end, end, { desc = "Remote Flash" })
desc = "Remote Flash", set({ "n", "x", "o" }, " t", function()
},
{
" R",
mode = { "o", "x" },
function()
require("flash").treesitter_search() require("flash").treesitter_search()
end, { desc = "Treesitter Search" })
end, end,
desc = "Treesitter Search",
},
{
"<c-s>",
mode = { "c" },
function()
require("flash").toggle()
end,
desc = "Toggle Flash Search",
},
},
} }

View File

@@ -1,10 +1,5 @@
return { return {
"jake-stewart/multicursor.nvim", init = function(mc)
branch = "1.0",
config = function()
local mc = require("multicursor-nvim")
mc.setup()
local set = vim.keymap.set local set = vim.keymap.set
-- Add or skip cursor above/below the main cursor. -- Add or skip cursor above/below the main cursor.

View File

@@ -1,8 +1,5 @@
return { return {
"stevearc/oil.nvim", init = function()
opts = {}, vim.keymap.set("n", "<leader>-", "<cmd>Oil<cr>", { desc = "Oil file manager" })
lazy = false, end,
keys = {
{ "<leader>-", "<cmd>Oil<cr>", desc = "Oil file manager" },
},
} }

View File

@@ -1,241 +1,142 @@
return { return {
"folke/snacks.nvim",
priority = 1000,
lazy = false,
keys = {
{
"<leader><space>",
function()
Snacks.picker.smart()
end,
desc = "Smart Find Files",
},
{
"<leader>a",
function()
Snacks.picker.buffers()
end,
desc = "Buffers",
},
{
"<leader>r",
function()
Snacks.picker.recent()
end,
desc = "Recent files",
},
{
"<leader>R",
function()
Snacks.picker.resume()
end,
desc = "Resume",
},
{
"<leader>b",
function()
Snacks.picker.lines()
end,
desc = "Buffer lines",
},
{
"<leader>B",
function()
Snacks.picker.grep_buffers()
end,
desc = "Grep Open Buffers",
},
{
"<leader>f",
function()
Snacks.picker.files()
end,
desc = "Find Files",
},
{
"<leader>s",
function()
Snacks.picker.grep()
end,
desc = "Grep",
},
{
"<leader>S",
function()
Snacks.picker.git_status()
end,
desc = "Git Status",
},
{
"<leader>g",
function()
Snacks.picker.git_files()
end,
desc = "Find Git Files",
},
{
"<leader>G",
function()
Snacks.picker.git_grep()
end,
desc = "Git Grep",
},
{
"<leader>l",
function()
Snacks.lazygit()
end,
desc = "Lazygit",
},
{
"<leader>L",
function()
Snacks.lazygit.log_file()
end,
desc = "Lazygit log file",
},
{
"<leader>n",
function()
Snacks.notifier.show_history()
end,
desc = "Notification History",
},
{
"<leader>N",
function()
Snacks.picker.notifications()
end,
desc = "Notifications",
},
{
"<leader>C",
function()
Snacks.picker.commands()
end,
desc = "Commands",
},
{
"<leader>h",
function()
Snacks.picker.keymaps()
end,
desc = "Keymaps",
},
{
"<leader>:",
function()
Snacks.picker.command_history()
end,
desc = "Command History",
},
{
'<leader>"',
function()
Snacks.picker.registers()
end,
desc = "Registers",
},
{
"<leader>$",
function()
Snacks.rename.rename_file()
end,
desc = "Rename File",
},
{
"<leader>z",
function()
Snacks.zen.zoom()
end,
desc = "Toggle Zoom",
},
-- LSP
{
"gd",
function()
Snacks.picker.lsp_definitions()
end,
desc = "Goto Definition",
},
{
"gD",
function()
Snacks.picker.lsp_declarations()
end,
desc = "Goto Declaration",
},
{
"gr",
function()
Snacks.picker.lsp_references()
end,
nowait = true,
desc = "References",
},
{
"gI",
function()
Snacks.picker.lsp_implementations()
end,
desc = "Goto Implementation",
},
{
"gy",
function()
Snacks.picker.lsp_type_definitions()
end,
desc = "Goto T[y]pe Definition",
},
{
"<leader>w",
function()
Snacks.picker.lsp_symbols()
end,
desc = "LSP Symbols",
},
{
"<leader>d",
function()
Snacks.picker.diagnostics_buffer()
end,
desc = "Buffer Diagnostics",
},
{
"<leader>D",
function()
Snacks.picker.diagnostics()
end,
desc = "Diagnostics",
},
{
"<leader>W",
function()
Snacks.picker.lsp_workspace_symbols()
end,
desc = "LSP Workspace Symbols",
},
-- Terminal
{
"<c-/>",
function()
Snacks.terminal()
end,
mode = { "n", "t" },
desc = "Toggle Terminal",
},
{
"<c-_>",
function()
Snacks.terminal()
end,
mode = { "n", "t" },
desc = "which_key_ignore",
},
},
init = function() init = function()
vim.api.nvim_create_autocmd("User", { local set = vim.keymap.set
pattern = "VeryLazy",
set("n", "<leader><space>", function()
Snacks.picker.smart()
end, { desc = "Smart Find Files" })
set("n", "<leader><space>", function()
Snacks.picker.smart()
end, { desc = "Smart Find Files" })
set("n", "<leader>a", function()
Snacks.picker.buffers()
end, { desc = "Buffers" })
set("n", "<leader>r", function()
Snacks.picker.recent()
end, { desc = "Recent files" })
set("n", "<leader>R", function()
Snacks.picker.resume()
end, { desc = "Resume" })
set("n", "<leader>b", function()
Snacks.picker.lines()
end, { desc = "Buffer lines" })
set("n", "<leader>B", function()
Snacks.picker.grep_buffers()
end, { desc = "Grep Open Buffers" })
set("n", "<leader>f", function()
Snacks.picker.files()
end, { desc = "Find Files" })
set("n", "<leader>s", function()
Snacks.picker.grep()
end, { desc = "Grep" })
set("n", "<leader>S", function()
Snacks.picker.git_status()
end, { desc = "Git Status" })
set("n", "<leader>g", function()
Snacks.picker.git_files()
end, { desc = "Find Git Files" })
set("n", "<leader>G", function()
Snacks.picker.git_grep()
end, { desc = "Git Grep" })
set("n", "<leader>l", function()
Snacks.lazygit()
end, { desc = "Lazygit" })
set("n", "<leader>L", function()
Snacks.lazygit.log_file()
end, { desc = "Lazygit log file" })
set("n", "<leader>n", function()
Snacks.notifier.show_history()
end, { desc = "Notification History" })
set("n", "<leader>N", function()
Snacks.picker.notifications()
end, { desc = "Notifications" })
set("n", "<leader>C", function()
Snacks.picker.commands()
end, { desc = "Commands" })
set("n", "<leader>h", function()
Snacks.picker.keymaps()
end, { desc = "Keymaps" })
set("n", "<leader>:", function()
Snacks.picker.command_history()
end, { desc = "Command History" })
set("n", '<leader>"', function()
Snacks.picker.registers()
end, { desc = "Registers" })
set("n", "<leader>$", function()
Snacks.rename.rename_file()
end, { desc = "Rename File" })
set("n", "<leader>z", function()
Snacks.zen.zoom()
end, { desc = "Toggle Zoom" })
-- LSP
set("n", "gd", function()
Snacks.picker.lsp_definitions()
end, { desc = "Goto Definition" })
set("n", "gD", function()
Snacks.picker.lsp_declarations()
end, { desc = "Goto Declaration" })
set("n", "gr", function()
Snacks.picker.lsp_references()
end, { desc = "References" })
set("n", "gI", function()
Snacks.picker.lsp_implementations()
end, { desc = "Goto Implementation" })
set("n", "gy", function()
Snacks.picker.lsp_type_definitions()
end, { desc = "Goto T[y]pe Definition" })
set("n", "<leader>w", function()
Snacks.picker.lsp_symbols()
end, { desc = "LSP Symbols" })
set("n", "<leader>d", function()
Snacks.picker.diagnostics_buffer()
end, { desc = "Buffer Diagnostics" })
set("n", "<leader>D", function()
Snacks.picker.diagnostics()
end, { desc = "Diagnostics" })
set("n", "<leader>W", function()
Snacks.picker.lsp_workspace_symbols()
end, { desc = "LSP Workspace Symbols" })
-- Terminal
set({ "n", "t" }, "<c-/>", function()
Snacks.terminal()
end, { desc = "Toggle Terminal" })
set({ "n", "t" }, "<c-_>", function()
Snacks.terminal()
end, { desc = "which_key_ignore" })
vim.api.nvim_create_autocmd("VimEnter", {
callback = function() callback = function()
-- Setup some globals for debugging (lazy-loaded) -- Setup some globals for debugging (lazy-loaded)
_G.dd = function(...) _G.dd = function(...)

View File

@@ -1,12 +1,5 @@
return { return {
"nvim-treesitter/nvim-treesitter",
branch = "master",
lazy = false,
build = ":TSUpdate",
main = "nvim-treesitter.configs", main = "nvim-treesitter.configs",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
opts = { opts = {
highlight = { highlight = {
enable = true, enable = true,

View File

@@ -183,3 +183,26 @@ local function jump(keys)
end end
vis:map(vis.modes.NORMAL, '\\', jump) vis:map(vis.modes.NORMAL, '\\', jump)
local function oneJump()
local v = vis.win.viewport.bytes
local data = vis.win.file:content(v)
local data = 'echo abc'
local code, out, err = vis:pipe(vis.win.file, v, 'chars-jump', false)
-- local code, out, err = vis:pipe(vis.win.file, v, 'cat', true)
-- local code, out, err = vis:pipe('chars-jump')
if code ~= 0 then
vis:info(err or ('fzf exit code ' .. code))
else
local p = jumps[out:sub(1, 1)]
if p then
vis.win.selection.pos = p
else
vis:info('not found')
end
end
return ret
end
vis:map(vis.modes.NORMAL, '-', oneJump)

View File

@@ -0,0 +1,5 @@
local lexer = lexer
local lex = lexer.new(...)
return lex

View File

@@ -56,7 +56,7 @@ XTerm.vt100.color14: #8FBCBB
XTerm.vt100.color7: #E5E9F0 XTerm.vt100.color7: #E5E9F0
XTerm.vt100.color15: #ECEFF4 XTerm.vt100.color15: #ECEFF4
st.font: FiraCode Nerd Font:size=10 st.font: Fira Code Retina:size=10
#ifdef THEME_DARK #ifdef THEME_DARK
st.lightmode: 0 st.lightmode: 0

View File

@@ -1 +1 @@
Net/ThemeName "Materia-dark" Net/ThemeName "Sunrise-Compact-Dark"

View File

@@ -6,8 +6,9 @@ fi
xset b off xset b off
xrandr --auto xrandr --auto
xrandr --output DP-0 --left-of DP-2 --primary #xrandr --output DP-0 --left-of DP-2 --primary
xrandr --output HDMI-0 --left-of DP-0 #xrandr --output HDMI-0 --left-of DP-0
xrandr --output HDMI-A-0 --mode 3840x2160 --right-of eDP --auto
xrdb -merge ~/.Xresources xrdb -merge ~/.Xresources
setxkbmap pl -option ctrl:nocaps setxkbmap pl -option ctrl:nocaps

View File

@@ -11,10 +11,10 @@ if [ "$THEME" = "toggle" ]; then
fi fi
if [ "$THEME" = dark ]; then if [ "$THEME" = dark ]; then
GTK_THEME=Materia-dark GTK_THEME=Sunrise-Compact-Dark
rm -f ~/.lightmode rm -f ~/.lightmode
elif [ "$THEME" = light ]; then elif [ "$THEME" = light ]; then
GTK_THEME=Materia-light GTK_THEME=Sunrise-Compact-Light
touch ~/.lightmode touch ~/.lightmode
else else
echo "error: unknown theme: should be either dark, light or toggle" >&2 echo "error: unknown theme: should be either dark, light or toggle" >&2