mirror of
https://github.com/iofq/nvim.nix.git
synced 2026-01-23 08:55:16 -06:00
Compare commits
2 commits
7e27221c7e
...
8fc4e6a407
| Author | SHA1 | Date | |
|---|---|---|---|
| 8fc4e6a407 | |||
| c8d9279372 |
9 changed files with 91 additions and 201 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
|
@ -12,7 +12,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
package_name: ["nvim-min"]
|
package_name: ["nvim"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: DeterminateSystems/nix-installer-action@main
|
- uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
## Usage
|
## Usage
|
||||||
Try it out!
|
Try it out!
|
||||||
```bash
|
```bash
|
||||||
nix run "github:iofq/nvim.nix" #nvim-min
|
nix run "github:iofq/nvim.nix" #nvim
|
||||||
```
|
```
|
||||||
|
|
||||||
Or use in a flake:
|
Or use in a flake:
|
||||||
|
|
|
||||||
183
flake.lock
generated
183
flake.lock
generated
|
|
@ -6,11 +6,11 @@
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760745932,
|
"lastModified": 1762016984,
|
||||||
"narHash": "sha256-Z9idyP9kiKxC10VL0vHnxcBwrkpNtBrC+Zxl9mQbCj8=",
|
"narHash": "sha256-ADZ2b2Oz+MOSjdKKCcQX9KmlhtmvVlZFEJr0HigWsOY=",
|
||||||
"owner": "iofq",
|
"owner": "iofq",
|
||||||
"repo": "dart.nvim",
|
"repo": "dart.nvim",
|
||||||
"rev": "26b476f2113143329637a27d4e52ce9772bcae5b",
|
"rev": "8822aabbfef95eda2b22a8f7ee08912c762ef941",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -35,38 +35,6 @@
|
||||||
"type": "github"
|
"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": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
|
@ -93,11 +61,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760813311,
|
"lastModified": 1762440070,
|
||||||
"narHash": "sha256-lbHQ7FXGzt6/IygWvJ1lCq+Txcut3xYYd6VIpF1ojkg=",
|
"narHash": "sha256-xxdepIcb39UJ94+YydGP221rjnpkDZUlykKuF54PsqI=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "4e627ac2e1b8f1de7f5090064242de9a259dbbc8",
|
"rev": "26d05891e14c88eb4a5d5bee659c0db5afb609d8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -188,29 +156,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"git-hooks_2": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat_3",
|
|
||||||
"gitignore": "gitignore_2",
|
|
||||||
"nixpkgs": [
|
|
||||||
"neovim-nightly-overlay",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1760663237,
|
|
||||||
"narHash": "sha256-BflA6U4AM1bzuRMR8QqzPXqh8sWVCNDzOdsxXEguJIc=",
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "git-hooks.nix",
|
|
||||||
"rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "git-hooks.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"gitignore": {
|
"gitignore": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|
@ -233,53 +178,6 @@
|
||||||
"type": "github"
|
"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": {
|
"luvit-meta": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
|
@ -298,22 +196,18 @@
|
||||||
},
|
},
|
||||||
"neovim-nightly-overlay": {
|
"neovim-nightly-overlay": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat_2",
|
|
||||||
"flake-parts": "flake-parts_2",
|
"flake-parts": "flake-parts_2",
|
||||||
"git-hooks": "git-hooks_2",
|
|
||||||
"hercules-ci-effects": "hercules-ci-effects",
|
|
||||||
"neovim-src": "neovim-src",
|
"neovim-src": "neovim-src",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
]
|
||||||
"treefmt-nix": "treefmt-nix"
|
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760832323,
|
"lastModified": 1762646693,
|
||||||
"narHash": "sha256-THAk4qzBOsp03bDBYK9Ek3mQEvl2g8Fea0QhpCoEzfs=",
|
"narHash": "sha256-h3c8Mcs4wI0U9JKzDyj1X+JUMc5KsfIXu2eyRE5ktAs=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "neovim-nightly-overlay",
|
"repo": "neovim-nightly-overlay",
|
||||||
"rev": "3c9432813e5528a13075f5493da6ff9ef249ad1d",
|
"rev": "2c33f92a62588cd30dbba26fa39384e29229bc6f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -325,11 +219,11 @@
|
||||||
"neovim-src": {
|
"neovim-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760810839,
|
"lastModified": 1762624437,
|
||||||
"narHash": "sha256-VYkZdjjMOYsugoSydDDWE/1l79swm4zc4NJl1Z0brjA=",
|
"narHash": "sha256-npSk+FSPkiaGwKTluegZ3tXqDpe3EFiRMQJ2Cc6rq4Y=",
|
||||||
"owner": "neovim",
|
"owner": "neovim",
|
||||||
"repo": "neovim",
|
"repo": "neovim",
|
||||||
"rev": "be73c35943f85e7835c3a0fc89bddaeba944db29",
|
"rev": "ded578625219d5056fdacdba4b04f0d5bf4fbe9d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -383,11 +277,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760913523,
|
"lastModified": 1762704076,
|
||||||
"narHash": "sha256-Il5+67iRA3xp0cIErILj4VwEJ2ICrDrvTAHEmBsZJKQ=",
|
"narHash": "sha256-kGEigbGxzpXpyeU9BtILXsMwTls5XcLyXEwYVfNjO4g=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "6a3b08503e9cab108f9f0ec27065c5854655662a",
|
"rev": "cdfa60cc7448c7943dd3feb0ab18e342d569c7a4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -399,11 +293,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_3": {
|
"nixpkgs_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760524057,
|
"lastModified": 1762363567,
|
||||||
"narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=",
|
"narHash": "sha256-YRqMDEtSMbitIMj+JLpheSz0pwEr0Rmy5mC7myl17xs=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5",
|
"rev": "ae814fd3904b621d8ab97418f1d0f2eb0d3716f4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -416,11 +310,11 @@
|
||||||
"nvim-treesitter": {
|
"nvim-treesitter": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760866486,
|
"lastModified": 1762599340,
|
||||||
"narHash": "sha256-ZeNCXy6+I18N+Nu2sKnEk2otVEb8V3tKhL8Jq95wS5k=",
|
"narHash": "sha256-hXs9TdytYtBeXW6nx9QZiQcqsuj1uLuZMf8kclaScQ8=",
|
||||||
"owner": "nvim-treesitter",
|
"owner": "nvim-treesitter",
|
||||||
"repo": "nvim-treesitter",
|
"repo": "nvim-treesitter",
|
||||||
"rev": "71bf1665f804d46f7e4b24ad7ffc11f6ea5b271a",
|
"rev": "d97d226cfd4c00af000b3b8529261352677fc6a8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -437,11 +331,11 @@
|
||||||
"nvim-treesitter-textobjects": "nvim-treesitter-textobjects"
|
"nvim-treesitter-textobjects": "nvim-treesitter-textobjects"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760906917,
|
"lastModified": 1762704339,
|
||||||
"narHash": "sha256-WJScDX0q/+PCRpvBSlJfV01kwvu9WCk5YDpzW2Zswj8=",
|
"narHash": "sha256-hRGD+CE04Z1qAJAaiJs6o+blS0WUEqfVS/5cqA0NcDI=",
|
||||||
"owner": "iofq",
|
"owner": "iofq",
|
||||||
"repo": "nvim-treesitter-main",
|
"repo": "nvim-treesitter-main",
|
||||||
"rev": "420c14c0523d65c6c7ce943e8f2fb896eff950e3",
|
"rev": "69e9583fe72fa2dbffcb740563a9cc48396e3f75",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -453,11 +347,11 @@
|
||||||
"nvim-treesitter-textobjects": {
|
"nvim-treesitter-textobjects": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1756368113,
|
"lastModified": 1762622273,
|
||||||
"narHash": "sha256-+KmOpRi4JAqm6UqYdtk80jwFrJhLCs0lZM/Liofq0R4=",
|
"narHash": "sha256-gzeT2gtmFaXhRSC13mijH6tlk/eWRZaUrGiEpKoAorA=",
|
||||||
"owner": "nvim-treesitter",
|
"owner": "nvim-treesitter",
|
||||||
"repo": "nvim-treesitter-textobjects",
|
"repo": "nvim-treesitter-textobjects",
|
||||||
"rev": "1b2d85d3de6114c4bcea89ffb2cd1ce9e3a19931",
|
"rev": "7024f8687b060dd9a425bde1fa8621c896a38138",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -506,27 +400,6 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"treefmt-nix": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"neovim-nightly-overlay",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1760802554,
|
|
||||||
"narHash": "sha256-5YkOYOCF8/XNw89/ABKFB0c/P78U2EVuKRDGTql6+kA=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "treefmt-nix",
|
|
||||||
"rev": "296ebf0c3668ebceb3b0bfee55298f112b4b5754",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "treefmt-nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,6 @@
|
||||||
packages = rec {
|
packages = rec {
|
||||||
default = nvim;
|
default = nvim;
|
||||||
nvim = pkgs.nvim-pkg;
|
nvim = pkgs.nvim-pkg;
|
||||||
nvim-min = pkgs.nvim-min-pkg;
|
|
||||||
};
|
};
|
||||||
devShells = {
|
devShells = {
|
||||||
default = shell;
|
default = shell;
|
||||||
|
|
|
||||||
|
|
@ -17,41 +17,18 @@ let
|
||||||
nvim-treesitter
|
nvim-treesitter
|
||||||
nvim-treesitter-textobjects
|
nvim-treesitter-textobjects
|
||||||
quicker-nvim
|
quicker-nvim
|
||||||
refactoring-nvim
|
|
||||||
render-markdown-nvim
|
render-markdown-nvim
|
||||||
snacks-nvim
|
snacks-nvim
|
||||||
];
|
];
|
||||||
|
|
||||||
basePackages = with prev; [
|
packages = with prev; [
|
||||||
ripgrep
|
ripgrep
|
||||||
fd
|
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
|
in
|
||||||
{
|
{
|
||||||
nvim-pkg = mkNeovim {
|
nvim-pkg = mkNeovim {
|
||||||
inherit plugins;
|
inherit plugins packages;
|
||||||
packages = basePackages ++ extraPackages;
|
|
||||||
};
|
|
||||||
|
|
||||||
nvim-min-pkg = mkNeovim {
|
|
||||||
inherit plugins;
|
|
||||||
packages = basePackages;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nvim-luarc-json = final.mk-luarc-json {
|
nvim-luarc-json = final.mk-luarc-json {
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,21 @@ function M.file_history(filename)
|
||||||
end
|
end
|
||||||
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 function get_history(f)
|
||||||
local status_raw = vim.fn.system(
|
local status_raw = vim.fn.system(
|
||||||
'jj log --ignore-working-copy --no-graph'
|
'jj log --ignore-working-copy --no-graph'
|
||||||
|
|
@ -85,6 +100,7 @@ function M.file_history(filename)
|
||||||
title = 'jj file history for ' .. filename,
|
title = 'jj file history for ' .. filename,
|
||||||
items = get_history(filename),
|
items = get_history(filename),
|
||||||
preview = preview,
|
preview = preview,
|
||||||
|
confirm = confirm,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ cmd('FileType', {
|
||||||
local ns = vim.api.nvim_create_namespace('nvim.difftool.hl')
|
local ns = vim.api.nvim_create_namespace('nvim.difftool.hl')
|
||||||
vim.api.nvim_buf_clear_namespace(event.buf, ns, 0, -1)
|
vim.api.nvim_buf_clear_namespace(event.buf, ns, 0, -1)
|
||||||
for i, item in ipairs(qf) do
|
for i, item in ipairs(qf) do
|
||||||
local path = vim.fn.fnamemodify(item.user_data.right, ':t')
|
local path = vim.fn.fnamemodify(item.user_data.right, ':.')
|
||||||
local hl = 'Added'
|
local hl = 'Added'
|
||||||
if
|
if
|
||||||
exec('git diff --quiet -- %s', path) ~= 0
|
exec('git diff --quiet -- %s', path) ~= 0
|
||||||
|
|
@ -98,6 +98,45 @@ cmd('BufWinEnter', {
|
||||||
vim.cmd(string.format('%dcopen', math.min(10, #items)))
|
vim.cmd(string.format('%dcopen', math.min(10, #items)))
|
||||||
end)
|
end)
|
||||||
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,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,7 @@ vim.schedule(function()
|
||||||
|
|
||||||
require('mini.git').setup()
|
require('mini.git').setup()
|
||||||
map('n', '<leader>gb', '<Cmd>Git blame -- %<CR>')
|
map('n', '<leader>gb', '<Cmd>Git blame -- %<CR>')
|
||||||
map('n', '<leader>go', function()
|
map('n', '<leader>go', MiniGit.show_at_cursor)
|
||||||
return MiniGit.show_at_cursor()
|
|
||||||
end)
|
|
||||||
|
|
||||||
local jump = require('mini.jump2d')
|
local jump = require('mini.jump2d')
|
||||||
jump.setup {
|
jump.setup {
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,7 @@ local map = vim.keymap.set
|
||||||
require('mini.basics').setup { mappings = { windows = true } }
|
require('mini.basics').setup { mappings = { windows = true } }
|
||||||
require('mini.icons').setup()
|
require('mini.icons').setup()
|
||||||
|
|
||||||
require('dart').setup {
|
require('dart').setup {}
|
||||||
tabline = {
|
|
||||||
icons = false,
|
|
||||||
label_marked_fg = 'cyan',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
require('snacks').setup {
|
require('snacks').setup {
|
||||||
bigfile = { enabled = true },
|
bigfile = { enabled = true },
|
||||||
|
|
@ -65,12 +60,6 @@ vim.schedule(function()
|
||||||
require('nvim-treesitter-textobjects').setup()
|
require('nvim-treesitter-textobjects').setup()
|
||||||
require('nvim-autopairs').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()
|
require('quicker').setup()
|
||||||
map('n', '<leader>qf', function()
|
map('n', '<leader>qf', function()
|
||||||
require('quicker').toggle { max_height = 20 }
|
require('quicker').toggle { max_height = 20 }
|
||||||
|
|
@ -82,7 +71,6 @@ vim.schedule(function()
|
||||||
json = { 'jq' },
|
json = { 'jq' },
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
python = { 'ruff' },
|
python = { 'ruff' },
|
||||||
nix = { 'nixfmt' },
|
|
||||||
fish = { 'fish_indent' },
|
fish = { 'fish_indent' },
|
||||||
['*'] = { 'trim_whitespace' },
|
['*'] = { 'trim_whitespace' },
|
||||||
},
|
},
|
||||||
|
|
@ -128,7 +116,7 @@ vim.schedule(function()
|
||||||
sources = {
|
sources = {
|
||||||
default = { 'lsp', 'path', 'snippets', 'ripgrep', 'buffer' },
|
default = { 'lsp', 'path', 'snippets', 'ripgrep', 'buffer' },
|
||||||
providers = {
|
providers = {
|
||||||
lsp = { fallbacks = {} }, -- include buffer even when LSP is active
|
lsp = { fallbacks = {}, async = true }, -- include buffer even when LSP is active
|
||||||
path = { opts = { get_cwd = vim.fn.getcwd } }, -- use nvim pwd instead of current file pwd
|
path = { opts = { get_cwd = vim.fn.getcwd } }, -- use nvim pwd instead of current file pwd
|
||||||
ripgrep = {
|
ripgrep = {
|
||||||
module = 'blink-ripgrep',
|
module = 'blink-ripgrep',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue