feat(nvim): half-baked migration from lazy.nvim to lz.n + vim.pack

This commit is contained in:
Barrett Ruth 2026-02-28 12:43:26 -05:00
parent 60969865b5
commit 50642823bd
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
30 changed files with 865 additions and 1315 deletions

View file

@ -13,59 +13,4 @@ function _G.bmap(mapping, opts)
_G.map(mapping, vim.tbl_extend('force', opts or {}, { buffer = 0 }))
end
local disabled_plugins = {
'2html_plugin',
'bugreport',
'getscript',
'getscriptPlugin',
'gzip',
'logipat',
'netrw',
'netrwFileHandlers',
'netrwPlugin',
'netrwSettings',
'optwin',
'rplugin',
'rrhelper',
'synmenu',
'tar',
'tarPlugin',
'tohtml',
'tutor',
'vimball',
'vimballPlugin',
'zip',
'zipPlugin',
}
for _, plugin in ipairs(disabled_plugins) do
vim.g['loaded_' .. plugin] = 1
end
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)
require('lazy').setup('plugins', {
change_detection = { enabled = false },
performance = { rtp = { reset = false } },
})
require('config.pack')

View file

@ -1,34 +0,0 @@
{
"blink-cmp-env": { "branch": "main", "commit": "99af62c1f9aa46005e8f50ad4ccee581946546ca" },
"blink-cmp-ghostty": { "branch": "main", "commit": "0b137d64f6c2172aedca8388ecbe2e2c215844d0" },
"blink-cmp-git": { "branch": "master", "commit": "10783593af764424018a95e75df6ad5a8b66fe07" },
"blink-cmp-ssh": { "branch": "main", "commit": "4d6c8e0c0983acb74bf7a2988307ab867ce231a9" },
"blink-cmp-tmux": { "branch": "main", "commit": "c0c59d1e5771a8de25b547dc18eb274cbce2438c" },
"blink.cmp": { "branch": "main", "commit": "b650e976a927be6b46487a0a610b75af111376c5" },
"cp.nvim": { "branch": "main", "commit": "e989897c7767b8d9c9a1be4ca5c0618b13a18ea4" },
"dial.nvim": { "branch": "master", "commit": "f2634758455cfa52a8acea6f142dcd6271a1bf57" },
"gitsigns.nvim": { "branch": "main", "commit": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519" },
"guard-collection": { "branch": "main", "commit": "edf6c86c06badc972964dadb7fd469022690cbf0" },
"guard.nvim": { "branch": "main", "commit": "addb8d2f40662b8b62d60dd7d18f503beb2332e7" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
"live-rename.nvim": { "branch": "main", "commit": "3a3cddf23b89a17992f9ca67afc5858077769462" },
"live-server.nvim": { "branch": "main", "commit": "baeb211719085eee61cdae22f106e53dcbdc4b6f" },
"midnight.nvim": { "branch": "main", "commit": "7891879b4e7ba183f377369beb094450d115bb4b" },
"mini.ai": { "branch": "main", "commit": "4b0a6207341d895b6cfe9bcb1e4d3e8607bfe4f4" },
"mini.bufremove": { "branch": "main", "commit": "ee69f823f84508c556127a5882760d9783692023" },
"mini.misc": { "branch": "main", "commit": "de8947231c29012271722651aa07f6749c41d1ed" },
"mini.pairs": { "branch": "main", "commit": "b7fde3719340946feb75017ef9d75edebdeb0566" },
"neogit": { "branch": "master", "commit": "2b6a9e4dacb435a95eff474c80d0e94ae0e4f909" },
"nvim-colorizer.lua": { "branch": "master", "commit": "fe9eed4d48f530fc9ffe4d785a936a49fa344e1a" },
"nvim-surround": { "branch": "main", "commit": "2800277e75eda268df2bfab6ebc53e2635455318" },
"nvim-treesitter": { "branch": "main", "commit": "dc42c209f3820bdfaae0956f15de29689aa6b451" },
"nvim-treesitter-textobjects": { "branch": "main", "commit": "a0e182ae21fda68c59d1f36c9ed45600aef50311" },
"nvim-vtsls": { "branch": "main", "commit": "0b5f73c9e50ce95842ea07bb3f05c7d66d87d14a" },
"overseer.nvim": { "branch": "master", "commit": "392093e610333c0aea89bf43de7362e25783eada" },
"treesj": { "branch": "main", "commit": "186084dee5e9c8eec40f6e39481c723dd567cb05" },
"vim-abolish": { "branch": "master", "commit": "dcbfe065297d31823561ba787f51056c147aa682" },
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
"vimtex": { "branch": "master", "commit": "95b93a24740f7b89dd8331326b41bdd1337d79f6" }
}

View file

@ -104,7 +104,7 @@ M.conventional_commits = make_source({
})
for name, src in pairs(M) do
package.loaded['config.blink.' .. name] = src
package.loaded['config.cmp.' .. name] = src
end
return M

View file

@ -1,155 +0,0 @@
--- @class Fold
local M = {}
---@param bufnr number the buffer number
---@return boolean whether the below foldexpr() is applicable to the buffer
local function should_apply_foldexpr(bufnr)
local ok, parser = pcall(vim.treesitter.get_parser, bufnr)
return ok and parser
end
--- @return string Fold level (as string for foldexpr)
function M.foldexpr()
local line = vim.v.lnum
local bufnr = vim.api.nvim_get_current_buf()
local foldnestmax = vim.wo.foldnestmax
local ok, parser = pcall(vim.treesitter.get_parser, bufnr)
if not ok or not parser then
return '0'
end
local trees = parser:parse()
if not trees or #trees == 0 then
return '0'
end
local root = trees[1]:root()
local line_text = vim.fn.getline(line)
local positions = {}
local first_col = line_text:match('^%s*()')
if first_col and first_col <= #line_text then
table.insert(positions, first_col - 1)
end
local last_col = line_text:find('%S%s*$')
if last_col then
table.insert(positions, last_col - 1)
end
if #positions == 0 then
table.insert(positions, 0)
end
local function is_foldable(node_type)
return
-- functions/methods
node_type == 'function_definition'
or node_type == 'function_declaration'
or node_type == 'method_definition'
or node_type == 'method_declaration'
or node_type == 'function_item'
-- structs/unions
or node_type == 'class_definition'
or node_type == 'class_declaration'
or node_type == 'class_specifier'
or node_type == 'struct_item'
or node_type == 'struct_specifier'
or node_type == 'struct_type'
-- interfaces
or node_type == 'union_specifier'
or node_type == 'interface_declaration'
or node_type == 'interface_definition'
or node_type == 'interface_type'
-- type decls/defs
or node_type == 'type_declaration'
or node_type == 'type_definition'
-- traits
or node_type == 'trait_item'
-- enums
or node_type == 'enum_declaration'
or node_type == 'enum_specifier'
-- namespace/modules
or node_type == 'enum_item'
or node_type == 'impl_item'
or node_type == 'namespace_definition'
or node_type == 'namespace_declaration'
or node_type == 'internal_module'
or node_type == 'mod_item'
end
local function should_fold(n)
if not n then
return false
end
local srow, _, erow, _ = n:range()
return (erow - srow + 1) >= vim.wo.foldminlines
end
local function nested_fold_level(node)
if not node then
return 0
end
local level = 0
local temp = node
while temp do
if is_foldable(temp:type()) and should_fold(temp) then
level = level + 1
end
temp = temp:parent()
end
return level
end
local function starts_on_line(n)
local srow, _, _, _ = n:range()
return srow + 1 == line
end
local max_level = 0
local is_start = false
for _, col in ipairs(positions) do
local node =
root:named_descendant_for_range(line - 1, col, line - 1, col)
if node then
local raw_level = nested_fold_level(node)
max_level = math.max(max_level, math.min(raw_level, foldnestmax))
local temp = node
while temp do
local this_level = nested_fold_level(temp)
if
is_foldable(temp:type())
and should_fold(temp)
and starts_on_line(temp)
and this_level <= foldnestmax
then
is_start = true
end
temp = temp:parent()
end
end
end
if max_level == 0 then
return '0'
end
if is_start then
return '>' .. max_level
end
return tostring(max_level)
end
function M.setup()
vim.opt.fillchars:append({
fold = ' ',
foldopen = 'v',
foldclose = '>',
foldsep = ' ',
})
vim.o.foldlevel = 1
vim.o.foldtext = ''
vim.o.foldnestmax = 2
vim.o.foldminlines = 5
vim.api.nvim_create_autocmd('FileType', {
pattern = '*',
callback = function(opts)
-- do not override fold settings if not applicable
if should_apply_foldexpr(opts.bufnr) then
vim.wo.foldmethod = 'expr'
vim.wo.foldexpr = 'v:lua.require("config.fold").foldexpr()'
end
end,
group = vim.api.nvim_create_augroup('AFold', { clear = true }),
})
end
return M

View file

@ -1,8 +0,0 @@
return {
setup = function()
vim.o.statusline =
'%!v:lua.require("config.lines.statusline").statusline()'
vim.o.statuscolumn =
'%!v:lua.require("config.lines.statuscolumn").statuscolumn()'
end,
}

View file

@ -1,72 +0,0 @@
return {
-- overlay relative numbers and line numbers directly on top of eachother
num = function()
if math.abs(vim.v.virtnum) > 0 then
return ''
end
local wo = vim.wo
if not wo.number and not wo.relativenumber then
return ''
end
local lnum = vim.v.lnum
local relnum = vim.v.relnum
local hl = relnum == 0 and 'CursorLineNr' or 'LineNr'
local marks = vim.api.nvim_buf_get_extmarks(
0,
-1,
{ lnum - 1, 0 },
{ lnum - 1, 0 },
{ details = true }
)
for _, mark in ipairs(marks) do
if mark[4] and mark[4].number_hl_group then
hl = mark[4].number_hl_group
break
end
end
return '%#' .. hl .. '#' .. (relnum == 0 and lnum or relnum)
end,
fold = function()
local expr = require('config.fold').foldexpr()
if expr:sub(1, 1) == '>' then
if vim.fn.foldclosed(vim.v.lnum) ~= -1 then
return '> '
else
return 'v '
end
end
if vim.fn.foldlevel(vim.v.lnum) == 0 then
return ''
end
return ' '
end,
sign = function()
local marks = vim.api.nvim_buf_get_extmarks(
0,
-1,
{ vim.v.lnum - 1, 0 },
{ vim.v.lnum - 1, -1 },
{ details = true, type = 'sign' }
)
for _, mark in ipairs(marks) do
local d = mark[4]
if d and d.sign_text then
local text = vim.trim(d.sign_text)
if text ~= '' then
return '%#'
.. (d.sign_hl_group or 'SignColumn')
.. '#'
.. text
end
end
end
return ' '
end,
statuscolumn = function()
return '%{%v:lua.require("config.lines.statuscolumn").sign()%}%{%v:lua.require("config.lines.statuscolumn").fold()%}%=%{%v:lua.require("config.lines.statuscolumn").num()%} '
end,
}

View file

@ -1,139 +0,0 @@
local empty = require('config.utils').empty
local M = {}
local mode = {
prefix = 'mode',
-- highlight = 'white',
value = function()
local mode_to_text = {
n = 'NORMAL',
i = 'INSERT',
v = 'VISUAL',
V = 'V-LINE',
['\22'] = 'V-BLOCK',
R = 'REPLACE',
c = 'COMMAND',
}
return mode_to_text[vim.fn.mode()]
end,
}
local file = {
prefix = 'fp',
-- highlight = 'blue',
value = function()
return vim.fn.expand('%:~')
-- return vim.fn.pathshorten(vim.fn.expand('%:~'))
-- return vim.fn.fnamemodify(
-- vim.fn.bufname(vim.api.nvim_get_current_buf()),
-- ':~:.'
-- )
end,
}
local git = {
prefix = 'git',
-- highlight = 'magenta',
value = function()
return vim.b.gitsigns_head
end,
}
local modified = {
value = function()
return vim.api.nvim_get_option_value('modified', { buf = 0 }) and '+w'
or ''
end,
}
local navic = {
prefix = 'loc',
value = function()
return require('nvim-navic').get_location()
end,
condition = function()
local ok, _ = pcall(require, 'nvim-navic')
return ok
end,
}
local search = {
prefix = '/',
value = function()
local count = vim.fn.searchcount({ maxcount = 999 })
return string.format(
'%s (%s/%d)',
vim.fn.getreg('/'),
count.current,
count.total
)
end,
condition = function()
local status, searchcount = pcall(vim.fn.searchcount)
if not status or not searchcount or vim.tbl_isempty(searchcount) then
return false
end
return searchcount.total > 0
end,
}
local filetype = {
prefix = function()
return empty(
vim.api.nvim_get_option_value(
'filetype',
{ buf = vim.api.nvim_get_current_buf() }
)
) and 'bt' or 'ft'
end,
-- highlight = 'green',
value = function()
local ft = vim.api.nvim_get_option_value(
'filetype',
{ buf = vim.api.nvim_get_current_buf() }
)
if empty(ft) then
ft = vim.bo.buftype
end
return ft
end,
}
local lineinfo = {
prefix = 'lnnr',
-- highlight = 'yellow',
value = '%c:%l/%L',
}
M.components = {
left = {
[1] = mode,
[2] = git,
[3] = file,
[4] = navic,
[5] = modified,
},
right = {
[1] = search,
[2] = lineinfo,
[3] = filetype,
},
}
local format_components = require('config.lines.utils').format_components
M.statusline = function()
return ('%s%%=%s'):format(
format_components(M.components.left),
format_components(M.components.right)
)
end
return M

View file

@ -1,38 +0,0 @@
local utils = require('config.utils')
local M = {}
local function vorfn(val_or_fn)
if type(val_or_fn) == 'function' then
return val_or_fn()
end
return val_or_fn
end
function M.format_components(components)
local side = {}
for i = 1, #components do
local component = components[i]
if
vorfn(component.condition) ~= false
and not utils.empty(vorfn(component.value))
then
side[#side + 1] = ('%%#%s#%s%%#%s#'):format(
component.highlight or 'Normal',
vorfn(component.value),
component.highlight or 'Normal'
)
end
end
if #side > 0 then
return (' %s '):format(table.concat(side, ''))
end
return ''
end
return M

View file

@ -7,13 +7,6 @@ function M.on_attach(client, bufnr)
bmap({ 'n', 'K', vim.lsp.buf.hover })
end
if client:supports_method(Methods.textDocument_documentSymbol) then
local ok, navic = pcall(require, 'nvim-navic')
if ok then
navic.attach(client, bufnr)
end
end
local ok, _ = pcall(require, 'fzf-lua')
local mappings = {

View file

@ -0,0 +1,47 @@
vim.g.loaded_2html_plugin = true
vim.g.loaded_bugreport = true
vim.g.loaded_getscript = true
vim.g.loaded_getscriptPlugin = true
vim.g.loaded_gzip = true
vim.g.loaded_logipat = true
vim.g.loaded_netrw = true
vim.g.loaded_netrwFileHandlers = true
vim.g.loaded_netrwPlugin = true
vim.g.loaded_netrwSettings = true
vim.g.loaded_optwin = true
vim.g.loaded_rplugin = true
vim.g.loaded_rrhelper = true
vim.g.loaded_synmenu = true
vim.g.loaded_tar = true
vim.g.loaded_tarPlugin = true
vim.g.loaded_tohtml = true
vim.g.loaded_tutor = true
vim.g.loaded_vimball = true
vim.g.loaded_vimballPlugin = true
vim.g.loaded_zip = true
vim.g.loaded_zipPlugin = true
local dev_plugins = {
['diffs.nvim'] = '~/dev/diffs.nvim',
['canola.nvim'] = '~/dev/canola.nvim',
['pending.nvim'] = '~/dev/pending.nvim',
}
for _, path in pairs(dev_plugins) do
vim.opt.rtp:prepend(path)
end
vim.g.lz_n = {
load = function(name)
name = name:match('[^/]+$') or name
if not dev_plugins[name] then
vim.cmd.packadd(name)
end
end,
}
vim.pack.add({
'https://github.com/lumen-oss/lz.n',
})
require('lz.n').load('plugins')

View file

@ -1,15 +0,0 @@
local project_configs = {
cavauto = {
lsp = {
clangd = {
cmd = { 'socat', '-', 'TCP:localhost:12345' },
},
},
},
}
local function project_name()
return vim.fn.fnamemodify(vim.fn.getcwd(), ':t')
end
return project_configs[project_name()] or {}

View file

@ -1,7 +0,0 @@
local M = {}
function M.empty(s)
return s == '' or s == nil
end
return M

View file

@ -1,6 +1,17 @@
local config = require('config.projects')
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client and client.name == 'clangd' then
bmap(
{ 'n', 'gh', vim.cmd.ClangdSwitchSourceHeader },
{ buffer = args.buf }
)
end
end,
group = vim.api.nvim_create_augroup('AClangdKeymap', { clear = true }),
})
local clangd_settings = {
return {
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' },
cmd = {
'clangd',
@ -19,21 +30,3 @@ local clangd_settings = {
},
},
}
local project_settings = (config.lsp and config.lsp.clangd)
and config.lsp.clangd
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client and client.name == 'clangd' then
bmap(
{ 'n', 'gh', vim.cmd.ClangdSwitchSourceHeader },
{ buffer = args.buf }
)
end
end,
group = vim.api.nvim_create_augroup('AClangdKeymap', { clear = true }),
})
return vim.tbl_extend('force', clangd_settings, project_settings or {})

View file

@ -1,128 +1,152 @@
vim.pack.add({
'https://github.com/saghen/blink.cmp',
'https://github.com/Kaiser-Yang/blink-cmp-git',
'https://github.com/bydlw98/blink-cmp-env',
'https://github.com/barrettruth/blink-cmp-ssh',
'https://github.com/barrettruth/blink-cmp-tmux',
'https://github.com/barrettruth/blink-cmp-ghostty',
})
local pack_dir = vim.fn.stdpath('data') .. '/site/pack/core/opt'
local blink_dir = pack_dir .. '/blink.cmp'
if
vim.fn.filereadable(blink_dir .. '/target/release/libblink_cmp_fuzzy.so')
== 0
then
vim.system({ 'nix', 'run', '.#build-plugin' }, { cwd = blink_dir }):wait()
end
vim.api.nvim_create_autocmd('PackChanged', {
callback = function(ev)
local name, kind = ev.data.spec.name, ev.data.kind
if kind == 'delete' then
return
end
if name == 'blink.cmp' then
vim.system(
{ 'nix', 'run', '.#build-plugin' },
{ cwd = ev.data.path }
)
end
end,
})
return {
'saghen/blink.cmp',
build = 'nix run .#build-plugin',
dependencies = {
'Kaiser-Yang/blink-cmp-git',
'folke/lazydev.nvim',
'bydlw98/blink-cmp-env',
'barrettruth/blink-cmp-ssh',
'barrettruth/blink-cmp-tmux',
'barrettruth/blink-cmp-ghostty'
},
---@module 'blink.cmp'
---@type blink.cmp.Config
event = { 'InsertEnter', 'LspAttach' },
config = function(_, opts)
vim.o.pumheight = 15
opts.completion.menu.max_height = vim.o.pumheight
require('config.blink')
require('blink.cmp').setup(opts)
end,
opts = {
fuzzy = { implementation = 'prefer_rust_with_warning' },
keymap = {
['<c-p>'] = { 'select_prev' },
['<c-n>'] = { 'show', 'select_next' },
['<c-space>'] = {},
['<c-y>'] = {
function(cmp)
return cmp.snippet_active() and cmp.accept()
or cmp.select_and_accept()
end,
'snippet_forward',
},
},
completion = {
accept = {
auto_brackets = { enabled = false },
},
documentation = {
auto_show = true,
window = {
border = 'single',
scrollbar = false,
keys = { { '<c-n>', mode = 'i' } },
after = function()
---@module 'blink.cmp'
---@type blink.cmp.Config
local opts = {
fuzzy = { implementation = 'prefer_rust_with_warning' },
keymap = {
['<c-p>'] = { 'select_prev' },
['<c-n>'] = { 'show', 'select_next' },
['<c-space>'] = {},
['<c-y>'] = {
function(cmp)
return cmp.snippet_active() and cmp.accept()
or cmp.select_and_accept()
end,
'snippet_forward',
},
},
menu = {
auto_show = false,
border = 'single',
scrollbar = false,
draw = {
treesitter = { 'lsp', 'snippets', 'buffer' },
columns = {
{ 'label', 'label_description', gap = 1 },
{ 'kind' },
completion = {
accept = {
auto_brackets = { enabled = false },
},
documentation = {
auto_show = true,
window = {
border = 'single',
scrollbar = false,
},
components = {
kind = {
ellipsis = false,
text = function(ctx)
return '[' .. ctx.kind .. ']'
end,
highlight = function(ctx)
return ctx.kind_hl
end,
},
menu = {
auto_show = false,
border = 'single',
scrollbar = false,
draw = {
treesitter = { 'lsp', 'snippets', 'buffer' },
columns = {
{ 'label', 'label_description', gap = 1 },
{ 'kind' },
},
components = {
kind = {
ellipsis = false,
text = function(ctx)
return '[' .. ctx.kind .. ']'
end,
highlight = function(ctx)
return ctx.kind_hl
end,
},
},
},
},
},
ghost_text = {
enabled = true,
show_with_selection = true,
show_without_selection = false,
show_without_menu = false,
},
},
sources = {
default = {
'git',
'conventional_commits',
'lsp',
'path',
'buffer',
'env',
'snippets',
'ssh',
'tmux',
'ghostty',
},
per_filetype = {
pending = { 'omni', 'buffer' },
},
providers = {
git = {
module = 'blink-cmp-git',
name = 'Git',
},
ssh = {
name = 'SSH',
module = 'blink-cmp-ssh',
},
tmux = {
name = 'Tmux',
module = 'blink-cmp-tmux',
},
ghostty = {
name = 'Ghostty',
module = 'blink-cmp-ghostty',
},
conventional_commits = {
name = 'Conventional Commits',
module = 'config.blink.conventional_commits',
},
lazydev = {
name = 'LazyDev',
module = 'lazydev.integrations.blink',
score_offset = 100,
},
env = {
name = 'Env',
module = 'blink-cmp-env',
ghost_text = {
enabled = true,
show_with_selection = true,
show_without_selection = false,
show_without_menu = false,
},
},
},
},
keys = { { '<c-n>', mode = 'i' } },
opts_extend = { 'sources.default' },
sources = {
default = {
'git',
'conventional_commits',
'lsp',
'path',
'buffer',
'env',
'snippets',
'ssh',
'tmux',
'ghostty',
},
per_filetype = {
pending = { 'omni', 'buffer' },
},
providers = {
git = {
module = 'blink-cmp-git',
name = 'Git',
},
ssh = {
name = 'SSH',
module = 'blink-cmp-ssh',
},
tmux = {
name = 'Tmux',
module = 'blink-cmp-tmux',
},
ghostty = {
name = 'Ghostty',
module = 'blink-cmp-ghostty',
},
conventional_commits = {
name = 'Conventional Commits',
module = 'config.cmp.conventional_commits',
},
lazydev = {
name = 'LazyDev',
module = 'lazydev.integrations.blink',
score_offset = 100,
},
env = {
name = 'Env',
module = 'blink-cmp-env',
},
},
},
}
vim.o.pumheight = 15
opts.completion.menu.max_height = vim.o.pumheight
require('config.cmp')
require('blink.cmp').setup(opts)
end,
}

View file

@ -126,6 +126,8 @@ local function insert_template(buf, lang, platform)
return true
end
vim.pack.add({ 'https://github.com/barrettruth/cp.nvim' })
return {
'barrettruth/cp.nvim',
cmd = 'CP',

View file

@ -1,12 +1,91 @@
vim.pack.add({
'https://github.com/ibhagwan/fzf-lua',
})
return {
'ibhagwan/fzf-lua',
config = function(_, opts)
after = function()
local fzf = require('fzf-lua')
local has_devicons = pcall(require, 'nvim-web-devicons')
opts.files = opts.files or {}
local opts = {
file_icon_padding = ' ',
files = {
cmd = vim.env.FZF_CTRL_T_COMMAND,
no_header_i = true,
},
fzf_args = (vim.env.FZF_DEFAULT_OPTS or ''):gsub(
'%-%-color=[^%s]+',
''
),
grep = {
no_header_i = true,
RIPGREP_CONFIG_PATH = vim.env.RIPGREP_CONFIG_PATH,
},
lsp = {
includeDeclaration = false,
jump1 = true,
symbols = {
symbol_hl_prefix = '@',
symbol_style = 3,
},
},
winopts = {
border = 'single',
preview = {
hidden = 'hidden',
},
},
actions = {
files = {
default = function(...)
require('fzf-lua.actions').file_edit(...)
end,
['ctrl-l'] = function(...)
local a = require('fzf-lua.actions')
a.file_sel_to_ll(...)
vim.cmd.lclose()
end,
['ctrl-q'] = function(...)
local a = require('fzf-lua.actions')
a.file_sel_to_qf(...)
vim.cmd.cclose()
end,
['ctrl-h'] = function(...)
require('fzf-lua.actions').toggle_hidden(...)
end,
['ctrl-v'] = function(...)
require('fzf-lua.actions').file_vsplit(...)
end,
['ctrl-x'] = function(...)
require('fzf-lua.actions').file_split(...)
end,
},
},
border = 'single',
git = {
files = {
cmd = 'git ls-files --cached --others --exclude-standard',
git_icons = false,
},
worktrees = {
fzf_args = (
(vim.env.FZF_DEFAULT_OPTS or '')
:gsub('%-%-bind=ctrl%-a:select%-all', '')
:gsub('--color=[^%s]+', '')
),
},
branches = {
fzf_args = (
(vim.env.FZF_DEFAULT_OPTS or '')
:gsub('%-%-bind=ctrl%-a:select%-all', '')
:gsub('--color=[^%s]+', '')
),
},
},
}
opts.files.file_icons = has_devicons
opts.grep = opts.grep or {}
opts.grep.file_icons = has_devicons
opts.grep.rg_opts =
fzf.defaults.grep.rg_opts:gsub('%-e$', "--glob='!.git/' -e")
@ -83,76 +162,4 @@ return {
{ 'gq', '<cmd>FzfLua quickfix<cr>' },
{ 'gl', '<cmd>FzfLua loclist<cr>' },
},
opts = {
file_icon_padding = ' ',
files = {
cmd = vim.env.FZF_CTRL_T_COMMAND,
no_header_i = true,
},
fzf_args = (vim.env.FZF_DEFAULT_OPTS or ''):gsub(
'%-%-color=[^%s]+',
''
),
grep = {
no_header_i = true,
RIPGREP_CONFIG_PATH = vim.env.RIPGREP_CONFIG_PATH,
},
lsp = {
includeDeclaration = false,
jump1 = true,
symbols = {
symbol_hl_prefix = '@',
symbol_style = 3,
},
},
winopts = {
border = 'single',
preview = {
hidden = 'hidden',
},
},
actions = {
files = {
default = function(...)
require('fzf-lua.actions').file_edit(...)
end,
['ctrl-l'] = function(...)
local a = require('fzf-lua.actions')
a.file_sel_to_ll(...)
vim.cmd.lclose()
end,
['ctrl-q'] = function(...)
local a = require('fzf-lua.actions')
a.file_sel_to_qf(...)
vim.cmd.cclose()
end,
['ctrl-h'] = function(...)
require('fzf-lua.actions').toggle_hidden(...)
end,
['ctrl-v'] = function(...)
require('fzf-lua.actions').file_vsplit(...)
end,
['ctrl-x'] = function(...)
require('fzf-lua.actions').file_split(...)
end,
},
},
border = 'single',
git = {
files = {
cmd = 'git ls-files --cached --others --exclude-standard',
git_icons = false,
},
worktrees = {
fzf_args = ((vim.env.FZF_DEFAULT_OPTS or '')
:gsub('%-%-bind=ctrl%-a:select%-all', '')
:gsub('--color=[^%s]+', '')),
},
branches = {
fzf_args = ((vim.env.FZF_DEFAULT_OPTS or '')
:gsub('%-%-bind=ctrl%-a:select%-all', '')
:gsub('--color=[^%s]+', '')),
},
},
},
}

View file

@ -1,3 +1,8 @@
vim.pack.add({
'https://github.com/tpope/vim-fugitive',
{ src = 'https://github.com/lewis6991/gitsigns.nvim', load = false },
})
---@return string
local function file_loc()
local root = vim.trim(vim.fn.system('git rev-parse --show-toplevel'))
@ -125,6 +130,7 @@ local function forge_picker(kind, state)
local forge = forges[forge_name]
local cli_kind = forge.kinds[kind]
local next_state = ({ all = 'open', open = 'closed', closed = 'all' })[state]
pcall(vim.cmd.packadd, 'fzf-lua')
require('fzf-lua').fzf_exec(forge.list_cmd(cli_kind, state), {
prompt = ('%s (%s)> '):format(forge.labels[kind], state),
header = ':: <c-o> to toggle all/open/closed',
@ -153,23 +159,79 @@ local function with_forge(fn)
end
end
map({
{ 'n', 'v' },
'<leader>go',
with_forge(function(forge)
local branch = vim.trim(vim.fn.system('git branch --show-current'))
forge.browse(file_loc(), branch)
end),
})
map({
{ 'n', 'v' },
'<leader>gy',
with_forge(function(forge)
forge.yank_commit(file_loc())
end),
})
map({
{ 'n', 'v' },
'<leader>gl',
with_forge(function(forge)
forge.yank_branch(file_loc())
end),
})
map({
'n',
'<leader>gx',
with_forge(function(forge)
forge.browse_root()
end),
})
map({
'n',
'<leader>gd',
function()
pcall(vim.cmd.packadd, 'fzf-lua')
require('fzf-lua').fzf_exec(
'git branch -a --format="%(refname:short)"',
{
prompt = 'Git diff> ',
actions = {
['default'] = function(selected)
vim.cmd('Git diff ' .. selected[1])
end,
},
}
)
end,
})
map({
'n',
'<leader>gi',
function()
forge_picker('issue', 'all')
end,
})
map({
'n',
'<leader>gp',
function()
forge_picker('pr', 'all')
end,
})
return {
{
'tpope/vim-fugitive',
cmd = { 'Git', 'G', 'Gread', 'Gwrite', 'Gdiffsplit', 'Gvdiffsplit' },
after = function()
vim.o.statusline = '%{FugitiveStatusline()} ' .. vim.o.statusline
end,
},
{
'barrettruth/diffs.nvim',
dir = '~/dev/diffs.nvim',
enabled = true,
dependencies = {
{
'NeogitOrg/neogit',
dependencies = { 'nvim-lua/plenary.nvim' },
enabled = false,
},
},
init = function()
before = function()
vim.g.diffs = {
fugitive = true,
neogit = false,
@ -187,96 +249,25 @@ return {
}
end,
},
{
'ibhagwan/fzf-lua',
keys = {
{
'<leader>go',
with_forge(function(forge)
local branch =
vim.trim(vim.fn.system('git branch --show-current'))
forge.browse(file_loc(), branch)
end),
mode = { 'n', 'v' },
},
{
'<leader>gy',
with_forge(function(forge)
forge.yank_commit(file_loc())
end),
mode = { 'n', 'v' },
},
{
'<leader>gl',
with_forge(function(forge)
forge.yank_branch(file_loc())
end),
mode = { 'n', 'v' },
},
{
'<leader>gx',
with_forge(function(forge)
forge.browse_root()
end),
},
{
'<leader>gd',
function()
require('fzf-lua').fzf_exec(
'git branch -a --format="%(refname:short)"',
{
prompt = 'Git diff> ',
actions = {
['default'] = function(selected)
vim.cmd('Git diff ' .. selected[1])
end,
},
}
)
end,
},
{
'<leader>gi',
function()
forge_picker('issue', 'all')
end,
},
{
'<leader>gp',
function()
forge_picker('pr', 'all')
end,
},
},
},
{
'lewis6991/gitsigns.nvim',
event = 'VeryLazy',
opts = {
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '' },
},
},
enabled = false,
event = 'DeferredUIEnter',
after = function()
require('gitsigns').setup({
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '' },
},
})
end,
keys = {
{
']g',
'<cmd>Gitsigns next_hunk<cr>',
desc = 'Next git hunk',
},
{
'[g',
'<cmd>Gitsigns prev_hunk<cr>',
desc = 'Previous git hunk',
},
{
'<leader>gB',
'<cmd>Gitsigns toggle_current_line_blame<cr>',
desc = 'Toggle line blame',
},
{ ']g', '<cmd>Gitsigns next_hunk<cr>' },
{ '[g', '<cmd>Gitsigns prev_hunk<cr>' },
{ '<leader>gB', '<cmd>Gitsigns toggle_current_line_blame<cr>' },
},
},
}

View file

@ -1,9 +1,11 @@
vim.pack.add({
'https://github.com/nvimdev/guard.nvim',
'https://github.com/nvimdev/guard-collection',
})
return {
'nvimdev/guard.nvim',
dependencies = {
'nvimdev/guard-collection',
},
init = function()
before = function()
vim.g.guard_config = {
fmt_on_save = false,
save_on_fmt = true,
@ -13,7 +15,7 @@ return {
keys = {
{ 'gF', '<cmd>Guard fmt<cr>', mode = { 'n', 'x' } },
},
config = function()
after = function()
local ft = require('guard.filetype')
ft('python')

View file

@ -1,24 +1,31 @@
vim.pack.add({
'https://github.com/neovim/nvim-lspconfig',
'https://github.com/folke/lazydev.nvim',
'https://github.com/saecki/live-rename.nvim',
})
return {
{
'neovim/nvim-lspconfig',
dir = '~/dev/nvim-lspconfig',
},
{
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
{ path = '${3rd}/luv/library' },
},
},
after = function()
require('lazydev').setup({
library = {
{ path = '${3rd}/luv/library' },
},
})
end,
},
{
'saecki/live-rename.nvim',
event = 'LspAttach',
config = function(_, opts)
after = function()
local live_rename = require('live-rename')
live_rename.setup(opts)
live_rename.setup()
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(o)
@ -43,70 +50,63 @@ return {
{
'yioneko/nvim-vtsls',
enabled = false,
config = function(_, opts)
require('vtsls').config(opts)
end,
dependencies = {
{
'davidosomething/format-ts-errors.nvim',
ft = {
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
},
},
},
ft = {
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
},
opts = {
on_attach = function(_, bufnr)
bmap(
{ 'n', 'gD', vim.cmd.VtsExec('goto_source_definition') },
{ buffer = bufnr }
)
end,
settings = {
typescript = {
inlayHints = {
parameterNames = { enabled = 'literals' },
parameterTypes = { enabled = true },
variableTypes = { enabled = true },
propertyDeclarationTypes = { enabled = true },
functionLikeReturnTypes = { enabled = true },
enumMemberValues = { enabled = true },
after = function()
require('vtsls').config({
on_attach = function(_, bufnr)
bmap(
{ 'n', 'gD', vim.cmd.VtsExec('goto_source_definition') },
{ buffer = bufnr }
)
end,
settings = {
typescript = {
inlayHints = {
parameterNames = { enabled = 'literals' },
parameterTypes = { enabled = true },
variableTypes = { enabled = true },
propertyDeclarationTypes = { enabled = true },
functionLikeReturnTypes = { enabled = true },
enumMemberValues = { enabled = true },
},
},
},
},
handlers = {
['textDocument/publishDiagnostics'] = function(_, result, ctx)
if not result.diagnostics then
return
end
local idx = 1
while idx <= #result.diagnostics do
local entry = result.diagnostics[idx]
local formatter =
require('format-ts-errors')[entry.code]
entry.message = formatter and formatter(entry.message)
or entry.message
if vim.tbl_contains({ 80001, 80006 }, entry.code) then
table.remove(result.diagnostics, idx)
else
idx = idx + 1
handlers = {
['textDocument/publishDiagnostics'] = function(
_,
result,
ctx
)
if not result.diagnostics then
return
end
end
vim.lsp.diagnostic.on_publish_diagnostics(_, result, ctx)
end,
},
},
local idx = 1
while idx <= #result.diagnostics do
local entry = result.diagnostics[idx]
local formatter =
require('format-ts-errors')[entry.code]
entry.message = formatter
and formatter(entry.message)
or entry.message
if
vim.tbl_contains({ 80001, 80006 }, entry.code)
then
table.remove(result.diagnostics, idx)
else
idx = idx + 1
end
end
vim.lsp.diagnostic.on_publish_diagnostics(
_,
result,
ctx
)
end,
},
})
end,
},
}

View file

@ -1,5 +1,3 @@
local oil_detail = false
local function parse_output(proc)
local result = proc:wait()
local ret = {}
@ -40,139 +38,156 @@ end
local git_status = new_git_status()
vim.pack.add({
-- 'https://github.com/barrettruth/midnight.nvim',
'https://github.com/echasnovski/mini.ai',
'https://github.com/monaqa/dial.nvim',
'https://github.com/catgoose/nvim-colorizer.lua',
'https://github.com/echasnovski/mini.pairs',
'https://github.com/echasnovski/mini.misc',
'https://github.com/nvim-mini/mini.bufremove',
'https://github.com/tpope/vim-abolish',
'https://github.com/tpope/vim-sleuth',
'https://github.com/kylechui/nvim-surround',
'https://github.com/lervag/vimtex',
})
return {
{
'barrettruth/live-server.nvim',
enabled = false,
init = function()
before = function()
vim.g.live_server = {
debug = false
debug = false,
}
end,
keys = { { '<leader>l', '<cmd>LiveServerToggle<cr>' } },
},
{
'barrettruth/midnight.nvim',
config = function()
after = function()
vim.cmd.colorscheme('midnight')
end,
},
{
'barrettruth/nonicons.nvim',
dir = '~/dev/nonicons.nvim',
enabled = false,
lazy = false,
dependencies = {
'nvim-tree/nvim-web-devicons',
},
},
{
'echasnovski/mini.pairs',
config = true,
after = function()
require('mini.pairs').setup()
end,
event = 'InsertEnter',
},
{
'echasnovski/mini.ai',
opts = {
custom_textobjects = {
b = false,
f = false,
e = function(ai_type)
local n_lines = vim.fn.line('$')
local start_line, end_line = 1, n_lines
if ai_type == 'i' then
while
start_line <= n_lines
and vim.fn.getline(start_line):match('^%s*$')
do
start_line = start_line + 1
after = function()
require('mini.ai').setup({
custom_textobjects = {
b = false,
f = false,
e = function(ai_type)
local n_lines = vim.fn.line('$')
local start_line, end_line = 1, n_lines
if ai_type == 'i' then
while
start_line <= n_lines
and vim.fn.getline(start_line):match('^%s*$')
do
start_line = start_line + 1
end
while
end_line >= start_line
and vim.fn.getline(end_line):match('^%s*$')
do
end_line = end_line - 1
end
end
while
end_line >= start_line
and vim.fn.getline(end_line):match('^%s*$')
do
end_line = end_line - 1
end
end
local to_col = math.max(vim.fn.getline(end_line):len(), 1)
return {
from = { line = start_line, col = 1 },
to = { line = end_line, col = to_col },
}
end,
l = function(ai_type)
local line_num = vim.fn.line('.')
local line = vim.fn.getline(line_num)
if line == '' then
local to_col =
math.max(vim.fn.getline(end_line):len(), 1)
return {
from = { line = line_num, col = 1 },
to = { line = line_num, col = 1 },
from = { line = start_line, col = 1 },
to = { line = end_line, col = to_col },
}
end
local start_col, end_col
if ai_type == 'i' then
start_col = line:find('%S') or 1
end_col = line:match('.*%S()') or 1
else
start_col, end_col = 1, line:len()
end
return {
from = { line = line_num, col = start_col },
to = { line = line_num, col = end_col },
}
end,
I = function(ai_type)
local cur_line = vim.fn.line('.')
local cur_indent = vim.fn.indent(cur_line)
if vim.fn.getline(cur_line):match('^%s*$') then
local search_line = cur_line + 1
while
search_line <= vim.fn.line('$')
and vim.fn.getline(search_line):match('^%s*$')
do
search_line = search_line + 1
end,
l = function(ai_type)
local line_num = vim.fn.line('.')
local line = vim.fn.getline(line_num)
if line == '' then
return {
from = { line = line_num, col = 1 },
to = { line = line_num, col = 1 },
}
end
if search_line <= vim.fn.line('$') then
cur_indent = vim.fn.indent(search_line)
local start_col, end_col
if ai_type == 'i' then
start_col = line:find('%S') or 1
end_col = line:match('.*%S()') or 1
else
start_col, end_col = 1, line:len()
end
end
local start_line, end_line = cur_line, cur_line
while start_line > 1 do
local prev = start_line - 1
local prev_blank = vim.fn.getline(prev):match('^%s*$')
if ai_type == 'i' and prev_blank then
break
return {
from = { line = line_num, col = start_col },
to = { line = line_num, col = end_col },
}
end,
I = function(ai_type)
local cur_line = vim.fn.line('.')
local cur_indent = vim.fn.indent(cur_line)
if vim.fn.getline(cur_line):match('^%s*$') then
local search_line = cur_line + 1
while
search_line <= vim.fn.line('$')
and vim.fn.getline(search_line):match('^%s*$')
do
search_line = search_line + 1
end
if search_line <= vim.fn.line('$') then
cur_indent = vim.fn.indent(search_line)
end
end
if
not prev_blank
and vim.fn.indent(prev) < cur_indent
then
break
local start_line, end_line = cur_line, cur_line
while start_line > 1 do
local prev = start_line - 1
local prev_blank =
vim.fn.getline(prev):match('^%s*$')
if ai_type == 'i' and prev_blank then
break
end
if
not prev_blank
and vim.fn.indent(prev) < cur_indent
then
break
end
start_line = prev
end
start_line = prev
end
while end_line < vim.fn.line('$') do
local next = end_line + 1
local next_blank = vim.fn.getline(next):match('^%s*$')
if ai_type == 'i' and next_blank then
break
while end_line < vim.fn.line('$') do
local next = end_line + 1
local next_blank =
vim.fn.getline(next):match('^%s*$')
if ai_type == 'i' and next_blank then
break
end
if
not next_blank
and vim.fn.indent(next) < cur_indent
then
break
end
end_line = next
end
if
not next_blank
and vim.fn.indent(next) < cur_indent
then
break
end
end_line = next
end
local to_col = math.max(vim.fn.getline(end_line):len(), 1)
return {
from = { line = start_line, col = 1 },
to = { line = end_line, col = to_col },
}
end,
},
},
local to_col =
math.max(vim.fn.getline(end_line):len(), 1)
return {
from = { line = start_line, col = 1 },
to = { line = end_line, col = to_col },
}
end,
},
})
end,
keys = {
{ 'a', mode = { 'x', 'o' } },
{ 'i', mode = { 'x', 'o' } },
@ -181,14 +196,14 @@ return {
{
'lervag/vimtex',
ft = { 'latex' },
init = function()
before = function()
vim.g.vimtex_view_method = 'sioyek'
vim.g.vimtex_quickfix_mode = 0
end,
},
{
'monaqa/dial.nvim',
config = function(_)
after = function()
local augend = require('dial.augend')
require('dial.config').augends:register_group({
default = {
@ -232,7 +247,6 @@ return {
end,
mode = 'n',
},
{
'<c-a>',
function()
@ -265,23 +279,63 @@ return {
},
{
'catgoose/nvim-colorizer.lua',
opts = {
user_default_options = {
names = false,
rrggbbaa = true,
css = true,
css_fn = true,
rgb_fn = true,
hsl_fn = true,
},
},
after = function()
require('colorizer').setup({
user_default_options = {
names = false,
rrggbbaa = true,
css = true,
css_fn = true,
rgb_fn = true,
hsl_fn = true,
},
})
end,
event = 'BufReadPre',
},
{
'barrettruth/canola.nvim',
dir = '~/dev/canola.nvim',
config = function(_, opts)
require('oil').setup(opts)
enabled = true,
after = function()
require('oil').setup({
skip_confirm_for_simple_edits = true,
prompt_save_on_select_new_entry = false,
float = { border = 'single' },
view_options = {
is_hidden_file = function(name, bufnr)
local dir = require('oil').get_current_dir(bufnr)
local is_dotfile = vim.startswith(name, '.')
and name ~= '..'
if not dir then
return is_dotfile
end
if is_dotfile then
return not git_status[dir].tracked[name]
else
return git_status[dir].ignored[name]
end
end,
},
keymaps = {
['<C-h>'] = false,
['<C-t>'] = false,
['<C-l>'] = false,
['<C-r>'] = 'actions.refresh',
['<C-s>'] = { 'actions.select', opts = { vertical = true } },
['<C-x>'] = {
'actions.select',
opts = { horizontal = true },
},
q = function()
local ok, bufremove = pcall(require, 'mini.bufremove')
if ok then
bufremove.delete()
else
vim.cmd.bd()
end
end,
},
})
local refresh = require('oil.actions').refresh
local orig_refresh = refresh.callback
refresh.callback = function(...)
@ -301,97 +355,17 @@ return {
group = vim.api.nvim_create_augroup('AOil', { clear = true }),
})
end,
event = 'VeryLazy',
event = 'DeferredUIEnter',
keys = {
{ '-', '<cmd>e .<cr>' },
{ '_', vim.cmd.Oil },
},
opts = {
skip_confirm_for_simple_edits = true,
prompt_save_on_select_new_entry = false,
float = { border = 'single' },
view_options = {
is_hidden_file = function(name, bufnr)
local dir = require('oil').get_current_dir(bufnr)
local is_dotfile = vim.startswith(name, '.')
and name ~= '..'
if not dir then
return is_dotfile
end
if is_dotfile then
return not git_status[dir].tracked[name]
else
return git_status[dir].ignored[name]
end
end,
},
keymaps = {
['<C-h>'] = false,
['<C-t>'] = false,
['<C-l>'] = false,
['<C-r>'] = 'actions.refresh',
['<C-s>'] = { 'actions.select', opts = { vertical = true } },
['<C-x>'] = { 'actions.select', opts = { horizontal = true } },
q = function()
local ok, bufremove = pcall(require, 'mini.bufremove')
if ok then
bufremove.delete()
else
vim.cmd.bd()
end
end,
},
},
dependencies = {
{
'malewicz1337/oil-git.nvim',
dir = '~/dev/oil-git.nvim',
opts = {
symbol_position = 'signcolumn',
can_use_signcolumn = function()
return true
end,
show_file_highlights = false,
show_directory_highlights = false,
symbols = {
file = {
added = '',
modified = '',
renamed = '',
deleted = '_',
copied = '',
conflict = '',
untracked = '',
ignored = ' ',
},
directory = {
added = '',
modified = '',
renamed = '',
deleted = '_',
copied = '',
conflict = '',
untracked = '',
ignored = ' ',
},
},
highlights = {
OilGitAdded = { link = 'GitSignsAdd' },
OilGitModified = { link = 'GitSignsChange' },
OilGitRenamed = { link = 'GitSignsChange' },
OilGitDeleted = { link = 'GitSignsDelete' },
OilGitCopied = { link = 'GitSignsChange' },
OilGitConflict = { link = 'GitSignsDelete' },
OilGitUntracked = { link = 'GitSignsAdd' },
OilGitIgnored = { link = 'Comment' },
},
},
},
{ '_', '<cmd>Oil<cr>' },
},
},
{
'echasnovski/mini.misc',
config = true,
after = function()
require('mini.misc').setup()
end,
keys = {
{
'<c-w>m',
@ -401,7 +375,9 @@ return {
},
{
'nvim-mini/mini.bufremove',
config = true,
after = function()
require('mini.bufremove').setup()
end,
keys = {
{
'<leader>bd',
@ -413,11 +389,13 @@ return {
},
},
},
{ 'tpope/vim-abolish', event = 'VeryLazy' },
{ 'tpope/vim-abolish', event = 'DeferredUIEnter' },
{ 'tpope/vim-sleuth', event = 'BufReadPost' },
{
'kylechui/nvim-surround',
config = true,
after = function()
require('nvim-surround').setup()
end,
keys = {
{ 'cs', mode = 'n' },
{ 'ds', mode = 'n' },
@ -430,22 +408,22 @@ return {
{
-- TODO: replace this with own barrettruth/render.nvim
'wallpants/github-preview.nvim',
dir = '~/dev/github-preview.nvim',
after = function()
require('github-preview').setup({
single_file = true,
cursor_line = {
disable = true,
},
})
end,
keys = { { '<leader>m', '<cmd>silent GithubPreviewToggle<cr>' } },
opts = {
single_file = true,
cursor_line = {
disable = true,
},
},
},
{
'barrettruth/pending.nvim',
init = function()
before = function()
vim.g.pending = { debug = true }
end,
dir = '~/dev/pending.nvim',
-- TODO: should we be using this or `<Plug>` mappings?
keys = { { '<leader>p', '<cmd>Pending<cr>' }}
}
keys = { { '<leader>p', '<cmd>Pending<cr>' } },
},
}

View file

@ -1,30 +0,0 @@
return {
'stevearc/overseer.nvim',
init = function()
vim.api.nvim_create_autocmd('VimLeavePre', {
callback = function()
local overseer = require('overseer')
for _, task in ipairs(overseer.list_tasks()) do
if task:is_running() then
task:stop()
end
task:dispose(true)
end
current_task = nil
end,
group = vim.api.nvim_create_augroup('AOverseer', { clear = true }),
})
end,
opts = {
strategy = 'terminal',
task_list = {
bindings = {
q = '<Cmd>OverseerClose<CR>',
},
},
},
keys = {
{ '<leader>Oa', '<cmd>OverseerTaskAction<cr>' },
{ '<leader>Ob', '<cmd>OverseerBuild<cr>' },
},
}

View file

@ -1,31 +1,46 @@
vim.pack.add({
'https://github.com/nvim-treesitter/nvim-treesitter',
'https://github.com/nvim-treesitter/nvim-treesitter-textobjects',
'https://github.com/Wansmer/treesj',
})
vim.api.nvim_create_autocmd('PackChanged', {
callback = function(ev)
local name, kind = ev.data.spec.name, ev.data.kind
if kind == 'delete' then
return
end
if name == 'nvim-treesitter' then
vim.schedule(function()
vim.cmd('TSUpdate all')
end)
end
end,
})
return {
{
'nvim-treesitter/nvim-treesitter',
branch = 'main',
build = ':TSUpdate all',
opts = {
auto_install = true,
},
after = function()
require('nvim-treesitter').setup({ auto_install = true })
end,
},
{
'nvim-treesitter/nvim-treesitter-textobjects',
branch = 'main',
dependencies = 'nvim-treesitter/nvim-treesitter',
init = function()
before = function()
vim.g.no_plugin_maps = true
end,
opts = {
select = {
enable = true,
lookahead = true,
},
move = {
enable = true,
set_jumps = true,
},
},
config = function(_, opts)
require('nvim-treesitter-textobjects').setup(opts)
after = function()
require('nvim-treesitter-textobjects').setup({
select = {
enable = true,
lookahead = true,
},
move = {
enable = true,
set_jumps = true,
},
})
local select = require('nvim-treesitter-textobjects.select')
local select_maps = {
@ -113,7 +128,9 @@ return {
},
{
'Wansmer/treesj',
config = true,
after = function()
require('treesj').setup()
end,
keys = {
{ 'gt', '<cmd>lua require("treesj").toggle()<cr>' },
},

View file

@ -0,0 +1,132 @@
{
"plugins": {
"blink-cmp-env": {
"rev": "99af62c1f9aa46005e8f50ad4ccee581946546ca",
"src": "https://github.com/bydlw98/blink-cmp-env"
},
"blink-cmp-ghostty": {
"rev": "9752af1afc2858ec36da5fd33cdf59d45c6d9029",
"src": "https://github.com/barrettruth/blink-cmp-ghostty"
},
"blink-cmp-git": {
"rev": "10783593af764424018a95e75df6ad5a8b66fe07",
"src": "https://github.com/Kaiser-Yang/blink-cmp-git"
},
"blink-cmp-ssh": {
"rev": "43ee35376242ee762a91b756da945ddbce0e0ac4",
"src": "https://github.com/barrettruth/blink-cmp-ssh"
},
"blink-cmp-tmux": {
"rev": "2a5f967da7ca8ecfea608c25fb454aea7e464567",
"src": "https://github.com/barrettruth/blink-cmp-tmux"
},
"blink.cmp": {
"rev": "b650e976a927be6b46487a0a610b75af111376c5",
"src": "https://github.com/saghen/blink.cmp"
},
"cp.nvim": {
"rev": "24b088e8e9e71a484c0a9f36226e76471966d1e9",
"src": "https://github.com/barrettruth/cp.nvim"
},
"dial.nvim": {
"rev": "f2634758455cfa52a8acea6f142dcd6271a1bf57",
"src": "https://github.com/monaqa/dial.nvim"
},
"fzf-lua": {
"rev": "d637241b34f2cb012309baebb2e35e440a946d8b",
"src": "https://github.com/ibhagwan/fzf-lua"
},
"gitsigns.nvim": {
"rev": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519",
"src": "https://github.com/lewis6991/gitsigns.nvim"
},
"guard-collection": {
"rev": "edf6c86c06badc972964dadb7fd469022690cbf0",
"src": "https://github.com/nvimdev/guard-collection"
},
"guard.nvim": {
"rev": "addb8d2f40662b8b62d60dd7d18f503beb2332e7",
"src": "https://github.com/nvimdev/guard.nvim"
},
"lazydev.nvim": {
"rev": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d",
"src": "https://github.com/folke/lazydev.nvim"
},
"live-rename.nvim": {
"rev": "3a3cddf23b89a17992f9ca67afc5858077769462",
"src": "https://github.com/saecki/live-rename.nvim"
},
"lz.n": {
"rev": "3a696418821fa8e4963a0a59dd1f8d40fedb6824",
"src": "https://github.com/lumen-oss/lz.n"
},
"midnight.nvim": {
"rev": "af0a44bec80ed1fb1ff0dbcd3f3336ef8750ec8a",
"src": "https://github.com/barrettruth/midnight.nvim"
},
"mini.ai": {
"rev": "4b0a6207341d895b6cfe9bcb1e4d3e8607bfe4f4",
"src": "https://github.com/echasnovski/mini.ai"
},
"mini.bufremove": {
"rev": "ee69f823f84508c556127a5882760d9783692023",
"src": "https://github.com/nvim-mini/mini.bufremove"
},
"mini.misc": {
"rev": "de8947231c29012271722651aa07f6749c41d1ed",
"src": "https://github.com/echasnovski/mini.misc"
},
"mini.pairs": {
"rev": "b7fde3719340946feb75017ef9d75edebdeb0566",
"src": "https://github.com/echasnovski/mini.pairs"
},
"nvim-colorizer.lua": {
"rev": "ae0d66307a5b431c7b633806eb27769334ac5f05",
"src": "https://github.com/catgoose/nvim-colorizer.lua"
},
"nvim-lspconfig": {
"rev": "f386df19b145607a33885b6110ef5c04faae42cb",
"src": "https://github.com/neovim/nvim-lspconfig"
},
"nvim-surround": {
"rev": "ce4ad4a8909d7f4537803c8f09b79e78c49a6cc4",
"src": "https://github.com/kylechui/nvim-surround"
},
"nvim-treesitter": {
"rev": "b9171ede5de41b3f2dfa33fe33ebd585d795f928",
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
},
"nvim-treesitter-textobjects": {
"rev": "a0e182ae21fda68c59d1f36c9ed45600aef50311",
"src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
},
"nvim-web-devicons": {
"rev": "737cf6c657898d0c697311d79d361288a1343d50",
"src": "https://github.com/nvim-tree/nvim-web-devicons"
},
"overseer.nvim": {
"rev": "2802c15182dae2de71f9c82e918d7ba850b90c22",
"src": "https://github.com/stevearc/overseer.nvim"
},
"treesj": {
"rev": "186084dee5e9c8eec40f6e39481c723dd567cb05",
"src": "https://github.com/Wansmer/treesj"
},
"vim-abolish": {
"rev": "dcbfe065297d31823561ba787f51056c147aa682",
"src": "https://github.com/tpope/vim-abolish"
},
"vim-fugitive": {
"rev": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4",
"src": "https://github.com/tpope/vim-fugitive"
},
"vim-sleuth": {
"rev": "be69bff86754b1aa5adcbb527d7fcd1635a84080",
"src": "https://github.com/tpope/vim-sleuth"
},
"vimtex": {
"rev": "95b93a24740f7b89dd8331326b41bdd1337d79f6",
"src": "https://github.com/lervag/vimtex"
}
}
}

View file

@ -1,13 +1,11 @@
local api, au = vim.api, vim.api.nvim_create_autocmd
local aug = vim.api.nvim_create_augroup('AAugs', { clear = true })
local aug = api.nvim_create_augroup('AAugs', { clear = true })
au('BufEnter', {
vim.api.nvim_create_autocmd('BufEnter', {
command = 'setl formatoptions-=cro spelloptions=camel,noplainbuffer',
group = aug,
})
au({ 'TermOpen', 'BufWinEnter' }, {
vim.api.nvim_create_autocmd({ 'TermOpen', 'BufWinEnter' }, {
callback = function(args)
if vim.bo[args.buf].buftype == 'terminal' then
vim.opt_local.number = true
@ -18,41 +16,19 @@ au({ 'TermOpen', 'BufWinEnter' }, {
group = aug,
})
au('BufWritePost', {
pattern = (
os.getenv('XDG_CONFIG_HOME') or (os.getenv('HOME') .. '/.config')
) .. '/dunst/dunstrc',
callback = function()
vim.fn.system('killall dunst && nohup dunst &; disown')
end,
group = aug,
})
au('BufReadPost', {
vim.api.nvim_create_autocmd('BufReadPost', {
command = 'sil! normal g`"',
group = aug,
})
au({ 'BufRead', 'BufNewFile' }, {
pattern = '*/templates/*.html',
callback = function(opts)
vim.api.nvim_set_option_value(
'filetype',
'htmldjango',
{ buf = opts.buf }
)
end,
group = aug,
})
au('TextYankPost', {
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank({ higroup = 'Visual', timeout = 300 })
end,
group = aug,
})
au({ 'FocusLost', 'BufLeave', 'VimLeave' }, {
vim.api.nvim_create_autocmd({ 'FocusLost', 'BufLeave', 'VimLeave' }, {
pattern = '*',
callback = function()
vim.cmd('silent! wall')

View file

@ -1 +0,0 @@
require('config.fold').setup()

View file

@ -1,18 +1,19 @@
local api = vim.api
local ns = api.nvim_create_namespace('highlight_undo')
local ns = vim.api.nvim_create_namespace('highlight_undo')
api.nvim_set_hl(0, 'HighlightUndo', { link = 'IncSearch', default = true })
vim.api.nvim_set_hl(0, 'HighlightUndo', { link = 'IncSearch', default = true })
for _, key in ipairs({ 'u', '<C-r>', 'U' }) do
vim.keymap.set('n', key, function()
api.nvim_buf_attach(0, false, {
vim.api.nvim_buf_attach(0, false, {
on_bytes = function(_, buf, _, sr, sc, _, _, _, _, ner, nec)
local er, ec = sr + ner, sc + nec
if er >= api.nvim_buf_line_count(buf) then
ec = #(api.nvim_buf_get_lines(buf, -2, -1, false)[1] or '')
if er >= vim.api.nvim_buf_line_count(buf) then
ec = #(
vim.api.nvim_buf_get_lines(buf, -2, -1, false)[1] or ''
)
end
vim.schedule(function()
if not api.nvim_buf_is_valid(buf) then
if not vim.api.nvim_buf_is_valid(buf) then
return
end
vim.hl.range(
@ -23,8 +24,8 @@ for _, key in ipairs({ 'u', '<C-r>', 'U' }) do
{ er, ec }
)
vim.defer_fn(function()
if api.nvim_buf_is_valid(buf) then
api.nvim_buf_clear_namespace(buf, ns, 0, -1)
if vim.api.nvim_buf_is_valid(buf) then
vim.api.nvim_buf_clear_namespace(buf, ns, 0, -1)
end
end, 300)
end)

View file

@ -1,68 +1,10 @@
map({
'n',
'gx',
function()
local url = vim.fn.expand('<cfile>', nil)
if not url:match('https') and url:match('/') then
url = 'https://github.com/' .. url
end
vim.fn.jobstart({ vim.env.BROWSER, url })
end,
})
map({ { 'i', 'c' }, '<c-a>', '<esc>' })
for key, cmd in pairs({
left = 'vertical resize -10',
right = 'vertical resize +10',
down = 'resize +10',
up = 'resize -10',
}) do
map({
'n',
('<%s>'):format(key),
function()
vim.cmd(cmd)
end,
})
end
map({ 'n', '<left>', '<cmd>vertical resize -10<cr>' })
map({ 'n', '<right>', '<cmd>vertical resize +10<cr>' })
map({ 'n', '<down>', '<cmd>resize +10<cr>' })
map({ 'n', '<up>', '<cmd>resize -10<cr>' })
map({ 'n', 'J', 'mzJ`z' })
map({ 'x', 'p', '"_dp' })
map({ 'x', 'P', '"_dP' })
map({ 't', '<esc>', '<c-\\><c-n>' })
map({ 'n', '<leader>iw', '<cmd>setlocal wrap!<cr>' })
map({ 'n', '<leader>is', '<cmd>setlocal spell!<cr>' })
local state = nil
map({
'n',
'<leader>iz',
function()
if state then
for k, v in pairs(state) do
vim.opt_local[k] = v
end
state = nil
else
state = {
number = vim.opt_local.number:get(),
relativenumber = vim.opt_local.relativenumber:get(),
signcolumn = vim.opt_local.signcolumn:get(),
statuscolumn = vim.opt_local.statuscolumn:get(),
laststatus = vim.opt_local.laststatus:get(),
cmdheight = vim.opt_local.cmdheight:get(),
}
vim.opt_local.number = false
vim.opt_local.relativenumber = false
vim.opt_local.signcolumn = 'no'
vim.opt_local.statuscolumn = ''
vim.opt_local.laststatus = 0
vim.opt_local.cmdheight = 0
end
end,
})

View file

@ -1 +1 @@
require('config.lines').setup()
vim.o.statusline = " %{expand('%:~')} %h%m%r%=%c:%l/%L "

View file

@ -1,14 +1,12 @@
local o, opt = vim.o, vim.opt
o.autoread = true
o.autowrite = true
o.breakindent = true
o.cursorline = true
o.cmdheight = 0
o.conceallevel = 0
opt.diffopt:append('linematch:60')
o.expandtab = true
@ -16,8 +14,11 @@ o.expandtab = true
o.exrc = true
o.secure = true
opt.foldcolumn = 'auto:1'
opt.signcolumn = 'no'
o.foldcolumn = '1'
o.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
o.foldlevel = 1
o.foldmethod = 'expr'
o.foldtext = ''
opt.fillchars = {
eob = ' ',
@ -50,8 +51,6 @@ o.shiftwidth = 2
opt.shortmess:append('acCIs')
o.showmode = false
o.showtabline = 0
o.spellfile = (vim.env.XDG_DATA_HOME or (vim.env.HOME .. '/.local/share'))

42
flake.lock generated
View file

@ -5,11 +5,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1772069414,
"narHash": "sha256-5RL+Ym1sLpWirBLN1pySLXV7l9tNPEx2VTeLMHelzo8=",
"lastModified": 1772160751,
"narHash": "sha256-PXv9nrm8HHLGIU2B1XRjOvzlPW9sFdzbtWiJQ1wE8dM=",
"owner": "ryoppippi",
"repo": "claude-code-overlay",
"rev": "7b7dcb59ecfc3ab727cd7792c33d59fc6f6f8b4f",
"rev": "662bdbf5ea61fc3cde167bbe3686343a149ea6c6",
"type": "github"
},
"original": {
@ -46,11 +46,11 @@
]
},
"locked": {
"lastModified": 1772060133,
"narHash": "sha256-VuyRptb8v1lVGMlLp4/1vRX3Efwec0CN0S6mKmDPzLg=",
"lastModified": 1772164835,
"narHash": "sha256-zRcwrZDeBfYipqv/7K7TqsfPb87LFU6b7JhoNUGSnvQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ce9b6e52500a0ea0ec48f0bbf6d7a3e431d9dfa4",
"rev": "2a39b0828bbffce0d73769a61e46e780488d098b",
"type": "github"
},
"original": {
@ -87,11 +87,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1771977871,
"narHash": "sha256-lhmPJpB4V67O7rpTxb637yYX4C4PyhlnCGk+hrpjiyA=",
"lastModified": 1772150696,
"narHash": "sha256-0QNL7sbGgKipjr1uXr3KpaPgBWKZmM97l/T7zkWdVqI=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "76b7e0e4f7ed155a090a551cd2ab3e7cd81eb6c3",
"rev": "de416cbd51404e64540ca4746393d1866b219bae",
"type": "github"
},
"original": {
@ -103,11 +103,11 @@
"neovim-src": {
"flake": false,
"locked": {
"lastModified": 1771977223,
"narHash": "sha256-RAPxiR+GFi+eH8Hd8zP9Pg4ZRwAwGiCN+HOt9K5LMb4=",
"lastModified": 1772148728,
"narHash": "sha256-ot+6q4IoboWMfD4xW26pE8zT3e5ocfZ8XD/FzKxeEUo=",
"owner": "neovim",
"repo": "neovim",
"rev": "327dcb897024159bdb201caf23d8d5673d7a0567",
"rev": "18c5f06c9f6068b9a26a1ed4ab0f66b91db85cd9",
"type": "github"
},
"original": {
@ -149,11 +149,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1771923393,
"narHash": "sha256-Fy0+UXELv9hOE8WjYhJt8fMDLYTU2Dqn3cX4BwoGBos=",
"lastModified": 1772082373,
"narHash": "sha256-wySf8a6hvuqgFdwvvzPPTARBCMLDz7WFAufGkllD1M4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ea7f1f06811ce7fcc81d6c6fd4213150c23edcf2",
"rev": "26eaeac4e409d7b5a6bf6f90a2a2dc223c78d915",
"type": "github"
},
"original": {
@ -165,11 +165,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1771923393,
"narHash": "sha256-Fy0+UXELv9hOE8WjYhJt8fMDLYTU2Dqn3cX4BwoGBos=",
"lastModified": 1772082373,
"narHash": "sha256-wySf8a6hvuqgFdwvvzPPTARBCMLDz7WFAufGkllD1M4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ea7f1f06811ce7fcc81d6c6fd4213150c23edcf2",
"rev": "26eaeac4e409d7b5a6bf6f90a2a2dc223c78d915",
"type": "github"
},
"original": {
@ -211,11 +211,11 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1772070741,
"narHash": "sha256-5Egc9T2lC85Xp/JjoSqCgHDAQsVoaR424yKFdcEXoAo=",
"lastModified": 1772158021,
"narHash": "sha256-UX/mZlmDYccOVGDIEFVvXkHRSjjSkOnYO/F4O6XDrKg=",
"owner": "0xc000022070",
"repo": "zen-browser-flake",
"rev": "b1432f1ffc71de24512585cee495eea302834290",
"rev": "0af6863a54e1468ce1ef34bf0bbd073aed5a8b2e",
"type": "github"
},
"original": {