nvim bump + switch from packer -> lazy

This commit is contained in:
agryphus 2024-12-11 14:54:20 -05:00
parent cc99d55125
commit c28dd3e9a9
12 changed files with 209 additions and 203 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
/plugin/
lazy-lock.json

View file

@ -200,7 +200,7 @@ hl(0, 'NvimTreeCursorLine', { fg = palette.yellow })
hl(0, 'NvimTreeEndOfBuffer', { fg = palette.medium_gray })
hl(0, 'NvimTreeIndentMarker', { fg = palette.medium_gray })
hl(0, 'NvimTreeFolderIcon', { fg = palette.yellow })
hl(0, 'WhichKeyFloat', { bg = nil })
hl(0, 'WhichKeyBorder', { fg = palette.medium_gray, bg = palette.accent })
hl(0, 'WhichKeyDesc', { link = "function" })
hl(0, 'WhichKey', { fg = palette.medium_gray_blue })
hl(0, 'WhichKeyGroup', { fg = palette.gray_blue, bold = true })

View file

@ -1,52 +1,44 @@
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
math.randomseed(os.time())
local function pick_color()
local colors = {"String", "Identifier", "Keyword", "Number"}
return colors[math.random(#colors)]
end
local function footer()
local total_plugins = #vim.tbl_keys(packer_plugins)
local version = vim.version()
local nvim_version_info = " NVIM v" .. version.major .. "." .. version.minor .. "." .. version.patch
return nvim_version_info .. " 󰏖 " .. total_plugins .. " plugins"
local total_plugins = #require("lazy").plugins()
local version = vim.version()
local nvim_version_info = " NVIM v" .. version.major .. "." .. version.minor .. "." .. version.patch
return nvim_version_info .. " 󰏖 " .. total_plugins .. " plugins"
end
-- Set header
dashboard.section.header.val = {
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ",
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
" ⠈ ⠈⢿⣿⣟⠦⠄⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
" ⣸⣿⣿⢧⠄⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
" ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿ ",
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷⠄ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
"⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
"⠙⠃ ⣼⣿⡟⠌ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿⠐⣿⣿⡇ ⠛⠻⢷⣄",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ⠁",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣀⣤⣾⡿⠃ ",
"⢀⣀⠀⣠⣀⣠⣾⣿⣿⡿⠛⠋⠉⠉⠉ ⠉⠉⠉⠉⠛⠻⣿⣿⣷⣄⣀⢿⡽⢻⣦",
"⠻⠶⠾⠿⠿⠿⠋⠉ N E O V I M ⠉⠻⠿⠿⠿⠿⠿⠋",
" ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ",
" ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
" ⠈ ⠈⢿⣿⣟⠦⠄⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
" ⣸⣿⣿⢧⠄⢻⠻⣿⣿⣷⣄⣀⠄⠢⣀⡀⠈⠙⠿⠄ ",
" ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
" ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿ ",
" ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷⠄ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
"⣠⣿⠿⠛ ⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
"⠙⠃ ⣼⣿⡟⠌ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿⠐⣿⣿⡇ ⠛⠻⢷⣄",
" ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ⠁",
" ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣀⣤⣾⡿⠃ ",
"⢀⣀⠀⣠⣀⣠⣾⣿⣿⡿⠛⠋⠉⠉⠉ ⠉⠉⠉⠉⠛⠻⣿⣿⣷⣄⣀⢿⡽⢻⣦",
"⠻⠶⠾⠿⠿⠿⠋⠉ N E O V I M ⠉⠻⠿⠿⠿⠿⠿⠋",
}
-- Set menu
dashboard.section.buttons.val = {
dashboard.button( "e", " New file" , ":ene <BAR> startinsert <CR>"),
dashboard.button( "q", "󰩈 Quit NVIM", ":qa<CR>"),
dashboard.button( "e", " New file" , ":ene <BAR> startinsert <CR>"),
dashboard.button( "q", "󰩈 Quit NVIM", ":qa<CR>"),
}
vim.api.nvim_create_autocmd("VimEnter", {
once = true,
callback = function()
math.randomseed(os.time())
local fg_color = tostring(math.random(0, 12))
local hi_setter = "hi AlphaHeader ctermfg="
vim.cmd(hi_setter .. fg_color)
end
once = true,
callback = function()
math.randomseed(os.time())
local fg_color = tostring(math.random(0, 12))
local hi_setter = "hi AlphaHeader ctermfg="
vim.cmd(hi_setter .. fg_color)
end
})
dashboard.section.footer.val = footer()

View file

@ -1,4 +1,4 @@
local wk = require("which-key")
wk.register({g = { name = "git" }, prefix = "<leader>"})
-- wk.add({g = { name = "git" }, prefix = "<leader>"})
vim.keymap.set("n", "<leader>gs", vim.cmd.Git, { desc = "Git status" })

View file

@ -59,11 +59,13 @@ cmp.setup({
}
})
-- DIAGNOSTICS
-- Show all diagnostics on current line in floating window
vim.api.nvim_set_keymap(
'n', 'gl', ':lua vim.diagnostic.open_float()<CR>',
{ noremap = true, silent = true }
)
vim.keymap.set("n", "gl", ":lua vim.diagnostic.open_float()<CR>",
{ noremap = true, silent = true })
vim.keymap.set("n", "<leader>le", ":LspStop<CR>",
{ desc = "LSP Stop" })
vim.keymap.set("n", "<leader>ls", ":LspStart<CR>",
{ desc = "LSP Start" })

View file

@ -1,10 +1,10 @@
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
require("nvim-tree").setup()
vim.keymap.set("n", "<leader>pt", vim.cmd.NvimTreeToggle)
-- sets transparent background
vim.cmd[[hi NvimTreeNormal guibg=NONE ctermbg=NONE]]
-- -- set termguicolors to enable highlight groups
-- vim.opt.termguicolors = true
--
-- require("nvim-tree").setup()
--
-- vim.keymap.set("n", "<leader>pt", vim.cmd.NvimTreeToggle)
--
-- -- sets transparent background
-- vim.cmd[[hi NvimTreeNormal guibg=NONE ctermbg=NONE]]
--

View file

@ -8,19 +8,20 @@ require("telescope").setup{
local wk = require("which-key")
-- <leader> p
wk.register({p = { name = "project" }, prefix = "<leader>"})
vim.keymap.set("n", "<leader>p", "<noop>", {desc = "Project"})
vim.keymap.set("n", "<leader>pf", builtin.find_files, {desc = "Project find"})
vim.keymap.set("n", "<leader>ps", function ()
vim.keymap.set("n", "<leader>ps",
function ()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end , {desc = "Project search"})
end,
{ desc = "Project search" })
-- <leader> f
wk.register({f = { name = "find" }, prefix = "<leader>"})
-- wk.add({f = { name = "find" }, prefix = "<leader>"})
vim.keymap.set("n", "<leader>fr", builtin.oldfiles, { desc = "Find recent" })
-- <leader> h
wk.register({h = { name = "help" }, prefix = "<leader>"})
-- wk.add({h = { name = "help" }, prefix = "<leader>"})
vim.keymap.set("n", "<leader>ht", builtin.colorscheme, { desc = "Load theme" })
vim.keymap.set("n", "<leader>hf", builtin.commands , { desc = "Describe function" })
vim.keymap.set("n", "<leader>hk", builtin.keymaps , { desc = "Describe key" })

View file

@ -1,11 +1,11 @@
require("which-key").setup({
window = {
win = {
border = "single", -- none, single, double, shadow
position = "bottom", -- bottom, top
margin = { 0, 0, 0, 0 }, -- extra window margin [top, right, bottom, left]. When between 0 and 1, will be treated as a percentage of the screen size.
padding = { 0, 2, 0, 2 }, -- extra window padding [top, right, bottom, left]
winblend = 0, -- value between 0-100 0 for fully opaque and 100 for fully transparent
padding = { 0, 0, 0, 0 }, -- extra window padding [top, right, bottom, left]
zindex = 1000, -- positive value to position WhichKey above other floating windows.
wo = {
winblend = 0, -- value between 0-100 0 for fully opaque and 100 for fully transparent
},
},
layout = {
height = { min = 4, max = 25 }, -- min and max height of the columns
@ -14,3 +14,4 @@ require("which-key").setup({
align = "left", -- align columns left, center or right
},
})

View file

@ -1,4 +1,4 @@
require("andrew.remap")
require("andrew.packer")
require("andrew.lazy")
require("andrew.set")

119
lua/andrew/lazy.lua Normal file
View file

@ -0,0 +1,119 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
-- Terminal file manager support
-- "DreamMaoMao/yazi.nvim",
{
"mikavilpas/yazi.nvim",
event = "VeryLazy",
},
-- Dashboard buffer
{
"goolord/alpha-nvim",
-- dependencies = { 'echasnovski/mini.icons' },
dependencies = { 'nvim-tree/nvim-web-devicons' },
},
-- Zen mode
"folke/zen-mode.nvim",
-- Show valid keys mid key chord
"folke/which-key.nvim",
-- config = function()
-- vim.o.timeout = true
-- vim.o.timeoutlen = 300
-- end
-- Find files and strings
{
'nvim-telescope/telescope.nvim', tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim' },
},
{
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate"
},
-- Themes
"aktersnurra/no-clown-fiesta.nvim",
"ellisonleao/gruvbox.nvim",
{ 'rose-pine/neovim', as = 'rose-pine' },
'Mofiqul/vscode.nvim',
-- Referencing a hex code highlights it in that color
"norcalli/nvim-colorizer.lua",
-- Relative line numbers disappear when not actively in buffer
"jeffkreeftmeijer/vim-numbertoggle",
-- History visualizer
"mbbill/undotree",
-- See function signatures when typing them
{
"ray-x/lsp_signature.nvim",
event = "VeryLazy",
opts = {},
config = function(_, opts) require'lsp_signature'.setup(opts) end
},
-- Left-side file tree dispaly
{
"nvim-tree/nvim-tree.lua",
requires = {
"nvim-tree/nvim-web-devicons", -- for file icons
},
},
-- Shows current mode on bottom of screen
"itchyny/lightline.vim",
-- LSP
{'VonHeikemen/lsp-zero.nvim', branch = 'v4.x'},
{'neovim/nvim-lspconfig'},
{'hrsh7th/cmp-nvim-lsp'},
{'hrsh7th/nvim-cmp'},
-- Better diagnostics
{
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
},
-- Linting
"jose-elias-alvarez/null-ls.nvim",
-- Git wrapper
"tpope/vim-fugitive",
-- Latex editing in vim
"lervag/vimtex",
-- Auto comment
"numToStr/Comment.nvim",
})

View file

@ -1,138 +0,0 @@
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
return require("packer").startup(function(use)
use "wbthomason/packer.nvim"
-- QML syntax highlighting
use "peterhoeg/vim-qml"
-- Terminal file manager support
use "DreamMaoMao/yazi.nvim"
-- Coq support
use "whonore/Coqtail"
-- Dashboard buffer
use "goolord/alpha-nvim"
-- Show valid keys mid key chord
use {
"folke/which-key.nvim",
config = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end
}
-- File manager in nvim
use {
"ptzz/lf.vim",
requires = { {"voldikss/vim-floaterm"} },
}
vim.cmd("let g:lf_map_keys = 0") -- Need to put here or else doesn't work
-- Zen mode
use "folke/zen-mode.nvim"
-- Find files and strings
use {
"nvim-telescope/telescope.nvim", tag = "0.1.4",
requires = { {"nvim-lua/plenary.nvim"} }
}
-- Treesitter
use({"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"})
-- Themes
use "aktersnurra/no-clown-fiesta.nvim"
use "ellisonleao/gruvbox.nvim"
use { 'rose-pine/neovim', as = 'rose-pine' }
use 'Mofiqul/vscode.nvim'
-- Referencing a hex code highlights it in that color
use "norcalli/nvim-colorizer.lua"
-- Relative line numbers disappear when not actively in buffer
use "jeffkreeftmeijer/vim-numbertoggle"
-- History visualizer
use "mbbill/undotree"
-- See function signatures when typing them
use "ray-x/lsp_signature.nvim"
require "lsp_signature".setup({})
-- Left-side file tree dispaly
use {
"nvim-tree/nvim-tree.lua",
requires = {
"nvim-tree/nvim-web-devicons", -- for file icons
},
tag = "nightly" -- optional, updated every week
}
-- Shows current mode on bottom of screen
use "itchyny/lightline.vim"
-- LSP
use {
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'}, -- Required
-- Autocompletion
{'hrsh7th/nvim-cmp'}, -- Required
{'hrsh7th/cmp-nvim-lsp'}, -- Required
{'hrsh7th/cmp-buffer'}, -- Optional
{'hrsh7th/cmp-path'}, -- Optional
{'saadparwaiz1/cmp_luasnip'}, -- Optional
{'hrsh7th/cmp-nvim-lua'}, -- Optional
-- Snippets
{'L3MON4D3/LuaSnip'}, -- Required
{'rafamadriz/friendly-snippets'}, -- Optional
}
}
-- Better diagnostics
use {
"folke/trouble.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
}
-- Linting
use "jose-elias-alvarez/null-ls.nvim"
-- Git wrapper
use("tpope/vim-fugitive")
-- Latex editing in vim
use "lervag/vimtex"
-- Auto comment
use "numToStr/Comment.nvim"
-- Jupyter notebook integration
-- use {
-- "glacambre/firenvim",
-- run = function() vim.fn["firenvim#install"](0) end
-- }
if packer_bootstrap then
require('packer').sync()
end
end)

View file

@ -46,6 +46,35 @@ vim.keymap.set("n", "<leader>tc",
end,
{desc = "Toggle color column"})
vim.keymap.set("n", "<leader>t", "<noop>", {desc = "Toggle"})
vim.keymap.set("n", "<leader>tl",
function ()
if vim.wo.number == false and vim.wo.relativenumber == false then
vim.wo.number = true
print("absolute numbers")
elseif vim.wo.number == true and vim.wo.relativenumber == false then
vim.wo.relativenumber = true
print("relative line numbers")
else
vim.wo.number = false
vim.wo.relativenumber = false
print("no line numbers")
end
end,
{desc = "Toggle line numbers"})
vim.keymap.set("n", "<leader>tw",
function ()
if vim.wo.wrap then
vim.wo.wrap = false
print("nowrap")
else
vim.wo.wrap = true
print("wrap")
end
end,
{desc = "Toggle line wrapping"})
-- case insensitive search
vim.keymap.set("n", "<leader>/", "/\\c")
vim.keymap.set("n", "<leader>?", "?\\c")