Compare commits

..

No commits in common. "8fc4e6a40762bc511b36533cb4a96de028fc1e8e" and "ce017fd37cc7b007adfb3377f9142793be8fdf58" have entirely different histories.

10 changed files with 204 additions and 161 deletions

View file

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
package_name: ["nvim"]
package_name: ["nvim-min"]
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main

View file

@ -5,7 +5,7 @@
## Usage
Try it out!
```bash
nix run "github:iofq/nvim.nix" #nvim
nix run "github:iofq/nvim.nix" #nvim-min
```
Or use in a flake:

183
flake.lock generated
View file

@ -6,11 +6,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1762016984,
"narHash": "sha256-ADZ2b2Oz+MOSjdKKCcQX9KmlhtmvVlZFEJr0HigWsOY=",
"lastModified": 1760366615,
"narHash": "sha256-qGWNl+UQLvdFl8AAgywOHthizfKovk8az1xhRhQeVn8=",
"owner": "iofq",
"repo": "dart.nvim",
"rev": "8822aabbfef95eda2b22a8f7ee08912c762ef941",
"rev": "5fac43b0f7b5500c69a51a3717aef8ccceacd178",
"type": "github"
},
"original": {
@ -35,6 +35,38 @@
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
@ -61,11 +93,11 @@
]
},
"locked": {
"lastModified": 1762440070,
"narHash": "sha256-xxdepIcb39UJ94+YydGP221rjnpkDZUlykKuF54PsqI=",
"lastModified": 1759362264,
"narHash": "sha256-wfG0S7pltlYyZTM+qqlhJ7GMw2fTF4mLKCIVhLii/4M=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "26d05891e14c88eb4a5d5bee659c0db5afb609d8",
"rev": "758cf7296bee11f1706a574c77d072b8a7baa881",
"type": "github"
},
"original": {
@ -156,6 +188,29 @@
"type": "github"
}
},
"git-hooks_2": {
"inputs": {
"flake-compat": "flake-compat_3",
"gitignore": "gitignore_2",
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
]
},
"locked": {
"lastModified": 1759523803,
"narHash": "sha256-PTod9NG+i3XbbnBKMl/e5uHDBYpwIWivQ3gOWSEuIEM=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "cfc9f7bb163ad8542029d303e599c0f7eee09835",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
@ -178,6 +233,53 @@
"type": "github"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"neovim-nightly-overlay",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"hercules-ci-effects": {
"inputs": {
"flake-parts": [
"neovim-nightly-overlay",
"flake-parts"
],
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
]
},
"locked": {
"lastModified": 1758022363,
"narHash": "sha256-ENUhCRWgSX4ni751HieNuQoq06dJvApV/Nm89kh+/A0=",
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"rev": "1a3667d33e247ad35ca250698d63f49a5453d824",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"type": "github"
}
},
"luvit-meta": {
"flake": false,
"locked": {
@ -196,18 +298,22 @@
},
"neovim-nightly-overlay": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_2",
"git-hooks": "git-hooks_2",
"hercules-ci-effects": "hercules-ci-effects",
"neovim-src": "neovim-src",
"nixpkgs": [
"nixpkgs"
]
],
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1762646693,
"narHash": "sha256-h3c8Mcs4wI0U9JKzDyj1X+JUMc5KsfIXu2eyRE5ktAs=",
"lastModified": 1760313895,
"narHash": "sha256-39JFRb006AOsIcOq+03H3y6YcGyaphk1CW5DRi14cOE=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "2c33f92a62588cd30dbba26fa39384e29229bc6f",
"rev": "7ff73a295b0065bde2f8b43b31558136ca77bd98",
"type": "github"
},
"original": {
@ -219,11 +325,11 @@
"neovim-src": {
"flake": false,
"locked": {
"lastModified": 1762624437,
"narHash": "sha256-npSk+FSPkiaGwKTluegZ3tXqDpe3EFiRMQJ2Cc6rq4Y=",
"lastModified": 1760312166,
"narHash": "sha256-RnB+oJcP37YT9pjr1osUQtJc+1qcVyaaeSbiSyXwm1Y=",
"owner": "neovim",
"repo": "neovim",
"rev": "ded578625219d5056fdacdba4b04f0d5bf4fbe9d",
"rev": "72b0bfa1fb7e897e5126aabae718a5480f466b9e",
"type": "github"
},
"original": {
@ -277,11 +383,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1762704076,
"narHash": "sha256-kGEigbGxzpXpyeU9BtILXsMwTls5XcLyXEwYVfNjO4g=",
"lastModified": 1760326837,
"narHash": "sha256-z+C6KRPRjwqEsTEAwUavapBWcbR7YOlQP91O+W5L1ek=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cdfa60cc7448c7943dd3feb0ab18e342d569c7a4",
"rev": "cfe6b045750c3aa5127817bc3f44f2909b1ee175",
"type": "github"
},
"original": {
@ -293,11 +399,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1762363567,
"narHash": "sha256-YRqMDEtSMbitIMj+JLpheSz0pwEr0Rmy5mC7myl17xs=",
"lastModified": 1760038930,
"narHash": "sha256-Oncbh0UmHjSlxO7ErQDM3KM0A5/Znfofj2BSzlHLeVw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ae814fd3904b621d8ab97418f1d0f2eb0d3716f4",
"rev": "0b4defa2584313f3b781240b29d61f6f9f7e0df3",
"type": "github"
},
"original": {
@ -310,11 +416,11 @@
"nvim-treesitter": {
"flake": false,
"locked": {
"lastModified": 1762599340,
"narHash": "sha256-hXs9TdytYtBeXW6nx9QZiQcqsuj1uLuZMf8kclaScQ8=",
"lastModified": 1760260935,
"narHash": "sha256-To/syCZPs7vKA0WkuBz7ZxCGT/wzj705QfxZng6Nsjo=",
"owner": "nvim-treesitter",
"repo": "nvim-treesitter",
"rev": "d97d226cfd4c00af000b3b8529261352677fc6a8",
"rev": "0606c7a9dcaa5c5beee0b0f09043e9fdd1ba0a68",
"type": "github"
},
"original": {
@ -331,11 +437,11 @@
"nvim-treesitter-textobjects": "nvim-treesitter-textobjects"
},
"locked": {
"lastModified": 1762704339,
"narHash": "sha256-hRGD+CE04Z1qAJAaiJs6o+blS0WUEqfVS/5cqA0NcDI=",
"lastModified": 1760324917,
"narHash": "sha256-ZlVGaUbxHf4DNR4GWhF1mvlMhP8IBbwF0g8WO1SL+Yw=",
"owner": "iofq",
"repo": "nvim-treesitter-main",
"rev": "69e9583fe72fa2dbffcb740563a9cc48396e3f75",
"rev": "da2262419eb66cfa426aa62ccf1fc8fdea33b4a0",
"type": "github"
},
"original": {
@ -347,11 +453,11 @@
"nvim-treesitter-textobjects": {
"flake": false,
"locked": {
"lastModified": 1762622273,
"narHash": "sha256-gzeT2gtmFaXhRSC13mijH6tlk/eWRZaUrGiEpKoAorA=",
"lastModified": 1756368113,
"narHash": "sha256-+KmOpRi4JAqm6UqYdtk80jwFrJhLCs0lZM/Liofq0R4=",
"owner": "nvim-treesitter",
"repo": "nvim-treesitter-textobjects",
"rev": "7024f8687b060dd9a425bde1fa8621c896a38138",
"rev": "1b2d85d3de6114c4bcea89ffb2cd1ce9e3a19931",
"type": "github"
},
"original": {
@ -400,6 +506,27 @@
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
]
},
"locked": {
"lastModified": 1760120816,
"narHash": "sha256-gq9rdocpmRZCwLS5vsHozwB6b5nrOBDNc2kkEaTXHfg=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "761ae7aff00907b607125b2f57338b74177697ed",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",

View file

@ -73,6 +73,7 @@
packages = rec {
default = nvim;
nvim = pkgs.nvim-pkg;
nvim-min = pkgs.nvim-min-pkg;
};
devShells = {
default = shell;

1
new
View file

@ -1 +0,0 @@
print('kjsnadf')

View file

@ -17,18 +17,41 @@ let
nvim-treesitter
nvim-treesitter-textobjects
quicker-nvim
refactoring-nvim
render-markdown-nvim
snacks-nvim
];
packages = with prev; [
basePackages = with prev; [
ripgrep
fd
];
# Extra packages that should be included on nixos but don't need to be bundled
extraPackages = with prev; [
# linters
yamllint
jq
hadolint
nixfmt
shellcheck
golangci-lint
# LSPs
gopls
lua-language-server
nixd
basedpyright
];
in
{
nvim-pkg = mkNeovim {
inherit plugins packages;
inherit plugins;
packages = basePackages ++ extraPackages;
};
nvim-min-pkg = mkNeovim {
inherit plugins;
packages = basePackages;
};
nvim-luarc-json = final.mk-luarc-json {

View file

@ -49,58 +49,4 @@ function M.status()
}
end
function M.file_history(filename)
local function preview(ctx)
if ctx.item.rev then
Snacks.picker.preview.cmd(
{ 'jj', 'log', '--ignore-working-copy', '--git', '-r', ctx.item.rev, '-p', filename },
ctx
)
else
ctx.preview:reset()
return 'No preview available.'
end
end
local function confirm(picker, item)
picker:close()
local cmd = string.format('jj show --git -r %s', item.rev)
local out = vim.fn.systemlist(cmd)
local bufnr = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, out)
vim.bo[bufnr].bufhidden = 'wipe'
vim.bo[bufnr].buftype = 'nofile'
vim.bo[bufnr].filetype = 'diff'
vim.keymap.set('n', 'q', vim.cmd.bdelete, { buffer = bufnr, noremap = true })
vim.api.nvim_set_current_buf(bufnr)
end
local function get_history(f)
local status_raw = vim.fn.system(
'jj log --ignore-working-copy --no-graph'
.. ' --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",),)\''
.. ' -- '
.. f
)
local lines = {}
for line in status_raw:gmatch('[^\r\n]+') do
local rev = string.match(line, '(%w+)%s.*')
table.insert(lines, {
text = line,
rev = rev,
})
end
return lines
end
Snacks.picker.pick {
format = 'text',
title = 'jj file history for ' .. filename,
items = get_history(filename),
preview = preview,
confirm = confirm,
}
end
return M

View file

@ -30,7 +30,7 @@ cmd({ 'FocusGained', 'TermClose', 'TermLeave' }, {
})
-- Configure difftool buffers
cmd('FileType', {
vim.api.nvim_create_autocmd('FileType', {
pattern = 'qf',
group = vim.api.nvim_create_augroup('difftool', { clear = true }),
callback = function(event)
@ -41,14 +41,14 @@ cmd('FileType', {
local qf = vim.fn.getqflist()
local entry = qf[1]
if not entry or not entry.user_data or not entry.user_data.diff then
if not entry or not entry.user_data.diff then
return nil
end
local ns = vim.api.nvim_create_namespace('nvim.difftool.hl')
vim.api.nvim_buf_clear_namespace(event.buf, ns, 0, -1)
for i, item in ipairs(qf) do
local path = vim.fn.fnamemodify(item.user_data.right, ':.')
local path = vim.fn.fnamemodify(item.user_data.right, ':t')
local hl = 'Added'
if
exec('git diff --quiet -- %s', path) ~= 0
@ -75,71 +75,6 @@ cmd('FileType', {
end,
})
-- open conflicts in qflist
cmd('BufWinEnter', {
callback = function(event)
if not vim.wo.diff then
return
end
local items = {}
while true do
local found = vim.fn.search('^<<<<<<<', 'W')
if found == 0 then
break
end
local line = vim.api.nvim_buf_get_lines(event.buf, found - 1, found, false)[1]
table.insert(items, { bufnr = event.buf, lnum = found, text = line })
end
if #items > 1 then
vim.fn.setqflist(items, 'r')
vim.schedule(function()
vim.cmd(string.format('%dcopen', math.min(10, #items)))
end)
end
local function get_hunks(bufnr)
local conf_start = vim.fn.search('^<<<<<<<', 'bc')
local base_start = vim.fn.search('^|||||||', 'W')
local base_end = vim.fn.search('^=======', 'W')
local conf_end = vim.fn.search('^>>>>>>>', 'W')
local left = vim.api.nvim_buf_get_lines(bufnr, conf_start, base_start - 1, false)
local right = vim.api.nvim_buf_get_lines(bufnr, base_end, conf_end - 1, false)
return {
start = conf_start,
stop = conf_end,
left = left,
right = right,
}
end
local function apply_hunk(hunks, first)
local result = {}
if first == -1 then -- left first
vim.list_extend(result, hunks.left)
vim.list_extend(result, hunks.right)
else
vim.list_extend(result, hunks.right)
vim.list_extend(result, hunks.left)
end
-- apply hunk in place
vim.api.nvim_buf_set_lines(0, hunks.start - 1, hunks.stop, false, result)
end
-- "combine" mappings ala vscode's merge editor
vim.keymap.set('n', '<leader>dl', function()
apply_hunk(get_hunks(event.buf), -1)
end, { buffer = event.buf })
vim.keymap.set('n', '<leader>dr', function()
apply_hunk(get_hunks(event.buf), 1)
end, { buffer = event.buf })
end,
})
-- Init treesitter
cmd('FileType', {
group = vim.api.nvim_create_augroup('treesitter', { clear = true }),

View file

@ -18,7 +18,9 @@ vim.schedule(function()
require('mini.git').setup()
map('n', '<leader>gb', '<Cmd>Git blame -- %<CR>')
map('n', '<leader>go', MiniGit.show_at_cursor)
map('n', '<leader>go', function()
return MiniGit.show_at_cursor()
end)
local jump = require('mini.jump2d')
jump.setup {

View file

@ -3,7 +3,12 @@ local map = vim.keymap.set
require('mini.basics').setup { mappings = { windows = true } }
require('mini.icons').setup()
require('dart').setup {}
require('dart').setup {
tabline = {
icons = false,
label_marked_fg = 'cyan',
},
}
require('snacks').setup {
bigfile = { enabled = true },
@ -51,15 +56,19 @@ map('n', '<leader>f.', Snacks.picker.resume)
map('n', '<leader>fb', Snacks.picker.buffers)
map('n', '<leader>fq', Snacks.picker.qflist)
map('n', '<leader>jf', require('iofq.snacks_jj').status)
map('n', '<leader>jh', function()
require('iofq.snacks_jj').file_history(vim.api.nvim_buf_get_name(0))
end)
vim.schedule(function()
require('nvim-treesitter').setup()
require('nvim-treesitter-textobjects').setup()
require('render-markdown').setup()
require('nvim-autopairs').setup()
require('refactoring').setup()
map('n', '<leader>rr', require('refactoring').select_refactor)
map('n', '<leader>rv', function()
require('refactoring').refactor('Inline Variable')
end)
require('quicker').setup()
map('n', '<leader>qf', function()
require('quicker').toggle { max_height = 20 }
@ -71,6 +80,7 @@ vim.schedule(function()
json = { 'jq' },
lua = { 'stylua' },
python = { 'ruff' },
nix = { 'nixfmt' },
fish = { 'fish_indent' },
['*'] = { 'trim_whitespace' },
},
@ -116,7 +126,7 @@ vim.schedule(function()
sources = {
default = { 'lsp', 'path', 'snippets', 'ripgrep', 'buffer' },
providers = {
lsp = { fallbacks = {}, async = true }, -- include buffer even when LSP is active
lsp = { fallbacks = {} }, -- include buffer even when LSP is active
path = { opts = { get_cwd = vim.fn.getcwd } }, -- use nvim pwd instead of current file pwd
ripgrep = {
module = 'blink-ripgrep',