mirror of
https://github.com/iofq/nvim.nix.git
synced 2026-01-23 08:55:16 -06:00
Compare commits
2 commits
63f5dd46e9
...
3c5c3a6745
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c5c3a6745 | |||
| 775af7d730 |
9 changed files with 55 additions and 169 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
99
flake.lock
generated
99
flake.lock
generated
|
|
@ -61,11 +61,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1765835352,
|
||||
"narHash": "sha256-XswHlK/Qtjasvhd1nOa1e8MgZ8GS//jBoTqWtrS1Giw=",
|
||||
"lastModified": 1767609335,
|
||||
"narHash": "sha256-feveD98mQpptwrAEggBQKJTYbvwwglSbOv53uCfH9PY=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "a34fae9c08a15ad73f295041fec82323541400a9",
|
||||
"rev": "250481aafeb741edfe23d29195671c19b36b6dca",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -203,11 +203,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1766016290,
|
||||
"narHash": "sha256-YMf/PUyY4z7RlIe/Dzn1NnxZGS0Vp2eHxcMNWJM9q+A=",
|
||||
"lastModified": 1768003501,
|
||||
"narHash": "sha256-pxxUR3VRDcDpMgF1qb9FnlHAEOGi24bk6pdB1QzL1II=",
|
||||
"owner": "nix-community",
|
||||
"repo": "neovim-nightly-overlay",
|
||||
"rev": "f7fbc4e3d4ccea45eaa5b187884592eb42dfdbbd",
|
||||
"rev": "d31b28318affe5d58ef12e7f72a7adfa66930a7a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -219,11 +219,11 @@
|
|||
"neovim-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1766014002,
|
||||
"narHash": "sha256-KE/ufBGH8XFXTw3Vt1DrK1rQmAEp1Q+oyLQibX5UKO0=",
|
||||
"lastModified": 1768000044,
|
||||
"narHash": "sha256-hcdQHR8l8oZDIl0vXKNtbrN+32dTs9EYvlqppoHgG2k=",
|
||||
"owner": "neovim",
|
||||
"repo": "neovim",
|
||||
"rev": "c172fd9f464d5766eab9071e8f4770504c920c05",
|
||||
"rev": "930817f1009d9d392103b5440e2503cb47fdacc0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -277,98 +277,27 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1765779637,
|
||||
"narHash": "sha256-KJ2wa/BLSrTqDjbfyNx70ov/HdgNBCBBSQP3BIzKnv4=",
|
||||
"lastModified": 1768020509,
|
||||
"narHash": "sha256-V7El1ktdJ0/WWEr6wGBKFYu433vitrWvxmvPk79FsSc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1306659b587dc277866c7b69eb97e5f07864d8c4",
|
||||
"rev": "299d331f770cdf7c466a4faa08b3070a767d681d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"ref": "master",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1765472234,
|
||||
"narHash": "sha256-9VvC20PJPsleGMewwcWYKGzDIyjckEz8uWmT0vCDYK0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2fbfb1d73d239d2402a8fe03963e37aab15abe8b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-treesitter": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1765632521,
|
||||
"narHash": "sha256-HT+UzX1m4hm2QAqDa0dltArr3gMyYhXHnHoYkkQBWZA=",
|
||||
"owner": "nvim-treesitter",
|
||||
"repo": "nvim-treesitter",
|
||||
"rev": "74b119812e9f82bccc2f0eca156faff0354362ae",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-treesitter",
|
||||
"ref": "main",
|
||||
"repo": "nvim-treesitter",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-treesitter-main": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nvim-treesitter": "nvim-treesitter",
|
||||
"nvim-treesitter-textobjects": "nvim-treesitter-textobjects"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1765744132,
|
||||
"narHash": "sha256-+Uw+965kDJTriyUGiYF/eYAuQBowoBZpLzJswInqLCY=",
|
||||
"owner": "iofq",
|
||||
"repo": "nvim-treesitter-main",
|
||||
"rev": "2e8b5c686fc346c34b1d2a269584b32f480e7b7f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "iofq",
|
||||
"repo": "nvim-treesitter-main",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-treesitter-textobjects": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1765672441,
|
||||
"narHash": "sha256-w2dzc5oWyEoPUgbqaAuNKCeFeh81rYJPOCPVRnFC724=",
|
||||
"owner": "nvim-treesitter",
|
||||
"repo": "nvim-treesitter-textobjects",
|
||||
"rev": "0d7c800fadcfe2d33089f5726cb8907fc846eece",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nvim-treesitter",
|
||||
"ref": "main",
|
||||
"repo": "nvim-treesitter-textobjects",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"dart": "dart",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"gen-luarc": "gen-luarc",
|
||||
"neovim-nightly-overlay": "neovim-nightly-overlay",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nvim-treesitter-main": "nvim-treesitter-main"
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
|
|
|
|||
17
flake.nix
17
flake.nix
|
|
@ -2,7 +2,7 @@
|
|||
description = "Neovim derivation";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.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";
|
||||
|
|
@ -15,9 +15,6 @@
|
|||
dart = {
|
||||
url = "github:iofq/dart.nvim";
|
||||
};
|
||||
nvim-treesitter-main = {
|
||||
url = "github:iofq/nvim-treesitter-main";
|
||||
};
|
||||
};
|
||||
outputs =
|
||||
inputs@{
|
||||
|
|
@ -32,17 +29,6 @@
|
|||
neovim-overlay = import ./nix/neovim-overlay.nix { inherit inputs; };
|
||||
finalOverlays = [
|
||||
inputs.neovim-nightly-overlay.overlays.default
|
||||
inputs.nvim-treesitter-main.overlays.default
|
||||
(final: prev: {
|
||||
vimPlugins = prev.vimPlugins.extend (
|
||||
f: p: {
|
||||
nvim-treesitter = p.nvim-treesitter.withAllGrammars;
|
||||
nvim-treesitter-textobjects = p.nvim-treesitter-textobjects.overrideAttrs {
|
||||
dependencies = [ f.nvim-treesitter ];
|
||||
};
|
||||
}
|
||||
);
|
||||
})
|
||||
neovim-overlay
|
||||
];
|
||||
in
|
||||
|
|
@ -73,6 +59,7 @@
|
|||
packages = rec {
|
||||
default = nvim;
|
||||
nvim = pkgs.nvim-pkg;
|
||||
nvim-min = pkgs.nvim-min-pkg;
|
||||
};
|
||||
devShells = {
|
||||
default = shell;
|
||||
|
|
|
|||
|
|
@ -14,21 +14,43 @@ let
|
|||
nvim-autopairs
|
||||
nvim-lint
|
||||
nvim-lspconfig
|
||||
nvim-treesitter
|
||||
nvim-treesitter.withAllGrammars
|
||||
nvim-treesitter-textobjects
|
||||
quicker-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 {
|
||||
|
|
|
|||
|
|
@ -62,21 +62,6 @@ function M.file_history(filename)
|
|||
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'
|
||||
|
|
@ -100,7 +85,6 @@ function M.file_history(filename)
|
|||
title = 'jj file history for ' .. filename,
|
||||
items = get_history(filename),
|
||||
preview = preview,
|
||||
confirm = confirm,
|
||||
}
|
||||
end
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ cmd('FileType', {
|
|||
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
|
||||
|
|
@ -98,45 +98,6 @@ cmd('BufWinEnter', {
|
|||
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,
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ vim.schedule(function()
|
|||
ai.setup {
|
||||
n_lines = 300,
|
||||
custom_textobjects = {
|
||||
i = require('mini.extra').gen_ai_spec.indent(),
|
||||
b = require('mini.extra').gen_ai_spec.buffer(),
|
||||
a = ai.gen_spec.treesitter { a = '@parameter.outer', i = '@parameter.inner' },
|
||||
f = ai.gen_spec.treesitter { a = '@function.outer', i = '@function.inner' },
|
||||
},
|
||||
|
|
@ -18,7 +16,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 {
|
||||
|
|
|
|||
|
|
@ -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 },
|
||||
|
|
@ -71,6 +76,7 @@ vim.schedule(function()
|
|||
json = { 'jq' },
|
||||
lua = { 'stylua' },
|
||||
python = { 'ruff' },
|
||||
nix = { 'nixfmt' },
|
||||
fish = { 'fish_indent' },
|
||||
['*'] = { 'trim_whitespace' },
|
||||
},
|
||||
|
|
@ -93,14 +99,11 @@ vim.schedule(function()
|
|||
|
||||
require('lint').linters_by_ft = {
|
||||
docker = { 'hadolint' },
|
||||
yaml = { 'yamllint' },
|
||||
sh = { 'shellcheck' },
|
||||
go = { 'golangcilint' },
|
||||
ruby = { 'rubocop' },
|
||||
fish = { 'fish' },
|
||||
bash = { 'bash' },
|
||||
nix = { 'nix' },
|
||||
php = { 'php' },
|
||||
}
|
||||
vim.api.nvim_create_autocmd({ 'BufWritePost' }, {
|
||||
callback = function()
|
||||
|
|
@ -116,7 +119,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',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue