mirror of
https://github.com/iofq/nvim.nix.git
synced 2026-01-23 00:45:17 -06:00
cleanup, mini rice
This commit is contained in:
parent
3231eec14e
commit
c46a229713
11 changed files with 127 additions and 87 deletions
34
flake.lock
generated
34
flake.lock
generated
|
|
@ -378,22 +378,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-uns": {
|
||||
"locked": {
|
||||
"lastModified": 1750506804,
|
||||
"narHash": "sha256-VLFNc4egNjovYVxDGyBYTrvVCgDYgENp5bVi9fPTDYc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4206c4cb56751df534751b058295ea61357bbbaa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1750749555,
|
||||
|
|
@ -410,6 +394,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"oil-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1749076816,
|
||||
"narHash": "sha256-fbRbRT9VJdppOs4hML1J113qLHdj7YRuSDQgZkt34cM=",
|
||||
"owner": "stevearc",
|
||||
"repo": "oil.nvim",
|
||||
"rev": "08c2bce8b00fd780fb7999dbffdf7cd174e896fb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "stevearc",
|
||||
"repo": "oil.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
|
|
@ -417,7 +417,7 @@
|
|||
"mini-nvim": "mini-nvim",
|
||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-uns": "nixpkgs-uns"
|
||||
"oil-nvim": "oil-nvim"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
description = "Neovim derivation";
|
||||
|
||||
inputs = {
|
||||
nixpkgs-uns.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/master";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
|
||||
|
|
@ -14,6 +13,10 @@
|
|||
url = "github:echasnovski/mini.nvim";
|
||||
flake = false;
|
||||
};
|
||||
oil-nvim = {
|
||||
url = "github:stevearc/oil.nvim";
|
||||
flake = false;
|
||||
};
|
||||
# Add bleeding-edge plugins here.
|
||||
# They can be updated with `nix flake update` (make sure to commit the generated flake.lock)
|
||||
# wf-nvim = {
|
||||
|
|
@ -52,7 +55,6 @@
|
|||
nil
|
||||
stylua
|
||||
luajitPackages.luacheck
|
||||
nvim-dev
|
||||
alejandra
|
||||
];
|
||||
shellHook = ''
|
||||
|
|
@ -67,6 +69,7 @@
|
|||
default = nvim;
|
||||
nvim = pkgs.nvim-pkg;
|
||||
nvim-min = pkgs.nvim-min-pkg;
|
||||
nvim-dev = pkgs.nvim-dev;
|
||||
};
|
||||
devShells = {
|
||||
default = shell;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ with final.pkgs.lib; let
|
|||
mkNeovim = pkgs.callPackage ./mkNeovim.nix {inherit pkgs-wrapNeovim;};
|
||||
|
||||
mini-nvim-git = mkNvimPlugin inputs.mini-nvim "mini.nvim";
|
||||
oil-nvim-git = mkNvimPlugin inputs.oil-nvim "oil.nvim";
|
||||
|
||||
all-plugins = with pkgs.vimPlugins; [
|
||||
blink-cmp
|
||||
|
|
@ -25,13 +26,13 @@ with final.pkgs.lib; let
|
|||
lazy-nvim
|
||||
mini-nvim-git
|
||||
nightfox-nvim
|
||||
nvim-bqf
|
||||
nvim-lint
|
||||
nvim-lspconfig
|
||||
nvim-treesitter-context
|
||||
nvim-treesitter-textobjects
|
||||
nvim-treesitter.withAllGrammars
|
||||
oil-nvim
|
||||
oil-nvim-git
|
||||
quicker-nvim
|
||||
refactoring-nvim
|
||||
render-markdown-nvim
|
||||
snacks-nvim
|
||||
|
|
@ -40,7 +41,6 @@ with final.pkgs.lib; let
|
|||
|
||||
basePackages = with pkgs; [
|
||||
ripgrep
|
||||
fd
|
||||
];
|
||||
# Extra packages that should be included on nixos but don't need to be bundled
|
||||
extraPackages = with pkgs; [
|
||||
|
|
@ -49,6 +49,7 @@ with final.pkgs.lib; let
|
|||
yamllint
|
||||
jq
|
||||
hadolint
|
||||
alejandra
|
||||
shellcheck
|
||||
|
||||
# LSPs
|
||||
|
|
@ -56,6 +57,10 @@ with final.pkgs.lib; let
|
|||
lua-language-server
|
||||
nil
|
||||
basedpyright
|
||||
|
||||
#other
|
||||
jujutsu
|
||||
fd
|
||||
];
|
||||
in {
|
||||
nvim-pkg = mkNeovim {
|
||||
|
|
@ -69,8 +74,8 @@ in {
|
|||
plugins = all-plugins;
|
||||
appName = "nvim";
|
||||
extraPackages = basePackages;
|
||||
withNodeJs = false;
|
||||
withSqlite = false;
|
||||
withPython3 = false;
|
||||
};
|
||||
|
||||
# This is meant to be used within a devshell.
|
||||
|
|
|
|||
1
nvim/ftplugin/php.lua
Normal file
1
nvim/ftplugin/php.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.opt.tabstop = 4
|
||||
|
|
@ -5,6 +5,9 @@ vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
|
|||
vim.opt.cmdheight = 1
|
||||
vim.opt.diffopt = 'internal,filler,closeoff,inline:char'
|
||||
vim.opt.expandtab = true -- insert tabs as spaces
|
||||
vim.o.foldenable = true
|
||||
vim.o.foldmethod = 'expr' -- use tree-sitter for folding method
|
||||
vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||
vim.opt.inccommand = 'split' -- incremental live completion
|
||||
vim.opt.list = true
|
||||
vim.opt.nrformats:append('alpha') -- let Ctrl-a do letters as well
|
||||
|
|
@ -80,7 +83,8 @@ vim.keymap.set('n', '<S-l>', vim.cmd.bnext, { noremap = true, silent = true })
|
|||
vim.keymap.set('n', '<S-h>', vim.cmd.bprev, { noremap = true, silent = true })
|
||||
vim.keymap.set('v', '<', '<gv')
|
||||
vim.keymap.set('v', '>', '>gv')
|
||||
vim.keymap.set('v', 'q:', '<Nop')
|
||||
vim.keymap.set({ 'v', 'n' }, 'q:', '<nop>')
|
||||
vim.keymap.set({ 'n', 'v' }, '<C-b>', '<C-a>') -- usually have C-a mapped to tmux
|
||||
|
||||
-- resize splits if window got resized
|
||||
vim.api.nvim_create_autocmd({ 'VimResized' }, {
|
||||
|
|
|
|||
38
nvim/lua/plugins/lib/minipairs.lua
Normal file
38
nvim/lua/plugins/lib/minipairs.lua
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
-- 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
|
||||
|
|
@ -39,6 +39,10 @@ return {
|
|||
},
|
||||
analyses = {
|
||||
unusedvariable = true,
|
||||
unusedparams = true,
|
||||
useany = true,
|
||||
unusedwrite = true,
|
||||
nilness = true,
|
||||
shadow = true,
|
||||
},
|
||||
hints = {
|
||||
|
|
@ -52,6 +56,8 @@ return {
|
|||
},
|
||||
usePlaceholders = true,
|
||||
staticcheck = true,
|
||||
completeUnimported = true,
|
||||
semanticTokens = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
@ -154,6 +160,7 @@ return {
|
|||
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
||||
end,
|
||||
mode = { 'n', 'x' },
|
||||
desc = 'toggle buffer formatting',
|
||||
},
|
||||
{
|
||||
'\\F',
|
||||
|
|
@ -161,6 +168,7 @@ return {
|
|||
vim.g.disable_autoformat = not vim.g.disable_autoformat
|
||||
end,
|
||||
mode = { 'n', 'x' },
|
||||
desc = 'toggle global formatting',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
|
|
@ -171,6 +179,7 @@ return {
|
|||
lua = { 'stylua' },
|
||||
python = { 'ruff' },
|
||||
nix = { 'alejandra' },
|
||||
fish = { 'fish_indent' },
|
||||
['*'] = { 'trim_whitespace' },
|
||||
},
|
||||
format_on_save = function(bufnr)
|
||||
|
|
@ -181,8 +190,8 @@ return {
|
|||
return { timeout_ms = 500, lsp_format = 'last' }
|
||||
end,
|
||||
default_format_opts = {
|
||||
timeout_ms = 500,
|
||||
lsp_format = 'last',
|
||||
timeout_ms = 1500,
|
||||
lsp_format = 'fallback',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -197,6 +206,7 @@ return {
|
|||
sh = { 'shellcheck' },
|
||||
go = { 'golangcilint' },
|
||||
ruby = { 'rubocop' },
|
||||
fish = { 'fish' },
|
||||
}
|
||||
vim.api.nvim_command('au BufWritePost * lua require("lint").try_lint()')
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -1,45 +1,7 @@
|
|||
-- ripped from lazyvim
|
||||
local function setup_pairs(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
|
||||
|
||||
return {
|
||||
{
|
||||
'echasnovski/mini.nvim',
|
||||
dependencies = 'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
lazy = false,
|
||||
keys = {
|
||||
{
|
||||
|
|
@ -112,7 +74,24 @@ return {
|
|||
},
|
||||
}
|
||||
vim.schedule(function()
|
||||
require('mini.ai').setup()
|
||||
local ai = require('mini.ai')
|
||||
local extra_ai = require('mini.extra').gen_ai_spec
|
||||
ai.setup {
|
||||
n_lines = 300,
|
||||
custom_textobjects = {
|
||||
i = extra_ai.indent(),
|
||||
g = extra_ai.buffer(),
|
||||
u = ai.gen_spec.function_call(),
|
||||
a = ai.gen_spec.treesitter { a = '@parameter.outer', i = '@parameter.inner' },
|
||||
k = ai.gen_spec.treesitter { a = '@assignment.lhs', i = '@assignment.lhs' },
|
||||
v = ai.gen_spec.treesitter { a = '@assignment.rhs', i = '@assignment.rhs' },
|
||||
f = ai.gen_spec.treesitter { a = '@function.outer', i = '@function.inner' },
|
||||
o = ai.gen_spec.treesitter {
|
||||
a = { '@block.outer', '@conditional.outer', '@loop.outer' },
|
||||
i = { '@block.inner', '@conditional.inner', '@loop.inner' },
|
||||
},
|
||||
},
|
||||
}
|
||||
require('mini.align').setup()
|
||||
require('mini.bracketed').setup()
|
||||
require('mini.icons').setup()
|
||||
|
|
@ -138,7 +117,7 @@ return {
|
|||
spotter = jump.gen_spotter.vimpattern(),
|
||||
}
|
||||
|
||||
setup_pairs {
|
||||
require('plugins.lib.minipairs') {
|
||||
modes = { insert = true, command = true, terminal = false },
|
||||
skip_next = [=[[%w%%%'%[%"%.%`%$]]=],
|
||||
skip_ts = { 'string' },
|
||||
|
|
@ -167,6 +146,7 @@ return {
|
|||
{ mode = 'n', keys = 'z' },
|
||||
{ mode = 'n', keys = ']' },
|
||||
{ mode = 'n', keys = '[' },
|
||||
{ mode = 'n', keys = '\\' },
|
||||
},
|
||||
window = {
|
||||
config = { width = 'auto' },
|
||||
|
|
|
|||
|
|
@ -127,12 +127,23 @@ return {
|
|||
},
|
||||
},
|
||||
{
|
||||
'kevinhwang91/nvim-bqf',
|
||||
'stevearc/quicker.nvim',
|
||||
event = 'VeryLazy',
|
||||
opts = {
|
||||
auto_resize_height = true,
|
||||
preview = {
|
||||
winblend = 0,
|
||||
config = true,
|
||||
keys = {
|
||||
{
|
||||
'<leader>qf',
|
||||
function()
|
||||
require('quicker').toggle()
|
||||
end,
|
||||
desc = 'Toggle qflist',
|
||||
},
|
||||
{
|
||||
'<leader>qr',
|
||||
function()
|
||||
require('quicker').refresh()
|
||||
end,
|
||||
desc = 'Refresh qflist',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ return {
|
|||
indent = { enabled = true },
|
||||
input = { enabled = true },
|
||||
words = { enabled = true },
|
||||
scope = { enabled = true },
|
||||
picker = {
|
||||
enabled = true,
|
||||
matcher = { frecency = true },
|
||||
|
|
|
|||
|
|
@ -15,11 +15,9 @@ return {
|
|||
config = function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = {},
|
||||
ignore_install = { 'org' },
|
||||
auto_install = false,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
|
|
@ -28,28 +26,17 @@ return {
|
|||
enable = true,
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
['ia'] = '@parameter.inner',
|
||||
['ik'] = '@assignment.lhs',
|
||||
['iv'] = '@assignment.rhs',
|
||||
['is'] = { query = '@local.scope', query_group = 'locals', desc = 'Select language scope' },
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
goto_next_start = {
|
||||
[']a'] = '@parameter.inner',
|
||||
[']f'] = '@function.outer',
|
||||
[']]'] = '@statement.outer',
|
||||
[']t'] = '@statement.outer',
|
||||
},
|
||||
goto_previous_start = {
|
||||
['[a'] = '@parameter.inner',
|
||||
['[f'] = '@function.outer',
|
||||
['[['] = '@statement.outer',
|
||||
['[t'] = '@statement.outer',
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue