mirror of
https://github.com/iofq/nvim.nix.git
synced 2026-01-23 00:45:17 -06:00
autopairs + cleanup
This commit is contained in:
parent
4b7636090f
commit
d01db43a23
15 changed files with 176 additions and 204 deletions
36
flake.lock
generated
36
flake.lock
generated
|
|
@ -389,13 +389,47 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nvim-treesitter": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1754498994,
|
||||||
|
"owner": "nvim-treesitter",
|
||||||
|
"repo": "nvim-treesitter",
|
||||||
|
"rev": "4eb35c03443742a4c3b2db13d36da9cddb6268c3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nvim-treesitter",
|
||||||
|
"ref": "main",
|
||||||
|
"repo": "nvim-treesitter",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nvim-treesitter-textobjects": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751128959,
|
||||||
|
"owner": "nvim-treesitter",
|
||||||
|
"repo": "nvim-treesitter-textobjects",
|
||||||
|
"rev": "b54cec389e98c5b0babbe618773acec927437cab",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nvim-treesitter",
|
||||||
|
"ref": "main",
|
||||||
|
"repo": "nvim-treesitter-textobjects",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"dart": "dart",
|
"dart": "dart",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"gen-luarc": "gen-luarc",
|
"gen-luarc": "gen-luarc",
|
||||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2",
|
||||||
|
"nvim-treesitter": "nvim-treesitter",
|
||||||
|
"nvim-treesitter-textobjects": "nvim-treesitter-textobjects"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,14 @@
|
||||||
url = "github:iofq/dart.nvim";
|
url = "github:iofq/dart.nvim";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
nvim-treesitter = {
|
||||||
|
url = "github:nvim-treesitter/nvim-treesitter/main";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
nvim-treesitter-textobjects = {
|
||||||
|
url = "github:nvim-treesitter/nvim-treesitter-textobjects/main";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
# Add bleeding-edge plugins here.
|
# Add bleeding-edge plugins here.
|
||||||
# They can be updated with `nix flake update` (make sure to commit the generated flake.lock)
|
# They can be updated with `nix flake update` (make sure to commit the generated flake.lock)
|
||||||
# wf-nvim = {
|
# wf-nvim = {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ let
|
||||||
mkNeovim = pkgs.callPackage ./mkNeovim.nix { inherit pkgs-wrapNeovim; };
|
mkNeovim = pkgs.callPackage ./mkNeovim.nix { inherit pkgs-wrapNeovim; };
|
||||||
|
|
||||||
dart-nvim-git = mkNvimPlugin inputs.dart "dart.nvim";
|
dart-nvim-git = mkNvimPlugin inputs.dart "dart.nvim";
|
||||||
|
nvim-treesitter-textobjects-git = mkNvimPlugin inputs.nvim-treesitter-textobjects "nvim-treesitter-textobjects";
|
||||||
|
nvim-treesitter-git = pkgs.vimPlugins.nvim-treesitter.overrideAttrs (old: {
|
||||||
|
src = inputs.nvim-treesitter;
|
||||||
|
});
|
||||||
|
|
||||||
all-plugins = with pkgs.vimPlugins; [
|
all-plugins = with pkgs.vimPlugins; [
|
||||||
blink-cmp
|
blink-cmp
|
||||||
|
|
@ -26,17 +30,17 @@ let
|
||||||
friendly-snippets
|
friendly-snippets
|
||||||
lazy-nvim
|
lazy-nvim
|
||||||
mini-nvim
|
mini-nvim
|
||||||
|
nvim-autopairs
|
||||||
nvim-lint
|
nvim-lint
|
||||||
nvim-lspconfig
|
nvim-lspconfig
|
||||||
|
nvim-treesitter-git.withAllGrammars
|
||||||
nvim-treesitter-context
|
nvim-treesitter-context
|
||||||
nvim-treesitter-textobjects
|
nvim-treesitter-textobjects-git
|
||||||
nvim-treesitter-textsubjects
|
nvim-treesitter-textsubjects
|
||||||
nvim-treesitter.withAllGrammars
|
|
||||||
quicker-nvim
|
quicker-nvim
|
||||||
refactoring-nvim
|
refactoring-nvim
|
||||||
render-markdown-nvim
|
render-markdown-nvim
|
||||||
snacks-nvim
|
snacks-nvim
|
||||||
trouble-nvim
|
|
||||||
];
|
];
|
||||||
|
|
||||||
basePackages = with pkgs; [
|
basePackages = with pkgs; [
|
||||||
|
|
@ -69,6 +73,7 @@ in
|
||||||
appName = "nvim";
|
appName = "nvim";
|
||||||
extraPackages = basePackages ++ extraPackages;
|
extraPackages = basePackages ++ extraPackages;
|
||||||
withNodeJs = false;
|
withNodeJs = false;
|
||||||
|
withSqlite = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
nvim-min-pkg = mkNeovim {
|
nvim-min-pkg = mkNeovim {
|
||||||
|
|
@ -76,7 +81,7 @@ in
|
||||||
appName = "nvim";
|
appName = "nvim";
|
||||||
extraPackages = basePackages;
|
extraPackages = basePackages;
|
||||||
withNodeJs = false;
|
withNodeJs = false;
|
||||||
withSqlite = false;
|
withSqlite = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# This is meant to be used within a devshell.
|
# This is meant to be used within a devshell.
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,7 @@ hi(0, 'MiniIndentscopeSymbol', { link = 'Delimiter' })
|
||||||
hi(0, 'MiniJump', { bg = '#ad5c7c', fg = '#0f1c1e' })
|
hi(0, 'MiniJump', { bg = '#ad5c7c', fg = '#0f1c1e' })
|
||||||
hi(0, 'MiniJump2dDim', { link = 'Comment' })
|
hi(0, 'MiniJump2dDim', { link = 'Comment' })
|
||||||
hi(0, 'MiniJump2dSpot', { bold = true, fg = '#a1cdd8' })
|
hi(0, 'MiniJump2dSpot', { bold = true, fg = '#a1cdd8' })
|
||||||
hi(0, 'MiniJump2dSpotAhead', { bg = '#0f1c1e', fg = '#4d7d90', nocombine = true })
|
hi(0, 'MiniJump2dSpotAhead', { bold = true, fg = '#a1cdd8' })
|
||||||
hi(0, 'MiniJump2dSpotUnique', { bold = true, fg = '#fda47f' })
|
hi(0, 'MiniJump2dSpotUnique', { bold = true, fg = '#fda47f' })
|
||||||
hi(0, 'MiniMapNormal', { link = 'NormalFloat' })
|
hi(0, 'MiniMapNormal', { link = 'NormalFloat' })
|
||||||
hi(0, 'MiniMapSymbolCount', { link = 'Special' })
|
hi(0, 'MiniMapSymbolCount', { link = 'Special' })
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
-- create undopath
|
-- create undopath
|
||||||
local undopath = vim.fn.stdpath('data') .. 'undo'
|
|
||||||
vim.api.nvim_create_autocmd('VimEnter', {
|
vim.api.nvim_create_autocmd('VimEnter', {
|
||||||
command = 'silent !mkdir -p ' .. undopath,
|
command = 'silent !mkdir -p ' .. vim.fn.stdpath('data') .. 'undo',
|
||||||
group = vim.api.nvim_create_augroup('Init', {}),
|
group = vim.api.nvim_create_augroup('Init', {}),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -55,3 +54,57 @@ vim.api.nvim_create_autocmd({ 'FocusGained', 'TermClose', 'TermLeave' }, {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Init treesitter
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
callback = function(event)
|
||||||
|
local bufnr = event.buf
|
||||||
|
local filetype = vim.api.nvim_get_option_value('filetype', { buf = bufnr })
|
||||||
|
|
||||||
|
if filetype == '' then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local parser_name = vim.treesitter.language.get_lang(filetype)
|
||||||
|
if not parser_name then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local parser_installed = pcall(vim.treesitter.get_parser, bufnr, parser_name)
|
||||||
|
if not parser_installed then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local function map(lhs, rhs, opts)
|
||||||
|
if lhs == '' then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
opts = vim.tbl_deep_extend('force', { silent = true }, opts or {})
|
||||||
|
vim.keymap.set({ 'v', 'n' }, lhs, rhs, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||||
|
vim.treesitter.start()
|
||||||
|
|
||||||
|
map('[c', function()
|
||||||
|
require('treesitter-context').go_to_context(vim.v.count1)
|
||||||
|
end, { desc = 'jump to TS context' })
|
||||||
|
map(']f', function()
|
||||||
|
require('nvim-treesitter-textobjects.move').goto_next_start('@function.outer', 'textobjects')
|
||||||
|
end, { desc = 'next function def' })
|
||||||
|
map('[f', function()
|
||||||
|
require('nvim-treesitter-textobjects.move').goto_previous_start('@function.outer', 'textobjects')
|
||||||
|
end, { desc = 'prev function def' })
|
||||||
|
map(']a', function()
|
||||||
|
require('nvim-treesitter-textobjects.move').goto_next_start('@parameter.inner', 'textobjects')
|
||||||
|
end, { desc = 'next param def' })
|
||||||
|
map('[a', function()
|
||||||
|
require('nvim-treesitter-textobjects.move').goto_previous_start('@parameter.inner', 'textobjects')
|
||||||
|
end, { desc = 'prev param def' })
|
||||||
|
map('a]', function()
|
||||||
|
require('nvim-treesitter-textobjects.swap').swap_next('@parameter.inner')
|
||||||
|
end, { desc = 'swap next arg' })
|
||||||
|
map('a[', function()
|
||||||
|
require('nvim-treesitter-textobjects.swap').swap_previous('@parameter.inner')
|
||||||
|
end, { desc = 'swap prev arg' })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,24 @@
|
||||||
vim.opt.autowrite = true
|
vim.opt.autowrite = true
|
||||||
vim.opt.backspace = 'indent,eol,start'
|
vim.opt.backspace = 'indent,eol,start'
|
||||||
vim.opt.confirm = true
|
vim.opt.confirm = true
|
||||||
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
|
||||||
vim.opt.diffopt = 'internal,filler,closeoff,inline:char'
|
vim.opt.diffopt = 'internal,filler,closeoff,inline:char'
|
||||||
vim.opt.expandtab = true -- insert tabs as spaces
|
vim.opt.expandtab = true -- insert tabs as spaces
|
||||||
vim.o.foldlevelstart = 99
|
|
||||||
vim.opt.inccommand = 'split' -- incremental live completion
|
vim.opt.inccommand = 'split' -- incremental live completion
|
||||||
vim.opt.list = true
|
vim.opt.laststatus = 1 -- statusline only if split
|
||||||
vim.opt.nrformats:append('alpha') -- let Ctrl-a do letters as well
|
vim.opt.nrformats:append('alpha') -- let Ctrl-a do letters as well
|
||||||
vim.opt.path:append('**') -- enable fuzzy :find ing
|
vim.opt.path:append('**') -- enable fuzzy :find ing
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
vim.opt.shadafile = 'NONE' -- disable shada
|
vim.opt.shadafile = 'NONE' -- disable shada (unless session)
|
||||||
vim.opt.shiftwidth = 0 -- >> shifts by tabstop
|
vim.opt.shiftwidth = 0 -- >> shifts by tabstop
|
||||||
vim.opt.showmatch = true -- highlight matching brackets
|
vim.opt.showmatch = true -- highlight matching brackets
|
||||||
|
vim.opt.showmode = true
|
||||||
vim.opt.signcolumn = 'no'
|
vim.opt.signcolumn = 'no'
|
||||||
vim.opt.softtabstop = -1 -- backspace removes tabstop
|
vim.opt.softtabstop = -1 -- backspace removes tabstop
|
||||||
vim.opt.swapfile = false
|
vim.opt.swapfile = false
|
||||||
vim.opt.tabstop = 2 -- 2 space tabs are based
|
vim.opt.tabstop = 2 -- 2 space tabs are based
|
||||||
vim.opt.updatetime = 250 -- decrease update time
|
vim.opt.updatetime = 250 -- decrease update time
|
||||||
vim.opt.virtualedit = 'onemore'
|
vim.opt.virtualedit = 'onemore'
|
||||||
vim.opt.winborder = 'single'
|
vim.opt.winborder = 'rounded'
|
||||||
vim.cmd('colorscheme iofq')
|
vim.cmd('colorscheme iofq')
|
||||||
|
|
||||||
-- Configure Neovim diagnostic messages
|
-- Configure Neovim diagnostic messages
|
||||||
|
|
@ -33,3 +32,5 @@ vim.diagnostic.config {
|
||||||
source = 'if_many',
|
source = 'if_many',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
require('config.keymaps')
|
||||||
|
require('config.autocmd')
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ vim.keymap.set('n', '\\t', function()
|
||||||
vim.o.tabstop = vim.o.tabstop == 8 and 2 or 2 * vim.o.tabstop
|
vim.o.tabstop = vim.o.tabstop == 8 and 2 or 2 * vim.o.tabstop
|
||||||
end, { silent = true, desc = 'toggle tabstop' })
|
end, { silent = true, desc = 'toggle tabstop' })
|
||||||
vim.keymap.set({ 'v', 'i' }, 'wq', '<esc>l', { noremap = true, silent = true })
|
vim.keymap.set({ 'v', 'i' }, 'wq', '<esc>l', { noremap = true, silent = true })
|
||||||
vim.keymap.set({ 'v', 'n' }, 'q:', '<nop>')
|
|
||||||
vim.keymap.set('v', '<', '<gv')
|
vim.keymap.set('v', '<', '<gv')
|
||||||
vim.keymap.set('v', '>', '>gv')
|
vim.keymap.set('v', '>', '>gv')
|
||||||
vim.keymap.set('n', 'n', 'nzz', { noremap = true })
|
vim.keymap.set('n', 'n', 'nzz', { noremap = true })
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ return {
|
||||||
path = {
|
path = {
|
||||||
opts = {
|
opts = {
|
||||||
get_cwd = function(_)
|
get_cwd = function(_)
|
||||||
return vim.fn.getcwd()
|
return vim.fn.getcwd() -- use nvim pwd instead of current file pwd
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
-- ripped from lazyvim
|
|
||||||
return function(opts)
|
|
||||||
local pairs = require('mini.pairs')
|
|
||||||
pairs.setup(opts)
|
|
||||||
local open = pairs.open
|
|
||||||
pairs.open = function(pair, neigh_pattern)
|
|
||||||
if vim.fn.getcmdline() ~= '' then
|
|
||||||
return open(pair, neigh_pattern)
|
|
||||||
end
|
|
||||||
local o, c = pair:sub(1, 1), pair:sub(2, 2)
|
|
||||||
local line = vim.api.nvim_get_current_line()
|
|
||||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
|
||||||
local next = line:sub(cursor[2] + 1, cursor[2] + 1)
|
|
||||||
local before = line:sub(1, cursor[2])
|
|
||||||
if opts.markdown and o == '`' and vim.bo.filetype == 'markdown' and before:match('^%s*``') then
|
|
||||||
return '`\n```' .. vim.api.nvim_replace_termcodes('<up>', true, true, true)
|
|
||||||
end
|
|
||||||
if opts.skip_next and next ~= '' and next:match(opts.skip_next) then
|
|
||||||
return o
|
|
||||||
end
|
|
||||||
if opts.skip_ts and #opts.skip_ts > 0 then
|
|
||||||
local ok, captures = pcall(vim.treesitter.get_captures_at_pos, 0, cursor[1] - 1, math.max(cursor[2] - 1, 0))
|
|
||||||
for _, capture in ipairs(ok and captures or {}) do
|
|
||||||
if vim.tbl_contains(opts.skip_ts, capture.capture) then
|
|
||||||
return o
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if opts.skip_unbalanced and next == c and c ~= o then
|
|
||||||
local _, count_open = line:gsub(vim.pesc(pair:sub(1, 1)), '')
|
|
||||||
local _, count_close = line:gsub(vim.pesc(pair:sub(2, 2)), '')
|
|
||||||
if count_close > count_open then
|
|
||||||
return o
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return open(pair, neigh_pattern)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
local sessions = require('mini.sessions')
|
|
||||||
|
M.setup = function()
|
||||||
|
local id = M.get_id()
|
||||||
|
if M.check_exists(id) then
|
||||||
|
vim.notify('Existing session for ' .. id)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>fs', function()
|
||||||
|
require('plugins.lib.session_jj').load()
|
||||||
|
end, { noremap = true, desc = 'mini session select' })
|
||||||
|
end
|
||||||
|
|
||||||
M.get_id = function()
|
M.get_id = function()
|
||||||
local jj_root = vim.system({ 'jj', 'workspace', 'root' }):wait()
|
local jj_root = vim.system({ 'jj', 'workspace', 'root' }):wait()
|
||||||
|
|
@ -27,7 +37,7 @@ M.get_id = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
M.check_exists = function(id)
|
M.check_exists = function(id)
|
||||||
for name, _ in pairs(sessions.detected) do
|
for name, _ in pairs(MiniSessions.detected) do
|
||||||
if name == id then
|
if name == id then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
@ -48,13 +58,14 @@ M.load = function()
|
||||||
}, { prompt = 'Session found at ' .. id .. ', load it?' }, function(c)
|
}, { prompt = 'Session found at ' .. id .. ', load it?' }, function(c)
|
||||||
if c == 'Yes' then
|
if c == 'Yes' then
|
||||||
-- load session (buffers, etc) as well as shada (marks)
|
-- load session (buffers, etc) as well as shada (marks)
|
||||||
sessions.read(id)
|
MiniSessions.read(id)
|
||||||
vim.notify('loaded jj session: ' .. id)
|
vim.notify('loaded jj session: ' .. id)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
sessions.write(id)
|
MiniSessions.write(id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
_G.M = M
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,6 @@ return {
|
||||||
{
|
{
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
event = 'VeryLazy',
|
event = 'VeryLazy',
|
||||||
dependencies = {
|
|
||||||
'folke/trouble.nvim',
|
|
||||||
event = 'VeryLazy',
|
|
||||||
opts = {
|
|
||||||
pinned = true,
|
|
||||||
focus = true,
|
|
||||||
follow = false,
|
|
||||||
auto_close = false,
|
|
||||||
win = {
|
|
||||||
size = 0.33,
|
|
||||||
position = 'right',
|
|
||||||
type = 'split',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function()
|
config = function()
|
||||||
vim.lsp.enable {
|
vim.lsp.enable {
|
||||||
'nil_ls',
|
'nil_ls',
|
||||||
|
|
@ -93,7 +78,7 @@ return {
|
||||||
'\\f',
|
'\\f',
|
||||||
function()
|
function()
|
||||||
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
||||||
vim.notify(string.format('Buffer formatting disabled: %s', vim.b.disable_autoformat))
|
Snacks.notify(string.format('Buffer formatting disabled: %s', vim.b.disable_autoformat))
|
||||||
end,
|
end,
|
||||||
mode = { 'n', 'x' },
|
mode = { 'n', 'x' },
|
||||||
desc = 'toggle buffer formatting',
|
desc = 'toggle buffer formatting',
|
||||||
|
|
@ -102,7 +87,7 @@ return {
|
||||||
'\\F',
|
'\\F',
|
||||||
function()
|
function()
|
||||||
vim.g.disable_autoformat = not vim.g.disable_autoformat
|
vim.g.disable_autoformat = not vim.g.disable_autoformat
|
||||||
vim.notify(string.format('Global formatting disabled: %s', vim.g.disable_autoformat))
|
Snacks.notify(string.format('Global formatting disabled: %s', vim.g.disable_autoformat))
|
||||||
end,
|
end,
|
||||||
mode = { 'n', 'x' },
|
mode = { 'n', 'x' },
|
||||||
desc = 'toggle global formatting',
|
desc = 'toggle global formatting',
|
||||||
|
|
|
||||||
|
|
@ -29,50 +29,9 @@ return {
|
||||||
':Git ',
|
':Git ',
|
||||||
desc = 'git command',
|
desc = 'git command',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'<leader>fs',
|
|
||||||
function()
|
|
||||||
require('plugins.lib.session_jj').load()
|
|
||||||
end,
|
|
||||||
noremap = true,
|
|
||||||
desc = 'mini session select',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'\\z',
|
|
||||||
function()
|
|
||||||
require('mini.misc').zoom()
|
|
||||||
end,
|
|
||||||
desc = 'mini zoom',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require('mini.basics').setup { mappings = { windows = true } }
|
require('mini.basics').setup { mappings = { windows = true } }
|
||||||
require('mini.statusline').setup {
|
|
||||||
content = {
|
|
||||||
active = function()
|
|
||||||
local mode, mode_hl = MiniStatusline.section_mode {}
|
|
||||||
-- local filename = MiniStatusline.section_filename { trunc_width = 140 }
|
|
||||||
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
|
|
||||||
'%=', -- End left alignment
|
|
||||||
-- { hl = 'MiniStatuslineDevinfo', strings = { filename } },
|
|
||||||
{ hl = 'MiniStatuslineDevinfo', strings = { diagnostics, lsp } },
|
|
||||||
{ hl = 'MiniStatuslineDevinfo', strings = { search } },
|
|
||||||
{ hl = mode_hl, strings = { mode } },
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
inactive = function()
|
|
||||||
local filename = MiniStatusline.section_filename { trunc_width = 140 }
|
|
||||||
return MiniStatusline.combine_groups {
|
|
||||||
{ hl = 'MiniStatuslineFilename', strings = { filename } },
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
local ai = require('mini.ai')
|
local ai = require('mini.ai')
|
||||||
local extra_ai = require('mini.extra').gen_ai_spec
|
local extra_ai = require('mini.extra').gen_ai_spec
|
||||||
|
|
@ -81,6 +40,7 @@ return {
|
||||||
custom_textobjects = {
|
custom_textobjects = {
|
||||||
i = extra_ai.indent(),
|
i = extra_ai.indent(),
|
||||||
g = extra_ai.buffer(),
|
g = extra_ai.buffer(),
|
||||||
|
l = extra_ai.line(),
|
||||||
u = ai.gen_spec.function_call(),
|
u = ai.gen_spec.function_call(),
|
||||||
a = ai.gen_spec.treesitter { a = '@parameter.outer', i = '@parameter.inner' },
|
a = ai.gen_spec.treesitter { a = '@parameter.outer', i = '@parameter.inner' },
|
||||||
k = ai.gen_spec.treesitter { a = '@assignment.lhs', i = '@assignment.lhs' },
|
k = ai.gen_spec.treesitter { a = '@assignment.lhs', i = '@assignment.lhs' },
|
||||||
|
|
@ -114,15 +74,8 @@ return {
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
verbose = {
|
|
||||||
write = false,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
local jj_sesh = require('plugins.lib.session_jj')
|
require('plugins.lib.session_jj').setup()
|
||||||
local jj_id = jj_sesh.get_id()
|
|
||||||
if jj_sesh.check_exists(jj_id) then
|
|
||||||
vim.notify('Existing session for ' .. jj_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
local jump = require('mini.jump2d')
|
local jump = require('mini.jump2d')
|
||||||
jump.setup {
|
jump.setup {
|
||||||
|
|
@ -130,14 +83,6 @@ return {
|
||||||
spotter = jump.gen_spotter.vimpattern(),
|
spotter = jump.gen_spotter.vimpattern(),
|
||||||
}
|
}
|
||||||
|
|
||||||
require('plugins.lib.minipairs') {
|
|
||||||
modes = { insert = true, command = false, terminal = false },
|
|
||||||
skip_next = [=[[%w%%%'%[%"%.%`%$]]=],
|
|
||||||
skip_ts = { 'string' },
|
|
||||||
skip_unbalanced = true,
|
|
||||||
markdown = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
local diff = require('mini.diff')
|
local diff = require('mini.diff')
|
||||||
diff.setup {
|
diff.setup {
|
||||||
options = { wrap_goto = true },
|
options = { wrap_goto = true },
|
||||||
|
|
@ -210,7 +155,6 @@ return {
|
||||||
})
|
})
|
||||||
|
|
||||||
local multi = require('mini.keymap').map_multistep
|
local multi = require('mini.keymap').map_multistep
|
||||||
multi({ 'i' }, '<BS>', { 'minipairs_bs' })
|
|
||||||
multi({ 'i', 's' }, '<Tab>', { 'blink_accept', 'vimsnippet_next', 'increase_indent' })
|
multi({ 'i', 's' }, '<Tab>', { 'blink_accept', 'vimsnippet_next', 'increase_indent' })
|
||||||
multi({ 'i', 's' }, '<S-Tab>', { 'vimsnippet_prev', 'decrease_indent' })
|
multi({ 'i', 's' }, '<S-Tab>', { 'vimsnippet_prev', 'decrease_indent' })
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,37 @@ return {
|
||||||
event = 'VeryLazy',
|
event = 'VeryLazy',
|
||||||
config = true,
|
config = true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'windwp/nvim-autopairs',
|
||||||
|
event = 'VeryLazy',
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
event = 'VeryLazy',
|
||||||
|
branch = 'main',
|
||||||
|
main = 'nvim-treesitter.configs',
|
||||||
|
config = true,
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
|
branch = 'main',
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
|
'RRethy/nvim-treesitter-textsubjects',
|
||||||
|
{
|
||||||
|
'nvim-treesitter/nvim-treesitter-context',
|
||||||
|
opts = {
|
||||||
|
max_lines = 5,
|
||||||
|
min_window_height = 50,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'jinh0/eyeliner.nvim',
|
'jinh0/eyeliner.nvim',
|
||||||
event = 'VeryLazy',
|
event = 'VeryLazy',
|
||||||
init = function()
|
config = true,
|
||||||
vim.api.nvim_set_hl(0, 'EyelinerPrimary', { underline = true })
|
|
||||||
vim.api.nvim_set_hl(0, 'EyelinerSecondary', { underline = true, bold = true })
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'MeanderingProgrammer/render-markdown.nvim',
|
'MeanderingProgrammer/render-markdown.nvim',
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ return {
|
||||||
priority = 1000,
|
priority = 1000,
|
||||||
opts = {
|
opts = {
|
||||||
bigfile = { enabled = true },
|
bigfile = { enabled = true },
|
||||||
quickfile = { enabled = true },
|
|
||||||
notifier = {
|
notifier = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
timeout = 4000,
|
timeout = 4000,
|
||||||
|
|
@ -14,16 +13,16 @@ return {
|
||||||
notification = {
|
notification = {
|
||||||
wo = { wrap = true },
|
wo = { wrap = true },
|
||||||
},
|
},
|
||||||
|
terminal = {
|
||||||
|
border = 'rounded',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
terminal = { enabled = true },
|
terminal = { enabled = true },
|
||||||
indent = { enabled = true },
|
indent = { enabled = true },
|
||||||
input = { enabled = true },
|
input = { enabled = true },
|
||||||
words = { enabled = true },
|
|
||||||
picker = {
|
picker = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
jump = {
|
jump = { reuse_win = true },
|
||||||
reuse_win = true,
|
|
||||||
},
|
|
||||||
matcher = {
|
matcher = {
|
||||||
frecency = true,
|
frecency = true,
|
||||||
history_bonus = true,
|
history_bonus = true,
|
||||||
|
|
@ -31,19 +30,23 @@ return {
|
||||||
},
|
},
|
||||||
layout = 'ivy_split',
|
layout = 'ivy_split',
|
||||||
sources = {
|
sources = {
|
||||||
files = { hidden = true },
|
|
||||||
grep = { hidden = true },
|
grep = { hidden = true },
|
||||||
explorer = { hidden = true },
|
explorer = { hidden = true },
|
||||||
git_files = { untracked = true },
|
|
||||||
lsp_symbols = {
|
lsp_symbols = {
|
||||||
filter = { default = true },
|
filter = { default = true },
|
||||||
layout = 'left',
|
layout = 'left',
|
||||||
},
|
},
|
||||||
smart = {
|
smart = {
|
||||||
|
sort = {
|
||||||
|
fields = {
|
||||||
|
'score:desc',
|
||||||
|
'idx',
|
||||||
|
'#text',
|
||||||
|
},
|
||||||
|
},
|
||||||
multi = {
|
multi = {
|
||||||
'marks',
|
'marks',
|
||||||
{ source = 'buffers', current = false },
|
{ source = 'buffers', current = false },
|
||||||
'recent',
|
|
||||||
{ source = 'files', hidden = true },
|
{ source = 'files', hidden = true },
|
||||||
{ source = 'git_files', untracked = true },
|
{ source = 'git_files', untracked = true },
|
||||||
},
|
},
|
||||||
|
|
@ -51,14 +54,10 @@ return {
|
||||||
},
|
},
|
||||||
win = {
|
win = {
|
||||||
input = {
|
input = {
|
||||||
keys = {
|
keys = { ['wq'] = { 'close', mode = 'i' } },
|
||||||
['wq'] = { 'close', mode = 'i' },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
list = {
|
list = {
|
||||||
keys = {
|
keys = { ['wq'] = { 'close', mode = 'i' } },
|
||||||
['wq'] = { 'close', mode = 'i' },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -75,7 +74,7 @@ return {
|
||||||
{
|
{
|
||||||
'<C-/>',
|
'<C-/>',
|
||||||
function()
|
function()
|
||||||
Snacks.terminal.toggle('$SHELL')
|
Snacks.terminal.toggle('command -v fish >/dev/null && exec fish || exec bash')
|
||||||
end,
|
end,
|
||||||
mode = { 'n', 't' },
|
mode = { 'n', 't' },
|
||||||
desc = 'terminal open',
|
desc = 'terminal open',
|
||||||
|
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
event = "VeryLazy",
|
|
||||||
dependencies = {
|
|
||||||
{
|
|
||||||
"nvim-treesitter/nvim-treesitter-context",
|
|
||||||
opts = {
|
|
||||||
max_lines = 2,
|
|
||||||
min_window_height = 50,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
||||||
"RRethy/nvim-treesitter-textsubjects",
|
|
||||||
},
|
|
||||||
main = "nvim-treesitter.configs",
|
|
||||||
opts = {
|
|
||||||
ensure_installed = {},
|
|
||||||
auto_install = false,
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
indent = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
matchup = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
textobjects = {
|
|
||||||
move = {
|
|
||||||
enable = true,
|
|
||||||
goto_next_start = {
|
|
||||||
["]a"] = "@parameter.inner",
|
|
||||||
["]f"] = "@function.outer",
|
|
||||||
},
|
|
||||||
goto_previous_start = {
|
|
||||||
["[a"] = "@parameter.inner",
|
|
||||||
["[f"] = "@function.outer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
swap = {
|
|
||||||
enable = true,
|
|
||||||
swap_next = {
|
|
||||||
["a]"] = "@parameter.inner",
|
|
||||||
},
|
|
||||||
swap_previous = {
|
|
||||||
["a["] = "@parameter.inner",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue