mirror of
https://github.com/iofq/nvim.nix.git
synced 2026-01-23 00:45:17 -06:00
even more jj mini/snacks rice
This commit is contained in:
parent
83f9f90f1f
commit
75c09a73ff
15 changed files with 345 additions and 337 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@ result
|
|||
*.AppImage
|
||||
.direnv
|
||||
.luarc.json
|
||||
nvim/lazy*json
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ with lib;
|
|||
viAlias ? appName == "nvim", # Add a "vi" binary to the build output as an alias?
|
||||
vimAlias ? appName == "nvim", # Add a "vim" binary to the build output as an alias?
|
||||
wrapRc ? true,
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
# This is the structure of a plugin definition.
|
||||
# Each plugin in the `plugins` argument list can also be defined as this attrset
|
||||
defaultPlugin = {
|
||||
|
|
@ -51,35 +52,38 @@ with lib;
|
|||
externalPackages = extraPackages ++ (optionals withSqlite [ pkgs.sqlite ]);
|
||||
|
||||
# Map all plugins to an attrset { plugin = <plugin>; config = <config>; optional = <tf>; ... }
|
||||
normalizedPlugins = map (x:
|
||||
defaultPlugin
|
||||
// (
|
||||
if x ? plugin
|
||||
then x
|
||||
else {plugin = x;}
|
||||
))
|
||||
plugins;
|
||||
normalizedPlugins = map (x: defaultPlugin // (if x ? plugin then x else { plugin = x; })) plugins;
|
||||
|
||||
# This nixpkgs util function creates an attrset
|
||||
# that pkgs.wrapNeovimUnstable uses to configure the Neovim build.
|
||||
neovimConfig = pkgs-wrapNeovim.neovimUtils.makeNeovimConfig {
|
||||
inherit extraPython3Packages withPython3 withRuby withNodeJs viAlias vimAlias;
|
||||
inherit
|
||||
extraPython3Packages
|
||||
withPython3
|
||||
withRuby
|
||||
withNodeJs
|
||||
viAlias
|
||||
vimAlias
|
||||
;
|
||||
plugins = normalizedPlugins;
|
||||
};
|
||||
|
||||
packDir = pkgs.neovimUtils.packDir({
|
||||
packDir = pkgs.neovimUtils.packDir {
|
||||
myNeovimPackages = pkgs.neovimUtils.normalizedPluginsToVimPackage normalizedPlugins;
|
||||
});
|
||||
};
|
||||
|
||||
# This uses the ignoreConfigRegexes list to filter
|
||||
# the nvim directory
|
||||
nvimRtpSrc = let
|
||||
nvimRtpSrc =
|
||||
let
|
||||
src = ../nvim;
|
||||
in
|
||||
lib.cleanSourceWith {
|
||||
inherit src;
|
||||
name = "nvim-rtp-src";
|
||||
filter = path: tyoe: let
|
||||
filter =
|
||||
path: tyoe:
|
||||
let
|
||||
srcPrefix = toString src + "/";
|
||||
relPath = lib.removePrefix srcPrefix (toString path);
|
||||
in
|
||||
|
|
@ -111,13 +115,12 @@ with lib;
|
|||
# The final init.lua content that we pass to the Neovim wrapper.
|
||||
# It wraps the user init.lua, prepends the lua lib directory to the RTP
|
||||
# and prepends the nvim and after directory to the RTP
|
||||
initLua = ''
|
||||
vim.opt.rtp:prepend('${nvimRtp}')
|
||||
initLua =
|
||||
''
|
||||
LAZY_OPTS = {
|
||||
performance = {
|
||||
reset_packpath = false,
|
||||
reset_packpath = true,
|
||||
rtp = {
|
||||
reset = false,
|
||||
disabled_plugins = {
|
||||
"netrwPlugin",
|
||||
"tutor",
|
||||
|
|
@ -134,22 +137,22 @@ with lib;
|
|||
install = { missing = false, },
|
||||
spec = {{ import = "plugins" }},
|
||||
}
|
||||
'' + (builtins.readFile ../nvim/init.lua);
|
||||
vim.opt.rtp:prepend('${nvimRtp}')
|
||||
''
|
||||
+ (builtins.readFile ../nvim/init.lua);
|
||||
|
||||
# Add arguments to the Neovim wrapper script
|
||||
extraMakeWrapperArgs = builtins.concatStringsSep " " (
|
||||
# Set the NVIM_APPNAME environment variable
|
||||
(optional (appName != "nvim" && appName != null && appName != "")
|
||||
''--set NVIM_APPNAME "${appName}"'')
|
||||
(optional (
|
||||
appName != "nvim" && appName != null && appName != ""
|
||||
) ''--set NVIM_APPNAME "${appName}"'')
|
||||
# Add external packages to the PATH
|
||||
++ (optional (externalPackages != [])
|
||||
''--prefix PATH : "${makeBinPath externalPackages}"'')
|
||||
++ (optional (externalPackages != [ ]) ''--prefix PATH : "${makeBinPath externalPackages}"'')
|
||||
# Set the LIBSQLITE_CLIB_PATH if sqlite is enabled
|
||||
++ (optional withSqlite
|
||||
''--set LIBSQLITE_CLIB_PATH "${pkgs.sqlite.out}/lib/libsqlite3.so"'')
|
||||
++ (optional withSqlite ''--set LIBSQLITE_CLIB_PATH "${pkgs.sqlite.out}/lib/libsqlite3.so"'')
|
||||
# Set the LIBSQLITE environment variable if sqlite is enabled
|
||||
++ (optional withSqlite
|
||||
''--set LIBSQLITE "${pkgs.sqlite.out}/lib/libsqlite3.so"'')
|
||||
++ (optional withSqlite ''--set LIBSQLITE "${pkgs.sqlite.out}/lib/libsqlite3.so"'')
|
||||
);
|
||||
|
||||
luaPackages = neovim-unwrapped.lua.pkgs;
|
||||
|
|
@ -158,15 +161,20 @@ with lib;
|
|||
# Native Lua libraries
|
||||
extraMakeWrapperLuaCArgs =
|
||||
optionalString (resolvedExtraLuaPackages != [ ])
|
||||
''--suffix LUA_CPATH ";" "${concatMapStringsSep ";" luaPackages.getLuaCPath resolvedExtraLuaPackages}"'';
|
||||
''--suffix LUA_CPATH ";" "${
|
||||
concatMapStringsSep ";" luaPackages.getLuaCPath resolvedExtraLuaPackages
|
||||
}"'';
|
||||
|
||||
# Lua libraries
|
||||
extraMakeWrapperLuaArgs =
|
||||
optionalString (resolvedExtraLuaPackages != [ ])
|
||||
''--suffix LUA_PATH ";" "${concatMapStringsSep ";" luaPackages.getLuaPath resolvedExtraLuaPackages}"'';
|
||||
''--suffix LUA_PATH ";" "${
|
||||
concatMapStringsSep ";" luaPackages.getLuaPath resolvedExtraLuaPackages
|
||||
}"'';
|
||||
|
||||
# wrapNeovimUnstable is the nixpkgs utility function for building a Neovim derivation.
|
||||
neovim-wrapped = pkgs-wrapNeovim.wrapNeovimUnstable neovim-unwrapped (neovimConfig
|
||||
neovim-wrapped = pkgs-wrapNeovim.wrapNeovimUnstable neovim-unwrapped (
|
||||
neovimConfig
|
||||
// {
|
||||
luaRcContent = initLua;
|
||||
wrapperArgs =
|
||||
|
|
@ -178,7 +186,8 @@ with lib;
|
|||
+ " "
|
||||
+ extraMakeWrapperLuaArgs;
|
||||
wrapRc = wrapRc;
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
isCustomAppName = appName != null && appName != "nvim";
|
||||
in
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ with final.pkgs.lib; let
|
|||
diffview-nvim
|
||||
eyeliner-nvim
|
||||
friendly-snippets
|
||||
fzf-vim
|
||||
lazy-nvim
|
||||
mini-nvim-git
|
||||
nightfox-nvim
|
||||
|
|
@ -34,11 +35,8 @@ with final.pkgs.lib; let
|
|||
oil-nvim
|
||||
refactoring-nvim
|
||||
render-markdown-nvim
|
||||
scope-nvim
|
||||
snacks-nvim
|
||||
trouble-nvim
|
||||
treewalker-nvim
|
||||
yanky-nvim
|
||||
];
|
||||
|
||||
basePackages = with pkgs; [
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
vim.opt.tabstop = 4
|
||||
|
|
@ -28,5 +28,6 @@ if not LAZY_OPTS then
|
|||
},
|
||||
}
|
||||
end
|
||||
vim.cmd('packadd cfilter')
|
||||
require('lazy').setup(LAZY_OPTS)
|
||||
require('config')
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"blink-copilot": { "branch": "main", "commit": "bdc45bbbed2ec252b3a29f4adecf031e157b5573" },
|
||||
"blink-ripgrep.nvim": { "branch": "main", "commit": "0a2c3c1ce8c3c56e7490cae835a981d5dbeb472c" },
|
||||
"blink.cmp": { "branch": "main", "commit": "4f38ce99a472932d5776337f08f7a8180f1f571a" },
|
||||
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
|
||||
"copilot.lua": { "branch": "master", "commit": "a5c390f8d8e85b501b22dcb2f30e0cbbd69d5ff0" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"eyeliner.nvim": { "branch": "main", "commit": "8f197eb30cecdf4c2cc9988a5eecc6bc34c0c7d6" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"mini.nvim": { "branch": "main", "commit": "ee23e1abc206efc6d6cce19ec8c0a3da7a897035" },
|
||||
"nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" },
|
||||
"nvim-bqf": { "branch": "main", "commit": "9cbec7cf8ad2a902a0a41241ad16c3489620321b" },
|
||||
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "1b801f68d09e70e59e6dd967b663b6d84ee3e87d" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "94ea4f436d2b59c80f02e293466c374584f03b8c" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "6daca3ad780f045550b820f262002f35175a6c04" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ed373482db797bbf71bdff37a15c7555a84dce47" },
|
||||
"oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" },
|
||||
"refactoring.nvim": { "branch": "master", "commit": "2be7ea3f10b7e59658f5abf6dffc50b5d61964d6" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "b2d857c848c2c27440c8e5efc8e49a9b5bcf13c6" },
|
||||
"scope.nvim": { "branch": "main", "commit": "3fc963e75f88990a9467ff72b8eea667a69c30a2" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
|
||||
"treewalker.nvim": { "branch": "main", "commit": "34bf0a6044e0b5e3d93b7012ae7bdf457de91ba1" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||
"yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" }
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ vim.opt.autowrite = true
|
|||
vim.opt.backspace = 'indent,eol,start'
|
||||
vim.opt.confirm = true
|
||||
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
||||
vim.opt.cmdheight = 0
|
||||
vim.opt.cmdheight = 1
|
||||
vim.opt.diffopt = 'internal,filler,closeoff,inline:char'
|
||||
vim.opt.expandtab = true -- insert tabs as spaces
|
||||
vim.opt.inccommand = 'split' -- incremental live completion
|
||||
|
|
@ -28,7 +28,7 @@ end, { silent = true, desc = 'toggle tabstop' })
|
|||
|
||||
-- autocmd
|
||||
----------------------------------------
|
||||
local undopath = '~/.local/share/nvim/undo'
|
||||
local undopath = vim.fn.stdpath('data') .. 'undo'
|
||||
vim.api.nvim_create_autocmd('VimEnter', {
|
||||
command = 'silent !mkdir -p ' .. undopath,
|
||||
group = vim.api.nvim_create_augroup('Init', {}),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ return {
|
|||
'fang2hou/blink-copilot',
|
||||
},
|
||||
opts = {
|
||||
enabled = function()
|
||||
return not vim.tbl_contains({ 'snacks_picker_input', 'oil' }, vim.bo.filetype)
|
||||
end,
|
||||
fuzzy = {
|
||||
sorts = {
|
||||
'exact',
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ end
|
|||
|
||||
JJ.jj_start_watching_tree_state = function(buf_id, path)
|
||||
local stdout = vim.loop.new_pipe()
|
||||
local args = { 'workspace', 'root' }
|
||||
local args = { 'workspace', 'root', '--ignore-working-copy' }
|
||||
local spawn_opts = {
|
||||
args = args,
|
||||
cwd = vim.fn.fnamemodify(path, ':h'),
|
||||
|
|
@ -86,7 +86,7 @@ JJ.jj_set_ref_text = vim.schedule_wrap(function(buf_id)
|
|||
-- Set
|
||||
local stdout = vim.loop.new_pipe()
|
||||
local spawn_opts = {
|
||||
args = { 'file', 'show', '-r', '@-', './' .. basename },
|
||||
args = { 'file', 'show', '--ignore-working-copy', '-r', '@-', './' .. basename },
|
||||
cwd = cwd,
|
||||
stdio = { nil, stdout, nil },
|
||||
}
|
||||
|
|
|
|||
48
nvim/lua/plugins/lib/session_jj.lua
Normal file
48
nvim/lua/plugins/lib/session_jj.lua
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
local M = {}
|
||||
M.load = function()
|
||||
local jj_root = vim.system({ 'jj', 'workspace', 'root' }):wait()
|
||||
local sessions = require('mini.sessions')
|
||||
|
||||
if jj_root.code ~= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local result = vim
|
||||
.system({
|
||||
'jj',
|
||||
'log',
|
||||
'-r',
|
||||
'latest(heads(::@ & bookmarks()))',
|
||||
'--template',
|
||||
'bookmarks',
|
||||
'--no-pager',
|
||||
'--no-graph',
|
||||
})
|
||||
:wait()
|
||||
local branch = vim.trim(string.gsub(result.stdout, '[\n*]', ''))
|
||||
local root = vim.trim(string.gsub(jj_root.stdout, '\n', ''))
|
||||
local jj_sesh = string.gsub(string.format('jj:%s:%s', root, branch), '[./]', '-')
|
||||
if jj_sesh ~= '' then
|
||||
vim.opt.shadafile = vim.fn.stdpath('data') .. '/myshada/' .. jj_sesh .. '.shada'
|
||||
for name, _ in pairs(sessions.detected) do
|
||||
if name == jj_sesh then
|
||||
vim.ui.select({
|
||||
'No',
|
||||
'Yes',
|
||||
}, { prompt = 'Session found at ' .. jj_sesh .. ', load it?' }, function(c)
|
||||
if c == 'Yes' then
|
||||
-- load session (buffers, etc) as well as shada (marks)
|
||||
sessions.read(jj_sesh)
|
||||
vim.cmd('rshada')
|
||||
vim.notify('loaded jj session: ' .. jj_sesh)
|
||||
end
|
||||
end)
|
||||
return
|
||||
end
|
||||
end
|
||||
vim.cmd('wshada')
|
||||
sessions.write(jj_sesh)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -23,7 +23,7 @@ function M.status()
|
|||
file = string.match(text, '{.-=>%s*(.-)}')
|
||||
end
|
||||
|
||||
local diff = vim.fn.system('jj diff ' .. file .. ' --no-pager --stat --git')
|
||||
local diff = vim.fn.system('jj diff ' .. file .. ' --ignore-working-copy --no-pager --stat --git')
|
||||
table.insert(files, {
|
||||
text = text,
|
||||
file = file,
|
||||
|
|
@ -56,8 +56,7 @@ function M.status()
|
|||
end
|
||||
|
||||
function M.revs()
|
||||
local function jj_new()
|
||||
return function(picker, item)
|
||||
local function jj_new(picker, item)
|
||||
picker:close()
|
||||
if item then
|
||||
if not item.rev then
|
||||
|
|
@ -71,62 +70,50 @@ function M.revs()
|
|||
end, { cwd = item.cwd })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function jj_rev_cmd(rev)
|
||||
if rev ~= nil then
|
||||
return vim.fn.system { 'jj', 'show', '--git', '-r', rev }
|
||||
local function jj_rev_cmd(ctx)
|
||||
if ctx.item.rev then
|
||||
Snacks.picker.preview.cmd({ 'jj', 'show', '--ignore-working-copy', '--git', '-r', ctx.item.rev }, ctx)
|
||||
else
|
||||
ctx.preview:reset()
|
||||
return 'No preview available.'
|
||||
end
|
||||
end
|
||||
|
||||
local function jj_log(revset)
|
||||
if revset == nil then
|
||||
revset = '-r @'
|
||||
revset = '-r "ancestors(@,25)"'
|
||||
else
|
||||
revset = '-r ' .. revset
|
||||
end
|
||||
local status_raw = vim.fn.system(
|
||||
'jj log '
|
||||
'jj log --ignore-working-copy '
|
||||
.. revset
|
||||
..
|
||||
' --template \'if(root, format_root_commit(self), label(if(current_working_copy, "working_copy"), concat( format_short_commit_header(self) ++ " ", separate(" ", if(empty, label("empty", "(empty)")), if(description, description.first_line(), label(if(empty, "empty"), description_placeholder),),) ++ "\n",),))\''
|
||||
' --template \'if(root, format_root_commit(self), label(if(current_working_copy, "working_copy"), concat(separate(" ", self.change_id().shortest(8), self.bookmarks()), " | ", if(empty, label("empty", "(empty)")), if(description, description.first_line(), label(if(empty, "empty"), description_placeholder),),) ++ "\n",),)\''
|
||||
)
|
||||
local lines = {}
|
||||
|
||||
for line in status_raw:gmatch('[^\r\n]+') do
|
||||
local sign, rev, description = string.match(line, '(.)%s*(%a+)(.*)')
|
||||
local sign, rev = string.match(line, '(.)%s(%a+)%s.*')
|
||||
table.insert(lines, {
|
||||
text = line,
|
||||
file = line,
|
||||
sign = sign,
|
||||
rev = rev,
|
||||
hl = 'SnacksPickerGitMsg',
|
||||
description = description,
|
||||
diff = jj_rev_cmd(rev),
|
||||
})
|
||||
end
|
||||
|
||||
return lines
|
||||
end
|
||||
|
||||
local lines = jj_log('::@')
|
||||
|
||||
Snacks.picker.pick {
|
||||
source = 'jj_revs',
|
||||
items = lines,
|
||||
layout = 'ivy',
|
||||
format = 'text',
|
||||
title = 'jj log',
|
||||
confirm = jj_new(),
|
||||
preview = function(ctx)
|
||||
if ctx.item.file then
|
||||
Snacks.picker.preview.diff(ctx)
|
||||
else
|
||||
ctx.preview:reset()
|
||||
ctx.preview:set_title('No rev found')
|
||||
end
|
||||
end,
|
||||
items = jj_log(),
|
||||
confirm = jj_new,
|
||||
preview = jj_rev_cmd,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ return {
|
|||
{
|
||||
'echasnovski/mini.nvim',
|
||||
lazy = false,
|
||||
dependencies = { 'folke/snacks.nvim' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>gp',
|
||||
|
|
@ -52,7 +51,7 @@ return {
|
|||
desc = 'git diff overlay',
|
||||
},
|
||||
{
|
||||
'<leader>gd',
|
||||
'<leader>go',
|
||||
function()
|
||||
return MiniGit.show_at_cursor()
|
||||
end,
|
||||
|
|
@ -61,7 +60,7 @@ return {
|
|||
},
|
||||
{
|
||||
'<leader>gb',
|
||||
'<Cmd>vertical Git blame -- %<CR>',
|
||||
'<Cmd>Git blame -- %<CR>',
|
||||
noremap = true,
|
||||
desc = 'git blame',
|
||||
},
|
||||
|
|
@ -72,12 +71,12 @@ return {
|
|||
desc = 'git command',
|
||||
},
|
||||
{
|
||||
'S',
|
||||
'<leader>fs',
|
||||
function()
|
||||
MiniJump2d.start { spotter = MiniJump2d.gen_spotter.vimpattern() }
|
||||
require('plugins.lib.session_jj').load()
|
||||
end,
|
||||
noremap = true,
|
||||
desc = 'mini jump',
|
||||
desc = 'mini session select',
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
|
|
@ -91,17 +90,16 @@ return {
|
|||
active = function()
|
||||
local mode, mode_hl = MiniStatusline.section_mode {}
|
||||
local filename = MiniStatusline.section_filename { trunc_width = 140 }
|
||||
local diff = MiniStatusline.section_diff { trunc_width = 75, icon = '' }
|
||||
local diagnostics = MiniStatusline.section_diagnostics { trunc_width = 75 }
|
||||
local lsp = MiniStatusline.section_lsp { trunc_width = 75 }
|
||||
local search = MiniStatusline.section_searchcount { trunc_width = 75 }
|
||||
|
||||
return MiniStatusline.combine_groups {
|
||||
'%<', -- Mark general truncate point
|
||||
{ hl = 'MiniStatuslineFilename', strings = { '' } },
|
||||
-- { hl = 'MiniStatuslineFilename', strings = { filename } },
|
||||
'%=', -- End left alignment
|
||||
{ hl = 'MiniStatusDevinfo', strings = { diagnostics, lsp } },
|
||||
{ hl = 'MiniStatuslineFilename', strings = { search } },
|
||||
{ hl = 'MiniStatuslineDevinfo', strings = { rec, diagnostics, lsp } },
|
||||
{ hl = 'MiniStatuslineDevinfo', strings = { search } },
|
||||
{ hl = mode_hl, strings = { mode } },
|
||||
}
|
||||
end,
|
||||
|
|
@ -118,24 +116,28 @@ return {
|
|||
require('mini.align').setup()
|
||||
require('mini.bracketed').setup()
|
||||
require('mini.icons').setup()
|
||||
require('mini.jump2d').setup {
|
||||
view = { n_steps_ahead = 1, dim = true },
|
||||
require('mini.git').setup()
|
||||
require('mini.surround').setup()
|
||||
require('mini.splitjoin').setup { detect = { separator = '[,;\n]' } }
|
||||
|
||||
local sessions = require('mini.sessions')
|
||||
sessions.setup {
|
||||
file = '',
|
||||
autowrite = true,
|
||||
verbose = {
|
||||
write = false,
|
||||
},
|
||||
}
|
||||
require('mini.git').setup { command = { split = 'vertical' } }
|
||||
-- Bind both windows so that they scroll together
|
||||
local align_blame = function(au_data)
|
||||
if au_data.data.git_subcommand ~= 'blame' then
|
||||
return
|
||||
end
|
||||
local win_src = au_data.data.win_source
|
||||
vim.wo.wrap = false
|
||||
vim.fn.winrestview { topline = vim.fn.line('w0', win_src) }
|
||||
vim.api.nvim_win_set_cursor(0, { vim.fn.line('.', win_src), 0 })
|
||||
vim.wo[win_src].scrollbind, vim.wo.scrollbind = true, true
|
||||
if #vim.fn.argv() == 0 then
|
||||
require('plugins.lib.session_jj').load()
|
||||
end
|
||||
|
||||
local au_opts = { pattern = 'MiniGitCommandSplit', callback = align_blame }
|
||||
vim.api.nvim_create_autocmd('User', au_opts)
|
||||
local jump = require('mini.jump2d')
|
||||
jump.setup {
|
||||
view = { n_steps_ahead = 1, dim = true },
|
||||
spotter = jump.gen_spotter.vimpattern(),
|
||||
}
|
||||
|
||||
setup_pairs {
|
||||
modes = { insert = true, command = true, terminal = false },
|
||||
skip_next = [=[[%w%%%'%[%"%.%`%$]]=],
|
||||
|
|
@ -144,10 +146,7 @@ return {
|
|||
markdown = true,
|
||||
}
|
||||
|
||||
require('mini.surround').setup()
|
||||
require('mini.splitjoin').setup { detect = { separator = '[,;\n]' } }
|
||||
|
||||
local jj = require('nvim.lua.plugins.lib.minidiff_jj')
|
||||
local jj = require('plugins.lib.minidiff_jj')
|
||||
local diff = require('mini.diff')
|
||||
diff.setup {
|
||||
options = { wrap_goto = true },
|
||||
|
|
@ -178,14 +177,6 @@ return {
|
|||
miniclue.gen_clues.registers(),
|
||||
miniclue.gen_clues.windows(),
|
||||
miniclue.gen_clues.z(),
|
||||
{ mode = 'n', keys = '<Leader>wj', postkeys = '<Leader>w', desc = 'TS Down' },
|
||||
{ mode = 'n', keys = '<Leader>wk', postkeys = '<Leader>w', desc = 'TS Up' },
|
||||
{ mode = 'n', keys = '<Leader>wh', postkeys = '<Leader>w', desc = 'TS Left' },
|
||||
{ mode = 'n', keys = '<Leader>wl', postkeys = '<Leader>w', desc = 'TS Right' },
|
||||
{ mode = 'n', keys = '<Leader>w<C-J>', postkeys = '<Leader>w', desc = 'Swap TS Down' },
|
||||
{ mode = 'n', keys = '<Leader>w<C-K>', postkeys = '<Leader>w', desc = 'Swap TS Up' },
|
||||
{ mode = 'n', keys = '<Leader>w<C-H>', postkeys = '<Leader>w', desc = 'Swap TS Left' },
|
||||
{ mode = 'n', keys = '<Leader>w<C-L>', postkeys = '<Leader>w', desc = 'Swap TS Right' },
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ return {
|
|||
function()
|
||||
require('oil').toggle_float()
|
||||
end,
|
||||
{ noremap = true, silent = true },
|
||||
{ noremap = true, silent = true, desc = 'oil' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -32,7 +32,6 @@ return {
|
|||
vim.api.nvim_set_hl(0, 'EyelinerSecondary', { underline = true, bold = true })
|
||||
end,
|
||||
},
|
||||
{ 'tiagovla/scope.nvim', event = 'VeryLazy', config = true },
|
||||
{
|
||||
'MeanderingProgrammer/render-markdown.nvim',
|
||||
event = 'VeryLazy',
|
||||
|
|
@ -68,7 +67,14 @@ return {
|
|||
{ '<leader>nb', vim.cmd.DiffviewOpen, noremap = true, desc = 'diffview open' },
|
||||
{
|
||||
'<leader>nh',
|
||||
vim.cmd.DiffviewFileHistory,
|
||||
'<cmd>DiffviewFileHistory %<cr>',
|
||||
mode = { 'n', 'v' },
|
||||
noremap = true,
|
||||
desc = 'diffview history',
|
||||
},
|
||||
{
|
||||
'<leader>nH',
|
||||
'<cmd>DiffviewFileHistory<cr>',
|
||||
mode = { 'n', 'v' },
|
||||
noremap = true,
|
||||
desc = 'diffview history',
|
||||
|
|
@ -105,30 +111,6 @@ return {
|
|||
vim.api.nvim_set_hl(0, 'BlinkCmpGhostText', { link = 'String' })
|
||||
end,
|
||||
},
|
||||
{
|
||||
'gbprod/yanky.nvim',
|
||||
opts = {
|
||||
ring = {
|
||||
storage = 'memory',
|
||||
},
|
||||
picker = {
|
||||
select = {
|
||||
action = require('yanky.picker').actions.set_register('+'),
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ 'y', '<Plug>(YankyYank)', mode = { 'n', 'x' } },
|
||||
{
|
||||
'<leader>fp',
|
||||
'<cmd>YankyRingHistory<cr>',
|
||||
mode = { 'n', 'x' },
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = 'Pick history (yanky.nvim)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'ThePrimeagen/refactoring.nvim',
|
||||
event = 'VeryLazy',
|
||||
|
|
@ -144,5 +126,14 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{ 'kevinhwang91/nvim-bqf', event = 'VeryLazy', config = true },
|
||||
{
|
||||
'kevinhwang91/nvim-bqf',
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
auto_resize_height = true,
|
||||
preview = {
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
return {
|
||||
{
|
||||
'folke/snacks.nvim',
|
||||
dependencies = { 'folke/trouble.nvim' },
|
||||
dependencies = {
|
||||
'folke/trouble.nvim',
|
||||
},
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {
|
||||
|
|
@ -10,7 +12,6 @@ return {
|
|||
dim = { enabled = true },
|
||||
quickfile = { enabled = true },
|
||||
notifier = { enabled = true },
|
||||
scope = { enabled = true },
|
||||
terminal = { enabled = true },
|
||||
indent = { enabled = true },
|
||||
input = { enabled = true },
|
||||
|
|
@ -135,15 +136,6 @@ return {
|
|||
noremap = true,
|
||||
desc = 'snacks explorer',
|
||||
},
|
||||
{
|
||||
'<leader>fE',
|
||||
function()
|
||||
Snacks.explorer.reveal()
|
||||
end,
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = 'snacks explorer open current file',
|
||||
},
|
||||
{
|
||||
'<leader>fg',
|
||||
function()
|
||||
|
|
@ -180,15 +172,6 @@ return {
|
|||
silent = true,
|
||||
desc = 'See all pickers',
|
||||
},
|
||||
{
|
||||
"<leader>f'",
|
||||
function()
|
||||
Snacks.picker.marks()
|
||||
end,
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = 'Pick marks',
|
||||
},
|
||||
{
|
||||
'<leader>fu',
|
||||
function()
|
||||
|
|
@ -235,18 +218,54 @@ return {
|
|||
desc = 'pick notifications',
|
||||
},
|
||||
{
|
||||
'<leader>fj',
|
||||
'<leader>fm',
|
||||
function()
|
||||
require('nvim.lua.plugins.lib.snacks_jj').status()
|
||||
vim.cmd.delmarks { args = { '0-9' } }
|
||||
Snacks.picker.pick {
|
||||
finder = 'vim_marks',
|
||||
format = 'file',
|
||||
['local'] = false,
|
||||
global = true,
|
||||
actions = {
|
||||
markdel = function(picker)
|
||||
for _, item in ipairs(picker:selected()) do
|
||||
vim.cmd.delmarks { args = { item.label } }
|
||||
end
|
||||
vim.cmd('wshada')
|
||||
picker.list:set_selected()
|
||||
picker.list:set_target()
|
||||
picker:find()
|
||||
end,
|
||||
},
|
||||
win = {
|
||||
input = {
|
||||
keys = {
|
||||
['<c-x>'] = { 'markdel', mode = { 'n', 'i' } },
|
||||
},
|
||||
},
|
||||
list = {
|
||||
keys = { ['dd'] = 'markdel' },
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = 'pick global marks',
|
||||
},
|
||||
{
|
||||
'<leader>jf',
|
||||
function()
|
||||
require('plugins.lib.snacks_jj').status()
|
||||
end,
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = 'pick notifications',
|
||||
},
|
||||
{
|
||||
'<leader>fr',
|
||||
'<leader>jj',
|
||||
function()
|
||||
require('nvim.lua.plugins.lib.snacks_jj').revs()
|
||||
require('plugins.lib.snacks_jj').revs()
|
||||
end,
|
||||
noremap = true,
|
||||
silent = true,
|
||||
|
|
|
|||
|
|
@ -11,19 +11,6 @@ return {
|
|||
},
|
||||
},
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
{
|
||||
'aaronik/treewalker.nvim',
|
||||
keys = {
|
||||
{ '<leader>wj', '<cmd>Treewalker Down<cr>', silent = true, desc = 'Down (Treewalker)' },
|
||||
{ '<leader>wk', '<cmd>Treewalker Up<cr>', silent = true, desc = 'Up (Treewalker)' },
|
||||
{ '<leader>wh', '<cmd>Treewalker Left<cr>', silent = true, desc = 'Left (Treewalker)' },
|
||||
{ '<leader>wl', '<cmd>Treewalker Right<cr>', silent = true, desc = 'Right (Treewalker)' },
|
||||
{ '<leader>w<C-J>', '<cmd>Treewalker SwapDown<cr>', silent = true, desc = 'SwapDown (Treewalker)' },
|
||||
{ '<leader>w<C-K>', '<cmd>Treewalker SwapUp<cr>', silent = true, desc = 'SwapUp (Treewalker)' },
|
||||
{ '<leader>w<C-H>', '<cmd>Treewalker SwapLeft<cr>', silent = true, desc = 'SwapLeft (Treewalker)' },
|
||||
{ '<leader>w<C-L>', '<cmd>Treewalker SwapRight<cr>', silent = true, desc = 'SwapRight (Treewalker)' },
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue