Compare commits
5 Commits
3a15a7cdaf
...
00464e0e65
| Author | SHA1 | Date | |
|---|---|---|---|
| 00464e0e65 | |||
| f215ce2ab5 | |||
| 75b22a9223 | |||
| a9a438ab6f | |||
| 063c23441e |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/sh
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/sh
|
||||
|
||||
for i in */; do
|
||||
cd "$i"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
#set -x
|
||||
|
||||
dir="$(realpath ../..)"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
#set -x
|
||||
|
||||
Test="Test2"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
#set -x
|
||||
|
||||
Test="Test3"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
#set -x
|
||||
|
||||
Test="Test4"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
#set -x
|
||||
|
||||
Test=`basename $PWD`
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
#set -x
|
||||
|
||||
Test=`basename $PWD`
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
#set -x
|
||||
|
||||
Test=`basename $PWD`
|
||||
|
||||
@ -37,6 +37,7 @@ function M.get(user_config)
|
||||
tab_separator_selected = { fg = separator_fg, bg = active_bg },
|
||||
|
||||
tab_close = { fg = C.red, bg = inactive_bg },
|
||||
indicator_visible = { fg = C.peach, bg = inactive_bg, style = styles },
|
||||
indicator_selected = { fg = C.peach, bg = active_bg, style = styles },
|
||||
-- separators
|
||||
separator = { fg = separator_fg, bg = inactive_bg },
|
||||
@ -87,6 +88,7 @@ function M.get(user_config)
|
||||
diagnostic_selected = { fg = C.subtext0, bg = active_bg, style = styles },
|
||||
-- Modified
|
||||
modified = { fg = C.peach, bg = inactive_bg },
|
||||
modified_visible = { fg = C.peach, bg = inactive_bg },
|
||||
modified_selected = { fg = C.peach, bg = active_bg },
|
||||
}
|
||||
|
||||
|
||||
@ -417,7 +417,7 @@ function M.get()
|
||||
-- show an indicator that we have running lsps
|
||||
if view.lsp.name == false and next(active_clients) ~= nil then return assets.lsp.server .. " " .. "Lsp" end
|
||||
|
||||
-- show the actual name of the runing lsps
|
||||
-- show the actual name of the running lsps
|
||||
local index = 0
|
||||
local lsp_names = ""
|
||||
for _, lsp_config in ipairs(active_clients) do
|
||||
|
||||
@ -238,6 +238,9 @@ function M.get()
|
||||
NeogitTagDistance = {
|
||||
fg = C.blue,
|
||||
},
|
||||
NeogitWinSeparator = {
|
||||
link = "WinSeparator",
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ local function handler(err, result, ctx)
|
||||
end
|
||||
|
||||
local function inline_handler(err, result, ctx)
|
||||
if err then return end
|
||||
if err or not result then return end
|
||||
local bufnr = ctx.bufnr
|
||||
|
||||
if vim.api.nvim_get_current_buf() ~= bufnr then return end
|
||||
|
||||
@ -25,8 +25,7 @@
|
||||
'numToStr/Comment.nvim',
|
||||
opts = {
|
||||
-- add any options here
|
||||
},
|
||||
lazy = false,
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@ -32,6 +32,7 @@ local M = {
|
||||
twig = '{#%s#}',
|
||||
vim = '"%s',
|
||||
lean_b = '/-%s-/',
|
||||
ruby_block = '=begin%s=end',
|
||||
}
|
||||
|
||||
---Lang table that contains commentstring (linewise/blockwise) for multiple filetypes
|
||||
@ -40,23 +41,28 @@ local M = {
|
||||
local L = setmetatable({
|
||||
arduino = { M.cxx_l, M.cxx_b },
|
||||
applescript = { M.hash },
|
||||
asm = { M.hash },
|
||||
astro = { M.html },
|
||||
autohotkey = { M.semicolon, M.cxx_b },
|
||||
bash = { M.hash },
|
||||
beancount = { M.semicolon },
|
||||
bib = { M.latex },
|
||||
blueprint = { M.cxx_l }, -- Blueprint doesn't have block comments
|
||||
c = { M.cxx_l, M.cxx_b },
|
||||
cabal = { M.dash },
|
||||
cairo = { M.cxx_l },
|
||||
cmake = { M.hash, M.hash_bracket },
|
||||
conf = { M.hash },
|
||||
conkyrc = { M.dash, M.dash_bracket },
|
||||
coq = { M.fsharp_b },
|
||||
coq = { M.fsharp_b, M.fsharp_b },
|
||||
cpp = { M.cxx_l, M.cxx_b },
|
||||
cs = { M.cxx_l, M.cxx_b },
|
||||
css = { M.cxx_b, M.cxx_b },
|
||||
cuda = { M.cxx_l, M.cxx_b },
|
||||
cue = { M.cxx_l },
|
||||
dart = { M.cxx_l, M.cxx_b },
|
||||
dhall = { M.dash, M.haskell_b },
|
||||
dnsmasq = { M.hash },
|
||||
dosbatch = { 'REM%s' },
|
||||
dot = { M.cxx_l, M.cxx_b },
|
||||
dts = { M.cxx_l, M.cxx_b },
|
||||
@ -72,6 +78,7 @@ local L = setmetatable({
|
||||
fsharp = { M.cxx_l, M.fsharp_b },
|
||||
gdb = { M.hash },
|
||||
gdscript = { M.hash },
|
||||
gdshader = { M.cxx_l, M.cxx_b },
|
||||
gitignore = { M.hash },
|
||||
gleam = { M.cxx_l },
|
||||
glsl = { M.cxx_l, M.cxx_b },
|
||||
@ -83,18 +90,23 @@ local L = setmetatable({
|
||||
handlebars = { M.handlebars, M.handlebars },
|
||||
haskell = { M.dash, M.haskell_b },
|
||||
haxe = { M.cxx_l, M.cxx_b },
|
||||
hcl = { M.hash, M.cxx_b },
|
||||
heex = { M.html, M.html },
|
||||
html = { M.html, M.html },
|
||||
htmldjango = { M.html, M.html },
|
||||
hyprlang = { M.hash },
|
||||
idris = { M.dash, M.haskell_b },
|
||||
idris2 = { M.dash, M.haskell_b },
|
||||
ini = { M.hash },
|
||||
jai = { M.cxx_l, M.cxx_b },
|
||||
java = { M.cxx_l, M.cxx_b },
|
||||
javascript = { M.cxx_l, M.cxx_b },
|
||||
javascriptreact = { M.cxx_l, M.cxx_b },
|
||||
jq = { M.hash },
|
||||
jsonc = { M.cxx_l },
|
||||
jsonnet = { M.cxx_l, M.cxx_b },
|
||||
julia = { M.hash, '#=%s=#' },
|
||||
kdl = { M.cxx_l, M.cxx_b },
|
||||
kotlin = { M.cxx_l, M.cxx_b },
|
||||
lean = { M.dash, M.lean_b },
|
||||
lean3 = { M.dash, M.lean_b },
|
||||
@ -102,20 +114,26 @@ local L = setmetatable({
|
||||
lilypond = { M.latex, '%{%s%}' },
|
||||
lisp = { M.lisp_l, M.lisp_b },
|
||||
lua = { M.dash, M.dash_bracket },
|
||||
metalua = { M.dash, M.dash_bracket },
|
||||
luau = { M.dash, M.dash_bracket },
|
||||
markdown = { M.html, M.html },
|
||||
make = { M.hash },
|
||||
mbsyncrc = { M.dbl_hash },
|
||||
mermaid = { '%%%s' },
|
||||
meson = { M.hash },
|
||||
mojo = { M.hash },
|
||||
nextflow = { M.cxx_l, M.cxx_b },
|
||||
nim = { M.hash, '#[%s]#' },
|
||||
nix = { M.hash, M.cxx_b },
|
||||
nu = { M.hash },
|
||||
objc = { M.cxx_l, M.cxx_b },
|
||||
objcpp = { M.cxx_l, M.cxx_b },
|
||||
ocaml = { M.fsharp_b, M.fsharp_b },
|
||||
odin = { M.cxx_l, M.cxx_b },
|
||||
openscad = { M.cxx_l, M.cxx_b },
|
||||
plantuml = { "'%s", "/'%s'/" },
|
||||
purescript = { M.dash, M.haskell_b },
|
||||
puppet = { M.hash },
|
||||
python = { M.hash }, -- Python doesn't have block comments
|
||||
php = { M.cxx_l, M.cxx_b },
|
||||
prisma = { M.cxx_l },
|
||||
@ -125,15 +143,17 @@ local L = setmetatable({
|
||||
racket = { M.lisp_l, M.lisp_b },
|
||||
rasi = { M.cxx_l, M.cxx_b },
|
||||
readline = { M.hash },
|
||||
reason = { M.cxx_l, M.cxx_b },
|
||||
rego = { M.hash },
|
||||
remind = { M.hash },
|
||||
rescript = { M.cxx_l, M.cxx_b },
|
||||
robot = { M.hash }, -- Robotframework doesn't have block comments
|
||||
ron = { M.cxx_l, M.cxx_b },
|
||||
ruby = { M.hash },
|
||||
ruby = { M.hash, M.ruby_block },
|
||||
rust = { M.cxx_l, M.cxx_b },
|
||||
sbt = { M.cxx_l, M.cxx_b },
|
||||
scala = { M.cxx_l, M.cxx_b },
|
||||
scss = { M.cxx_b, M.cxx_b },
|
||||
scheme = { M.lisp_l, M.lisp_b },
|
||||
sh = { M.hash },
|
||||
solidity = { M.cxx_l, M.cxx_b },
|
||||
@ -143,11 +163,13 @@ local L = setmetatable({
|
||||
svelte = { M.html, M.html },
|
||||
swift = { M.cxx_l, M.cxx_b },
|
||||
sxhkdrc = { M.hash },
|
||||
systemverilog = { M.cxx_l, M.cxx_b },
|
||||
tablegen = { M.cxx_l, M.cxx_b },
|
||||
teal = { M.dash, M.dash_bracket },
|
||||
terraform = { M.hash, M.cxx_b },
|
||||
tex = { M.latex },
|
||||
template = { M.dbl_hash },
|
||||
tidal = { M.dash, M.haskell_b },
|
||||
tmux = { M.hash },
|
||||
toml = { M.hash },
|
||||
twig = { M.twig, M.twig },
|
||||
@ -155,11 +177,13 @@ local L = setmetatable({
|
||||
typescriptreact = { M.cxx_l, M.cxx_b },
|
||||
typst = { M.cxx_l, M.cxx_b },
|
||||
v = { M.cxx_l, M.cxx_b },
|
||||
vala = { M.cxx_l, M.cxx_b },
|
||||
verilog = { M.cxx_l },
|
||||
vhdl = { M.dash },
|
||||
vim = { M.vim },
|
||||
vifm = { M.vim },
|
||||
vue = { M.html, M.html },
|
||||
wgsl = { M.cxx_l, M.cxx_b },
|
||||
xdefaults = { '!%s' },
|
||||
xml = { M.html, M.html },
|
||||
xonsh = { M.hash }, -- Xonsh doesn't have block comments
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
set -e
|
||||
make fastlint
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
set -e
|
||||
IFS=' '
|
||||
while read local_ref _local_sha _remote_ref _remote_sha; do
|
||||
|
||||
@ -30,7 +30,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: stevearc/nvim-typecheck-action@v1
|
||||
- uses: stevearc/nvim-typecheck-action@v2
|
||||
with:
|
||||
path: lua
|
||||
|
||||
|
||||
@ -1,5 +1,39 @@
|
||||
# Changelog
|
||||
|
||||
## [5.9.0](https://github.com/stevearc/conform.nvim/compare/v5.8.0...v5.9.0) (2024-06-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add support for d2 ([#445](https://github.com/stevearc/conform.nvim/issues/445)) ([5e7a000](https://github.com/stevearc/conform.nvim/commit/5e7a000e4f239b56077e5a38680c5e9a0bf60e6a))
|
||||
* add support for efmt ([#428](https://github.com/stevearc/conform.nvim/issues/428)) ([a1d3c0a](https://github.com/stevearc/conform.nvim/commit/a1d3c0aff306b974bc07b4cdf52f1766dd89fc90))
|
||||
* add support for for vsg ([#451](https://github.com/stevearc/conform.nvim/issues/451)) ([cf562dd](https://github.com/stevearc/conform.nvim/commit/cf562dd160c27a7fc5342dfce7e1227746dd3aaa))
|
||||
* add support for fprettify ([#429](https://github.com/stevearc/conform.nvim/issues/429)) ([7999faf](https://github.com/stevearc/conform.nvim/commit/7999faf7bbec7461f62dabd57cccb784c8d804b5))
|
||||
* add support for hindent ([#430](https://github.com/stevearc/conform.nvim/issues/430)) ([9f46982](https://github.com/stevearc/conform.nvim/commit/9f46982b8dc2bf1e267d386ccd096f896369e323))
|
||||
* add support for kcl fmt ([#431](https://github.com/stevearc/conform.nvim/issues/431)) ([03a07d5](https://github.com/stevearc/conform.nvim/commit/03a07d58be09a681ab162f3a069dc9e86589bacb))
|
||||
* add support for npm-groovy-lint ([#433](https://github.com/stevearc/conform.nvim/issues/433)) ([8fd894c](https://github.com/stevearc/conform.nvim/commit/8fd894cdc248cad64dbfeac6b89e03db9f737a35))
|
||||
* add treesitter query formatter ([#425](https://github.com/stevearc/conform.nvim/issues/425)) ([63e0a32](https://github.com/stevearc/conform.nvim/commit/63e0a32c85a39484813957dc480f171907aa90b9))
|
||||
* **erlang:** support erlfmt ([#436](https://github.com/stevearc/conform.nvim/issues/436)) ([948c83b](https://github.com/stevearc/conform.nvim/commit/948c83b00eb81bf16b54c6a092ddd88be46793cd))
|
||||
* formatter override can use ([#453](https://github.com/stevearc/conform.nvim/issues/453)) ([a28a425](https://github.com/stevearc/conform.nvim/commit/a28a4255e5c5631ee9c58537592fca05447f0503))
|
||||
* **fortran:** support findent ([#426](https://github.com/stevearc/conform.nvim/issues/426)) ([969cdf5](https://github.com/stevearc/conform.nvim/commit/969cdf50b011bec08b4fb8bd3ea3031df183501b))
|
||||
* **haskell:** support stylish-haskell ([#435](https://github.com/stevearc/conform.nvim/issues/435)) ([dc612fb](https://github.com/stevearc/conform.nvim/commit/dc612fbf6194fcb3ef401871db1cae74134e9423))
|
||||
* **latex:** support llf ([#446](https://github.com/stevearc/conform.nvim/issues/446)) ([1743ee6](https://github.com/stevearc/conform.nvim/commit/1743ee6f9fc52825bdee9493e246876bed591bc1))
|
||||
* **lua:** support lua-format ([#432](https://github.com/stevearc/conform.nvim/issues/432)) ([b421e95](https://github.com/stevearc/conform.nvim/commit/b421e95a31e6c3b064a964292255e3b9c762fddd))
|
||||
* **python:** support pyink ([#427](https://github.com/stevearc/conform.nvim/issues/427)) ([8b147ca](https://github.com/stevearc/conform.nvim/commit/8b147ca7abccbb19dd952dbb7aeebcdd56b02aee))
|
||||
* **rst:** support rstfmt ([#434](https://github.com/stevearc/conform.nvim/issues/434)) ([294bd1d](https://github.com/stevearc/conform.nvim/commit/294bd1d4d32d4c4b797bfc997ea0e4c1a7019ce5))
|
||||
* support docstrfmt ([#441](https://github.com/stevearc/conform.nvim/issues/441)) ([c841697](https://github.com/stevearc/conform.nvim/commit/c84169717ee74698f9df20c6437fa06df03bf1fe))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* always add cwd to debug logs ([44879ff](https://github.com/stevearc/conform.nvim/commit/44879ffd0268ba931532537b1ee44ed77cd90a5d))
|
||||
* **dprint:** add support for binary in node_modules ([#422](https://github.com/stevearc/conform.nvim/issues/422)) ([b1285c7](https://github.com/stevearc/conform.nvim/commit/b1285c7c24559688a9e02d3828d9b72f553b3549))
|
||||
* **format-queries:** update query formatter for breaking changes in nvim-treesitter ([7159a23](https://github.com/stevearc/conform.nvim/commit/7159a23d19fb982269dae2e8147ebbe34965095b))
|
||||
* improve error message when formatter config is missing ([3f61023](https://github.com/stevearc/conform.nvim/commit/3f610236caf3db6576a0dd7760e5b0731659db68))
|
||||
* **rustfmt:** add a default cwd when config file is detected ([#419](https://github.com/stevearc/conform.nvim/issues/419)) ([355049b](https://github.com/stevearc/conform.nvim/commit/355049bc318c3c968b2b434cea9a5bcdf6bf8ea7))
|
||||
* set correct file extension for unsaved buffer temp files ([#440](https://github.com/stevearc/conform.nvim/issues/440)) ([88b699b](https://github.com/stevearc/conform.nvim/commit/88b699b595703f1ae9d9061c050e52b1fe7c33f1))
|
||||
* use vim.fs.root in neovim 0.10 ([584adfe](https://github.com/stevearc/conform.nvim/commit/584adfe7c665827601f4245c0c40273e8bc9e7cb))
|
||||
|
||||
## [5.8.0](https://github.com/stevearc/conform.nvim/compare/v5.7.0...v5.8.0) (2024-05-22)
|
||||
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ require("conform").setup({
|
||||
format_on_save = {
|
||||
-- These options will be passed to conform.format()
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
})
|
||||
```
|
||||
@ -207,22 +207,29 @@ You can view this list in vim with `:help conform-formatters`
|
||||
- [crystal](https://crystal-lang.org/) - Format Crystal code.
|
||||
- [csharpier](https://github.com/belav/csharpier) - The opinionated C# code formatter.
|
||||
- [cue_fmt](https://cuelang.org) - Format CUE files using `cue fmt` command.
|
||||
- [d2](https://github.com/terrastruct/d2) - D2 is a modern diagram scripting language that turns text to diagrams.
|
||||
- [darker](https://github.com/akaihola/darker) - Run black only on changed lines.
|
||||
- [dart_format](https://dart.dev/tools/dart-format) - Replace the whitespace in your program with formatting that follows Dart guidelines.
|
||||
- [deno_fmt](https://deno.land/manual/tools/formatter) - Use [Deno](https://deno.land/) to format TypeScript, JavaScript/JSON and markdown.
|
||||
- [dfmt](https://github.com/dlang-community/dfmt) - Formatter for D source code.
|
||||
- [djlint](https://github.com/Riverside-Healthcare/djLint) - ✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang.
|
||||
- [docstrfmt](https://github.com/LilSpazJoekp/docstrfmt) - reStructuredText formatter.
|
||||
- [dprint](https://github.com/dprint/dprint) - Pluggable and configurable code formatting platform written in Rust.
|
||||
- [easy-coding-standard](https://github.com/easy-coding-standard/easy-coding-standard) - ecs - Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP_CodeSniffer.
|
||||
- [efmt](https://github.com/sile/efmt) - Erlang code formatter.
|
||||
- [elm_format](https://github.com/avh4/elm-format) - elm-format formats Elm source code according to a standard set of rules based on the official [Elm Style Guide](https://elm-lang.org/docs/style-guide).
|
||||
- [erb_format](https://github.com/nebulab/erb-formatter) - Format ERB files with speed and precision.
|
||||
- [erlfmt](https://github.com/WhatsApp/erlfmt) - An automated code formatter for Erlang.
|
||||
- [eslint_d](https://github.com/mantoni/eslint_d.js/) - Like ESLint, but faster.
|
||||
- [fantomas](https://github.com/fsprojects/fantomas) - F# source code formatter.
|
||||
- [findent](https://github.com/wvermin/findent) - Indent, relabel and convert Fortran sources.
|
||||
- [fish_indent](https://fishshell.com/docs/current/cmds/fish_indent.html) - Indent or otherwise prettify a piece of fish code.
|
||||
- [fixjson](https://github.com/rhysd/fixjson) - JSON Fixer for Humans using (relaxed) JSON5.
|
||||
- [fnlfmt](https://git.sr.ht/~technomancy/fnlfmt) - A formatter for Fennel code.
|
||||
- [forge_fmt](https://github.com/foundry-rs/foundry) - Forge is a command-line tool that ships with Foundry. Forge tests, builds, and deploys your smart contracts.
|
||||
- [format-queries](https://github.com/nvim-treesitter/nvim-treesitter/blob/main/CONTRIBUTING.md#formatting) - Tree-sitter query formatter.
|
||||
- [fourmolu](https://hackage.haskell.org/package/fourmolu) - A fork of ormolu that uses four space indentation and allows arbitrary configuration.
|
||||
- [fprettify](https://github.com/fortran-lang/fprettify) - Auto-formatter for modern fortran source code.
|
||||
- [gci](https://github.com/daixiang0/gci) - GCI, a tool that controls Go package import order and makes it always deterministic.
|
||||
- [gdformat](https://github.com/Scony/godot-gdscript-toolkit) - A formatter for Godot's gdscript.
|
||||
- [gersemi](https://github.com/BlankSpruce/gersemi) - A formatter to make your CMake code the real treasure.
|
||||
@ -235,6 +242,7 @@ You can view this list in vim with `:help conform-formatters`
|
||||
- [golines](https://github.com/segmentio/golines) - A golang formatter that fixes long lines.
|
||||
- [google-java-format](https://github.com/google/google-java-format) - Reformats Java source code according to Google Java Style.
|
||||
- [hcl](https://github.com/hashicorp/hcl) - A formatter for HCL files.
|
||||
- [hindent](https://github.com/mihaimaruseac/hindent) - Haskell pretty printer.
|
||||
- [htmlbeautifier](https://github.com/threedaymonk/htmlbeautifier) - A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.
|
||||
- [indent](https://www.gnu.org/software/indent/) - GNU Indent.
|
||||
- [injected](doc/advanced_topics.md#injected-language-formatting-code-blocks) - Format treesitter injected languages.
|
||||
@ -244,11 +252,14 @@ You can view this list in vim with `:help conform-formatters`
|
||||
- [jq](https://github.com/stedolan/jq) - Command-line JSON processor.
|
||||
- [jsonnetfmt](https://github.com/google/go-jsonnet/tree/master/cmd/jsonnetfmt) - jsonnetfmt is a command line tool to format jsonnet files.
|
||||
- [just](https://github.com/casey/just) - Format Justfile.
|
||||
- [kcl](https://www.kcl-lang.io/docs/tools/cli/kcl/fmt) - The KCL Format tool modifies the files according to the KCL code style.
|
||||
- [ktfmt](https://github.com/facebook/ktfmt) - Reformats Kotlin source code to comply with the common community standard conventions.
|
||||
- [ktlint](https://ktlint.github.io/) - An anti-bikeshedding Kotlin linter with built-in formatter.
|
||||
- [latexindent](https://github.com/cmhughes/latexindent.pl) - A perl script for formatting LaTeX files that is generally included in major TeX distributions.
|
||||
- [leptosfmt](https://github.com/bram209/leptosfmt) - A formatter for the Leptos view! macro.
|
||||
- [liquidsoap-prettier](https://github.com/savonet/liquidsoap-prettier) - A binary to format Liquidsoap scripts
|
||||
- [llf](https://repo.or.cz/llf.git) - A LaTeX reformatter / beautifier.
|
||||
- [lua-format](https://github.com/Koihik/LuaFormatter) - Code formatter for Lua.
|
||||
- [markdown-toc](https://github.com/jonschlinkert/markdown-toc) - API and CLI for generating a markdown TOC (table of contents) for a README or any markdown files.
|
||||
- [markdownlint](https://github.com/DavidAnson/markdownlint) - A Node.js style checker and lint tool for Markdown/CommonMark files.
|
||||
- [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) - A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the markdownlint library.
|
||||
@ -259,6 +270,7 @@ You can view this list in vim with `:help conform-formatters`
|
||||
- [nimpretty](https://github.com/nim-lang/nim) - nimpretty is a Nim source code beautifier that follows the official style guide.
|
||||
- [nixfmt](https://github.com/serokell/nixfmt) - nixfmt is a formatter for Nix code, intended to apply a uniform style.
|
||||
- [nixpkgs_fmt](https://github.com/nix-community/nixpkgs-fmt) - nixpkgs-fmt is a Nix code formatter for nixpkgs.
|
||||
- [npm-groovy-lint](https://github.com/nvuillam/npm-groovy-lint) - Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files using command line.
|
||||
- [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) - Auto-formatter for OCaml code.
|
||||
- [ocp-indent](https://github.com/OCamlPro/ocp-indent) - Automatic indentation of OCaml source files.
|
||||
- [opa_fmt](https://www.openpolicyagent.org/docs/latest/cli/#opa-fmt) - Format Rego files using `opa fmt` command.
|
||||
@ -277,9 +289,11 @@ You can view this list in vim with `:help conform-formatters`
|
||||
- [pretty-php](https://github.com/lkrms/pretty-php) - The opinionated PHP code formatter.
|
||||
- [puppet-lint](https://github.com/puppetlabs/puppet-lint) - Check that your Puppet manifests conform to the style guide.
|
||||
- [purs-tidy](https://github.com/natefaubion/purescript-tidy) - A syntax tidy-upper for PureScript.
|
||||
- [pyink](https://github.com/google/pyink) - A Python formatter, forked from Black with a few different formatting behaviors.
|
||||
- [reorder-python-imports](https://github.com/asottile/reorder-python-imports) - Rewrites source to reorder python imports
|
||||
- [rescript-format](https://rescript-lang.org/) - The built-in ReScript formatter.
|
||||
- [roc](https://github.com/roc-lang/roc) - A fast, friendly, functional language.
|
||||
- [rstfmt](https://github.com/dzhu/rstfmt) - A formatter for reStructuredText.
|
||||
- [rubocop](https://github.com/rubocop/rubocop) - Ruby static code analyzer and formatter, based on the community Ruby style guide.
|
||||
- [rubyfmt](https://github.com/fables-tales/rubyfmt) - Ruby Autoformatter! (Written in Rust)
|
||||
- [ruff_fix](https://docs.astral.sh/ruff/) - An extremely fast Python linter, written in Rust. Fix lint errors.
|
||||
@ -302,6 +316,7 @@ You can view this list in vim with `:help conform-formatters`
|
||||
- [standardrb](https://github.com/standardrb/standard) - Ruby's bikeshed-proof linter and formatter.
|
||||
- [stylelint](https://github.com/stylelint/stylelint) - A mighty CSS linter that helps you avoid errors and enforce conventions.
|
||||
- [styler](https://github.com/devOpifex/r.nvim) - R formatter and linter.
|
||||
- [stylish-haskell](https://github.com/haskell/stylish-haskell) - Haskell code prettifier.
|
||||
- [stylua](https://github.com/JohnnyMorganz/StyLua) - An opinionated code formatter for Lua.
|
||||
- [swift_format](https://github.com/apple/swift-format) - Swift formatter from apple. Requires building from source with `swift build`.
|
||||
- [swiftformat](https://github.com/nicklockwood/SwiftFormat) - SwiftFormat is a code library and command-line tool for reformatting `swift` code on macOS or Linux.
|
||||
@ -315,11 +330,11 @@ You can view this list in vim with `:help conform-formatters`
|
||||
- [trim_whitespace](https://www.gnu.org/software/gawk/manual/gawk.html) - Trim whitespaces with awk.
|
||||
- [twig-cs-fixer](https://github.com/VincentLanglet/Twig-CS-Fixer) - Automatically fix Twig Coding Standards issues
|
||||
- [typos](https://github.com/crate-ci/typos) - Source code spell checker
|
||||
- [typstfmt](https://github.com/astrale-sharp/typstfmt) - Basic formatter for the Typst language with a future!
|
||||
- [typstyle](https://github.com/Enter-tainer/typstyle) - Beautiful and reliable typst code formatter.
|
||||
- [uncrustify](https://github.com/uncrustify/uncrustify) - A source code beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and Vala.
|
||||
- [usort](https://github.com/facebook/usort) - Safe, minimal import sorting for Python projects.
|
||||
- [verible](https://github.com/chipsalliance/verible/blob/master/verilog/tools/formatter/README.md) - The SystemVerilog formatter.
|
||||
- [vsg](https://github.com/jeremiah-c-leary/vhdl-style-guide) - Style guide enforcement for VHDL.
|
||||
- [xmlformat](https://github.com/pamoller/xmlformatter) - xmlformatter is an Open Source Python package, which provides formatting of XML documents.
|
||||
- [xmllint](http://xmlsoft.org/xmllint.html) - Despite the name, xmllint can be used to format XML files as well as lint them.
|
||||
- [yamlfix](https://github.com/lyz-code/yamlfix) - A configurable YAML formatter that keeps comments.
|
||||
@ -451,14 +466,14 @@ require("conform").setup({
|
||||
-- This can also be a function that returns the table.
|
||||
format_on_save = {
|
||||
-- I recommend these options. See :help conform.format for details.
|
||||
lsp_fallback = true,
|
||||
lsp_format = "fallback",
|
||||
timeout_ms = 500,
|
||||
},
|
||||
-- If this is set, Conform will run the formatter asynchronously after save.
|
||||
-- It will pass the table to conform.format().
|
||||
-- This can also be a function that returns the table.
|
||||
format_after_save = {
|
||||
lsp_fallback = true,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
-- Set the log level. Use `:ConformInfo` to see the location of the log file.
|
||||
log_level = vim.log.levels.ERROR,
|
||||
@ -499,9 +514,13 @@ require("conform").setup({
|
||||
},
|
||||
-- Set to false to disable merging the config with the base definition
|
||||
inherit = true,
|
||||
-- When inherit = true, add these additional arguments to the beginning of the command.
|
||||
-- When inherit = true, add these additional arguments to the command.
|
||||
-- This can also be a function, like args
|
||||
prepend_args = { "--use-tabs" },
|
||||
-- When inherit = true, add these additional arguments to the end of the command.
|
||||
-- This can also be a function, like args
|
||||
append_args = { "--trailing-comma" },
|
||||
},
|
||||
-- These can also be a function that returns the formatter
|
||||
other_formatter = function(bufnr)
|
||||
@ -544,8 +563,8 @@ require("conform").formatters.my_formatter = {
|
||||
| ----- | ------------------------ | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| opts | `nil\|conform.setupOpts` | | |
|
||||
| | formatters_by_ft | `nil\|table<string, conform.FiletypeFormatter>` | Map of filetype to formatters |
|
||||
| | format_on_save | `nil\|conform.FormatOpts\|fun(bufnr: integer): conform.FormatOpts` | If this is set, Conform will run the formatter on save. It will pass the table to conform.format(). This can also be a function that returns the table. |
|
||||
| | format_after_save | `nil\|conform.FormatOpts\|fun(bufnr: integer): conform.FormatOpts` | If this is set, Conform will run the formatter asynchronously after save. It will pass the table to conform.format(). This can also be a function that returns the table. |
|
||||
| | format_on_save | `nil\|conform.FormatOpts\|fun(bufnr: integer): nil\|conform.FormatOpts` | If this is set, Conform will run the formatter on save. It will pass the table to conform.format(). This can also be a function that returns the table. |
|
||||
| | format_after_save | `nil\|conform.FormatOpts\|fun(bufnr: integer): nil\|conform.FormatOpts` | If this is set, Conform will run the formatter asynchronously after save. It will pass the table to conform.format(). This can also be a function that returns the table. |
|
||||
| | log_level | `nil\|integer` | Set the log level (e.g. `vim.log.levels.DEBUG`). Use `:ConformInfo` to see the location of the log file. |
|
||||
| | notify_on_error | `nil\|boolean` | Conform will notify you when a formatter errors (default true). |
|
||||
| | formatters | `nil\|table<string, conform.FormatterConfigOverride\|fun(bufnr: integer): nil\|conform.FormatterConfigOverride>` | Custom formatters and overrides for built-in formatters. |
|
||||
@ -555,21 +574,21 @@ require("conform").formatters.my_formatter = {
|
||||
`format(opts, callback): boolean` \
|
||||
Format a buffer
|
||||
|
||||
| Param | Type | Desc | |
|
||||
| -------- | ---------------------------------------------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| opts | `nil\|conform.FormatOpts` | | |
|
||||
| | timeout_ms | `nil\|integer` | Time in milliseconds to block for formatting. Defaults to 1000. No effect if async = true. |
|
||||
| | bufnr | `nil\|integer` | Format this buffer (default 0) |
|
||||
| | async | `nil\|boolean` | If true the method won't block. Defaults to false. If the buffer is modified before the formatter completes, the formatting will be discarded. |
|
||||
| | dry_run | `nil\|boolean` | If true don't apply formatting changes to the buffer |
|
||||
| | formatters | `nil\|string[]` | List of formatters to run. Defaults to all formatters for the buffer filetype. |
|
||||
| | lsp_fallback | `nil\|boolean\|"always"` | Attempt LSP formatting if no formatters are available. Defaults to false. If "always", will attempt LSP formatting even if formatters are available. |
|
||||
| | quiet | `nil\|boolean` | Don't show any notifications for warnings or failures. Defaults to false. |
|
||||
| | range | `nil\|table` | Range to format. Table must contain `start` and `end` keys with {row, col} tuples using (1,0) indexing. Defaults to current selection in visual mode |
|
||||
| | id | `nil\|integer` | Passed to vim.lsp.buf.format when lsp_fallback = true |
|
||||
| | name | `nil\|string` | Passed to vim.lsp.buf.format when lsp_fallback = true |
|
||||
| | filter | `nil\|fun(client: table): boolean` | Passed to vim.lsp.buf.format when lsp_fallback = true |
|
||||
| callback | `nil\|fun(err: nil\|string, did_edit: nil\|boolean)` | Called once formatting has completed | |
|
||||
| Param | Type | Desc | |
|
||||
| -------- | ---------------------------------------------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| opts | `nil\|conform.FormatOpts` | | |
|
||||
| | timeout_ms | `nil\|integer` | Time in milliseconds to block for formatting. Defaults to 1000. No effect if async = true. |
|
||||
| | bufnr | `nil\|integer` | Format this buffer (default 0) |
|
||||
| | async | `nil\|boolean` | If true the method won't block. Defaults to false. If the buffer is modified before the formatter completes, the formatting will be discarded. |
|
||||
| | dry_run | `nil\|boolean` | If true don't apply formatting changes to the buffer |
|
||||
| | formatters | `nil\|string[]` | List of formatters to run. Defaults to all formatters for the buffer filetype. |
|
||||
| | lsp_format | `nil\|"never"\|"fallback"\|"prefer"\|"first"\|"last"` | "fallback" LSP formatting when no other formatters are available, "prefer" only LSP formatting when available, "first" LSP formatting then other formatters, "last" other formatters then LSP. |
|
||||
| | quiet | `nil\|boolean` | Don't show any notifications for warnings or failures. Defaults to false. |
|
||||
| | range | `nil\|table` | Range to format. Table must contain `start` and `end` keys with {row, col} tuples using (1,0) indexing. Defaults to current selection in visual mode |
|
||||
| | id | `nil\|integer` | Passed to vim.lsp.buf.format when using LSP formatting |
|
||||
| | name | `nil\|string` | Passed to vim.lsp.buf.format when using LSP formatting |
|
||||
| | filter | `nil\|fun(client: table): boolean` | Passed to vim.lsp.buf.format when using LSP formatting |
|
||||
| callback | `nil\|fun(err: nil\|string, did_edit: nil\|boolean)` | Called once formatting has completed | |
|
||||
|
||||
Returns:
|
||||
|
||||
@ -605,7 +624,7 @@ Get information about a formatter (including availability)
|
||||
### will_fallback_lsp(options)
|
||||
|
||||
`will_fallback_lsp(options): boolean` \
|
||||
Check if the buffer will use LSP formatting when lsp_fallback = true
|
||||
Check if the buffer will use LSP formatting when lsp_format = "fallback"
|
||||
|
||||
| Param | Type | Desc |
|
||||
| ------- | ------------ | ------------------------------------ |
|
||||
|
||||
@ -38,14 +38,14 @@ OPTIONS *conform-option
|
||||
-- This can also be a function that returns the table.
|
||||
format_on_save = {
|
||||
-- I recommend these options. See :help conform.format for details.
|
||||
lsp_fallback = true,
|
||||
lsp_format = "fallback",
|
||||
timeout_ms = 500,
|
||||
},
|
||||
-- If this is set, Conform will run the formatter asynchronously after save.
|
||||
-- It will pass the table to conform.format().
|
||||
-- This can also be a function that returns the table.
|
||||
format_after_save = {
|
||||
lsp_fallback = true,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
-- Set the log level. Use `:ConformInfo` to see the location of the log file.
|
||||
log_level = vim.log.levels.ERROR,
|
||||
@ -86,9 +86,13 @@ OPTIONS *conform-option
|
||||
},
|
||||
-- Set to false to disable merging the config with the base definition
|
||||
inherit = true,
|
||||
-- When inherit = true, add these additional arguments to the beginning of the command.
|
||||
-- When inherit = true, add these additional arguments to the command.
|
||||
-- This can also be a function, like args
|
||||
prepend_args = { "--use-tabs" },
|
||||
-- When inherit = true, add these additional arguments to the end of the command.
|
||||
-- This can also be a function, like args
|
||||
append_args = { "--trailing-comma" },
|
||||
},
|
||||
-- These can also be a function that returns the formatter
|
||||
other_formatter = function(bufnr)
|
||||
@ -115,11 +119,11 @@ setup({opts}) *conform.setu
|
||||
{opts} `nil|conform.setupOpts`
|
||||
{formatters_by_ft} `nil|table<string, conform.FiletypeFormatter>` Map
|
||||
of filetype to formatters
|
||||
{format_on_save} `nil|conform.FormatOpts|fun(bufnr: integer): conform.FormatOpts` I
|
||||
{format_on_save} `nil|conform.FormatOpts|fun(bufnr: integer): nil|conform.FormatOpts` I
|
||||
f this is set, Conform will run the formatter on
|
||||
save. It will pass the table to conform.format().
|
||||
This can also be a function that returns the table.
|
||||
{format_after_save} `nil|conform.FormatOpts|fun(bufnr: integer): conform.FormatOpts` I
|
||||
{format_after_save} `nil|conform.FormatOpts|fun(bufnr: integer): nil|conform.FormatOpts` I
|
||||
f this is set, Conform will run the formatter
|
||||
asynchronously after save. It will pass the table
|
||||
to conform.format(). This can also be a function
|
||||
@ -138,32 +142,32 @@ format({opts}, {callback}): boolean *conform.forma
|
||||
|
||||
Parameters:
|
||||
{opts} `nil|conform.FormatOpts`
|
||||
{timeout_ms} `nil|integer` Time in milliseconds to block for
|
||||
formatting. Defaults to 1000. No effect if async =
|
||||
true.
|
||||
{bufnr} `nil|integer` Format this buffer (default 0)
|
||||
{async} `nil|boolean` If true the method won't block. Defaults
|
||||
to false. If the buffer is modified before the
|
||||
formatter completes, the formatting will be discarded.
|
||||
{dry_run} `nil|boolean` If true don't apply formatting changes to
|
||||
the buffer
|
||||
{formatters} `nil|string[]` List of formatters to run. Defaults to
|
||||
all formatters for the buffer filetype.
|
||||
{lsp_fallback} `nil|boolean|"always"` Attempt LSP formatting if no
|
||||
formatters are available. Defaults to false. If
|
||||
"always", will attempt LSP formatting even if
|
||||
formatters are available.
|
||||
{quiet} `nil|boolean` Don't show any notifications for warnings
|
||||
or failures. Defaults to false.
|
||||
{range} `nil|table` Range to format. Table must contain `start`
|
||||
and `end` keys with {row, col} tuples using (1,0)
|
||||
indexing. Defaults to current selection in visual mode
|
||||
{id} `nil|integer` Passed to |vim.lsp.buf.format| when
|
||||
lsp_fallback = true
|
||||
{name} `nil|string` Passed to |vim.lsp.buf.format| when
|
||||
lsp_fallback = true
|
||||
{filter} `nil|fun(client: table): boolean` Passed to
|
||||
|vim.lsp.buf.format| when lsp_fallback = true
|
||||
{timeout_ms} `nil|integer` Time in milliseconds to block for
|
||||
formatting. Defaults to 1000. No effect if async = true.
|
||||
{bufnr} `nil|integer` Format this buffer (default 0)
|
||||
{async} `nil|boolean` If true the method won't block. Defaults to
|
||||
false. If the buffer is modified before the formatter
|
||||
completes, the formatting will be discarded.
|
||||
{dry_run} `nil|boolean` If true don't apply formatting changes to
|
||||
the buffer
|
||||
{formatters} `nil|string[]` List of formatters to run. Defaults to all
|
||||
formatters for the buffer filetype.
|
||||
{lsp_format} `nil|"never"|"fallback"|"prefer"|"first"|"last"` "fallbac
|
||||
k" LSP formatting when no other formatters are available,
|
||||
"prefer" only LSP formatting when available, "first" LSP
|
||||
formatting then other formatters, "last" other formatters
|
||||
then LSP.
|
||||
{quiet} `nil|boolean` Don't show any notifications for warnings
|
||||
or failures. Defaults to false.
|
||||
{range} `nil|table` Range to format. Table must contain `start`
|
||||
and `end` keys with {row, col} tuples using (1,0)
|
||||
indexing. Defaults to current selection in visual mode
|
||||
{id} `nil|integer` Passed to |vim.lsp.buf.format| when using
|
||||
LSP formatting
|
||||
{name} `nil|string` Passed to |vim.lsp.buf.format| when using
|
||||
LSP formatting
|
||||
{filter} `nil|fun(client: table): boolean` Passed to
|
||||
|vim.lsp.buf.format| when using LSP formatting
|
||||
{callback} `nil|fun(err: nil|string, did_edit: nil|boolean)` Called once
|
||||
formatting has completed
|
||||
Returns:
|
||||
@ -187,7 +191,7 @@ get_formatter_info({formatter}, {bufnr}): conform.FormatterInfo *conform.get_for
|
||||
{bufnr} `nil|integer`
|
||||
|
||||
will_fallback_lsp({options}): boolean *conform.will_fallback_lsp*
|
||||
Check if the buffer will use LSP formatting when lsp_fallback = true
|
||||
Check if the buffer will use LSP formatting when lsp_format = "fallback"
|
||||
|
||||
Parameters:
|
||||
{options} `nil|table` Options passed to |vim.lsp.buf.format|
|
||||
@ -238,6 +242,7 @@ FORMATTERS *conform-formatter
|
||||
`crystal` - Format Crystal code.
|
||||
`csharpier` - The opinionated C# code formatter.
|
||||
`cue_fmt` - Format CUE files using `cue fmt` command.
|
||||
`d2` - D2 is a modern diagram scripting language that turns text to diagrams.
|
||||
`darker` - Run black only on changed lines.
|
||||
`dart_format` - Replace the whitespace in your program with formatting that
|
||||
follows Dart guidelines.
|
||||
@ -246,22 +251,28 @@ FORMATTERS *conform-formatter
|
||||
`dfmt` - Formatter for D source code.
|
||||
`djlint` - ✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks -
|
||||
Handlebars - GoLang.
|
||||
`docstrfmt` - reStructuredText formatter.
|
||||
`dprint` - Pluggable and configurable code formatting platform written in Rust.
|
||||
`easy-coding-standard` - ecs - Use Coding Standard with 0-knowledge of PHP-CS-
|
||||
Fixer and PHP_CodeSniffer.
|
||||
`efmt` - Erlang code formatter.
|
||||
`elm_format` - elm-format formats Elm source code according to a standard set of
|
||||
rules based on the official [Elm Style Guide](https://elm-
|
||||
lang.org/docs/style-guide).
|
||||
`erb_format` - Format ERB files with speed and precision.
|
||||
`erlfmt` - An automated code formatter for Erlang.
|
||||
`eslint_d` - Like ESLint, but faster.
|
||||
`fantomas` - F# source code formatter.
|
||||
`findent` - Indent, relabel and convert Fortran sources.
|
||||
`fish_indent` - Indent or otherwise prettify a piece of fish code.
|
||||
`fixjson` - JSON Fixer for Humans using (relaxed) JSON5.
|
||||
`fnlfmt` - A formatter for Fennel code.
|
||||
`forge_fmt` - Forge is a command-line tool that ships with Foundry. Forge tests,
|
||||
builds, and deploys your smart contracts.
|
||||
`format-queries` - Tree-sitter query formatter.
|
||||
`fourmolu` - A fork of ormolu that uses four space indentation and allows
|
||||
arbitrary configuration.
|
||||
`fprettify` - Auto-formatter for modern fortran source code.
|
||||
`gci` - GCI, a tool that controls Go package import order and makes it always
|
||||
deterministic.
|
||||
`gdformat` - A formatter for Godot's gdscript.
|
||||
@ -280,6 +291,7 @@ FORMATTERS *conform-formatter
|
||||
`google-java-format` - Reformats Java source code according to Google Java
|
||||
Style.
|
||||
`hcl` - A formatter for HCL files.
|
||||
`hindent` - Haskell pretty printer.
|
||||
`htmlbeautifier` - A normaliser/beautifier for HTML that also understands
|
||||
embedded Ruby. Ideal for tidying up Rails templates.
|
||||
`indent` - GNU Indent.
|
||||
@ -291,6 +303,7 @@ FORMATTERS *conform-formatter
|
||||
`jq` - Command-line JSON processor.
|
||||
`jsonnetfmt` - jsonnetfmt is a command line tool to format jsonnet files.
|
||||
`just` - Format Justfile.
|
||||
`kcl` - The KCL Format tool modifies the files according to the KCL code style.
|
||||
`ktfmt` - Reformats Kotlin source code to comply with the common community
|
||||
standard conventions.
|
||||
`ktlint` - An anti-bikeshedding Kotlin linter with built-in formatter.
|
||||
@ -298,6 +311,8 @@ FORMATTERS *conform-formatter
|
||||
included in major TeX distributions.
|
||||
`leptosfmt` - A formatter for the Leptos view! macro.
|
||||
`liquidsoap-prettier` - A binary to format Liquidsoap scripts
|
||||
`llf` - A LaTeX reformatter / beautifier.
|
||||
`lua-format` - Code formatter for Lua.
|
||||
`markdown-toc` - API and CLI for generating a markdown TOC (table of contents)
|
||||
for a README or any markdown files.
|
||||
`markdownlint` - A Node.js style checker and lint tool for Markdown/CommonMark
|
||||
@ -315,6 +330,8 @@ FORMATTERS *conform-formatter
|
||||
`nixfmt` - nixfmt is a formatter for Nix code, intended to apply a uniform
|
||||
style.
|
||||
`nixpkgs_fmt` - nixpkgs-fmt is a Nix code formatter for nixpkgs.
|
||||
`npm-groovy-lint` - Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle
|
||||
files using command line.
|
||||
`ocamlformat` - Auto-formatter for OCaml code.
|
||||
`ocp-indent` - Automatic indentation of OCaml source files.
|
||||
`opa_fmt` - Format Rego files using `opa fmt` command.
|
||||
@ -339,9 +356,12 @@ FORMATTERS *conform-formatter
|
||||
`pretty-php` - The opinionated PHP code formatter.
|
||||
`puppet-lint` - Check that your Puppet manifests conform to the style guide.
|
||||
`purs-tidy` - A syntax tidy-upper for PureScript.
|
||||
`pyink` - A Python formatter, forked from Black with a few different formatting
|
||||
behaviors.
|
||||
`reorder-python-imports` - Rewrites source to reorder python imports
|
||||
`rescript-format` - The built-in ReScript formatter.
|
||||
`roc` - A fast, friendly, functional language.
|
||||
`rstfmt` - A formatter for reStructuredText.
|
||||
`rubocop` - Ruby static code analyzer and formatter, based on the community Ruby
|
||||
style guide.
|
||||
`rubyfmt` - Ruby Autoformatter! (Written in Rust)
|
||||
@ -372,6 +392,7 @@ FORMATTERS *conform-formatter
|
||||
`stylelint` - A mighty CSS linter that helps you avoid errors and enforce
|
||||
conventions.
|
||||
`styler` - R formatter and linter.
|
||||
`stylish-haskell` - Haskell code prettifier.
|
||||
`stylua` - An opinionated code formatter for Lua.
|
||||
`swift_format` - Swift formatter from apple. Requires building from source with
|
||||
`swift build`.
|
||||
@ -390,12 +411,12 @@ FORMATTERS *conform-formatter
|
||||
`trim_whitespace` - Trim whitespaces with awk.
|
||||
`twig-cs-fixer` - Automatically fix Twig Coding Standards issues
|
||||
`typos` - Source code spell checker
|
||||
`typstfmt` - Basic formatter for the Typst language with a future!
|
||||
`typstyle` - Beautiful and reliable typst code formatter.
|
||||
`uncrustify` - A source code beautifier for C, C++, C#, ObjectiveC, D, Java,
|
||||
Pawn and Vala.
|
||||
`usort` - Safe, minimal import sorting for Python projects.
|
||||
`verible` - The SystemVerilog formatter.
|
||||
`vsg` - Style guide enforcement for VHDL.
|
||||
`xmlformat` - xmlformatter is an Open Source Python package, which provides
|
||||
formatting of XML documents.
|
||||
`xmllint` - Despite the name, xmllint can be used to format XML files as well as
|
||||
|
||||
@ -24,7 +24,7 @@ vim.api.nvim_create_user_command("Format", function(args)
|
||||
["end"] = { args.line2, end_line:len() },
|
||||
}
|
||||
end
|
||||
require("conform").format({ async = true, lsp_fallback = true, range = range })
|
||||
require("conform").format({ async = true, lsp_format = "fallback", range = range })
|
||||
end, { range = true })
|
||||
```
|
||||
|
||||
@ -53,7 +53,7 @@ require("conform").setup({
|
||||
return
|
||||
end
|
||||
-- ...additional logic...
|
||||
return { timeout_ms = 500, lsp_fallback = true }
|
||||
return { timeout_ms = 500, lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
|
||||
@ -65,7 +65,7 @@ require("conform").setup({
|
||||
return
|
||||
end
|
||||
-- ...additional logic...
|
||||
return { lsp_fallback = true }
|
||||
return { lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
```
|
||||
@ -83,7 +83,7 @@ require("conform").setup({
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
return { timeout_ms = 500, lsp_fallback = true }
|
||||
return { timeout_ms = 500, lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
|
||||
@ -123,14 +123,14 @@ require("conform").setup({
|
||||
end
|
||||
end
|
||||
|
||||
return { timeout_ms = 200, lsp_fallback = true }, on_format
|
||||
return { timeout_ms = 200, lsp_format = "fallback" }, on_format
|
||||
end,
|
||||
|
||||
format_after_save = function(bufnr)
|
||||
if not slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
return
|
||||
end
|
||||
return { lsp_fallback = true }
|
||||
return { lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
```
|
||||
@ -149,7 +149,7 @@ return {
|
||||
-- Customize or remove this keymap to your liking
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_fallback = true })
|
||||
require("conform").format({ async = true, lsp_format = "fallback" })
|
||||
end,
|
||||
mode = "",
|
||||
desc = "Format buffer",
|
||||
@ -164,7 +164,7 @@ return {
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
},
|
||||
-- Set up format-on-save
|
||||
format_on_save = { timeout_ms = 500, lsp_fallback = true },
|
||||
format_on_save = { timeout_ms = 500, lsp_format = "fallback" },
|
||||
-- Customize formatters
|
||||
formatters = {
|
||||
shfmt = {
|
||||
|
||||
@ -5,7 +5,7 @@ return {
|
||||
url = "https://github.com/dprint/dprint",
|
||||
description = "Pluggable and configurable code formatting platform written in Rust.",
|
||||
},
|
||||
command = "dprint",
|
||||
command = util.from_node_modules("dprint"),
|
||||
args = { "fmt", "--stdin", "$FILENAME" },
|
||||
cwd = util.root_file({
|
||||
"dprint.json",
|
||||
|
||||
@ -18,4 +18,8 @@ return {
|
||||
|
||||
return args
|
||||
end,
|
||||
cwd = util.root_file({
|
||||
"rustfmt.toml",
|
||||
".rustfmt.toml",
|
||||
}),
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ return {
|
||||
meta = {
|
||||
url = "https://github.com/astrale-sharp/typstfmt",
|
||||
description = "Basic formatter for the Typst language with a future!",
|
||||
deprecated = true,
|
||||
},
|
||||
command = "typstfmt",
|
||||
stdin = true,
|
||||
|
||||
@ -18,4 +18,8 @@ return {
|
||||
|
||||
return args
|
||||
end,
|
||||
cwd = util.root_file({
|
||||
"rustfmt.toml",
|
||||
".rustfmt.toml",
|
||||
}),
|
||||
}
|
||||
|
||||
@ -166,6 +166,12 @@ M.setup = function(opts)
|
||||
end, { desc = "Show information about Conform formatters" })
|
||||
end
|
||||
|
||||
---@param obj any
|
||||
---@return boolean
|
||||
local function is_empty_table(obj)
|
||||
return type(obj) == "table" and vim.tbl_isempty(obj)
|
||||
end
|
||||
|
||||
---Get the configured formatter filetype for a buffer
|
||||
---@param bufnr? integer
|
||||
---@return nil|string filetype or nil if no formatter is configured
|
||||
@ -177,7 +183,9 @@ local function get_matching_filetype(bufnr)
|
||||
table.insert(filetypes, "_")
|
||||
for _, filetype in ipairs(filetypes) do
|
||||
local ft_formatters = M.formatters_by_ft[filetype]
|
||||
if ft_formatters then
|
||||
-- Sometimes people put an empty table here, and that should not count as configuring formatters
|
||||
-- for a filetype.
|
||||
if ft_formatters and not is_empty_table(ft_formatters) then
|
||||
return filetype
|
||||
end
|
||||
end
|
||||
@ -305,33 +313,58 @@ M.resolve_formatters = function(names, bufnr, warn_on_missing)
|
||||
return all_info
|
||||
end
|
||||
|
||||
---Check if there are any formatters configured specifically for the buffer's filetype
|
||||
---@param bufnr integer
|
||||
---@return boolean
|
||||
local function has_filetype_formatters(bufnr)
|
||||
local matching_filetype = get_matching_filetype(bufnr)
|
||||
return matching_filetype ~= nil and matching_filetype ~= "_"
|
||||
end
|
||||
|
||||
---@param opts table
|
||||
---@return boolean
|
||||
local function has_lsp_formatter(opts)
|
||||
local lsp_format = require("conform.lsp_format")
|
||||
return not vim.tbl_isempty(lsp_format.get_format_clients(opts))
|
||||
end
|
||||
|
||||
---@class conform.FormatOpts
|
||||
---@field timeout_ms nil|integer Time in milliseconds to block for formatting. Defaults to 1000. No effect if async = true.
|
||||
---@field bufnr nil|integer Format this buffer (default 0)
|
||||
---@field async nil|boolean If true the method won't block. Defaults to false. If the buffer is modified before the formatter completes, the formatting will be discarded.
|
||||
---@field dry_run nil|boolean If true don't apply formatting changes to the buffer
|
||||
---@field formatters nil|string[] List of formatters to run. Defaults to all formatters for the buffer filetype.
|
||||
---@field lsp_fallback nil|boolean|"always" Attempt LSP formatting if no formatters are available. Defaults to false. If "always", will attempt LSP formatting even if formatters are available.
|
||||
---@field lsp_format? "never"|"fallback"|"prefer"|"first"|"last" "fallback" LSP formatting when no other formatters are available, "prefer" only LSP formatting when available, "first" LSP formatting then other formatters, "last" other formatters then LSP.
|
||||
---@field quiet nil|boolean Don't show any notifications for warnings or failures. Defaults to false.
|
||||
---@field range nil|table Range to format. Table must contain `start` and `end` keys with {row, col} tuples using (1,0) indexing. Defaults to current selection in visual mode
|
||||
---@field id nil|integer Passed to |vim.lsp.buf.format| when lsp_fallback = true
|
||||
---@field name nil|string Passed to |vim.lsp.buf.format| when lsp_fallback = true
|
||||
---@field filter nil|fun(client: table): boolean Passed to |vim.lsp.buf.format| when lsp_fallback = true
|
||||
---@field id nil|integer Passed to |vim.lsp.buf.format| when using LSP formatting
|
||||
---@field name nil|string Passed to |vim.lsp.buf.format| when using LSP formatting
|
||||
---@field filter nil|fun(client: table): boolean Passed to |vim.lsp.buf.format| when using LSP formatting
|
||||
|
||||
---Format a buffer
|
||||
---@param opts? conform.FormatOpts
|
||||
---@param callback? fun(err: nil|string, did_edit: nil|boolean) Called once formatting has completed
|
||||
---@return boolean True if any formatters were attempted
|
||||
M.format = function(opts, callback)
|
||||
---@type {timeout_ms: integer, bufnr: integer, async: boolean, dry_run: boolean, lsp_fallback: boolean|"always", quiet: boolean, formatters?: string[], range?: conform.Range}
|
||||
---@type {timeout_ms: integer, bufnr: integer, async: boolean, dry_run: boolean, lsp_format: "never"|"first"|"last"|"prefer"|"fallback", quiet: boolean, formatters?: string[], range?: conform.Range}
|
||||
opts = vim.tbl_extend("keep", opts or {}, {
|
||||
timeout_ms = 1000,
|
||||
bufnr = 0,
|
||||
async = false,
|
||||
dry_run = false,
|
||||
lsp_fallback = false,
|
||||
lsp_format = "never",
|
||||
quiet = false,
|
||||
})
|
||||
|
||||
-- For backwards compatibility
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
if opts.lsp_fallback == true then
|
||||
opts.lsp_format = "fallback"
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
elseif opts.lsp_fallback == "always" then
|
||||
opts.lsp_format = "last"
|
||||
end
|
||||
|
||||
if opts.bufnr == 0 then
|
||||
opts.bufnr = vim.api.nvim_get_current_buf()
|
||||
end
|
||||
@ -349,71 +382,86 @@ M.format = function(opts, callback)
|
||||
local formatter_names = opts.formatters or M.list_formatters_for_buffer(opts.bufnr)
|
||||
local formatters =
|
||||
M.resolve_formatters(formatter_names, opts.bufnr, not opts.quiet and explicit_formatters)
|
||||
local has_lsp = has_lsp_formatter(opts)
|
||||
|
||||
local any_formatters = not vim.tbl_isempty(formatters)
|
||||
if not explicit_formatters and opts.lsp_fallback == true and M.will_fallback_lsp(opts) then
|
||||
-- use the LSP formatter when the configured formatters are from the fallback "_" filetype
|
||||
any_formatters = false
|
||||
else
|
||||
---@param err? conform.Error
|
||||
---@param did_edit? boolean
|
||||
local function handle_result(err, did_edit)
|
||||
if err then
|
||||
local level = errors.level_for_code(err.code)
|
||||
log.log(level, err.message)
|
||||
local should_notify = not opts.quiet and level >= vim.log.levels.WARN
|
||||
-- Execution errors have special handling. Maybe should reconsider this.
|
||||
local notify_msg = err.message
|
||||
if errors.is_execution_error(err.code) then
|
||||
should_notify = should_notify and M.notify_on_error and not err.debounce_message
|
||||
notify_msg = "Formatter failed. See :ConformInfo for details"
|
||||
end
|
||||
if should_notify then
|
||||
vim.notify(notify_msg, level)
|
||||
end
|
||||
end
|
||||
local err_message = err and err.message
|
||||
if not err_message and not vim.api.nvim_buf_is_valid(opts.bufnr) then
|
||||
err_message = "buffer was deleted"
|
||||
end
|
||||
if err_message then
|
||||
return callback(err_message)
|
||||
end
|
||||
|
||||
if opts.dry_run and did_edit then
|
||||
callback(nil, true)
|
||||
elseif opts.lsp_format == "last" and has_lsp then
|
||||
log.debug("Running LSP formatter on %s", vim.api.nvim_buf_get_name(opts.bufnr))
|
||||
lsp_format.format(opts, callback)
|
||||
else
|
||||
callback(nil, did_edit)
|
||||
end
|
||||
end
|
||||
local function run_cli_formatters(cb)
|
||||
local resolved_names = vim.tbl_map(function(f)
|
||||
return f.name
|
||||
end, formatters)
|
||||
log.debug("Running formatters on %s: %s", vim.api.nvim_buf_get_name(opts.bufnr), resolved_names)
|
||||
end
|
||||
|
||||
if any_formatters then
|
||||
---@param err? conform.Error
|
||||
---@param did_edit? boolean
|
||||
local function handle_result(err, did_edit)
|
||||
if err then
|
||||
local level = errors.level_for_code(err.code)
|
||||
log.log(level, err.message)
|
||||
local should_notify = not opts.quiet and level >= vim.log.levels.WARN
|
||||
-- Execution errors have special handling. Maybe should reconsider this.
|
||||
local notify_msg = err.message
|
||||
if errors.is_execution_error(err.code) then
|
||||
should_notify = should_notify and M.notify_on_error and not err.debounce_message
|
||||
notify_msg = "Formatter failed. See :ConformInfo for details"
|
||||
end
|
||||
if should_notify then
|
||||
vim.notify(notify_msg, level)
|
||||
end
|
||||
end
|
||||
local err_message = err and err.message
|
||||
if not err_message and not vim.api.nvim_buf_is_valid(opts.bufnr) then
|
||||
err_message = "buffer was deleted"
|
||||
end
|
||||
if err_message then
|
||||
return callback(err_message)
|
||||
end
|
||||
|
||||
if opts.dry_run and did_edit then
|
||||
callback(nil, true)
|
||||
elseif
|
||||
opts.lsp_fallback == "always" and not vim.tbl_isempty(lsp_format.get_format_clients(opts))
|
||||
then
|
||||
log.debug("Running LSP formatter on %s", vim.api.nvim_buf_get_name(opts.bufnr))
|
||||
lsp_format.format(opts, callback)
|
||||
else
|
||||
callback(nil, did_edit)
|
||||
end
|
||||
end
|
||||
|
||||
local run_opts = { exclusive = true, dry_run = opts.dry_run }
|
||||
if opts.async then
|
||||
runner.format_async(opts.bufnr, formatters, opts.range, run_opts, handle_result)
|
||||
runner.format_async(opts.bufnr, formatters, opts.range, run_opts, cb)
|
||||
else
|
||||
local err, did_edit =
|
||||
runner.format_sync(opts.bufnr, formatters, opts.timeout_ms, opts.range, run_opts)
|
||||
handle_result(err, did_edit)
|
||||
cb(err, did_edit)
|
||||
end
|
||||
return true
|
||||
elseif opts.lsp_fallback and not vim.tbl_isempty(lsp_format.get_format_clients(opts)) then
|
||||
end
|
||||
|
||||
-- check if formatters were configured for this buffer's filetype specifically (i.e. not the "_"
|
||||
-- or "*" formatters) AND that at least one of the configured formatters is available
|
||||
local any_formatters = has_filetype_formatters(opts.bufnr) and not vim.tbl_isempty(formatters)
|
||||
|
||||
if
|
||||
has_lsp
|
||||
and (opts.lsp_format == "prefer" or (opts.lsp_format ~= "never" and not any_formatters))
|
||||
then
|
||||
-- LSP formatting only
|
||||
log.debug("Running LSP formatter on %s", vim.api.nvim_buf_get_name(opts.bufnr))
|
||||
lsp_format.format(opts, callback)
|
||||
return true
|
||||
elseif has_lsp and opts.lsp_format == "first" then
|
||||
-- LSP formatting, then other formatters
|
||||
log.debug("Running LSP formatter on %s", vim.api.nvim_buf_get_name(opts.bufnr))
|
||||
lsp_format.format(opts, function(err, did_edit)
|
||||
if err or (did_edit and opts.dry_run) then
|
||||
return callback(err, did_edit)
|
||||
end
|
||||
run_cli_formatters(function(err2, did_edit2)
|
||||
handle_result(err2, did_edit or did_edit2)
|
||||
end)
|
||||
end)
|
||||
return true
|
||||
elseif not vim.tbl_isempty(formatters) then
|
||||
run_cli_formatters(handle_result)
|
||||
return true
|
||||
else
|
||||
local level = vim.tbl_isempty(formatter_names) and "debug" or "warn"
|
||||
local level = explicit_formatters and "warn" or "debug"
|
||||
log[level]("No formatters found for %s", vim.api.nvim_buf_get_name(opts.bufnr))
|
||||
callback("No formatters found for buffer")
|
||||
return false
|
||||
@ -592,7 +640,7 @@ M.get_formatter_info = function(formatter, bufnr)
|
||||
name = formatter,
|
||||
command = formatter,
|
||||
available = false,
|
||||
available_msg = "No config found",
|
||||
available_msg = "Formatter config missing or incomplete",
|
||||
}
|
||||
end
|
||||
|
||||
@ -647,7 +695,7 @@ M.get_formatter_info = function(formatter, bufnr)
|
||||
}
|
||||
end
|
||||
|
||||
---Check if the buffer will use LSP formatting when lsp_fallback = true
|
||||
---Check if the buffer will use LSP formatting when lsp_format = "fallback"
|
||||
---@param options? table Options passed to |vim.lsp.buf.format|
|
||||
---@return boolean
|
||||
M.will_fallback_lsp = function(options)
|
||||
@ -657,18 +705,15 @@ M.will_fallback_lsp = function(options)
|
||||
if options.bufnr == 0 then
|
||||
options.bufnr = vim.api.nvim_get_current_buf()
|
||||
end
|
||||
local matching_filetype = get_matching_filetype(options.bufnr)
|
||||
local has_primary_formatters = matching_filetype and matching_filetype ~= "_"
|
||||
local lsp_clients = require("conform.lsp_format").get_format_clients(options)
|
||||
return not has_primary_formatters and not vim.tbl_isempty(lsp_clients)
|
||||
return not has_filetype_formatters(options.bufnr) and has_lsp_formatter(options)
|
||||
end
|
||||
|
||||
M.formatexpr = function(opts)
|
||||
local lsp_format = require("conform.lsp_format")
|
||||
-- Change the defaults slightly from conform.format
|
||||
opts = vim.tbl_deep_extend("keep", opts or {}, {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true,
|
||||
lsp_format = "fallback",
|
||||
bufnr = vim.api.nvim_get_current_buf(),
|
||||
})
|
||||
-- Force async = false
|
||||
opts.async = false
|
||||
@ -697,15 +742,8 @@ M.formatexpr = function(opts)
|
||||
}
|
||||
end
|
||||
|
||||
if M.format(opts) then
|
||||
return 0
|
||||
elseif opts.lsp_fallback and not vim.tbl_isempty(lsp_format.get_format_clients(opts)) then
|
||||
-- No formatters were available; fall back to lsp formatter
|
||||
return vim.lsp.formatexpr({ timeout_ms = opts.timeout_ms })
|
||||
else
|
||||
-- Do not fallback to built-in formatter.
|
||||
return 0
|
||||
end
|
||||
M.format(opts)
|
||||
return 0
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
local errors = require("conform.errors")
|
||||
local fs = require("conform.fs")
|
||||
local ft_to_ext = require("conform.ft_to_ext")
|
||||
local log = require("conform.log")
|
||||
local util = require("conform.util")
|
||||
local uv = vim.uv or vim.loop
|
||||
@ -196,6 +197,7 @@ M.apply_format = function(bufnr, original_lines, new_lines, range, only_apply_ra
|
||||
end
|
||||
|
||||
log.trace("Comparing lines %s and %s", original_lines, new_lines)
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
local indices = vim.diff(original_text, new_text, {
|
||||
result_type = "indices",
|
||||
algorithm = "histogram",
|
||||
@ -328,6 +330,8 @@ local function run_formatter(bufnr, formatter, config, ctx, input_lines, opts, c
|
||||
log.debug("Run command: %s", cmd)
|
||||
if cwd then
|
||||
log.debug("Run CWD: %s", cwd)
|
||||
else
|
||||
log.debug("Run default CWD: %s", vim.fn.getcwd())
|
||||
end
|
||||
if env then
|
||||
log.debug("Run ENV: %s", env)
|
||||
@ -456,7 +460,7 @@ M.build_context = function(bufnr, config, range)
|
||||
filename = fs.join(dirname, "unnamed_temp")
|
||||
local ft = vim.bo[bufnr].filetype
|
||||
if ft and ft ~= "" then
|
||||
filename = filename .. "." .. ft
|
||||
filename = filename .. "." .. (ft_to_ext[ft] or ft)
|
||||
end
|
||||
else
|
||||
dirname = vim.fs.dirname(filename)
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
---@field inherit? boolean
|
||||
---@field command? string|fun(self: conform.FormatterConfig, ctx: conform.Context): string
|
||||
---@field prepend_args? string|string[]|fun(self: conform.FormatterConfig, ctx: conform.Context): string|string[]
|
||||
---@field append_args? string|string[]|fun(self: conform.FormatterConfig, ctx: conform.Context): string|string[]
|
||||
---@field format? fun(self: conform.LuaFormatterConfig, ctx: conform.Context, lines: string[], callback: fun(err: nil|string, new_lines: nil|string[])) Mutually exclusive with command
|
||||
---@field options? table
|
||||
|
||||
@ -61,8 +62,8 @@
|
||||
|
||||
---@class (exact) conform.setupOpts
|
||||
---@field formatters_by_ft? table<string, conform.FiletypeFormatter> Map of filetype to formatters
|
||||
---@field format_on_save? conform.FormatOpts|fun(bufnr: integer): conform.FormatOpts If this is set, Conform will run the formatter on save. It will pass the table to conform.format(). This can also be a function that returns the table.
|
||||
---@field format_after_save? conform.FormatOpts|fun(bufnr: integer): conform.FormatOpts If this is set, Conform will run the formatter asynchronously after save. It will pass the table to conform.format(). This can also be a function that returns the table.
|
||||
---@field format_on_save? conform.FormatOpts|fun(bufnr: integer): nil|conform.FormatOpts If this is set, Conform will run the formatter on save. It will pass the table to conform.format(). This can also be a function that returns the table.
|
||||
---@field format_after_save? conform.FormatOpts|fun(bufnr: integer): nil|conform.FormatOpts If this is set, Conform will run the formatter asynchronously after save. It will pass the table to conform.format(). This can also be a function that returns the table.
|
||||
---@field log_level? integer Set the log level (e.g. `vim.log.levels.DEBUG`). Use `:ConformInfo` to see the location of the log file.
|
||||
---@field notify_on_error? boolean Conform will notify you when a formatter errors (default true).
|
||||
---@field formatters? table<string, conform.FormatterConfigOverride|fun(bufnr: integer): nil|conform.FormatterConfigOverride> Custom formatters and overrides for built-in formatters.
|
||||
|
||||
@ -49,6 +49,9 @@ end
|
||||
---@return fun(self: conform.FormatterConfig, ctx: conform.Context): nil|string
|
||||
M.root_file = function(files)
|
||||
return function(self, ctx)
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
return vim.fs.root(ctx.dirname, files)
|
||||
end
|
||||
local found = vim.fs.find(files, { upward = true, path = ctx.dirname })[1]
|
||||
if found then
|
||||
return vim.fs.dirname(found)
|
||||
@ -167,6 +170,8 @@ M.merge_formatter_configs = function(config, override)
|
||||
local ret = vim.tbl_deep_extend("force", config, override)
|
||||
if override.prepend_args then
|
||||
M.add_formatter_args(ret, override.prepend_args, { append = false })
|
||||
elseif override.append_args then
|
||||
M.add_formatter_args(ret, override.append_args, { append = true })
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
set -e
|
||||
|
||||
mkdir -p ".testenv/config/nvim"
|
||||
|
||||
@ -16,7 +16,7 @@ require("conform").setup({
|
||||
return
|
||||
end
|
||||
-- ...additional logic...
|
||||
return { timeout_ms = 500, lsp_fallback = true }
|
||||
return { timeout_ms = 500, lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
|
||||
@ -28,6 +28,6 @@ require("conform").setup({
|
||||
return
|
||||
end
|
||||
-- ...additional logic...
|
||||
return { lsp_fallback = true }
|
||||
return { lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
|
||||
@ -25,14 +25,14 @@ require("conform").setup({
|
||||
-- This can also be a function that returns the table.
|
||||
format_on_save = {
|
||||
-- I recommend these options. See :help conform.format for details.
|
||||
lsp_fallback = true,
|
||||
lsp_format = "fallback",
|
||||
timeout_ms = 500,
|
||||
},
|
||||
-- If this is set, Conform will run the formatter asynchronously after save.
|
||||
-- It will pass the table to conform.format().
|
||||
-- This can also be a function that returns the table.
|
||||
format_after_save = {
|
||||
lsp_fallback = true,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
-- Set the log level. Use `:ConformInfo` to see the location of the log file.
|
||||
log_level = vim.log.levels.ERROR,
|
||||
@ -73,9 +73,13 @@ require("conform").setup({
|
||||
},
|
||||
-- Set to false to disable merging the config with the base definition
|
||||
inherit = true,
|
||||
-- When inherit = true, add these additional arguments to the beginning of the command.
|
||||
-- When inherit = true, add these additional arguments to the command.
|
||||
-- This can also be a function, like args
|
||||
prepend_args = { "--use-tabs" },
|
||||
-- When inherit = true, add these additional arguments to the end of the command.
|
||||
-- This can also be a function, like args
|
||||
append_args = { "--trailing-comma" },
|
||||
},
|
||||
-- These can also be a function that returns the formatter
|
||||
other_formatter = function(bufnr)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/bash
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*dashboard.txt* For Nvim 0.8.0 Last change: 2024 May 17
|
||||
*dashboard.txt* For Nvim 0.8.0 Last change: 2024 June 12
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *dashboard-table-of-contents*
|
||||
|
||||
@ -88,46 +88,34 @@ end
|
||||
|
||||
function db:new_file()
|
||||
vim.cmd('enew')
|
||||
if self.user_laststatus_value then
|
||||
vim.opt_local.laststatus = self.user_laststatus_value
|
||||
self.user_laststatus_value = nil
|
||||
end
|
||||
|
||||
if self.user_tabline_value then
|
||||
vim.opt_local.showtabline = self.user_showtabline_value
|
||||
self.user_showtabline_value = nil
|
||||
end
|
||||
end
|
||||
|
||||
-- cache the user options value restore after leave the dahsboard buffer
|
||||
-- or use DashboardNewFile command
|
||||
function db:cache_ui_options(opts)
|
||||
function db:save_user_options()
|
||||
self.user_cursor_line = vim.opt.cursorline:get()
|
||||
self.user_laststatus_value = vim.opt.laststatus:get()
|
||||
self.user_tabline_value = vim.opt.showtabline:get()
|
||||
end
|
||||
|
||||
function db:set_ui_options(opts)
|
||||
if opts.hide.statusline then
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
self.user_laststatus_value = vim.opt.laststatus:get()
|
||||
vim.opt.laststatus = 0
|
||||
end
|
||||
if opts.hide.tabline then
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
self.user_tabline_value = vim.opt.showtabline:get()
|
||||
vim.opt.showtabline = 0
|
||||
end
|
||||
end
|
||||
|
||||
function db:restore_options()
|
||||
function db:restore_user_options(opts)
|
||||
if self.user_cursor_line then
|
||||
vim.opt.cursorline = self.user_cursor_line
|
||||
self.user_cursor_line = nil
|
||||
end
|
||||
|
||||
if self.user_laststatus_value then
|
||||
if opts.hide.statusline and self.user_laststatus_value then
|
||||
vim.opt.laststatus = tonumber(self.user_laststatus_value)
|
||||
self.user_laststatus_value = nil
|
||||
end
|
||||
|
||||
if self.user_tabline_value then
|
||||
if opts.hide.tabline and self.user_tabline_value then
|
||||
vim.opt.showtabline = tonumber(self.user_tabline_value)
|
||||
self.user_tabline_value = nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -210,7 +198,8 @@ function db:load_theme(opts)
|
||||
end
|
||||
|
||||
require('dashboard.theme.' .. opts.theme)(config)
|
||||
self:cache_ui_options(opts)
|
||||
|
||||
self:set_ui_options(opts)
|
||||
|
||||
api.nvim_create_autocmd('VimResized', {
|
||||
buffer = self.bufnr,
|
||||
@ -222,13 +211,30 @@ function db:load_theme(opts)
|
||||
|
||||
api.nvim_create_autocmd('BufEnter', {
|
||||
callback = function(opt)
|
||||
if vim.bo.filetype == 'dashboard' then
|
||||
self:set_ui_options(opts)
|
||||
return
|
||||
end
|
||||
|
||||
local bufs = api.nvim_list_bufs()
|
||||
|
||||
bufs = vim.tbl_filter(function(k)
|
||||
return vim.bo[k].filetype == 'dashboard'
|
||||
end, bufs)
|
||||
|
||||
-- restore the user's UI settings is no dashboard buffers are visible
|
||||
local wins = api.nvim_tabpage_list_wins(0)
|
||||
wins = vim.tbl_filter(function(k)
|
||||
return vim.tbl_contains(bufs, api.nvim_win_get_buf(k))
|
||||
end, wins)
|
||||
|
||||
if #wins == 0 then
|
||||
self:restore_user_options(opts)
|
||||
end
|
||||
|
||||
-- clean up if there are no dashboard buffers at all
|
||||
if #bufs == 0 then
|
||||
self:cache_opts()
|
||||
self:restore_options()
|
||||
clean_ctx()
|
||||
pcall(api.nvim_del_autocmd, opt.id)
|
||||
end
|
||||
@ -259,7 +265,8 @@ function db:instance()
|
||||
self.winid = api.nvim_get_current_win()
|
||||
api.nvim_win_set_buf(self.winid, self.bufnr)
|
||||
|
||||
self.user_cursor_line = vim.opt.cursorline:get()
|
||||
self:save_user_options()
|
||||
|
||||
buf_local()
|
||||
if self.opts then
|
||||
self:load_theme(self.opts)
|
||||
|
||||
@ -118,7 +118,7 @@ local function generate_center(config)
|
||||
buffer = config.bufnr,
|
||||
callback = function()
|
||||
local buf = api.nvim_win_get_buf(0)
|
||||
if vim.api.nvim_buf_get_option(buf, 'filetype') ~= 'dashboard' then
|
||||
if vim.api.nvim_get_option_value('filetype', { buf = buf }) ~= 'dashboard' then
|
||||
return
|
||||
end
|
||||
|
||||
@ -132,11 +132,14 @@ local function generate_center(config)
|
||||
end
|
||||
before = curline
|
||||
|
||||
-- FIX: #422: In Lua the length of a string is the numbers of bytes not
|
||||
-- FIX: #422: In Lua the length of a string is the number of bytes not
|
||||
-- the number of characters.
|
||||
local curline_str = api.nvim_buf_get_lines(config.bufnr, curline - 1, curline, false)[1]
|
||||
local delta = col_width - api.nvim_strwidth(curline_str:sub(1, col + 1))
|
||||
api.nvim_win_set_cursor(config.winid, { curline, col + delta })
|
||||
local offset = col_width - api.nvim_strwidth(curline_str:sub(1, col + 1))
|
||||
if offset < 0 then
|
||||
offset = 0
|
||||
end
|
||||
api.nvim_win_set_cursor(config.winid, { curline, col + offset })
|
||||
end,
|
||||
})
|
||||
end, 0)
|
||||
|
||||
@ -175,10 +175,12 @@ local function mru_list(config)
|
||||
|
||||
if config.mru.cwd_only then
|
||||
local cwd = uv.cwd()
|
||||
local sep = utils.is_win and '\\' or '/'
|
||||
local cwd_with_sep = cwd .. sep
|
||||
mlist = vim.tbl_filter(function(file)
|
||||
local file_dir = vim.fn.fnamemodify(file, ':p:h')
|
||||
local file_dir = vim.fn.fnamemodify(file, ':p:h') .. sep
|
||||
if file_dir and cwd then
|
||||
return file_dir:find(cwd, 1, true) == 1
|
||||
return file_dir:sub(1, #cwd_with_sep) == cwd_with_sep
|
||||
end
|
||||
end, mlist)
|
||||
end
|
||||
|
||||
@ -276,6 +276,8 @@ require("diffview").setup({
|
||||
-- tabpage is a Diffview.
|
||||
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
|
||||
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
|
||||
{ "n", "[F", actions.select_first_entry, { desc = "Open the diff for the first file" } },
|
||||
{ "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } },
|
||||
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
|
||||
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
|
||||
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
|
||||
@ -341,6 +343,8 @@ require("diffview").setup({
|
||||
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
|
||||
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
|
||||
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
|
||||
{ "n", "[F", actions.select_first_entry, { desc = "Open the diff for the first file" } },
|
||||
{ "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } },
|
||||
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
|
||||
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
|
||||
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
|
||||
@ -365,9 +369,7 @@ require("diffview").setup({
|
||||
{ "n", "y", actions.copy_hash, { desc = "Copy the commit hash of the entry under the cursor" } },
|
||||
{ "n", "L", actions.open_commit_log, { desc = "Show commit details" } },
|
||||
{ "n", "X", actions.restore_entry, { desc = "Restore file to the state from the selected entry" } },
|
||||
{ "n", "zr", actions.open_fold, { desc = "Expand fold" } },
|
||||
{ "n", "zo", actions.open_fold, { desc = "Expand fold" } },
|
||||
{ "n", "zm", actions.close_fold, { desc = "Collapse fold" } },
|
||||
{ "n", "zc", actions.close_fold, { desc = "Collapse fold" } },
|
||||
{ "n", "h", actions.close_fold, { desc = "Collapse fold" } },
|
||||
{ "n", "za", actions.toggle_fold, { desc = "Toggle fold" } },
|
||||
@ -385,6 +387,8 @@ require("diffview").setup({
|
||||
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
|
||||
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
|
||||
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
|
||||
{ "n", "[F", actions.select_first_entry, { desc = "Open the diff for the first file" } },
|
||||
{ "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } },
|
||||
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
|
||||
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
|
||||
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
|
||||
|
||||
@ -1165,16 +1165,36 @@ select_entry *diffview-actions-select_entry*
|
||||
multiple files, this will collapse or open the entry. In the option
|
||||
panel this will interact with the option under the cursor.
|
||||
|
||||
select_next_entry *diffview-actions-select_next_entry*
|
||||
[count] select_next_entry *diffview-actions-select_next_entry*
|
||||
Contexts: `view`, `file_panel`, `file_history_panel`
|
||||
|
||||
Select the entry following the subject.
|
||||
|
||||
select_prev_entry *diffview-actions-select_prev_entry*
|
||||
[count] select_prev_entry *diffview-actions-select_prev_entry*
|
||||
Contexts: `view`, `file_panel`, `file_history_panel`
|
||||
|
||||
Select the entry preceding the subject.
|
||||
|
||||
select_first_entry *diffview-actions-select_first_entry*
|
||||
Contexts: `view`, `file_panel`, `file_history_panel`
|
||||
|
||||
Select the first entry.
|
||||
|
||||
select_last_entry *diffview-actions-select_last_entry*
|
||||
Contexts: `view`, `file_panel`, `file_history_panel`
|
||||
|
||||
Select the last entry.
|
||||
|
||||
[count] select_next_commit *diffview-actions-select_next_commit*
|
||||
Contexts: `file_history_view`, `file_history_panel`
|
||||
|
||||
Select the commit following the subject.
|
||||
|
||||
[count] select_prev_commit *diffview-actions-select_prev_commit*
|
||||
Contexts: `file_history_view`, `file_history_panel`
|
||||
|
||||
Select the commit preceding the subject.
|
||||
|
||||
stage_all *diffview-actions-stage_all*
|
||||
Contexts: `diff_view`, `file_panel`
|
||||
|
||||
|
||||
@ -97,6 +97,8 @@ DEFAULT CONFIG *diffview.defaults*
|
||||
-- tabpage is a Diffview.
|
||||
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
|
||||
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
|
||||
{ "n", "[F", actions.select_first_entry, { desc = "Open the diff for the first file" } },
|
||||
{ "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } },
|
||||
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
|
||||
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
|
||||
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
|
||||
@ -162,6 +164,8 @@ DEFAULT CONFIG *diffview.defaults*
|
||||
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
|
||||
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
|
||||
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
|
||||
{ "n", "[F", actions.select_first_entry, { desc = "Open the diff for the first file" } },
|
||||
{ "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } },
|
||||
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
|
||||
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
|
||||
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
|
||||
@ -186,9 +190,7 @@ DEFAULT CONFIG *diffview.defaults*
|
||||
{ "n", "y", actions.copy_hash, { desc = "Copy the commit hash of the entry under the cursor" } },
|
||||
{ "n", "L", actions.open_commit_log, { desc = "Show commit details" } },
|
||||
{ "n", "X", actions.restore_entry, { desc = "Restore file to the state from the selected entry" } },
|
||||
{ "n", "zr", actions.open_fold, { desc = "Expand fold" } },
|
||||
{ "n", "zo", actions.open_fold, { desc = "Expand fold" } },
|
||||
{ "n", "zm", actions.close_fold, { desc = "Collapse fold" } },
|
||||
{ "n", "zc", actions.close_fold, { desc = "Collapse fold" } },
|
||||
{ "n", "h", actions.close_fold, { desc = "Collapse fold" } },
|
||||
{ "n", "za", actions.toggle_fold, { desc = "Toggle fold" } },
|
||||
@ -206,6 +208,8 @@ DEFAULT CONFIG *diffview.defaults*
|
||||
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
|
||||
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
|
||||
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
|
||||
{ "n", "[F", actions.select_first_entry, { desc = "Open the diff for the first file" } },
|
||||
{ "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } },
|
||||
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
|
||||
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
|
||||
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
|
||||
|
||||
@ -35,7 +35,11 @@ diffview-actions-refresh_files diffview.txt /*diffview-actions-refresh_files*
|
||||
diffview-actions-restore_entry diffview.txt /*diffview-actions-restore_entry*
|
||||
diffview-actions-scroll_view diffview.txt /*diffview-actions-scroll_view*
|
||||
diffview-actions-select_entry diffview.txt /*diffview-actions-select_entry*
|
||||
diffview-actions-select_first_entry diffview.txt /*diffview-actions-select_first_entry*
|
||||
diffview-actions-select_last_entry diffview.txt /*diffview-actions-select_last_entry*
|
||||
diffview-actions-select_next_commit diffview.txt /*diffview-actions-select_next_commit*
|
||||
diffview-actions-select_next_entry diffview.txt /*diffview-actions-select_next_entry*
|
||||
diffview-actions-select_prev_commit diffview.txt /*diffview-actions-select_prev_commit*
|
||||
diffview-actions-select_prev_entry diffview.txt /*diffview-actions-select_prev_entry*
|
||||
diffview-actions-stage_all diffview.txt /*diffview-actions-stage_all*
|
||||
diffview-actions-toggle_files diffview.txt /*diffview-actions-toggle_files*
|
||||
|
||||
@ -635,6 +635,10 @@ local action_names = {
|
||||
"select_entry",
|
||||
"select_next_entry",
|
||||
"select_prev_entry",
|
||||
"select_first_entry",
|
||||
"select_last_entry",
|
||||
"select_next_commit",
|
||||
"select_prev_commit",
|
||||
"stage_all",
|
||||
"toggle_files",
|
||||
"toggle_flatten_dirs",
|
||||
|
||||
@ -124,6 +124,8 @@ M.defaults = {
|
||||
-- tabpage is a Diffview.
|
||||
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
|
||||
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
|
||||
{ "n", "[F", actions.select_first_entry, { desc = "Open the diff for the first file" } },
|
||||
{ "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } },
|
||||
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
|
||||
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
|
||||
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
|
||||
@ -190,6 +192,8 @@ M.defaults = {
|
||||
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
|
||||
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
|
||||
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
|
||||
{ "n", "[F", actions.select_first_entry, { desc = "Open the diff for the first file" } },
|
||||
{ "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } },
|
||||
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
|
||||
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
|
||||
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
|
||||
@ -232,6 +236,8 @@ M.defaults = {
|
||||
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
|
||||
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
|
||||
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
|
||||
{ "n", "[F", actions.select_first_entry, { desc = "Open the diff for the first file" } },
|
||||
{ "n", "]F", actions.select_last_entry, { desc = "Open the diff for the last file" } },
|
||||
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
|
||||
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
|
||||
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
|
||||
|
||||
@ -65,6 +65,18 @@ return function(view)
|
||||
view:close()
|
||||
end
|
||||
end,
|
||||
select_first_entry = function()
|
||||
local files = view.panel:ordered_file_list()
|
||||
if files and #files > 0 then
|
||||
view:set_file(files[1], false, true)
|
||||
end
|
||||
end,
|
||||
select_last_entry = function()
|
||||
local files = view.panel:ordered_file_list()
|
||||
if files and #files > 0 then
|
||||
view:set_file(files[#files], false, true)
|
||||
end
|
||||
end,
|
||||
select_next_entry = function()
|
||||
view:next_file(true)
|
||||
end,
|
||||
|
||||
@ -170,8 +170,13 @@ FileHistoryView.set_file = async.void(function(self, file, focus)
|
||||
if self:file_safeguard() or not file then return end
|
||||
|
||||
local entry = self.panel:find_entry(file)
|
||||
local cur_entry = self.panel.cur_item[1]
|
||||
|
||||
if entry then
|
||||
if cur_entry and entry ~= cur_entry then
|
||||
self.panel:set_entry_fold(cur_entry, false)
|
||||
end
|
||||
|
||||
self.panel:set_cur_item({ entry, file })
|
||||
self.panel:highlight_item(file)
|
||||
self.nulled = false
|
||||
|
||||
@ -59,6 +59,38 @@ return function(view)
|
||||
select_prev_entry = function()
|
||||
view:prev_item()
|
||||
end,
|
||||
select_first_entry = function()
|
||||
local entry = view.panel.entries[1]
|
||||
if entry and #entry.files > 0 then
|
||||
view:set_file(entry.files[1])
|
||||
end
|
||||
end,
|
||||
select_last_entry = function()
|
||||
local entry = view.panel.entries[#view.panel.entries]
|
||||
if entry and #entry.files > 0 then
|
||||
view:set_file(entry.files[#entry.files])
|
||||
end
|
||||
end,
|
||||
select_next_commit = function()
|
||||
local cur_entry = view.panel.cur_item[1]
|
||||
if not cur_entry then return end
|
||||
local entry_idx = utils.vec_indexof(view.panel.entries, cur_entry)
|
||||
if entry_idx == -1 then return end
|
||||
|
||||
local next_idx = (entry_idx + vim.v.count1 - 1) % #view.panel.entries + 1
|
||||
local next_entry = view.panel.entries[next_idx]
|
||||
view:set_file(next_entry.files[1])
|
||||
end,
|
||||
select_prev_commit = function()
|
||||
local cur_entry = view.panel.cur_item[1]
|
||||
if not cur_entry then return end
|
||||
local entry_idx = utils.vec_indexof(view.panel.entries, cur_entry)
|
||||
if entry_idx == -1 then return end
|
||||
|
||||
local next_idx = (entry_idx - vim.v.count1 - 1) % #view.panel.entries + 1
|
||||
local next_entry = view.panel.entries[next_idx]
|
||||
view:set_file(next_entry.files[1])
|
||||
end,
|
||||
next_entry = function()
|
||||
view.panel:highlight_next_file()
|
||||
end,
|
||||
|
||||
@ -23,65 +23,44 @@ function M.now()
|
||||
return vim.loop.hrtime() / 1000000
|
||||
end
|
||||
|
||||
---Echo string with multiple lines.
|
||||
---@param msg string|string[]
|
||||
---@param hl? string Highlight group name.
|
||||
---@param schedule? boolean Schedule the echo call.
|
||||
function M.echo_multiln(msg, hl, schedule)
|
||||
---@param level integer
|
||||
function M.notify(msg, level, schedule)
|
||||
if schedule then
|
||||
vim.schedule(function() M.echo_multiln(msg, hl, false) end)
|
||||
vim.schedule(function() M.notify(msg, level, false) end)
|
||||
return
|
||||
end
|
||||
if type(msg) == "table" then
|
||||
msg = table.concat(msg, "\n")
|
||||
end
|
||||
if msg == "" then
|
||||
return
|
||||
end
|
||||
|
||||
if type(msg) ~= "table" then msg = { msg } end
|
||||
if level == vim.log.levels.ERROR then
|
||||
logger:error(msg)
|
||||
end
|
||||
|
||||
local text = table.concat(msg, "\n")
|
||||
api.nvim_echo({ { text, hl } }, true, {})
|
||||
vim.notify(msg, level, { title = "diffview.nvim" })
|
||||
end
|
||||
|
||||
---@param msg string|string[]
|
||||
---@param schedule? boolean Schedule the echo call.
|
||||
function M.info(msg, schedule)
|
||||
if type(msg) ~= "table" then
|
||||
msg = { msg }
|
||||
end
|
||||
if not msg[1] or (msg[1] == "" and #msg == 1) then
|
||||
return
|
||||
end
|
||||
msg = M.vec_slice(msg)
|
||||
msg[1] = "[Diffview.nvim] " .. msg[1]
|
||||
M.echo_multiln(msg, "DiagnosticInfo", schedule)
|
||||
M.notify(msg, vim.log.levels.INFO, schedule)
|
||||
end
|
||||
|
||||
---@param msg string|string[]
|
||||
---@param schedule? boolean Schedule the echo call.
|
||||
function M.warn(msg, schedule)
|
||||
if type(msg) ~= "table" then
|
||||
msg = { msg }
|
||||
end
|
||||
if not msg[1] or (msg[1] == "" and #msg == 1) then
|
||||
return
|
||||
end
|
||||
msg = M.vec_slice(msg)
|
||||
msg[1] = "[Diffview.nvim] " .. msg[1]
|
||||
M.echo_multiln(msg, "WarningMsg", schedule)
|
||||
M.notify(msg, vim.log.levels.WARN, schedule)
|
||||
end
|
||||
|
||||
---@param msg string|string[]
|
||||
---@param schedule? boolean Schedule the echo call.
|
||||
function M.err(msg, schedule)
|
||||
if type(msg) ~= "table" then
|
||||
msg = { msg }
|
||||
end
|
||||
if not msg[1] or (msg[1] == "" and #msg == 1) then
|
||||
return
|
||||
end
|
||||
msg = M.vec_slice(msg)
|
||||
|
||||
logger:error(table.concat(msg, "\n"))
|
||||
|
||||
msg[1] = "[Diffview.nvim] " .. msg[1]
|
||||
M.echo_multiln(msg, "ErrorMsg", schedule)
|
||||
M.notify(msg, vim.log.levels.ERROR, schedule)
|
||||
end
|
||||
|
||||
---Call the function `f`, ignoring most of the window and buffer related
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*flash.nvim.txt* For Neovim >= 0.8.0 Last change: 2024 May 14
|
||||
*flash.nvim.txt* For Neovim >= 0.8.0 Last change: 2024 June 04
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *flash.nvim-table-of-contents*
|
||||
|
||||
@ -205,7 +205,12 @@ local defaults = {
|
||||
end,
|
||||
search = { wrap = false },
|
||||
highlight = { backdrop = true },
|
||||
jump = { register = false },
|
||||
jump = {
|
||||
register = false,
|
||||
-- when using jump labels, set to 'true' to automatically jump
|
||||
-- or execute a motion when there is only one match
|
||||
autojump = false,
|
||||
},
|
||||
},
|
||||
-- options used for treesitter selections
|
||||
-- `require("flash").treesitter()`
|
||||
|
||||
@ -68,14 +68,18 @@ end
|
||||
---@param state Flash.State
|
||||
function M.cursor(state)
|
||||
for _, win in ipairs(state.wins) do
|
||||
local cursor = vim.api.nvim_win_get_cursor(win)
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
vim.api.nvim_buf_set_extmark(buf, state.ns, cursor[1] - 1, cursor[2], {
|
||||
hl_group = "FlashCursor",
|
||||
end_col = cursor[2] + 1,
|
||||
priority = state.opts.highlight.priority + 3,
|
||||
strict = false,
|
||||
})
|
||||
if vim.api.nvim__redraw then
|
||||
vim.api.nvim__redraw({ cursor = true, win = win })
|
||||
else
|
||||
local cursor = vim.api.nvim_win_get_cursor(win)
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
vim.api.nvim_buf_set_extmark(buf, state.ns, cursor[1] - 1, cursor[2], {
|
||||
hl_group = "FlashCursor",
|
||||
end_col = cursor[2] + 1,
|
||||
priority = state.opts.highlight.priority + 3,
|
||||
strict = false,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -241,6 +241,10 @@ function M.jump(key)
|
||||
M.state:update({ force = true })
|
||||
|
||||
if M.jump_labels then
|
||||
if (Config.get("char").jump.autojump and #M.state.results == 1) then
|
||||
M.state:hide()
|
||||
return M.state
|
||||
end
|
||||
parsed.actions[Util.CR] = function()
|
||||
return false
|
||||
end
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#!/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin/sh
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/sh
|
||||
|
||||
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests {minimal_init = 'tests//init.lua', sequential = true}"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
*gitsigns.nvim*
|
||||
|
||||
Author: Lewis Russell <lewis6991@gmail.com>
|
||||
Version: v0.8.1
|
||||
Version: v0.9.0
|
||||
Homepage: <https://github.com/lewis6991/gitsigns.nvim>
|
||||
License: MIT license
|
||||
|
||||
@ -59,10 +59,7 @@ of the default settings:
|
||||
ignore_whitespace = false,
|
||||
virt_text_priority = 100,
|
||||
},
|
||||
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
|
||||
current_line_blame_formatter_opts = {
|
||||
relative_time = false,
|
||||
},
|
||||
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
@ -192,7 +189,7 @@ setqflist({target}, {opts}, {callback?}) *gitsigns.setqflist()*
|
||||
Open the quickfix/location list viewer.
|
||||
Defaults to `true`.
|
||||
|
||||
show({revision}) *gitsigns.show()*
|
||||
show({revision}, {callback}) *gitsigns.show()*
|
||||
Show revision {base} of the current file, if it is given, or
|
||||
with the currently set base (index by default).
|
||||
|
||||
@ -286,6 +283,17 @@ change_base({base}, {global}, {callback?}) *gitsigns.change_base()*
|
||||
{base} (string|nil): The object/revision to diff against.
|
||||
{global} (boolean|nil): Change the base of all buffers.
|
||||
|
||||
blame({callback?}) *gitsigns.blame()*
|
||||
Run git-blame on the current file and open the results
|
||||
in a scroll-bound vertical split.
|
||||
|
||||
<CR> is mapped to open a menu with the actions:
|
||||
- [Show commit] in a vertical split.
|
||||
- [Reblame at commit]
|
||||
|
||||
Attributes: ~
|
||||
{async}
|
||||
|
||||
blame_line({opts}, {callback?}) *gitsigns.blame_line()*
|
||||
Run git blame on the current line and show the results in a
|
||||
floating window. If already open, calling this will cause the
|
||||
@ -392,6 +400,8 @@ nav_hunk({direction}, {opts}, {callback?}) *gitsigns.nav_hunk()*
|
||||
• {greedy}: (boolean)
|
||||
Only navigate between non-contiguous hunks. Only useful if
|
||||
'diff_opts' contains `linematch`. Defaults to `true`.
|
||||
• {target}: (`'unstaged'|'staged'|'all'`)
|
||||
Which kinds of hunks to target. Defaults to `'unstaged'`.
|
||||
• {count}: (integer)
|
||||
Number of times to advance. Defaults to |v:count1|.
|
||||
|
||||
@ -554,6 +564,28 @@ signs *gitsigns-config-signs*
|
||||
|
||||
See |gitsigns-highlight-groups|.
|
||||
|
||||
signs_staged *gitsigns-config-signs_staged*
|
||||
Type: `table[extended]`
|
||||
Default: >
|
||||
{
|
||||
add = { text = '┃' },
|
||||
change = { text = '┃' },
|
||||
delete = { text = '▁' },
|
||||
topdelete = { text = '▔' },
|
||||
changedelete = { text = '~' },
|
||||
}
|
||||
<
|
||||
Configuration for signs of staged hunks.
|
||||
|
||||
See |gitsigns-config-signs|.
|
||||
|
||||
signs_staged_enable *gitsigns-config-signs_staged_enable*
|
||||
Type: `boolean`, Default: `true`
|
||||
|
||||
Show signs for staged hunks.
|
||||
|
||||
When enabled the signs defined in |git-config-signs_staged|` are used.
|
||||
|
||||
worktrees *gitsigns-config-worktrees*
|
||||
Type: `table`, Default: `nil`
|
||||
|
||||
@ -793,23 +825,8 @@ current_line_blame_opts *gitsigns-config-current_line_blame_opts*
|
||||
• extra_opts: string[]
|
||||
Extra options passed to `git-blame`.
|
||||
|
||||
current_line_blame_formatter_opts
|
||||
*gitsigns-config-current_line_blame_formatter_opts*
|
||||
DEPRECATED
|
||||
|
||||
Type: `table[extended]`
|
||||
Default: >
|
||||
`{
|
||||
relative_time = false
|
||||
}`
|
||||
<
|
||||
Options for the current line blame annotation formatter.
|
||||
|
||||
Fields: ~
|
||||
• relative_time: boolean
|
||||
|
||||
current_line_blame_formatter *gitsigns-config-current_line_blame_formatter*
|
||||
Type: `string|function`, Default: `" <author>, <author_time> - <summary> "`
|
||||
Type: `string|function`, Default: `" <author>, <author_time:%R> - <summary> "`
|
||||
|
||||
String or function used to format the virtual text of
|
||||
|gitsigns-config-current_line_blame|.
|
||||
@ -878,9 +895,6 @@ current_line_blame_formatter *gitsigns-config-current_line_blame_formatter*
|
||||
Note that the keys map onto the output of:
|
||||
`git blame --line-porcelain`
|
||||
|
||||
{opts} Passed directly from
|
||||
|gitsigns-config-current_line_blame_formatter_opts|.
|
||||
|
||||
Return: ~
|
||||
The result of this function is passed directly to the `opts.virt_text`
|
||||
field of |nvim_buf_set_extmark| and thus must be a list of
|
||||
@ -901,18 +915,6 @@ trouble *gitsigns-config-trouble*
|
||||
When using setqflist() or setloclist(), open Trouble instead of the
|
||||
quickfix/location list window.
|
||||
|
||||
yadm *gitsigns-config-yadm*
|
||||
DEPRECATED
|
||||
Please use |gitsigns-config-on_attach_pre| instead
|
||||
|
||||
Type: `table`
|
||||
Default: >
|
||||
`{
|
||||
enable = false
|
||||
}`
|
||||
<
|
||||
yadm configuration.
|
||||
|
||||
word_diff *gitsigns-config-word_diff*
|
||||
Type: `boolean`, Default: `false`
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@ gitsigns-config-count_chars gitsigns.txt /*gitsigns-config-count_chars*
|
||||
gitsigns-config-current_line_blame gitsigns.txt /*gitsigns-config-current_line_blame*
|
||||
gitsigns-config-current_line_blame_formatter gitsigns.txt /*gitsigns-config-current_line_blame_formatter*
|
||||
gitsigns-config-current_line_blame_formatter_nc gitsigns.txt /*gitsigns-config-current_line_blame_formatter_nc*
|
||||
gitsigns-config-current_line_blame_formatter_opts gitsigns.txt /*gitsigns-config-current_line_blame_formatter_opts*
|
||||
gitsigns-config-current_line_blame_opts gitsigns.txt /*gitsigns-config-current_line_blame_opts*
|
||||
gitsigns-config-debug_mode gitsigns.txt /*gitsigns-config-debug_mode*
|
||||
gitsigns-config-diff_opts gitsigns.txt /*gitsigns-config-diff_opts*
|
||||
@ -30,13 +29,14 @@ gitsigns-config-show_deleted gitsigns.txt /*gitsigns-config-show_deleted*
|
||||
gitsigns-config-sign_priority gitsigns.txt /*gitsigns-config-sign_priority*
|
||||
gitsigns-config-signcolumn gitsigns.txt /*gitsigns-config-signcolumn*
|
||||
gitsigns-config-signs gitsigns.txt /*gitsigns-config-signs*
|
||||
gitsigns-config-signs_staged gitsigns.txt /*gitsigns-config-signs_staged*
|
||||
gitsigns-config-signs_staged_enable gitsigns.txt /*gitsigns-config-signs_staged_enable*
|
||||
gitsigns-config-status_formatter gitsigns.txt /*gitsigns-config-status_formatter*
|
||||
gitsigns-config-trouble gitsigns.txt /*gitsigns-config-trouble*
|
||||
gitsigns-config-update_debounce gitsigns.txt /*gitsigns-config-update_debounce*
|
||||
gitsigns-config-watch_gitdir gitsigns.txt /*gitsigns-config-watch_gitdir*
|
||||
gitsigns-config-word_diff gitsigns.txt /*gitsigns-config-word_diff*
|
||||
gitsigns-config-worktrees gitsigns.txt /*gitsigns-config-worktrees*
|
||||
gitsigns-config-yadm gitsigns.txt /*gitsigns-config-yadm*
|
||||
gitsigns-events gitsigns.txt /*gitsigns-events*
|
||||
gitsigns-functions gitsigns.txt /*gitsigns-functions*
|
||||
gitsigns-highlight-groups gitsigns.txt /*gitsigns-highlight-groups*
|
||||
@ -47,6 +47,7 @@ gitsigns-statusline gitsigns.txt /*gitsigns-statusline*
|
||||
gitsigns-textobject gitsigns.txt /*gitsigns-textobject*
|
||||
gitsigns-usage gitsigns.txt /*gitsigns-usage*
|
||||
gitsigns.attach() gitsigns.txt /*gitsigns.attach()*
|
||||
gitsigns.blame() gitsigns.txt /*gitsigns.blame()*
|
||||
gitsigns.blame_line() gitsigns.txt /*gitsigns.blame_line()*
|
||||
gitsigns.change_base() gitsigns.txt /*gitsigns.change_base()*
|
||||
gitsigns.detach() gitsigns.txt /*gitsigns.detach()*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,37 +0,0 @@
|
||||
local _MODREV, _SPECREV = 'scm', '-1'
|
||||
|
||||
rockspec_format = "3.0"
|
||||
package = 'gitsigns.nvim'
|
||||
version = _MODREV .. _SPECREV
|
||||
|
||||
description = {
|
||||
summary = 'Git signs written in pure lua',
|
||||
detailed = [[
|
||||
Super fast git decorations implemented purely in Lua.
|
||||
]],
|
||||
homepage = 'http://github.com/lewis6991/gitsigns.nvim',
|
||||
license = 'MIT/X11',
|
||||
labels = { 'neovim' }
|
||||
}
|
||||
|
||||
dependencies = {
|
||||
'lua == 5.1',
|
||||
}
|
||||
|
||||
source = {
|
||||
url = 'http://github.com/lewis6991/gitsigns.nvim/archive/v' .. _MODREV .. '.zip',
|
||||
dir = 'gitsigns.nvim-' .. _MODREV,
|
||||
}
|
||||
|
||||
if _MODREV == 'scm' then
|
||||
source = {
|
||||
url = 'git://github.com/lewis6991/gitsigns.nvim',
|
||||
}
|
||||
end
|
||||
|
||||
build = {
|
||||
type = 'builtin',
|
||||
copy_directories = {
|
||||
'doc'
|
||||
}
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
rock_manifest = {
|
||||
doc = {
|
||||
["gitsigns.txt"] = "a329a90ab3b49a53ea44d986cbde6885"
|
||||
},
|
||||
["gitsigns.nvim-scm-1.rockspec"] = "a9b165d604ce401cfeea760a9366418d",
|
||||
lua = {
|
||||
gitsigns = {
|
||||
["actions.lua"] = "e1d7610fc1d5fc73cb891b286df0535e",
|
||||
["async.lua"] = "15f310cd469f5bfa46bb1e49e5a1d61c",
|
||||
["attach.lua"] = "097403415eba4dc5da07fdb948647841",
|
||||
["cache.lua"] = "909e8cdc787ca5e6d3ed62782dd5453b",
|
||||
cli = {
|
||||
["argparse.lua"] = "fb6c9ffda01b2090f3c252ecaf00f68a"
|
||||
},
|
||||
["cli.lua"] = "f00c3494d6be1b07c352c51132150586",
|
||||
["config.lua"] = "fa4a0f95747586aab60c9b848a72d9cf",
|
||||
["current_line_blame.lua"] = "bf5426f4569e207646c39f9d47a083af",
|
||||
["debounce.lua"] = "e0c1145a3dc341f46b36b43d814c1202",
|
||||
debug = {
|
||||
["log.lua"] = "897a3bf45d0996b9517fa8c0a2ba1dac"
|
||||
},
|
||||
["debug.lua"] = "ef5c8e3c1c9da306ed7b2eb33e657236",
|
||||
["diff.lua"] = "0c462ae71c77899e81da151dcfdf77eb",
|
||||
["diff_ext.lua"] = "04005195067132403fc336422e05c7d3",
|
||||
["diff_int.lua"] = "df447e56f11906998e81d5b94499e013",
|
||||
["diffthis.lua"] = "eb4ff5d430d2c4081f1fa9651d2768f7",
|
||||
git = {
|
||||
["version.lua"] = "068a582ed4565978eb1f6eb089a6fa6c"
|
||||
},
|
||||
["git.lua"] = "89ec79605c259e73ce8c19deb5b63194",
|
||||
["highlight.lua"] = "1d197d8f0f6f69a6455ac220a6890d80",
|
||||
["hunks.lua"] = "48fc2d8a9c89815e3c0521b1bb0788e9",
|
||||
["manager.lua"] = "af94331f013ed04d175e3c2b2d21c42b",
|
||||
["message.lua"] = "523ee4df9da4a7fa9b5ab2100eb27ac4",
|
||||
["popup.lua"] = "cbc11678e30094bff8ed54f0357e26f9",
|
||||
["repeat.lua"] = "798544de97c774bc8e10eecfd6479585",
|
||||
["signs.lua"] = "4c6533b4a406b049e68f49aee59417f6",
|
||||
["status.lua"] = "a229a7213a3fbecfcf2d98aaf587fcab",
|
||||
system = {
|
||||
["compat.lua"] = "05d2b6d08602fba46be9b540288091e7"
|
||||
},
|
||||
["system.lua"] = "d73fac4f6e734cc8ce9f13d6be027503",
|
||||
["test.lua"] = "082f7c7a556bf27352a378d047b8e79b",
|
||||
["util.lua"] = "e4c4d677e3ad296adee833318a5c5845",
|
||||
["watcher.lua"] = "ffcf36424ae17548bdc629cc2de3fcaa"
|
||||
},
|
||||
["gitsigns.lua"] = "48654d8ca2059edb2b3a0bdd09f871e1"
|
||||
}
|
||||
}
|
||||
@ -1,157 +0,0 @@
|
||||
commands = {}
|
||||
dependencies = {
|
||||
["gitsigns.nvim"] = {
|
||||
["scm-1"] = {
|
||||
{
|
||||
constraints = {
|
||||
{
|
||||
op = "==",
|
||||
version = {
|
||||
5, 1, string = "5.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "lua"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
modules = {
|
||||
gitsigns = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.actions"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.async"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.attach"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.cache"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.cli"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.cli.argparse"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.config"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.current_line_blame"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.debounce"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.debug"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.debug.log"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.diff"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.diff_ext"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.diff_int"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.diffthis"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.git"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.git.version"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.highlight"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.hunks"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.manager"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.message"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.popup"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.repeat"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.signs"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.status"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.system"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.system.compat"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.test"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.util"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
},
|
||||
["gitsigns.watcher"] = {
|
||||
"gitsigns.nvim/scm-1"
|
||||
}
|
||||
}
|
||||
repository = {
|
||||
["gitsigns.nvim"] = {
|
||||
["scm-1"] = {
|
||||
{
|
||||
arch = "installed",
|
||||
commands = {},
|
||||
dependencies = {},
|
||||
modules = {
|
||||
gitsigns = "gitsigns.lua",
|
||||
["gitsigns.actions"] = "gitsigns/actions.lua",
|
||||
["gitsigns.async"] = "gitsigns/async.lua",
|
||||
["gitsigns.attach"] = "gitsigns/attach.lua",
|
||||
["gitsigns.cache"] = "gitsigns/cache.lua",
|
||||
["gitsigns.cli"] = "gitsigns/cli.lua",
|
||||
["gitsigns.cli.argparse"] = "gitsigns/cli/argparse.lua",
|
||||
["gitsigns.config"] = "gitsigns/config.lua",
|
||||
["gitsigns.current_line_blame"] = "gitsigns/current_line_blame.lua",
|
||||
["gitsigns.debounce"] = "gitsigns/debounce.lua",
|
||||
["gitsigns.debug"] = "gitsigns/debug.lua",
|
||||
["gitsigns.debug.log"] = "gitsigns/debug/log.lua",
|
||||
["gitsigns.diff"] = "gitsigns/diff.lua",
|
||||
["gitsigns.diff_ext"] = "gitsigns/diff_ext.lua",
|
||||
["gitsigns.diff_int"] = "gitsigns/diff_int.lua",
|
||||
["gitsigns.diffthis"] = "gitsigns/diffthis.lua",
|
||||
["gitsigns.git"] = "gitsigns/git.lua",
|
||||
["gitsigns.git.version"] = "gitsigns/git/version.lua",
|
||||
["gitsigns.highlight"] = "gitsigns/highlight.lua",
|
||||
["gitsigns.hunks"] = "gitsigns/hunks.lua",
|
||||
["gitsigns.manager"] = "gitsigns/manager.lua",
|
||||
["gitsigns.message"] = "gitsigns/message.lua",
|
||||
["gitsigns.popup"] = "gitsigns/popup.lua",
|
||||
["gitsigns.repeat"] = "gitsigns/repeat.lua",
|
||||
["gitsigns.signs"] = "gitsigns/signs.lua",
|
||||
["gitsigns.status"] = "gitsigns/status.lua",
|
||||
["gitsigns.system"] = "gitsigns/system.lua",
|
||||
["gitsigns.system.compat"] = "gitsigns/system/compat.lua",
|
||||
["gitsigns.test"] = "gitsigns/test.lua",
|
||||
["gitsigns.util"] = "gitsigns/util.lua",
|
||||
["gitsigns.watcher"] = "gitsigns/watcher.lua"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,6 +17,10 @@ local cwd_watcher ---@type uv.uv_fs_event_t?
|
||||
local function get_gitdir_and_head()
|
||||
local cwd = assert(uv.cwd())
|
||||
|
||||
-- Run on the main loop to avoid:
|
||||
-- https://github.com/LazyVim/LazyVim/discussions/3407#discussioncomment-9622211
|
||||
async.scheduler()
|
||||
|
||||
-- Look in the cache first
|
||||
for _, bcache in pairs(require('gitsigns.cache').cache) do
|
||||
local repo = bcache.git_obj.repo
|
||||
@ -65,6 +69,11 @@ local update_cwd_head = async.create(function()
|
||||
|
||||
if cwd_watcher then
|
||||
cwd_watcher:stop()
|
||||
-- TODO(lewis6991): (#1027) Running `fs_event:stop()` -> `fs_event:start()`
|
||||
-- in the same loop event, on Windows, causes Nvim to hang on quit.
|
||||
if vim.fn.has('win32') then
|
||||
async.scheduler()
|
||||
end
|
||||
else
|
||||
cwd_watcher = assert(uv.new_fs_event())
|
||||
end
|
||||
@ -129,8 +138,10 @@ local function setup_attach()
|
||||
|
||||
local attach_autocmd_disabled = false
|
||||
|
||||
api.nvim_create_autocmd({ 'BufRead', 'BufNewFile', 'BufWritePost' }, {
|
||||
-- Need to attach in 'BufFilePost' since we always detach in 'BufFilePre'
|
||||
api.nvim_create_autocmd({ 'BufFilePost', 'BufRead', 'BufNewFile', 'BufWritePost' }, {
|
||||
group = 'gitsigns',
|
||||
desc = 'Gitsigns: attach',
|
||||
callback = function(args)
|
||||
local bufnr = args.buf --[[@as integer]]
|
||||
if attach_autocmd_disabled then
|
||||
@ -142,11 +153,21 @@ local function setup_attach()
|
||||
end,
|
||||
})
|
||||
|
||||
-- If the buffer name is about to change, then detach
|
||||
api.nvim_create_autocmd('BufFilePre', {
|
||||
group = 'gitsigns',
|
||||
desc = 'Gitsigns: detach when changing buffer names',
|
||||
callback = function(args)
|
||||
require('gitsigns.attach').detach(args.buf)
|
||||
end,
|
||||
})
|
||||
|
||||
--- vimpgrep creates and deletes lots of buffers so attaching to each one will
|
||||
--- waste lots of resource and even slow down vimgrep.
|
||||
--- waste lots of resource and slow down vimgrep.
|
||||
api.nvim_create_autocmd({ 'QuickFixCmdPre', 'QuickFixCmdPost' }, {
|
||||
group = 'gitsigns',
|
||||
pattern = '*vimgrep*',
|
||||
desc = 'Gitsigns: disable attach during vimgrep',
|
||||
callback = function(args)
|
||||
attach_autocmd_disabled = args.event == 'QuickFixCmdPre'
|
||||
end,
|
||||
|
||||
@ -215,10 +215,10 @@ local function get_hunks(bufnr, bcache, greedy, staged)
|
||||
end
|
||||
|
||||
if staged then
|
||||
return bcache.hunks_staged
|
||||
return vim.deepcopy(bcache.hunks_staged)
|
||||
end
|
||||
|
||||
return bcache.hunks
|
||||
return vim.deepcopy(bcache.hunks)
|
||||
end
|
||||
|
||||
--- @param bufnr integer
|
||||
@ -478,6 +478,7 @@ end)
|
||||
--- @field greedy boolean
|
||||
--- @field preview boolean
|
||||
--- @field count integer
|
||||
--- @field target 'unstaged'|'staged'|'all'
|
||||
|
||||
--- @param x string
|
||||
--- @param word string
|
||||
@ -513,6 +514,10 @@ local function process_nav_opts(opts)
|
||||
opts.count = vim.v.count1
|
||||
end
|
||||
|
||||
if opts.target == nil then
|
||||
opts.target = 'unstaged'
|
||||
end
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
@ -532,6 +537,30 @@ local function has_preview_inline(bufnr)
|
||||
return #api.nvim_buf_get_extmarks(bufnr, ns_inline, 0, -1, { limit = 1 }) > 0
|
||||
end
|
||||
|
||||
--- @param bufnr integer
|
||||
--- @param target 'unstaged'|'staged'|'all'
|
||||
--- @param greedy boolean
|
||||
--- @return Gitsigns.Hunk.Hunk[]
|
||||
local function get_nav_hunks(bufnr, target, greedy)
|
||||
local bcache = assert(cache[bufnr])
|
||||
local hunks_main = get_hunks(bufnr, bcache, greedy, false) or {}
|
||||
|
||||
local hunks --- @type Gitsigns.Hunk.Hunk[]
|
||||
if target == 'unstaged' then
|
||||
hunks = hunks_main
|
||||
else
|
||||
local hunks_head = get_hunks(bufnr, bcache, greedy, true) or {}
|
||||
hunks_head = Hunks.filter_common(hunks_head, hunks_main) or {}
|
||||
if target == 'all' then
|
||||
hunks = hunks_main
|
||||
vim.list_extend(hunks, hunks_head)
|
||||
elseif target == 'staged' then
|
||||
hunks = hunks_head
|
||||
end
|
||||
end
|
||||
return hunks
|
||||
end
|
||||
|
||||
--- @async
|
||||
--- @param direction 'first'|'last'|'next'|'prev'
|
||||
--- @param opts? Gitsigns.NavOpts
|
||||
@ -543,9 +572,7 @@ local function nav_hunk(direction, opts)
|
||||
return
|
||||
end
|
||||
|
||||
local hunks = get_hunks(bufnr, bcache, opts.greedy, false) or {}
|
||||
local hunks_head = get_hunks(bufnr, bcache, opts.greedy, true) or {}
|
||||
vim.list_extend(hunks, Hunks.filter_common(hunks_head, hunks) or {})
|
||||
local hunks = get_nav_hunks(bufnr, opts.target, opts.greedy)
|
||||
|
||||
if not hunks or vim.tbl_isempty(hunks) then
|
||||
if opts.navigation_message then
|
||||
@ -629,6 +656,8 @@ end
|
||||
--- • {greedy}: (boolean)
|
||||
--- Only navigate between non-contiguous hunks. Only useful if
|
||||
--- 'diff_opts' contains `linematch`. Defaults to `true`.
|
||||
--- • {target}: (`'unstaged'|'staged'|'all'`)
|
||||
--- Which kinds of hunks to target. Defaults to `'unstaged'`.
|
||||
--- • {count}: (integer)
|
||||
--- Number of times to advance. Defaults to |v:count1|.
|
||||
M.nav_hunk = async.create(2, function(direction, opts)
|
||||
@ -1023,6 +1052,19 @@ C.blame_line = function(args, _)
|
||||
M.blame_line(args)
|
||||
end
|
||||
|
||||
--- Run git-blame on the current file and open the results
|
||||
--- in a scroll-bound vertical split.
|
||||
---
|
||||
--- <CR> is mapped to open a menu with the actions:
|
||||
--- - [Show commit] in a vertical split.
|
||||
--- - [Reblame at commit]
|
||||
---
|
||||
--- Attributes: ~
|
||||
--- {async}
|
||||
M.blame = async.create(0, function()
|
||||
return require('gitsigns.blame').blame()
|
||||
end)
|
||||
|
||||
--- @param bcache Gitsigns.CacheEntry
|
||||
--- @param base string?
|
||||
local function update_buf_base(bcache, base)
|
||||
@ -1191,14 +1233,14 @@ CP.diffthis = complete_heads
|
||||
---
|
||||
--- Attributes: ~
|
||||
--- {async}
|
||||
M.show = function(revision)
|
||||
M.show = function(revision, callback)
|
||||
local bufnr = api.nvim_get_current_buf()
|
||||
if not cache[bufnr] then
|
||||
print('Error: Buffer is not attached.')
|
||||
return
|
||||
end
|
||||
local diffthis = require('gitsigns.diffthis')
|
||||
diffthis.show(bufnr, revision)
|
||||
diffthis.show(bufnr, revision, callback)
|
||||
end
|
||||
|
||||
CP.show = complete_heads
|
||||
|
||||
@ -138,15 +138,16 @@ end
|
||||
|
||||
--- @param _bufnr integer
|
||||
--- @param file string
|
||||
--- @param revision string?
|
||||
--- @param encoding string
|
||||
--- @return Gitsigns.GitObj?
|
||||
local function try_worktrees(_bufnr, file, encoding)
|
||||
local function try_worktrees(_bufnr, file, revision, encoding)
|
||||
if not config.worktrees then
|
||||
return
|
||||
end
|
||||
|
||||
for _, wt in ipairs(config.worktrees) do
|
||||
local git_obj = git.Obj.new(file, encoding, wt.gitdir, wt.toplevel)
|
||||
local git_obj = git.Obj.new(file, revision, encoding, wt.gitdir, wt.toplevel)
|
||||
if git_obj and git_obj.object_name then
|
||||
dprintf('Using worktree %s', vim.inspect(wt))
|
||||
return git_obj
|
||||
@ -211,13 +212,12 @@ local function get_buf_context(bufnr)
|
||||
file = file,
|
||||
gitdir = gitdir,
|
||||
toplevel = toplevel,
|
||||
-- Commit buffers have there base set back one revision with '^'
|
||||
-- Stage buffers always compare against the common ancestor (':1')
|
||||
-- :0: index
|
||||
-- :1: common ancestor
|
||||
-- :2: target commit (HEAD)
|
||||
-- :3: commit which is being merged
|
||||
base = commit and (commit:match('^:[1-3]') and ':1' or commit .. '^') or nil,
|
||||
base = commit and (commit:match('^:[1-3]') and ':1' or commit) or nil,
|
||||
}
|
||||
end
|
||||
|
||||
@ -273,7 +273,7 @@ local attach_throttled = throttle_by_id(function(cbuf, ctx, aucmd)
|
||||
local git_obj = git.Obj.new(file, revision, encoding, ctx.gitdir, ctx.toplevel)
|
||||
|
||||
if not git_obj and not passed_ctx then
|
||||
git_obj = try_worktrees(cbuf, file, encoding)
|
||||
git_obj = try_worktrees(cbuf, file, revision, encoding)
|
||||
async.scheduler()
|
||||
if not api.nvim_buf_is_valid(cbuf) then
|
||||
return
|
||||
|
||||
@ -67,15 +67,15 @@ end
|
||||
-- at a time.
|
||||
local BLAME_THRESHOLD_LEN = 1000000
|
||||
|
||||
--- @private
|
||||
--- @param lnum integer
|
||||
--- @async
|
||||
--- @param lnum? integer
|
||||
--- @param opts Gitsigns.BlameOpts
|
||||
--- @return table<integer,Gitsigns.BlameInfo?>?
|
||||
function CacheEntry:run_blame(lnum, opts)
|
||||
local bufnr = self.bufnr
|
||||
local blame_cache --- @type table<integer,Gitsigns.BlameInfo?>?
|
||||
repeat
|
||||
local buftext = util.buf_lines(bufnr)
|
||||
local buftext = util.buf_lines(bufnr, true)
|
||||
local tick = vim.b[bufnr].changedtick
|
||||
local lnum0 = #buftext > BLAME_THRESHOLD_LEN and lnum or nil
|
||||
-- TODO(lewis6991): Cancel blame on changedtick
|
||||
@ -97,7 +97,7 @@ local function get_blame_nc(file, lnum)
|
||||
return {
|
||||
orig_lnum = 0,
|
||||
final_lnum = lnum,
|
||||
commit = Git.not_commited(file),
|
||||
commit = Git.not_committed(file),
|
||||
filename = file,
|
||||
}
|
||||
end
|
||||
|
||||
@ -1,21 +1,10 @@
|
||||
--- @class (exact) Gitsigns.SchemaElem.Deprecated
|
||||
---
|
||||
--- Used for renaming fields.
|
||||
--- @field new_field? string
|
||||
---
|
||||
--- Documentation for deprecation. Will be added to the help file and used in
|
||||
--- the notification if `hard = true`.
|
||||
--- @field message? string
|
||||
---
|
||||
--- Emit a message via vim.notify
|
||||
--- @field hard? boolean
|
||||
|
||||
--- @class (exact) Gitsigns.SchemaElem
|
||||
--- @field type string|string[]
|
||||
--- @field type string|string[]|fun(x:any): boolean
|
||||
--- @field type_help? string
|
||||
--- @field refresh? fun(cb: fun()) Function to refresh the config value
|
||||
--- @field deep_extend? boolean
|
||||
--- @field default any
|
||||
--- @field deprecated? boolean|Gitsigns.SchemaElem.Deprecated
|
||||
--- @field deprecated? boolean
|
||||
--- @field default_help? string
|
||||
--- @field description string
|
||||
|
||||
@ -45,10 +34,7 @@
|
||||
--- | 'changedelete'
|
||||
--- | 'untracked'
|
||||
|
||||
--- @class (exact) Gitsigns.CurrentLineBlameFmtOpts
|
||||
--- @field relative_time boolean
|
||||
|
||||
--- @alias Gitsigns.CurrentLineBlameFmtFun fun(user: string, info: table<string,any>, opts: Gitsigns.CurrentLineBlameFmtOpts): {[1]:string,[2]:string}[]
|
||||
--- @alias Gitsigns.CurrentLineBlameFmtFun fun(user: string, info: table<string,any>): {[1]:string,[2]:string}[]
|
||||
|
||||
--- @class (exact) Gitsigns.CurrentLineBlameOpts : Gitsigns.BlameOpts
|
||||
--- @field virt_text? boolean
|
||||
@ -69,8 +55,8 @@
|
||||
--- @field diff_opts Gitsigns.DiffOpts
|
||||
--- @field base? string
|
||||
--- @field signs table<Gitsigns.SignType,Gitsigns.SignConfig>
|
||||
--- @field _signs_staged table<Gitsigns.SignType,Gitsigns.SignConfig>
|
||||
--- @field _signs_staged_enable boolean
|
||||
--- @field signs_staged table<Gitsigns.SignType,Gitsigns.SignConfig>
|
||||
--- @field signs_staged_enable boolean
|
||||
--- @field count_chars table<string|integer,string>
|
||||
--- @field signcolumn boolean
|
||||
--- @field numhl boolean
|
||||
@ -84,14 +70,12 @@
|
||||
--- @field update_debounce integer
|
||||
--- @field status_formatter fun(_: table<string,any>): string
|
||||
--- @field current_line_blame boolean
|
||||
--- @field current_line_blame_formatter_opts { relative_time: boolean }
|
||||
--- @field current_line_blame_formatter string|Gitsigns.CurrentLineBlameFmtFun
|
||||
--- @field current_line_blame_formatter_nc string|Gitsigns.CurrentLineBlameFmtFun
|
||||
--- @field current_line_blame_opts Gitsigns.CurrentLineBlameOpts
|
||||
--- @field preview_config table<string,any>
|
||||
--- @field auto_attach boolean
|
||||
--- @field attach_to_untracked boolean
|
||||
--- @field yadm { enable: boolean }
|
||||
--- @field worktrees {toplevel: string, gitdir: string}[]
|
||||
--- @field word_diff boolean
|
||||
--- @field trouble boolean
|
||||
@ -108,9 +92,7 @@ local M = {
|
||||
DiffOpts = {},
|
||||
SignConfig = {},
|
||||
watch_gitdir = {},
|
||||
current_line_blame_formatter_opts = {},
|
||||
current_line_blame_opts = {},
|
||||
yadm = {},
|
||||
Worktree = {},
|
||||
},
|
||||
}
|
||||
@ -182,10 +164,50 @@ M.config = setmetatable({}, {
|
||||
end,
|
||||
})
|
||||
|
||||
local function warn(s, ...)
|
||||
vim.notify_once(s:format(...), vim.log.levels.WARN, { title = 'gitsigns' })
|
||||
end
|
||||
|
||||
--- @param x Gitsigns.SignConfig
|
||||
--- @return boolean
|
||||
local function validate_signs(x)
|
||||
if type(x) ~= 'table' then
|
||||
return false
|
||||
end
|
||||
|
||||
local warnings --- @type table<string,true>?
|
||||
|
||||
--- @diagnostic disable-next-line:no-unknown
|
||||
for kind, s in pairs(M.schema.signs.default) do
|
||||
--- @diagnostic disable-next-line:no-unknown
|
||||
for ty, v in pairs(s) do
|
||||
if x[kind] and x[kind][ty] and vim.endswith(ty, 'hl') then
|
||||
warnings = warnings or {}
|
||||
local w = string.format(
|
||||
"'signs.%s.%s' is now deprecated, please define highlight '%s'",
|
||||
kind,
|
||||
ty,
|
||||
v
|
||||
)
|
||||
warnings[w] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if warnings then
|
||||
for w in vim.spairs(warnings) do
|
||||
warn(w)
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
--- @type table<string,Gitsigns.SchemaElem>
|
||||
M.schema = {
|
||||
signs = {
|
||||
type = 'table',
|
||||
type_help = 'table',
|
||||
type = validate_signs,
|
||||
deep_extend = true,
|
||||
default = {
|
||||
add = { hl = 'GitSignsAdd', text = '┃', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
|
||||
@ -244,7 +266,7 @@ M.schema = {
|
||||
]],
|
||||
},
|
||||
|
||||
_signs_staged = {
|
||||
signs_staged = {
|
||||
type = 'table',
|
||||
deep_extend = true,
|
||||
default = {
|
||||
@ -293,9 +315,9 @@ M.schema = {
|
||||
]],
|
||||
},
|
||||
|
||||
_signs_staged_enable = {
|
||||
signs_staged_enable = {
|
||||
type = 'boolean',
|
||||
default = false,
|
||||
default = true,
|
||||
description = [[
|
||||
Show signs for staged hunks.
|
||||
|
||||
@ -649,24 +671,9 @@ M.schema = {
|
||||
]],
|
||||
},
|
||||
|
||||
current_line_blame_formatter_opts = {
|
||||
type = 'table',
|
||||
deep_extend = true,
|
||||
deprecated = true,
|
||||
default = {
|
||||
relative_time = false,
|
||||
},
|
||||
description = [[
|
||||
Options for the current line blame annotation formatter.
|
||||
|
||||
Fields: ~
|
||||
• relative_time: boolean
|
||||
]],
|
||||
},
|
||||
|
||||
current_line_blame_formatter = {
|
||||
type = { 'string', 'function' },
|
||||
default = ' <author>, <author_time> - <summary> ',
|
||||
default = ' <author>, <author_time:%R> - <summary> ',
|
||||
description = [[
|
||||
String or function used to format the virtual text of
|
||||
|gitsigns-config-current_line_blame|.
|
||||
@ -735,9 +742,6 @@ M.schema = {
|
||||
Note that the keys map onto the output of:
|
||||
`git blame --line-porcelain`
|
||||
|
||||
{opts} Passed directly from
|
||||
|gitsigns-config-current_line_blame_formatter_opts|.
|
||||
|
||||
Return: ~
|
||||
The result of this function is passed directly to the `opts.virt_text`
|
||||
field of |nvim_buf_set_extmark| and thus must be a list of
|
||||
@ -769,17 +773,6 @@ M.schema = {
|
||||
]],
|
||||
},
|
||||
|
||||
yadm = {
|
||||
type = 'table',
|
||||
deprecated = {
|
||||
message = 'Please use |gitsigns-config-on_attach_pre| instead',
|
||||
},
|
||||
default = { enable = false },
|
||||
description = [[
|
||||
yadm configuration.
|
||||
]],
|
||||
},
|
||||
|
||||
_git_version = {
|
||||
type = 'string',
|
||||
default = 'auto',
|
||||
@ -861,22 +854,18 @@ M.schema = {
|
||||
},
|
||||
}
|
||||
|
||||
local function warn(s, ...)
|
||||
vim.notify(s:format(...), vim.log.levels.WARN, { title = 'gitsigns' })
|
||||
end
|
||||
|
||||
--- @param config Gitsigns.Config
|
||||
local function validate_config(config)
|
||||
--- @diagnostic disable-next-line:no-unknown
|
||||
for k, v in pairs(config) do
|
||||
for k, v in
|
||||
pairs(config --[[@as table<string,any>]])
|
||||
do
|
||||
local kschema = M.schema[k]
|
||||
if kschema == nil then
|
||||
warn("gitsigns: Ignoring invalid configuration field '%s'", k)
|
||||
elseif kschema.type then
|
||||
if type(kschema.type) == 'string' then
|
||||
vim.validate({
|
||||
[k] = { v, kschema.type },
|
||||
})
|
||||
else
|
||||
local ty = kschema.type
|
||||
if type(ty) == 'string' or type(ty) == 'function' then
|
||||
vim.validate({ [k] = { v, ty } })
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -888,28 +877,15 @@ local function handle_deprecated(cfg)
|
||||
local dep = v.deprecated
|
||||
if dep and cfg[k] ~= nil then
|
||||
if type(dep) == 'table' then
|
||||
if dep.new_field then
|
||||
local opts_key, field = dep.new_field:match('(.*)%.(.*)')
|
||||
if opts_key and field then
|
||||
-- Field moved to an options table
|
||||
local opts = (cfg[opts_key] or {}) --[[@as table<any,any>]]
|
||||
opts[field] = cfg[k]
|
||||
cfg[opts_key] = opts
|
||||
else
|
||||
-- Field renamed
|
||||
cfg[dep.new_field] = cfg[k]
|
||||
end
|
||||
end
|
||||
|
||||
if dep.hard then
|
||||
if dep.message then
|
||||
warn(dep.message)
|
||||
elseif dep.new_field then
|
||||
warn('%s is now deprecated, please use %s', k, dep.new_field)
|
||||
else
|
||||
warn('%s is now deprecated; ignoring', k)
|
||||
end
|
||||
end
|
||||
else
|
||||
warn('%s is now deprecated; ignoring', k)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -28,7 +28,7 @@ local function expand_blame_format(fmt, name, info)
|
||||
if info.author == name then
|
||||
info.author = 'You'
|
||||
end
|
||||
return util.expand_format(fmt, info, config.current_line_blame_formatter_opts.relative_time)
|
||||
return util.expand_format(fmt, info)
|
||||
end
|
||||
|
||||
--- @param virt_text {[1]: string, [2]: string}[]
|
||||
@ -41,7 +41,6 @@ local function flatten_virt_text(virt_text)
|
||||
return table.concat(res)
|
||||
end
|
||||
|
||||
--- @param winid integer
|
||||
--- @return integer
|
||||
local function win_width()
|
||||
local winid = api.nvim_get_current_win()
|
||||
@ -61,7 +60,7 @@ end
|
||||
--- @param fmt string
|
||||
--- @return Gitsigns.CurrentLineBlameFmtFun
|
||||
local function default_formatter(fmt)
|
||||
return function(username, blame_info, _opts)
|
||||
return function(username, blame_info)
|
||||
return {
|
||||
{
|
||||
expand_blame_format(fmt, username, blame_info),
|
||||
@ -85,7 +84,7 @@ local function get_blame_virt_text(bufnr, blame_info)
|
||||
clb_formatter = default_formatter(clb_formatter)
|
||||
end
|
||||
|
||||
return clb_formatter(git_obj.repo.username, blame_info, config.current_line_blame_formatter_opts)
|
||||
return clb_formatter(git_obj.repo.username, blame_info)
|
||||
end
|
||||
|
||||
--- @param bufnr integer
|
||||
|
||||
@ -43,20 +43,7 @@ function M.dump_cache()
|
||||
vim.api.nvim_echo({ { text } }, false, {})
|
||||
end
|
||||
|
||||
--- @param noecho boolean
|
||||
--- @return string[]?
|
||||
function M.debug_messages(noecho)
|
||||
if noecho then
|
||||
return log.messages
|
||||
else
|
||||
for _, m in ipairs(log.messages) do
|
||||
vim.api.nvim_echo({ { m } }, false, {})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.clear_debug()
|
||||
log.messages = {}
|
||||
end
|
||||
M.debug_messages = log.show
|
||||
M.clear_debug = log.clear
|
||||
|
||||
return M
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
local start_time = vim.loop.hrtime()
|
||||
|
||||
local M = {
|
||||
debug_mode = false,
|
||||
verbose = false,
|
||||
messages = {}, --- @type string[]
|
||||
messages = {} --- @type [number, string, string, string][]
|
||||
}
|
||||
|
||||
--- @param name string
|
||||
@ -44,7 +46,6 @@ local function getvarvalue(name, lvl)
|
||||
end
|
||||
|
||||
-- not found; get global
|
||||
--- @diagnostic disable-next-line:deprecated
|
||||
return getfenv(func)[name]
|
||||
end
|
||||
|
||||
@ -52,71 +53,72 @@ end
|
||||
--- @return {name:string, bufnr: integer}
|
||||
local function get_context(lvl)
|
||||
lvl = lvl + 1
|
||||
local ret = {} --- @type {name:string, bufnr: integer}
|
||||
ret.name = getvarvalue('__FUNC__', lvl)
|
||||
if not ret.name then
|
||||
|
||||
local name = getvarvalue('__FUNC__', lvl)
|
||||
if not name then
|
||||
local name0 = debug.getinfo(lvl, 'n').name or ''
|
||||
ret.name = name0:gsub('(.*)%d+$', '%1')
|
||||
name = name0:gsub('(.*)%d+$', '%1')
|
||||
end
|
||||
ret.bufnr = getvarvalue('bufnr', lvl)
|
||||
|
||||
local bufnr = getvarvalue('bufnr', lvl)
|
||||
or getvarvalue('_bufnr', lvl)
|
||||
or getvarvalue('cbuf', lvl)
|
||||
or getvarvalue('buf', lvl)
|
||||
|
||||
return ret
|
||||
return {name=name, bufnr=bufnr}
|
||||
end
|
||||
|
||||
-- If called in a callback then make sure the callback defines a __FUNC__
|
||||
-- variable which can be used to identify the name of the function.
|
||||
--- @param kind string
|
||||
--- @param obj any
|
||||
--- @param lvl integer
|
||||
local function cprint(obj, lvl)
|
||||
local function cprint(kind, obj, lvl)
|
||||
lvl = lvl + 1
|
||||
--- @type string
|
||||
local msg = type(obj) == 'string' and obj or vim.inspect(obj)
|
||||
local ctx = get_context(lvl)
|
||||
local msg2 --- @type string
|
||||
local time = (vim.loop.hrtime() - start_time) / 1e6
|
||||
local ctx1 = ctx.name
|
||||
if ctx.bufnr then
|
||||
msg2 = string.format('%s(%s): %s', ctx.name, ctx.bufnr, msg)
|
||||
else
|
||||
msg2 = string.format('%s: %s', ctx.name, msg)
|
||||
ctx1 = string.format('%s(%s)', ctx1, ctx.bufnr)
|
||||
end
|
||||
table.insert(M.messages, msg2)
|
||||
table.insert(M.messages, {time, kind, ctx1, msg})
|
||||
end
|
||||
|
||||
function M.dprint(obj)
|
||||
if not M.debug_mode then
|
||||
return
|
||||
end
|
||||
cprint(obj, 2)
|
||||
cprint('debug', obj, 2)
|
||||
end
|
||||
|
||||
function M.dprintf(obj, ...)
|
||||
if not M.debug_mode then
|
||||
return
|
||||
end
|
||||
cprint(obj:format(...), 2)
|
||||
cprint('debug', obj:format(...), 2)
|
||||
end
|
||||
|
||||
function M.vprint(obj)
|
||||
if not (M.debug_mode and M.verbose) then
|
||||
return
|
||||
end
|
||||
cprint(obj, 2)
|
||||
cprint('info', obj, 2)
|
||||
end
|
||||
|
||||
function M.vprintf(obj, ...)
|
||||
if not (M.debug_mode and M.verbose) then
|
||||
return
|
||||
end
|
||||
cprint(obj:format(...), 2)
|
||||
cprint('info', obj:format(...), 2)
|
||||
end
|
||||
|
||||
local function eprint(msg, level)
|
||||
local info = debug.getinfo(level + 2, 'Sl')
|
||||
if info then
|
||||
msg = string.format('(ERROR) %s(%d): %s', info.short_src, info.currentline, msg)
|
||||
end
|
||||
M.messages[#M.messages + 1] = debug.traceback(msg)
|
||||
local ctx = info and string.format('%s<%d>', info.short_src, info.currentline) or '???'
|
||||
local time = (vim.loop.hrtime() - start_time) / 1e6
|
||||
table.insert(M.messages, { time, 'error', ctx, debug.traceback(msg) })
|
||||
if M.debug_mode then
|
||||
error(msg, 3)
|
||||
end
|
||||
@ -141,4 +143,49 @@ function M.assert(cond, msg)
|
||||
return not cond
|
||||
end
|
||||
|
||||
local sev_to_hl = {
|
||||
debug = 'Title',
|
||||
info = 'MoreMsg',
|
||||
warn = 'WarningMsg',
|
||||
error = 'ErrorMsg',
|
||||
}
|
||||
|
||||
function M.clear()
|
||||
M.messages = {}
|
||||
end
|
||||
|
||||
--- @param m [number, string, string, string]
|
||||
--- @return [string,string][]
|
||||
local function build_msg(m)
|
||||
local time, kind, ctx, msg = m[1], m[2], m[3], m[4]
|
||||
local hl = sev_to_hl[kind]
|
||||
return {
|
||||
{ string.format('%.2f ', time), 'Comment' },
|
||||
{ kind:upper():sub(1,1), hl },
|
||||
{ string.format(' %s:', ctx), 'Tag'},
|
||||
{ ' ' },
|
||||
{ msg }
|
||||
}
|
||||
end
|
||||
|
||||
function M.show()
|
||||
for _, m in ipairs(M.messages) do
|
||||
vim.api.nvim_echo(build_msg(m), false, {})
|
||||
end
|
||||
end
|
||||
|
||||
--- @return string[]?
|
||||
function M.get()
|
||||
local r = {} --- @type string[]
|
||||
for _, m in ipairs(M.messages) do
|
||||
local e = build_msg(m)
|
||||
local e1 = {} --- @type string[]
|
||||
for _, x in ipairs(e) do
|
||||
e1[#e1+1] = x[1]
|
||||
end
|
||||
r[#r+1] = table.concat(e1)
|
||||
end
|
||||
return r
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@ -7,6 +7,7 @@ local manager = require('gitsigns.manager')
|
||||
local message = require('gitsigns.message')
|
||||
local Status = require('gitsigns.status')
|
||||
|
||||
local dprint = require('gitsigns.debug.log').dprint
|
||||
local throttle_by_id = require('gitsigns.debounce').throttle_by_id
|
||||
|
||||
local M = {}
|
||||
@ -176,11 +177,14 @@ end)
|
||||
--- @param bufnr integer
|
||||
--- @param base string
|
||||
M.show = async.create(2, function(bufnr, base)
|
||||
__FUNC__ = 'show'
|
||||
local bufname = create_show_buf(bufnr, base)
|
||||
if not bufname then
|
||||
dprint('No bufname for revision ' .. base)
|
||||
return
|
||||
end
|
||||
|
||||
dprint('bufname ' .. bufname)
|
||||
vim.cmd.edit(bufname)
|
||||
end)
|
||||
|
||||
|
||||
@ -327,35 +327,6 @@ function Repo:update_abbrev_head()
|
||||
self.abbrev_head = M.get_repo_info(self.toplevel).abbrev_head
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- @param dir string
|
||||
--- @param gitdir? string
|
||||
--- @param toplevel? string
|
||||
function Repo:try_yadm(dir, gitdir, toplevel)
|
||||
if not config.yadm.enable or self.gitdir then
|
||||
return
|
||||
end
|
||||
|
||||
local home = os.getenv('HOME')
|
||||
|
||||
if not home or not vim.startswith(dir, home) then
|
||||
return
|
||||
end
|
||||
|
||||
if #git_command({ 'ls-files', dir }, { command = 'yadm' }) == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
M.get_repo_info(dir, 'yadm', gitdir, toplevel)
|
||||
local yadm_info = M.get_repo_info(dir, 'yadm', gitdir, toplevel)
|
||||
for k, v in
|
||||
pairs(yadm_info --[[@as table<string,any>]])
|
||||
do
|
||||
---@diagnostic disable-next-line:no-unknown
|
||||
self[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
--- @async
|
||||
--- @param dir string
|
||||
--- @param gitdir? string
|
||||
@ -373,8 +344,6 @@ function Repo.new(dir, gitdir, toplevel)
|
||||
self[k] = v
|
||||
end
|
||||
|
||||
self:try_yadm(dir, gitdir, toplevel)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -424,11 +393,15 @@ end
|
||||
--- @field object_name? string
|
||||
--- @field has_conflicts? true
|
||||
|
||||
function Obj:from_tree()
|
||||
return self.revision and not vim.startswith(self.revision, ':')
|
||||
end
|
||||
|
||||
--- @param file? string
|
||||
--- @param silent? boolean
|
||||
--- @return Gitsigns.FileInfo
|
||||
function Obj:file_info(file, silent)
|
||||
if self.revision and not vim.startswith(self.revision, ':') then
|
||||
if self:from_tree() then
|
||||
return self:file_info_tree(file, silent)
|
||||
else
|
||||
return self:file_info_index(file, silent)
|
||||
@ -436,12 +409,16 @@ function Obj:file_info(file, silent)
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- Get information about files in the index and the working tree
|
||||
--- @param file? string
|
||||
--- @param silent? boolean
|
||||
--- @return Gitsigns.FileInfo
|
||||
function Obj:file_info_index(file, silent)
|
||||
local has_eol = check_version({ 2, 9 })
|
||||
|
||||
-- --others + --exclude-standard means ignored files won't return info, but
|
||||
-- untracked files will. Unlike file_info_tree which won't return untracked
|
||||
-- files.
|
||||
local cmd = {
|
||||
'-c',
|
||||
'core.quotepath=off',
|
||||
@ -499,6 +476,7 @@ function Obj:file_info_index(file, silent)
|
||||
end
|
||||
|
||||
--- @private
|
||||
--- Get information about files in a certain revision
|
||||
--- @param file? string
|
||||
--- @param silent? boolean
|
||||
--- @return Gitsigns.FileInfo
|
||||
@ -615,7 +593,7 @@ local NOT_COMMITTED = {
|
||||
|
||||
--- @param file string
|
||||
--- @return Gitsigns.CommitInfo
|
||||
function M.not_commited(file)
|
||||
function M.not_committed(file)
|
||||
local time = os.time()
|
||||
return {
|
||||
sha = string.rep('0', 40),
|
||||
@ -649,7 +627,7 @@ function Obj:run_blame(lines, lnum, opts)
|
||||
-- As we support attaching to untracked files we need to return something if
|
||||
-- the file isn't isn't tracked in git.
|
||||
-- If abbrev_head is empty, then assume the repo has no commits
|
||||
local commit = M.not_commited(self.file)
|
||||
local commit = M.not_committed(self.file)
|
||||
for i in ipairs(lines) do
|
||||
ret[i] = {
|
||||
orig_lnum = 0,
|
||||
|
||||
@ -283,7 +283,8 @@ local function cmul(x, factor)
|
||||
end
|
||||
|
||||
local function dprintf(fmt, ...)
|
||||
require('gitsigns.debug.log').dprintf(fmt, ...)
|
||||
dprintf = require('gitsigns.debug.log').dprintf
|
||||
dprintf(fmt, ...)
|
||||
end
|
||||
|
||||
--- @param hl string
|
||||
|
||||
@ -432,7 +432,6 @@ function M.filter_common(a, b)
|
||||
end
|
||||
|
||||
a, b = a or {}, b or {}
|
||||
local max_iter = math.max(#a, #b)
|
||||
|
||||
local a_i = 1
|
||||
local b_i = 1
|
||||
@ -440,7 +439,9 @@ function M.filter_common(a, b)
|
||||
--- @type Gitsigns.Hunk.Hunk[]
|
||||
local ret = {}
|
||||
|
||||
for _ = 1, max_iter do
|
||||
-- Need an offset of 1 in order to process when we hit the end of either
|
||||
-- a or b
|
||||
for _ = 1, math.max(#a, #b) + 1 do
|
||||
local a_h, b_h = a[a_i], b[b_i]
|
||||
|
||||
if not a_h then
|
||||
|
||||
@ -488,9 +488,10 @@ M.update = throttle_by_id(function(bufnr)
|
||||
return
|
||||
end
|
||||
|
||||
if config._signs_staged_enable and not file_mode and not git_obj.revision then
|
||||
if config.signs_staged_enable and not file_mode then
|
||||
if not bcache.compare_text_head or config._refresh_staged_on_update then
|
||||
bcache.compare_text_head = git_obj:get_show_text('HEAD')
|
||||
local staged_rev = git_obj:from_tree() and git_obj.revision .. '^' or 'HEAD'
|
||||
bcache.compare_text_head = git_obj:get_show_text(staged_rev)
|
||||
if not M.schedule(bufnr, true) then
|
||||
return
|
||||
end
|
||||
@ -581,8 +582,8 @@ function M.setup()
|
||||
})
|
||||
|
||||
signs_normal = Signs.new(config.signs)
|
||||
if config._signs_staged_enable then
|
||||
signs_staged = Signs.new(config._signs_staged, 'staged')
|
||||
if config.signs_staged_enable then
|
||||
signs_staged = Signs.new(config.signs_staged, 'staged')
|
||||
end
|
||||
|
||||
M.update_debounced = debounce_trailing(config.update_debounce, async.create(1, M.update))
|
||||
|
||||
@ -126,7 +126,7 @@ function M.new(cfg, name)
|
||||
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.config = cfg
|
||||
self.hls = name == 'staged' and config._signs_staged or config.signs
|
||||
self.hls = name == 'staged' and config.signs_staged or config.signs
|
||||
self.group = 'gitsigns_signs_' .. (name or '')
|
||||
self.ns = api.nvim_create_namespace(self.group)
|
||||
return self
|
||||
|
||||
@ -71,8 +71,9 @@ local function add_bom(x, encoding)
|
||||
end
|
||||
|
||||
--- @param bufnr integer
|
||||
--- @param noendofline? boolean
|
||||
--- @return string[]
|
||||
function M.buf_lines(bufnr)
|
||||
function M.buf_lines(bufnr, noendofline)
|
||||
-- nvim_buf_get_lines strips carriage returns if fileformat==dos
|
||||
local buftext = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||
|
||||
@ -84,7 +85,7 @@ function M.buf_lines(bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
if vim.bo[bufnr].endofline then
|
||||
if not noendofline and vim.bo[bufnr].endofline then
|
||||
-- Add CR to the last line
|
||||
if dos then
|
||||
buftext[#buftext] = buftext[#buftext] .. '\r'
|
||||
@ -116,6 +117,15 @@ function M.buf_rename(bufnr, name)
|
||||
delete_alt(bufnr)
|
||||
end
|
||||
|
||||
--- @param events string[]
|
||||
--- @param f fun()
|
||||
function M.noautocmd(events, f)
|
||||
local ei = vim.o.eventignore
|
||||
vim.o.eventignore = table.concat(events, ',')
|
||||
f()
|
||||
vim.o.eventignore = ei
|
||||
end
|
||||
|
||||
--- @param bufnr integer
|
||||
--- @param start_row integer
|
||||
--- @param end_row integer
|
||||
@ -254,9 +264,8 @@ end
|
||||
|
||||
---@param fmt string
|
||||
---@param info table<string,any>
|
||||
---@param reltime? boolean Use relative time as the default date format
|
||||
---@return string
|
||||
function M.expand_format(fmt, info, reltime)
|
||||
function M.expand_format(fmt, info)
|
||||
local ret = {} --- @type string[]
|
||||
|
||||
for _ = 1, 20 do -- loop protection
|
||||
@ -277,7 +286,7 @@ function M.expand_format(fmt, info, reltime)
|
||||
end
|
||||
if vim.endswith(key, '_time') then
|
||||
if time_fmt == '' then
|
||||
time_fmt = reltime and '%R' or '%Y-%m-%d'
|
||||
time_fmt = '%Y-%m-%d'
|
||||
end
|
||||
v = expand_date(time_fmt, v)
|
||||
end
|
||||
|
||||
@ -8,6 +8,7 @@ local util = require('gitsigns.util')
|
||||
|
||||
local cache = require('gitsigns.cache').cache
|
||||
local config = require('gitsigns.config').config
|
||||
local throttle_by_id = require('gitsigns.debounce').throttle_by_id
|
||||
local debounce_trailing = require('gitsigns.debounce').debounce_trailing
|
||||
local manager = require('gitsigns.manager')
|
||||
|
||||
@ -52,15 +53,21 @@ local function handle_moved(bufnr, old_relpath)
|
||||
local old_name = api.nvim_buf_get_name(bufnr)
|
||||
|
||||
if not bufexists then
|
||||
util.buf_rename(bufnr, bcache.file)
|
||||
-- Do not trigger BufFilePre/Post
|
||||
-- TODO(lewis6991): figure out how to avoid reattaching without
|
||||
-- disabling all autocommands.
|
||||
util.noautocmd({ 'BufFilePre', 'BufFilePost' }, function()
|
||||
util.buf_rename(bufnr, bcache.file)
|
||||
end)
|
||||
end
|
||||
|
||||
local msg = bufexists and 'Cannot rename' or 'Renamed'
|
||||
dprintf('%s buffer %d from %s to %s', msg, bufnr, old_name, bcache.file)
|
||||
end
|
||||
|
||||
--- @async
|
||||
--- @param bufnr integer
|
||||
local watcher_handler = async.create(1, function(bufnr)
|
||||
local function watcher_handler0(bufnr)
|
||||
local __FUNC__ = 'watcher_handler'
|
||||
|
||||
-- Avoid cache hit for detached buffer
|
||||
@ -99,9 +106,13 @@ local watcher_handler = async.create(1, function(bufnr)
|
||||
cache[bufnr]:invalidate(true)
|
||||
|
||||
require('gitsigns.manager').update(bufnr)
|
||||
end)
|
||||
end
|
||||
|
||||
local watcher_handler_debounced = debounce_trailing(200, watcher_handler, 1)
|
||||
--- Debounce and throttle the handler.
|
||||
--- We also throttle in case the debounce delay is not enough and to prevent
|
||||
--- too many handlers from being launched (and interleaved).
|
||||
local watcher_handler =
|
||||
debounce_trailing(200, async.create(1, throttle_by_id(watcher_handler0, true)), 1)
|
||||
|
||||
--- vim.inspect but on one line
|
||||
--- @param x any
|
||||
@ -142,7 +153,7 @@ function M.watch_gitdir(bufnr, gitdir)
|
||||
|
||||
dprint(info)
|
||||
|
||||
watcher_handler_debounced(bufnr)
|
||||
watcher_handler(bufnr)
|
||||
end)
|
||||
return w
|
||||
end
|
||||
|
||||
@ -1 +1 @@
|
||||
/nix/store/mqbhz05llkddfb5wni0m48kw22ixxps4-lua-5.1.5
|
||||
/nix/store/3czmrawji85vf8979kll2yx2f1kjkric-lua-5.1.5
|
||||
@ -1,49 +1,50 @@
|
||||
rock_manifest = {
|
||||
doc = {
|
||||
["gitsigns.txt"] = "a329a90ab3b49a53ea44d986cbde6885"
|
||||
["gitsigns.txt"] = "e537e0db7825ce01a1c568a124432989"
|
||||
},
|
||||
["gitsigns.nvim-scm-1.rockspec"] = "a9b165d604ce401cfeea760a9366418d",
|
||||
lua = {
|
||||
gitsigns = {
|
||||
["actions.lua"] = "e1d7610fc1d5fc73cb891b286df0535e",
|
||||
["actions.lua"] = "accecf1db114ace88739c40835cb5a77",
|
||||
["async.lua"] = "15f310cd469f5bfa46bb1e49e5a1d61c",
|
||||
["attach.lua"] = "097403415eba4dc5da07fdb948647841",
|
||||
["cache.lua"] = "909e8cdc787ca5e6d3ed62782dd5453b",
|
||||
["attach.lua"] = "6f81186d03fbde2ddc631c46fea09315",
|
||||
["blame.lua"] = "e8388c8b29982475bfccec28ea4f72be",
|
||||
["cache.lua"] = "a084b897b3af2f3603a018f4c00c20fa",
|
||||
cli = {
|
||||
["argparse.lua"] = "fb6c9ffda01b2090f3c252ecaf00f68a"
|
||||
},
|
||||
["cli.lua"] = "f00c3494d6be1b07c352c51132150586",
|
||||
["config.lua"] = "fa4a0f95747586aab60c9b848a72d9cf",
|
||||
["current_line_blame.lua"] = "bf5426f4569e207646c39f9d47a083af",
|
||||
["config.lua"] = "ef58f99d7782297a32e3867634906738",
|
||||
["current_line_blame.lua"] = "b1e920875977e12bb4f9f6be08a92db8",
|
||||
["debounce.lua"] = "e0c1145a3dc341f46b36b43d814c1202",
|
||||
debug = {
|
||||
["log.lua"] = "897a3bf45d0996b9517fa8c0a2ba1dac"
|
||||
["log.lua"] = "f7e994b68e9cbcf91adfeb5bc379d7b1"
|
||||
},
|
||||
["debug.lua"] = "ef5c8e3c1c9da306ed7b2eb33e657236",
|
||||
["debug.lua"] = "6a819b17a531b74ee11622145097afae",
|
||||
["diff.lua"] = "0c462ae71c77899e81da151dcfdf77eb",
|
||||
["diff_ext.lua"] = "04005195067132403fc336422e05c7d3",
|
||||
["diff_int.lua"] = "df447e56f11906998e81d5b94499e013",
|
||||
["diffthis.lua"] = "eb4ff5d430d2c4081f1fa9651d2768f7",
|
||||
["diffthis.lua"] = "b91c6a177c0a80c5e611b8c09f6eb46e",
|
||||
git = {
|
||||
["version.lua"] = "068a582ed4565978eb1f6eb089a6fa6c"
|
||||
},
|
||||
["git.lua"] = "89ec79605c259e73ce8c19deb5b63194",
|
||||
["highlight.lua"] = "1d197d8f0f6f69a6455ac220a6890d80",
|
||||
["hunks.lua"] = "48fc2d8a9c89815e3c0521b1bb0788e9",
|
||||
["manager.lua"] = "af94331f013ed04d175e3c2b2d21c42b",
|
||||
["git.lua"] = "8a216cac54214508e798c7f4b920dd36",
|
||||
["highlight.lua"] = "f1966ef758f9a0a86102a699ec7a1eca",
|
||||
["hunks.lua"] = "ee058ee8b056b055cd8404460ca6921f",
|
||||
["manager.lua"] = "527083250ad693ee4faa5e4dde47f275",
|
||||
["message.lua"] = "523ee4df9da4a7fa9b5ab2100eb27ac4",
|
||||
["popup.lua"] = "cbc11678e30094bff8ed54f0357e26f9",
|
||||
["repeat.lua"] = "798544de97c774bc8e10eecfd6479585",
|
||||
["signs.lua"] = "4c6533b4a406b049e68f49aee59417f6",
|
||||
["signs.lua"] = "9224bcde01ebd0c320bcd678822fc799",
|
||||
["status.lua"] = "a229a7213a3fbecfcf2d98aaf587fcab",
|
||||
system = {
|
||||
["compat.lua"] = "05d2b6d08602fba46be9b540288091e7"
|
||||
},
|
||||
["system.lua"] = "d73fac4f6e734cc8ce9f13d6be027503",
|
||||
["test.lua"] = "082f7c7a556bf27352a378d047b8e79b",
|
||||
["util.lua"] = "e4c4d677e3ad296adee833318a5c5845",
|
||||
["watcher.lua"] = "ffcf36424ae17548bdc629cc2de3fcaa"
|
||||
["util.lua"] = "b24bac967bc60ba1434bf5cd7cf3fc98",
|
||||
["watcher.lua"] = "034303cfa063c77bb6628f1a55d559c4"
|
||||
},
|
||||
["gitsigns.lua"] = "48654d8ca2059edb2b3a0bdd09f871e1"
|
||||
["gitsigns.lua"] = "784d1b15d5970f0177fd19d163ea9dfb"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,519 +0,0 @@
|
||||
==============================================================================
|
||||
Table of Contents *haskell-tools.contents*
|
||||
|
||||
Introduction ··························································· |intro|
|
||||
The haskell-tools module ······································· |haskell-tools|
|
||||
plugin configuration ···································· |haskell-tools.config|
|
||||
haskell-language-server LSP client tools ··················· |haskell-tools.lsp|
|
||||
haskell-tools nvim-dap setup ······························· |haskell-tools.dap|
|
||||
haskell-tools Hoogle search ····························· |haskell-tools.hoogle|
|
||||
haskell-tools GHCi REPL module ···························· |haskell-tools.repl|
|
||||
haskell-tools Project module ··························· |haskell-tools.project|
|
||||
haskell-tools fast-tags module ···························· |haskell-tools.tags|
|
||||
haskell-tools Logging ······································ |haskell-tools.log|
|
||||
|
||||
==============================================================================
|
||||
Introduction *intro*
|
||||
|
||||
This plugin automatically configures the `haskell-language-server` builtin LSP client
|
||||
and integrates with other haskell tools.
|
||||
|
||||
WARNING:
|
||||
Do not call the `lspconfig.hls` setup or set up the lsp manually,
|
||||
as doing so may cause conflicts.
|
||||
|
||||
NOTE: This plugin is a filetype plugin.
|
||||
There is no need to call a `setup` function.
|
||||
|
||||
==============================================================================
|
||||
The haskell-tools module *haskell-tools*
|
||||
|
||||
Entry-point into this plugin's public API.
|
||||
|
||||
HaskellTools *HaskellTools*
|
||||
|
||||
|
||||
==============================================================================
|
||||
plugin configuration *haskell-tools.config*
|
||||
|
||||
To configure haskell-tools.nvim, set the variable `vim.g.haskell_tools`,
|
||||
which is a `HTOpts` table, in your neovim configuration.
|
||||
|
||||
Example:
|
||||
>
|
||||
---@type HTOpts
|
||||
vim.g.haskell_tools = {
|
||||
---@type ToolsOpts
|
||||
tools = {
|
||||
-- ...
|
||||
},
|
||||
---@type HaskellLspClientOpts
|
||||
hls = {
|
||||
on_attach = function(client, bufnr)
|
||||
-- Set keybindings, etc. here.
|
||||
end,
|
||||
-- ...
|
||||
},
|
||||
---@type HTDapOpts
|
||||
dap = {
|
||||
-- ...
|
||||
},
|
||||
}
|
||||
<
|
||||
|
||||
Note: `vim.g.haskell_tools` can also be a function that returns a 'HTOpts' table.
|
||||
|
||||
|
||||
HTOpts *HTOpts*
|
||||
|
||||
Fields: ~
|
||||
{tools?} (ToolsOpts) haskell-tools module options.
|
||||
{hls?} (HaskellLspClientOpts) haskell-language-server client options.
|
||||
{dap?} (HTDapOpts) debug adapter config for nvim-dap.
|
||||
|
||||
|
||||
ToolsOpts *ToolsOpts*
|
||||
|
||||
Fields: ~
|
||||
{codeLens?} (CodeLensOpts) LSP codeLens options.
|
||||
{hoogle?} (HoogleOpts) Hoogle type signature search options.
|
||||
{hover?} (HoverOpts) LSP hover options.
|
||||
{definition?} (DefinitionOpts) LSP go-to-definition options.
|
||||
{repl?} (ReplOpts) GHCi repl options.
|
||||
{tags?} (FastTagsOpts) fast-tags module options.
|
||||
{log?} (HTLogOpts) haskell-tools logger options.
|
||||
|
||||
|
||||
CodeLensOpts *CodeLensOpts*
|
||||
|
||||
Fields: ~
|
||||
{autoRefresh?} (fun():boolean|boolean) (default: `true`) Whether to auto-refresh code-lenses.
|
||||
|
||||
|
||||
HoogleOpts *HoogleOpts*
|
||||
|
||||
Fields: ~
|
||||
{mode?} (HoogleMode) Use a telescope with a local hoogle installation or a web backend, or use the browser for hoogle signature search?
|
||||
|
||||
|
||||
HoogleMode *HoogleMode*
|
||||
|
||||
Type: ~
|
||||
"auto"|"telescope-local"|"telescope-web"|"browser"
|
||||
|
||||
|
||||
HoverOpts *HoverOpts*
|
||||
|
||||
Fields: ~
|
||||
{enable?} (fun():boolean|boolean) (default: `true`) Whether to enable haskell-tools hover.
|
||||
{border?} (string[][]) The hover window's border. Set to `nil` to disable.
|
||||
{stylize_markdown?} (boolean) (default: `false`) The builtin LSP client's default behaviour is to stylize markdown. Setting this option to false sets the file type to markdown and enables treesitter syntax highligting for Haskell snippets if nvim-treesitter is installed.
|
||||
{auto_focus?} (boolean) (default: `false`) Whether to automatically switch to the hover window.
|
||||
|
||||
|
||||
DefinitionOpts *DefinitionOpts*
|
||||
|
||||
Fields: ~
|
||||
{hoogle_signature_fallback?} (fun():boolean|boolean) (default: `false`) Configure `vim.lsp.definition` to fall back to hoogle search (does not affect `vim.lsp.tagfunc`).
|
||||
|
||||
|
||||
ReplOpts *ReplOpts*
|
||||
|
||||
Fields: ~
|
||||
{handler?} (fun():ReplHandler|ReplHandler) `'builtin'`: Use the simple builtin repl. `'toggleterm'`: Use akinsho/toggleterm.nvim.
|
||||
{prefer?} (fun():repl_backend|repl_backend) Prefer cabal or stack when both stack and cabal project files are present?
|
||||
{builtin?} (BuiltinReplOpts) Configuration for the builtin repl.
|
||||
{auto_focus?} (boolean) Whether to auto-focus the repl on toggle or send. If unset, the handler decides.
|
||||
|
||||
|
||||
ReplHandler *ReplHandler*
|
||||
|
||||
Type: ~
|
||||
"builtin"|"toggleterm"
|
||||
|
||||
|
||||
repl_backend *repl_backend*
|
||||
|
||||
Type: ~
|
||||
"cabal"|"stack"
|
||||
|
||||
|
||||
BuiltinReplOpts *BuiltinReplOpts*
|
||||
|
||||
Fields: ~
|
||||
{create_repl_window?} (fun(view:ReplView):fun(mk_repl_cmd:mk_repl_cmd_fun))
|
||||
|
||||
|
||||
ReplView *ReplView*
|
||||
|
||||
Fields: ~
|
||||
{create_repl_split?} (fun(opts:ReplViewOpts):mk_repl_cmd_fun) Create the REPL in a horizontally split window.
|
||||
{create_repl_vsplit?} (fun(opts:ReplViewOpts):mk_repl_cmd_fun) Create the REPL in a vertically split window.
|
||||
{create_repl_tabnew?} (fun(opts:ReplViewOpts):mk_repl_cmd_fun) Create the REPL in a new tab.
|
||||
{create_repl_cur_win?} (fun(opts:ReplViewOpts):mk_repl_cmd_fun) Create the REPL in the current window.
|
||||
|
||||
|
||||
ReplViewOpts *ReplViewOpts*
|
||||
|
||||
Fields: ~
|
||||
{delete_buffer_on_exit?} (boolean) Whether to delete the buffer when the Repl quits.
|
||||
{size?} (fun():number|number) The size of the window or a function that determines it.
|
||||
|
||||
|
||||
mk_repl_cmd_fun *mk_repl_cmd_fun*
|
||||
|
||||
Type: ~
|
||||
fun():string[]|nil
|
||||
|
||||
|
||||
FastTagsOpts *FastTagsOpts*
|
||||
|
||||
Fields: ~
|
||||
{enable?} (boolean|fun():boolean)
|
||||
|
||||
|
||||
HTLogOpts *HTLogOpts*
|
||||
|
||||
Fields: ~
|
||||
{level?} (number|string) The log level.
|
||||
|
||||
See: ~
|
||||
|vim.log.levels|
|
||||
|
||||
|
||||
HaskellLspClientOpts *HaskellLspClientOpts*
|
||||
|
||||
Fields: ~
|
||||
{auto_attach?} (fun():boolean|boolean) Whether to automatically attach the LSP client. Defaults to `true` if the haskell-language-server executable is found.
|
||||
{debug?} (boolean) Whether to enable haskell-language-server debug logging.
|
||||
{on_attach?} (fun(client:number,bufnr:number,ht:HaskellTools)) Callback that is invoked when the client attaches to a buffer.
|
||||
{cmd?} (fun():string[]|string[]) The command to start haskell-language-server with.
|
||||
{capabilities?} (lsp.ClientCapabilities) LSP client capabilities.
|
||||
{settings?} (fun(project_root:string|nil):table|table) The haskell-language-server settings or a function that creates them. To view the default settings, run `haskell-language-server generate-default-config`.
|
||||
{default_settings?} (table) The default haskell-language-server settings that will be used if no settings are specified or detected.
|
||||
{logfile?} (string) The path to the haskell-language-server log file.
|
||||
|
||||
|
||||
To print all options that are available for your haskell-language-server version, run `haskell-language-server-wrapper generate-default-config`
|
||||
See: https://haskell-language-server.readthedocs.io/en/latest/configuration.html.
|
||||
|
||||
HTDapOpts *HTDapOpts*
|
||||
|
||||
Fields: ~
|
||||
{cmd?} (string[]) The command to start the debug adapter server with.
|
||||
{logFile?} (string) Log file path for detected configurations.
|
||||
{logLevel?} (HaskellDebugAdapterLogLevel) The log level for detected configurations.
|
||||
{auto_discover?} (boolean|AddDapConfigOpts) Set to `false` to disable auto-discovery of launch configurations. `true` uses the default configurations options`.
|
||||
|
||||
|
||||
HaskellDebugAdapterLogLevel *HaskellDebugAdapterLogLevel*
|
||||
|
||||
Type: ~
|
||||
"Debug"|"Info"|"Warning"|"Error"
|
||||
|
||||
|
||||
==============================================================================
|
||||
haskell-language-server LSP client tools *haskell-tools.lsp*
|
||||
|
||||
The following commands are available:
|
||||
|
||||
* `:HlsStart` - Start the LSP client.
|
||||
* `:HlsStop` - Stop the LSP client.
|
||||
* `:HlsRestart` - Restart the LSP client.
|
||||
* `:HlsEvalAll` - Evaluate all code snippets in comments.
|
||||
|
||||
LoadHlsSettingsOpts *LoadHlsSettingsOpts*
|
||||
|
||||
Fields: ~
|
||||
{settings_file_pattern} (string|nil) File name or pattern to search for. Defaults to 'hls.json'
|
||||
|
||||
|
||||
HlsTools *HlsTools*
|
||||
|
||||
|
||||
*HlsTools.load_hls_settings*
|
||||
HlsTools.load_hls_settings({project_root}, {opts})
|
||||
Search the project root for a haskell-language-server settings JSON file and load it to a Lua table.
|
||||
Falls back to the `hls.default_settings` if no file is found or file cannot be read or decoded.
|
||||
|
||||
Parameters: ~
|
||||
{project_root} (string|nil) The project root
|
||||
{opts} (LoadHlsSettingsOpts|nil)
|
||||
|
||||
Returns: ~
|
||||
(table) hls_settings
|
||||
|
||||
See: ~
|
||||
|https://haskell-language-server.readthedocs.io/en/latest/configuration.html|
|
||||
|
||||
|
||||
HlsTools.start({bufnr}) *HlsTools.start*
|
||||
Start or attach the LSP client.
|
||||
Fails silently if the buffer's filetype is not one of the filetypes specified in the config.
|
||||
|
||||
Parameters: ~
|
||||
{bufnr} (number|nil) The buffer number (optional), defaults to the current buffer
|
||||
|
||||
Returns: ~
|
||||
(number|nil) The LSP client ID
|
||||
|
||||
|
||||
HlsTools.stop({bufnr}) *HlsTools.stop*
|
||||
Stop the LSP client.
|
||||
|
||||
Parameters: ~
|
||||
{bufnr} (number|nil) The buffer number (optional), defaults to the current buffer
|
||||
|
||||
Returns: ~
|
||||
(table[]) A list of clients that will be stopped
|
||||
|
||||
|
||||
HlsTools.restart({bufnr}) *HlsTools.restart*
|
||||
Restart the LSP client.
|
||||
Fails silently if the buffer's filetype is not one of the filetypes specified in the config.
|
||||
|
||||
Parameters: ~
|
||||
{bufnr} (number|nil) The buffer number (optional), defaults to the current buffer
|
||||
|
||||
Returns: ~
|
||||
(number|nil) The LSP client ID after restart
|
||||
|
||||
|
||||
HlsTools.buf_eval_all({bufnr}) *HlsTools.buf_eval_all*
|
||||
Evaluate all code snippets in comments.
|
||||
|
||||
Parameters: ~
|
||||
{bufnr} (number|nil) Defaults to the current buffer.
|
||||
|
||||
Returns: ~
|
||||
(nil)
|
||||
|
||||
|
||||
==============================================================================
|
||||
haskell-tools nvim-dap setup *haskell-tools.dap*
|
||||
|
||||
HsDapLaunchConfiguration *HsDapLaunchConfiguration*
|
||||
|
||||
|
||||
HsDapTools *HsDapTools*
|
||||
|
||||
|
||||
AddDapConfigOpts *AddDapConfigOpts*
|
||||
|
||||
|
||||
*HsDapTools.discover_configurations*
|
||||
HsDapTools.discover_configurations({bufnr}, {opts})
|
||||
Discover nvim-dap launch configurations for haskell-debug-adapter.
|
||||
|
||||
Parameters: ~
|
||||
{bufnr} (number|nil) The buffer number
|
||||
{opts} (AddDapConfigOpts|nil)
|
||||
|
||||
Returns: ~
|
||||
(nil)
|
||||
|
||||
|
||||
==============================================================================
|
||||
haskell-tools Hoogle search *haskell-tools.hoogle*
|
||||
|
||||
HoogleTools *HoogleTools*
|
||||
|
||||
|
||||
HoogleTools.hoogle_signature({options}) *HoogleTools.hoogle_signature*
|
||||
|
||||
Parameters: ~
|
||||
{options} (table<string,any>|nil) Includes the `search_term` and options to pass to the telescope picker (if available)
|
||||
|
||||
Returns: ~
|
||||
(nil)
|
||||
|
||||
|
||||
==============================================================================
|
||||
haskell-tools GHCi REPL module *haskell-tools.repl*
|
||||
|
||||
The following commands are available:
|
||||
|
||||
* `:HtReplToggle` - Toggle a GHCi repl.
|
||||
* `:HtReplQuit` - Quit the current repl.
|
||||
* `:HtReplLoad` - Load a Haskell file into the repl.
|
||||
* `:HtReplReload` - Reload the current repl.
|
||||
|
||||
HsReplTools *HsReplTools*
|
||||
|
||||
|
||||
HsReplTools.buf_mk_repl_cmd() *HsReplTools.buf_mk_repl_cmd*
|
||||
Create the command to create a repl for the current buffer.
|
||||
|
||||
Returns: ~
|
||||
(table|nil) command
|
||||
|
||||
|
||||
HsReplTools.operator() *HsReplTools.operator*
|
||||
|
||||
See: ~
|
||||
|operatorfunc|
|
||||
|
||||
|
||||
HsReplTools.paste({reg}) *HsReplTools.paste*
|
||||
Paste from register `reg` to the REPL
|
||||
|
||||
Parameters: ~
|
||||
{reg} (string|nil) register (defaults to '"')
|
||||
|
||||
|
||||
HsReplTools.paste_type({reg}) *HsReplTools.paste_type*
|
||||
Query the REPL for the type of register `reg`
|
||||
|
||||
Parameters: ~
|
||||
{reg} (string|nil) register (defaults to '"')
|
||||
|
||||
|
||||
HsReplTools.cword_type() *HsReplTools.cword_type*
|
||||
Query the REPL for the type of word under the cursor
|
||||
|
||||
|
||||
HsReplTools.paste_info({reg}) *HsReplTools.paste_info*
|
||||
Query the REPL for info on register `reg`
|
||||
|
||||
Parameters: ~
|
||||
{reg} (string|nil) register (defaults to '"')
|
||||
|
||||
|
||||
HsReplTools.cword_info() *HsReplTools.cword_info*
|
||||
Query the REPL for the type of word under the cursor
|
||||
|
||||
|
||||
HsReplTools.load_file({filepath}) *HsReplTools.load_file*
|
||||
Load a file into the REPL
|
||||
|
||||
Parameters: ~
|
||||
{filepath} (string) The absolute file path
|
||||
|
||||
|
||||
HsReplTools.reload() *HsReplTools.reload*
|
||||
Reload the repl
|
||||
|
||||
|
||||
==============================================================================
|
||||
haskell-tools Project module *haskell-tools.project*
|
||||
|
||||
The following commands are available:
|
||||
|
||||
* `:HsProjectFile` - Open the project file for the current buffer (cabal.project or stack.yaml).
|
||||
* `:HsPackageYaml` - Open the package.yaml file for the current buffer.
|
||||
* `:HsPackageCabal` - Open the *.cabal file for the current buffer.
|
||||
|
||||
HsProjectTools *HsProjectTools*
|
||||
|
||||
|
||||
HsProjectTools.root_dir({project_file}) *HsProjectTools.root_dir*
|
||||
Get the project's root directory
|
||||
|
||||
Parameters: ~
|
||||
{project_file} (string) The path to a project file
|
||||
|
||||
Returns: ~
|
||||
(string|nil)
|
||||
|
||||
|
||||
HsProjectTools.open_package_yaml() *HsProjectTools.open_package_yaml*
|
||||
Open the package.yaml of the package containing the current buffer.
|
||||
|
||||
Returns: ~
|
||||
(nil)
|
||||
|
||||
|
||||
HsProjectTools.open_package_cabal() *HsProjectTools.open_package_cabal*
|
||||
Open the *.cabal file of the package containing the current buffer.
|
||||
|
||||
Returns: ~
|
||||
(nil)
|
||||
|
||||
|
||||
HsProjectTools.open_project_file() *HsProjectTools.open_project_file*
|
||||
Open the current buffer's project file (cabal.project or stack.yaml).
|
||||
|
||||
Returns: ~
|
||||
(nil)
|
||||
|
||||
|
||||
==============================================================================
|
||||
haskell-tools fast-tags module *haskell-tools.tags*
|
||||
|
||||
GenerateProjectTagsOpts *GenerateProjectTagsOpts*
|
||||
|
||||
Fields: ~
|
||||
{refresh} (boolean) Whether to refresh the tags if they have already been generated
|
||||
|
||||
|
||||
FastTagsTools *FastTagsTools*
|
||||
for the project (default: true)
|
||||
|
||||
|
||||
*FastTagsTools.generate_project_tags*
|
||||
FastTagsTools.generate_project_tags({path}, {opts})
|
||||
Generates tags for the current project
|
||||
|
||||
Parameters: ~
|
||||
{path} (string|nil) File path
|
||||
{opts} (GenerateProjectTagsOpts|nil) Options
|
||||
|
||||
|
||||
*FastTagsTools.generate_package_tags*
|
||||
FastTagsTools.generate_package_tags({path})
|
||||
Generate tags for the package containing `path`
|
||||
|
||||
Parameters: ~
|
||||
{path} (string|nil) File path
|
||||
|
||||
|
||||
==============================================================================
|
||||
haskell-tools Logging *haskell-tools.log*
|
||||
|
||||
The following commands are available:
|
||||
|
||||
* `:HtLog` - Open the haskell-tools.nvim log file.
|
||||
* `:HlsLog` - Open the haskell-language-server log file.
|
||||
* `:HtSetLogLevel` - Set the haskell-tools.nvim and LSP client log level.
|
||||
|
||||
HaskellToolsLog *HaskellToolsLog*
|
||||
|
||||
|
||||
HaskellToolsLog.get_hls_logfile() *HaskellToolsLog.get_hls_logfile*
|
||||
Get the haskell-language-server log file
|
||||
|
||||
Returns: ~
|
||||
(string) filepath
|
||||
|
||||
|
||||
HaskellToolsLog.get_logfile() *HaskellToolsLog.get_logfile*
|
||||
Get the haskell-tools.nvim log file path.
|
||||
|
||||
Returns: ~
|
||||
(string) filepath
|
||||
|
||||
|
||||
HaskellToolsLog.nvim_open_hls_logfile() *HaskellToolsLog.nvim_open_hls_logfile*
|
||||
Open the haskell-language-server log file
|
||||
|
||||
Returns: ~
|
||||
(nil)
|
||||
|
||||
|
||||
HaskellToolsLog.nvim_open_logfile() *HaskellToolsLog.nvim_open_logfile*
|
||||
Open the haskell-tools.nvim log file.
|
||||
|
||||
Returns: ~
|
||||
(nil)
|
||||
|
||||
|
||||
HaskellToolsLog.set_level() *HaskellToolsLog.set_level*
|
||||
|
||||
Returns: ~
|
||||
(nil)
|
||||
|
||||
See: ~
|
||||
|vim.log.levels|
|
||||
|
||||
|
||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||
@ -1 +0,0 @@
|
||||
require('haskell-tools.internal').ftplugin()
|
||||
@ -1 +0,0 @@
|
||||
require('haskell-tools.internal').ftplugin()
|
||||
@ -1 +0,0 @@
|
||||
require('haskell-tools.internal').ftplugin()
|
||||
@ -1 +0,0 @@
|
||||
require('haskell-tools.internal').ftplugin()
|
||||
@ -1,34 +0,0 @@
|
||||
local git_ref = '3.1.8'
|
||||
local modrev = '3.1.8'
|
||||
local specrev = '1'
|
||||
|
||||
local repo_url = 'https://github.com/mrcjkb/haskell-tools.nvim'
|
||||
|
||||
rockspec_format = '3.0'
|
||||
package = 'haskell-tools.nvim'
|
||||
version = modrev ..'-'.. specrev
|
||||
|
||||
description = {
|
||||
summary = 'Supercharge your Haskell experience in neovim!',
|
||||
detailed = [[
|
||||
This plugin automatically configures the haskell-language-server builtin LSP client
|
||||
and integrates with other Haskell tools. See the README's #features section
|
||||
for more info.]],
|
||||
labels = { 'dap', 'debug-adapter-protocol', 'fast-tags', 'haskell', 'hoogle', 'language-server', 'language-server-protocol', 'lsp', 'lsp-client', 'lua', 'neovim', 'neovim-plugin', 'nvim', 'plugin', 'repl', 'tagfunc', 'telescope', 'vim' } ,
|
||||
homepage = 'https://github.com/mrcjkb/haskell-tools.nvim',
|
||||
license = 'GPL-2.0'
|
||||
}
|
||||
|
||||
dependencies = { 'lua >= 5.1' }
|
||||
|
||||
test_dependencies = { }
|
||||
|
||||
source = {
|
||||
url = repo_url .. '/archive/' .. git_ref .. '.zip',
|
||||
dir = 'haskell-tools.nvim-' .. '3.1.8',
|
||||
}
|
||||
|
||||
build = {
|
||||
type = 'builtin',
|
||||
copy_directories = { 'doc', 'ftplugin' } ,
|
||||
}
|
||||
@ -1,73 +0,0 @@
|
||||
rock_manifest = {
|
||||
doc = {
|
||||
["haskell-tools.txt"] = "dea283444425fa165997d28c1ac610c8"
|
||||
},
|
||||
ftplugin = {
|
||||
["cabal.lua"] = "4f72e96d3601fed58fd4a24e9633172d",
|
||||
["cabalproject.lua"] = "4f72e96d3601fed58fd4a24e9633172d",
|
||||
["haskell.lua"] = "4f72e96d3601fed58fd4a24e9633172d",
|
||||
["lhaskell.lua"] = "4f72e96d3601fed58fd4a24e9633172d"
|
||||
},
|
||||
["haskell-tools.nvim-3.1.8-1.rockspec"] = "653d0f8f3d848afa2ac2e8d64e470886",
|
||||
lua = {
|
||||
["haskell-tools"] = {
|
||||
["compat.lua"] = "1457323a47d791e5ff2393871a112357",
|
||||
config = {
|
||||
["check.lua"] = "4c6c96c3b51efe53b54c8bc4f14d93d6",
|
||||
["init.lua"] = "e1f6bc006747eb79f131b527acb83b1f",
|
||||
["internal.lua"] = "373f754423a5786afbfcdea048d74bc7"
|
||||
},
|
||||
dap = {
|
||||
["init.lua"] = "007e49a6c0a33047d9dc3cc0c76474e7",
|
||||
["internal.lua"] = "f30905af3fdff69d13c20682767c44a2"
|
||||
},
|
||||
["deps.lua"] = "ff7e0f06f003b497c958805a391c1eaf",
|
||||
["health.lua"] = "941c948e1667a8a532f2b93f59d0347b",
|
||||
hoogle = {
|
||||
["helpers.lua"] = "e5428112e897aa06b0a76d186679b110",
|
||||
["init.lua"] = "5385afa48b78262001e50154b6f02ec3",
|
||||
["local.lua"] = "eca412a13b7a33cba0b2935c4024d864",
|
||||
["web.lua"] = "4ebe05b9a484b20e88ff51af76f6a88e"
|
||||
},
|
||||
["init.lua"] = "81946a46a32bdc3066333f6cac348712",
|
||||
["internal.lua"] = "f149d8830ae8f0516393ffb31b573765",
|
||||
log = {
|
||||
["init.lua"] = "c8b080a5a9701cb8ae3c526acd868964",
|
||||
["internal.lua"] = "ed9e8200543b60724d27d5a991191a3e"
|
||||
},
|
||||
lsp = {
|
||||
["definition.lua"] = "04348f8215b227a5da688b92e1cfe23b",
|
||||
["eval.lua"] = "69614508eab450ad811c9cbdd46130a9",
|
||||
["helpers.lua"] = "010ab78c87db24c8142c29ac35c218e8",
|
||||
["hover.lua"] = "9e03896e1877b06c98f11ce1b643343c",
|
||||
["init.lua"] = "44c4d7be0311e2d746e00308710345e9"
|
||||
},
|
||||
["os.lua"] = "110cd7ec57e6587360092f8f78025783",
|
||||
["parser.lua"] = "402dc6ebad5cffbe6700e774ad64724a",
|
||||
project = {
|
||||
["cabal.lua"] = "ef4d57f352f6f15cb21bc3dc72e37872",
|
||||
["helpers.lua"] = "c167cfdaca3d44feb95eb921470dbaf0",
|
||||
["init.lua"] = "eebdb000f25db6280299ccc89ee64fc6",
|
||||
["stack.lua"] = "71c00101f8004f9c905a9ddb33dc6889"
|
||||
},
|
||||
repl = {
|
||||
["builtin.lua"] = "c1b6210d95f533ec06bb3857f8d1dc7e",
|
||||
["init.lua"] = "3529ee48e2a8e39f962fd6d351ff6ee3",
|
||||
["toggleterm.lua"] = "f62892e49e2f5b25394f0c254a9cebb6"
|
||||
},
|
||||
["strings.lua"] = "6429d6757a6c08856f425b72d7d8362c",
|
||||
["tags.lua"] = "b82dd1a468edfc13323b2f290f73dc24",
|
||||
types = {
|
||||
["internal.lua"] = "a078237ae853c7f19c396a7d5001fa28"
|
||||
}
|
||||
},
|
||||
telescope = {
|
||||
_extensions = {
|
||||
ht = {
|
||||
["extension.lua"] = "040c10b48645d3230bba5952281ea858"
|
||||
},
|
||||
["ht.lua"] = "ebd1a0ec34353b6b42b5e6012ff69dd9"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,173 +0,0 @@
|
||||
commands = {}
|
||||
dependencies = {
|
||||
["haskell-tools.nvim"] = {
|
||||
["3.1.8-1"] = {
|
||||
{
|
||||
constraints = {
|
||||
{
|
||||
op = ">=",
|
||||
version = {
|
||||
5, 1, string = "5.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "lua"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
modules = {
|
||||
["haskell-tools.compat"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.config.check"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.config.init"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.config.internal"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.dap.init"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.dap.internal"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.deps"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.health"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.hoogle.helpers"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.hoogle.init"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.hoogle.local"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.hoogle.web"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.init"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.internal"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.log.init"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.log.internal"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.lsp.definition"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.lsp.eval"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.lsp.helpers"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.lsp.hover"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.lsp.init"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.os"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.parser"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.project.cabal"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.project.helpers"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.project.init"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.project.stack"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.repl.builtin"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.repl.init"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.repl.toggleterm"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.strings"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.tags"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["haskell-tools.types.internal"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["telescope._extensions.ht"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
},
|
||||
["telescope._extensions.ht.extension"] = {
|
||||
"haskell-tools.nvim/3.1.8-1"
|
||||
}
|
||||
}
|
||||
repository = {
|
||||
["haskell-tools.nvim"] = {
|
||||
["3.1.8-1"] = {
|
||||
{
|
||||
arch = "installed",
|
||||
commands = {},
|
||||
dependencies = {},
|
||||
modules = {
|
||||
["haskell-tools.compat"] = "haskell-tools/compat.lua",
|
||||
["haskell-tools.config.check"] = "haskell-tools/config/check.lua",
|
||||
["haskell-tools.config.init"] = "haskell-tools/config/init.lua",
|
||||
["haskell-tools.config.internal"] = "haskell-tools/config/internal.lua",
|
||||
["haskell-tools.dap.init"] = "haskell-tools/dap/init.lua",
|
||||
["haskell-tools.dap.internal"] = "haskell-tools/dap/internal.lua",
|
||||
["haskell-tools.deps"] = "haskell-tools/deps.lua",
|
||||
["haskell-tools.health"] = "haskell-tools/health.lua",
|
||||
["haskell-tools.hoogle.helpers"] = "haskell-tools/hoogle/helpers.lua",
|
||||
["haskell-tools.hoogle.init"] = "haskell-tools/hoogle/init.lua",
|
||||
["haskell-tools.hoogle.local"] = "haskell-tools/hoogle/local.lua",
|
||||
["haskell-tools.hoogle.web"] = "haskell-tools/hoogle/web.lua",
|
||||
["haskell-tools.init"] = "haskell-tools/init.lua",
|
||||
["haskell-tools.internal"] = "haskell-tools/internal.lua",
|
||||
["haskell-tools.log.init"] = "haskell-tools/log/init.lua",
|
||||
["haskell-tools.log.internal"] = "haskell-tools/log/internal.lua",
|
||||
["haskell-tools.lsp.definition"] = "haskell-tools/lsp/definition.lua",
|
||||
["haskell-tools.lsp.eval"] = "haskell-tools/lsp/eval.lua",
|
||||
["haskell-tools.lsp.helpers"] = "haskell-tools/lsp/helpers.lua",
|
||||
["haskell-tools.lsp.hover"] = "haskell-tools/lsp/hover.lua",
|
||||
["haskell-tools.lsp.init"] = "haskell-tools/lsp/init.lua",
|
||||
["haskell-tools.os"] = "haskell-tools/os.lua",
|
||||
["haskell-tools.parser"] = "haskell-tools/parser.lua",
|
||||
["haskell-tools.project.cabal"] = "haskell-tools/project/cabal.lua",
|
||||
["haskell-tools.project.helpers"] = "haskell-tools/project/helpers.lua",
|
||||
["haskell-tools.project.init"] = "haskell-tools/project/init.lua",
|
||||
["haskell-tools.project.stack"] = "haskell-tools/project/stack.lua",
|
||||
["haskell-tools.repl.builtin"] = "haskell-tools/repl/builtin.lua",
|
||||
["haskell-tools.repl.init"] = "haskell-tools/repl/init.lua",
|
||||
["haskell-tools.repl.toggleterm"] = "haskell-tools/repl/toggleterm.lua",
|
||||
["haskell-tools.strings"] = "haskell-tools/strings.lua",
|
||||
["haskell-tools.tags"] = "haskell-tools/tags.lua",
|
||||
["haskell-tools.types.internal"] = "haskell-tools/types/internal.lua",
|
||||
["telescope._extensions.ht"] = "telescope/_extensions/ht.lua",
|
||||
["telescope._extensions.ht.extension"] = "telescope/_extensions/ht/extension.lua"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
local git_ref = '3.1.8'
|
||||
local modrev = '3.1.8'
|
||||
local specrev = '1'
|
||||
|
||||
local repo_url = 'https://github.com/mrcjkb/haskell-tools.nvim'
|
||||
|
||||
rockspec_format = '3.0'
|
||||
package = 'haskell-tools.nvim'
|
||||
version = modrev ..'-'.. specrev
|
||||
|
||||
description = {
|
||||
summary = 'Supercharge your Haskell experience in neovim!',
|
||||
detailed = [[
|
||||
This plugin automatically configures the haskell-language-server builtin LSP client
|
||||
and integrates with other Haskell tools. See the README's #features section
|
||||
for more info.]],
|
||||
labels = { 'dap', 'debug-adapter-protocol', 'fast-tags', 'haskell', 'hoogle', 'language-server', 'language-server-protocol', 'lsp', 'lsp-client', 'lua', 'neovim', 'neovim-plugin', 'nvim', 'plugin', 'repl', 'tagfunc', 'telescope', 'vim' } ,
|
||||
homepage = 'https://github.com/mrcjkb/haskell-tools.nvim',
|
||||
license = 'GPL-2.0'
|
||||
}
|
||||
|
||||
dependencies = { 'lua >= 5.1' }
|
||||
|
||||
test_dependencies = { }
|
||||
|
||||
source = {
|
||||
url = repo_url .. '/archive/' .. git_ref .. '.zip',
|
||||
dir = 'haskell-tools.nvim-' .. '3.1.8',
|
||||
}
|
||||
|
||||
build = {
|
||||
type = 'builtin',
|
||||
copy_directories = { 'doc', 'ftplugin' } ,
|
||||
}
|
||||
@ -33,7 +33,7 @@ local folding_range_capabilities = deps.if_available('ufo', function(_)
|
||||
}
|
||||
end, {})
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
'keep',
|
||||
'force',
|
||||
ht_capabilities,
|
||||
cmp_capabilities,
|
||||
selection_range_capabilities,
|
||||
|
||||
@ -1 +1 @@
|
||||
/nix/store/mqbhz05llkddfb5wni0m48kw22ixxps4-lua-5.1.5
|
||||
/nix/store/3czmrawji85vf8979kll2yx2f1kjkric-lua-5.1.5
|
||||
@ -8,14 +8,14 @@ rock_manifest = {
|
||||
["haskell.lua"] = "4f72e96d3601fed58fd4a24e9633172d",
|
||||
["lhaskell.lua"] = "4f72e96d3601fed58fd4a24e9633172d"
|
||||
},
|
||||
["haskell-tools.nvim-3.1.8-1.rockspec"] = "653d0f8f3d848afa2ac2e8d64e470886",
|
||||
["haskell-tools.nvim-3.1.10-1.rockspec"] = "18d77dcfb4eabe4ff073dfcdf377925d",
|
||||
lua = {
|
||||
["haskell-tools"] = {
|
||||
["compat.lua"] = "1457323a47d791e5ff2393871a112357",
|
||||
config = {
|
||||
["check.lua"] = "4c6c96c3b51efe53b54c8bc4f14d93d6",
|
||||
["init.lua"] = "e1f6bc006747eb79f131b527acb83b1f",
|
||||
["internal.lua"] = "373f754423a5786afbfcdea048d74bc7"
|
||||
["internal.lua"] = "471dfa798228e41621483c89212a7544"
|
||||
},
|
||||
dap = {
|
||||
["init.lua"] = "007e49a6c0a33047d9dc3cc0c76474e7",
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*luasnip.txt* For NVIM v0.8.0 Last change: 2024 May 24
|
||||
*luasnip.txt* For NVIM v0.8.0 Last change: 2024 June 07
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *luasnip-table-of-contents*
|
||||
@ -241,7 +241,7 @@ Common opts:
|
||||
|
||||
- `node_ext_opts` and `merge_node_ext_opts`: Control `ext_opts` (most likely
|
||||
highlighting) of the node. Described in detail in |luasnip-ext_opts|
|
||||
- `key`: The node can be reffered to by this key. Useful for either |luasnip-key-indexer| or for finding the node at runtime (See
|
||||
- `key`: The node can be referred to by this key. Useful for either |luasnip-key-indexer| or for finding the node at runtime (See
|
||||
|luasnip-snippets-api|), for example inside a `dynamicNode`. The keys
|
||||
do not have to be unique across the entire lifetime of the snippet, but at any
|
||||
point in time, the snippet may contain each key only once. This means it is
|
||||
@ -759,7 +759,7 @@ ChoiceNodes allow choosing between multiple nodes.
|
||||
|
||||
- `jump_index`: `number`, since choiceNodes can be jumped to, they need a
|
||||
jump-index (Info in |luasnip-basics-jump-index|).
|
||||
- `choices`: `node[]|node`, the choices. The first will be initialliy active.
|
||||
- `choices`: `node[]|node`, the choices. The first will be initially active.
|
||||
A list of nodes will be turned into a `snippetNode`.
|
||||
- `node_opts`: `table`. `choiceNode` supports the keys common to all nodes
|
||||
described in |luasnip-node|, and one additional key:
|
||||
@ -897,7 +897,7 @@ All of these parameters except `indentstring` are exactly the same as in
|
||||
|
||||
- `indentstring`: `string`, will be used to indent the nodes inside this
|
||||
`snippetNode`.
|
||||
All occurences of `"$PARENT_INDENT"` are replaced with the actual indent of
|
||||
All occurrences of `"$PARENT_INDENT"` are replaced with the actual indent of
|
||||
the parent.
|
||||
|
||||
|
||||
@ -1277,7 +1277,7 @@ A shortcut for `functionNode`s that only do very basic string manipulation.
|
||||
- `lambda`: An object created by applying string-operations to `l._n`, objects
|
||||
representing the `n`th argnode.
|
||||
For example:
|
||||
- `l._1:gsub("a", "e")` replaces all occurences of "a" in the text of the
|
||||
- `l._1:gsub("a", "e")` replaces all occurrences of "a" in the text of the
|
||||
first argnode with "e", or
|
||||
- `l._1 .. l._2` concatenates text of the first and second argnode.
|
||||
If an argnode contains multiple lines of text, they are concatenated with
|
||||
@ -1351,8 +1351,8 @@ Examples:
|
||||
m({ 1, 2 }, l._1:match("^" .. l._2 .. "$"), l._1:gsub("a", "e"))
|
||||
})
|
||||
<
|
||||
This inserts the text of the node with jump-index 1, with all occurences of `a`
|
||||
replaced with `e`, if the second insertNode matches the first exactly.
|
||||
This inserts the text of the node with jump-index 1, with all occurrences of
|
||||
`a` replaced with `e`, if the second insertNode matches the first exactly.
|
||||
|
||||
|
||||
REPEAT *luasnip-extras-repeat*
|
||||
@ -1466,7 +1466,7 @@ any way, correspond to the jump-index of the nodes!
|
||||
|
||||
`fmt(format:string, nodes:table of nodes, opts:table|nil) -> table of nodes`
|
||||
|
||||
- `format`: a string. Occurences of `{<somekey>}` ( `{}` are customizable; more
|
||||
- `format`: a string. Occurrences of `{<somekey>}` ( `{}` are customizable; more
|
||||
on that later) are replaced with `content[<somekey>]` (which should be a
|
||||
node), while surrounding text becomes `textNode`s.
|
||||
To escape a delimiter, repeat it (`"{{"`).
|
||||
@ -1476,7 +1476,7 @@ any way, correspond to the jump-index of the nodes!
|
||||
numbered placeholder).
|
||||
If a key appears more than once in `format`, the node in
|
||||
`content[<duplicate_key>]` is inserted for the first, and copies of it for
|
||||
subsequent occurences.
|
||||
subsequent occurrences.
|
||||
- `nodes`: just a table of nodes.
|
||||
- `opts`: optional arguments:
|
||||
- `delimiters`: string, two characters. Change `{}` to some other pair, e.g.
|
||||
@ -1589,7 +1589,7 @@ Here’s one set of example keybindings:
|
||||
inoremap <c-f> <cmd>lua require('luasnip.extras.otf').on_the_fly("e")<cr>
|
||||
<
|
||||
|
||||
Obviously, `<c-f>` is arbritary and can be changed to any other key combo.
|
||||
Obviously, `<c-f>` is arbitrary and can be changed to any other key combo.
|
||||
Another interesting application is allowing multiple on-the-fly snippets at the
|
||||
same time by retrieving snippets from multiple registers:
|
||||
|
||||
@ -1629,7 +1629,7 @@ Contains some utility functions that can be passed to the `ft_func` or
|
||||
the buffer.
|
||||
- `from_cursor_pos`: uses treesitter to determine the filetype at the cursor.
|
||||
With that, it’s possible to expand snippets in injected regions, as long as
|
||||
the treesitter parser supports them. If this is used in conjuction with
|
||||
the treesitter parser supports them. If this is used in conjunction with
|
||||
`lazy_load`, extra care must be taken that all the filetypes that can be
|
||||
expanded in a given buffer are also returned by `load_ft_func` (otherwise their
|
||||
snippets may not be loaded). This can easily be achieved with `extend_load_ft`.
|
||||
@ -1637,7 +1637,7 @@ Contains some utility functions that can be passed to the `ft_func` or
|
||||
described above is loading more filetypes than just that of the target buffer
|
||||
when `lazy_load`ing. This can be done ergonomically via `extend_load_ft`:
|
||||
calling it with a table where the keys are filetypes, and the values are the
|
||||
filetypes that should be loaded additionaly returns a function that can be
|
||||
filetypes that should be loaded additionally returns a function that can be
|
||||
passed to `load_ft_func` and takes care of extending the filetypes properly.
|
||||
>lua
|
||||
ls.setup({
|
||||
@ -1661,7 +1661,7 @@ which alters text before the snippet’s trigger. While these can be
|
||||
implemented using regTrig snippets, this helper makes the process easier in
|
||||
most cases.
|
||||
|
||||
The simplest example, which surrounds the text preceeding the `.br` with
|
||||
The simplest example, which surrounds the text preceding the `.br` with
|
||||
brackets `[]`, looks like:
|
||||
|
||||
>lua
|
||||
@ -1709,7 +1709,7 @@ as the table in the same position for `s` except:
|
||||
against. The default match pattern is `"[%w%.%_%-]+$"`. Note the `$`. This
|
||||
matches since only the line _up until_ the beginning of the trigger is
|
||||
matched against the pattern, which makes the character immediately
|
||||
preceeding the trigger match as the end of the string.
|
||||
preceding the trigger match as the end of the string.
|
||||
|
||||
Some other match strings, including the default, are available from the postfix
|
||||
module. `require("luasnip.extras.postfix).matches`:
|
||||
@ -1746,7 +1746,7 @@ TREESITTER-POSTFIX-SNIPPET *luasnip-extras-treesitter-postfix-snippet*
|
||||
Instead of triggering a postfix-snippet when some pattern matches in front of
|
||||
the trigger, it might be useful to match if some specific treesitter-nodes
|
||||
surround/are in front of the trigger. While this functionality can also be
|
||||
implemented by a cusutom `resolveExpandParams`, this helper simplifies the
|
||||
implemented by a custom `resolveExpandParams`, this helper simplifies the
|
||||
common cases.
|
||||
|
||||
This matching of treesitter-nodes can be done either
|
||||
@ -1757,7 +1757,7 @@ This matching of treesitter-nodes can be done either
|
||||
- by providing a function that manually walks the node-tree, and returns the
|
||||
node in front of the trigger on success (for increased flexibility).
|
||||
|
||||
A simple example, which surrounds the previous node’s text preceeding the
|
||||
A simple example, which surrounds the previous node’s text preceding the
|
||||
`.mv` with `std::move()` in cpp files, looks like:
|
||||
|
||||
>lua
|
||||
@ -2175,9 +2175,9 @@ although, for usage outside of LuaSnip, best copy the source file:
|
||||
- arg_indx, `number` (required): the position of the parameter to override.
|
||||
- extend, `fn(arg, extend_value) -> effective_arg` (optional): this function
|
||||
is used to extend the args passed to the decorated function.
|
||||
It defaults to a function which just extends the the arg-table with the
|
||||
It defaults to a function which just extends the arg-table with the
|
||||
extend table (accepts `nil`).
|
||||
This extend behaviour is adaptable to accomodate `s`, where the first
|
||||
This extend behaviour is adaptable to accommodate `s`, where the first
|
||||
argument may be string or table.
|
||||
|
||||
`apply(fn, ...) -> decorated_fn`:
|
||||
@ -2394,7 +2394,7 @@ variable is unknown (that is, its name isn’t defined) the name of the
|
||||
variable is inserted and it is transformed into a placeholder.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
The above necessiates a differentiation between `unknown` and `unset`
|
||||
The above necessitates a differentiation between `unknown` and `unset`
|
||||
variables:
|
||||
|
||||
For LuaSnip, a variable `VARNAME` is `unknown` when `env.VARNAME` returns `nil`
|
||||
@ -2439,7 +2439,7 @@ where `opts` can contain the following keys:
|
||||
- `include`: List of languages to include, includes everything by default.
|
||||
- `{override,default}_priority`: These keys are passed straight to the
|
||||
`add_snippets`-calls (documented in |luasnip-api|) and can therefore change the
|
||||
priority of snippets loaded from some colletion (or, in combination with
|
||||
priority of snippets loaded from some collection (or, in combination with
|
||||
`{in,ex}clude`, only some of its snippets).
|
||||
- `fs_event_providers`: `table<string, boolean>?`, specifies which mechanisms
|
||||
should be used to watch files for updates/creation.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
||||
" Vim filetype plugin for SnipMate snippets (.snippets files)
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let b:undo_ftplugin = "setl et< sts< cms< fdm< fde<"
|
||||
|
||||
" Use hard tabs
|
||||
setlocal noexpandtab softtabstop=0
|
||||
|
||||
setlocal commentstring=#\ %s
|
||||
setlocal nospell
|
||||
@ -1,37 +0,0 @@
|
||||
local git_ref = 'v2.3.0'
|
||||
local modrev = '2.3.0'
|
||||
local specrev = '1'
|
||||
|
||||
local repo_url = 'https://github.com/L3MON4D3/LuaSnip'
|
||||
|
||||
rockspec_format = '3.0'
|
||||
package = 'luasnip'
|
||||
version = modrev ..'-'.. specrev
|
||||
|
||||
description = {
|
||||
summary = 'Snippet Engine for Neovim written in Lua.',
|
||||
detailed = '',
|
||||
labels = { 'lua', 'neovim', 'snippet-engine', 'snippets' } ,
|
||||
homepage = 'https://github.com/L3MON4D3/LuaSnip',
|
||||
license = 'Apache-2.0'
|
||||
}
|
||||
|
||||
dependencies = { 'lua >= 5.1', 'jsregexp >= 0.0.5, <= 0.0.7' }
|
||||
|
||||
test_dependencies = { }
|
||||
|
||||
source = {
|
||||
url = repo_url .. '/archive/' .. git_ref .. '.zip',
|
||||
dir = 'LuaSnip-' .. '2.3.0',
|
||||
}
|
||||
|
||||
if modrev == 'scm' or modrev == 'dev' then
|
||||
source = {
|
||||
url = repo_url:gsub('https', 'git')
|
||||
}
|
||||
end
|
||||
|
||||
build = {
|
||||
type = 'builtin',
|
||||
copy_directories = { 'doc', 'ftplugin', 'plugin', 'syntax' } ,
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
vim.filetype.add({
|
||||
extension = { snippets = "snippets" },
|
||||
})
|
||||
|
||||
local function silent_map(mode, lhs, rhs, desc)
|
||||
vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc or "" })
|
||||
end
|
||||
|
||||
silent_map("i", "<Plug>luasnip-expand-or-jump", function()
|
||||
require("luasnip").expand_or_jump()
|
||||
end, "LuaSnip: Expand or jump in the current snippet")
|
||||
silent_map("i", "<Plug>luasnip-expand-snippet", function()
|
||||
require("luasnip").expand()
|
||||
end, "LuaSnip: Expand the current snippet")
|
||||
silent_map("i", "<Plug>luasnip-next-choice", function()
|
||||
require("luasnip").change_choice(1)
|
||||
end, "LuaSnip: Change to the next choice from the choiceNode")
|
||||
silent_map("i", "<Plug>luasnip-prev-choice", function()
|
||||
require("luasnip").change_choice(-1)
|
||||
end, "LuaSnip: Change to the previous choice from the choiceNode")
|
||||
silent_map("i", "<Plug>luasnip-jump-next", function()
|
||||
require("luasnip").jump(1)
|
||||
end, "LuaSnip: Jump to the next node")
|
||||
silent_map("i", "<Plug>luasnip-jump-prev", function()
|
||||
require("luasnip").jump(-1)
|
||||
end, "LuaSnip: Jump to the previous node")
|
||||
|
||||
silent_map("n", "<Plug>luasnip-delete-check", function()
|
||||
require("luasnip").unlink_current_if_deleted()
|
||||
end, "LuaSnip: Removes current snippet from jumplist")
|
||||
silent_map("!", "<Plug>luasnip-delete-check", function()
|
||||
require("luasnip").unlink_current_if_deleted()
|
||||
end, "LuaSnip: Removes current snippet from jumplist")
|
||||
|
||||
silent_map("", "<Plug>luasnip-expand-repeat", function()
|
||||
require("luasnip").expand_repeat()
|
||||
end, "LuaSnip: Repeat last node expansion")
|
||||
silent_map("!", "<Plug>luasnip-expand-repeat", function()
|
||||
require("luasnip").expand_repeat()
|
||||
end, "LuaSnip: Repeat last node expansion")
|
||||
|
||||
silent_map("s", "<Plug>luasnip-expand-or-jump", function()
|
||||
require("luasnip").expand_or_jump()
|
||||
end, "LuaSnip: Expand or jump in the current snippet")
|
||||
silent_map("s", "<Plug>luasnip-expand-snippet", function()
|
||||
require("luasnip").expand()
|
||||
end, "LuaSnip: Expand the current snippet")
|
||||
silent_map("s", "<Plug>luasnip-next-choice", function()
|
||||
require("luasnip").change_choice(1)
|
||||
end, "LuaSnip: Change to the next choice from the choiceNode")
|
||||
silent_map("s", "<Plug>luasnip-prev-choice", function()
|
||||
require("luasnip").change_choice(-1)
|
||||
end, "LuaSnip: Change to the previous choice from the choiceNode")
|
||||
silent_map("s", "<Plug>luasnip-jump-next", function()
|
||||
require("luasnip").jump(1)
|
||||
end, "LuaSnip: Jump to the next node")
|
||||
silent_map("s", "<Plug>luasnip-jump-prev", function()
|
||||
require("luasnip").jump(-1)
|
||||
end, "LuaSnip: Jump to the previous node")
|
||||
|
||||
vim.api.nvim_create_user_command("LuaSnipUnlinkCurrent", function()
|
||||
require("luasnip").unlink_current()
|
||||
end, { force = true })
|
||||
|
||||
--stylua: ignore
|
||||
vim.api.nvim_create_user_command("LuaSnipListAvailable", function()
|
||||
(
|
||||
(
|
||||
vim.version
|
||||
and type(vim.version) == "table"
|
||||
and (
|
||||
((vim.version().major == 0) and (vim.version().minor >= 9))
|
||||
or (vim.version().major > 0) )
|
||||
) and vim.print
|
||||
or vim.pretty_print
|
||||
)(require("luasnip").available())
|
||||
end, { force = true })
|
||||
|
||||
require("luasnip.config")._setup()
|
||||
|
||||
-- register these during startup so lazy_load will also load filetypes whose
|
||||
-- events fired only before lazy_load is actually called.
|
||||
-- (BufWinEnter -> lazy_load() wouldn't load any files without these).
|
||||
vim.api.nvim_create_augroup("_luasnip_lazy_load", {})
|
||||
vim.api.nvim_create_autocmd({ "BufWinEnter", "FileType" }, {
|
||||
callback = function(event)
|
||||
require("luasnip.loaders").load_lazy_loaded(tonumber(event.buf))
|
||||
end,
|
||||
group = "_luasnip_lazy_load",
|
||||
})
|
||||
@ -1,23 +0,0 @@
|
||||
function! luasnip#expandable()
|
||||
return luaeval('require("luasnip").expandable()')
|
||||
endfunction
|
||||
|
||||
function! luasnip#expand_or_jumpable()
|
||||
return luaeval('require("luasnip").expand_or_jumpable()')
|
||||
endfunction
|
||||
|
||||
function! luasnip#expand_or_locally_jumpable()
|
||||
return luaeval('require("luasnip").expand_or_locally_jumpable()')
|
||||
endfunction
|
||||
|
||||
function! luasnip#locally_jumpable(direction)
|
||||
return luaeval('require("luasnip").locally_jumpable(_A)', a:direction)
|
||||
endfunction
|
||||
|
||||
function! luasnip#jumpable(direction)
|
||||
return luaeval('require("luasnip").jumpable(_A)', a:direction)
|
||||
endfunction
|
||||
|
||||
function! luasnip#choice_active()
|
||||
return luaeval('require("luasnip").choice_active()')
|
||||
endfunction
|
||||
@ -1,116 +0,0 @@
|
||||
rock_manifest = {
|
||||
doc = {
|
||||
["luasnip.txt"] = "5014cf9a2bb7c7360fd34a1a02356207"
|
||||
},
|
||||
ftplugin = {
|
||||
["snippets.vim"] = "ecd77fcf256c792985acf12ea7603322"
|
||||
},
|
||||
lua = {
|
||||
luasnip = {
|
||||
["_types.lua"] = "a1b1fc45d496f8ece3e17dc3541e5f93",
|
||||
["config.lua"] = "1bb0edf593b14b243b116d70cbb605c9",
|
||||
["default_config.lua"] = "51eea9c217eed18af81d580129c70461",
|
||||
extras = {
|
||||
["_extra_types.lua"] = "b8f4a120d5abe22f0112efdcae358817",
|
||||
["_lambda.lua"] = "e94a2ad0606ed3c4276a573d4e7ab205",
|
||||
["_parser_combinator.lua"] = "bacc166557d1b5f9f03aff25a56bc801",
|
||||
["_treesitter.lua"] = "d9fb19599b9d95edab033fdda0684c32",
|
||||
conditions = {
|
||||
["expand.lua"] = "35c3ab55ec8e9916ed7cde31cc807b08",
|
||||
["init.lua"] = "12f7e4b6fd6b5796c36ce61db5844efd",
|
||||
["show.lua"] = "0cd4059f6ba5582f409ced580e9fef13"
|
||||
},
|
||||
["expand_conditions.lua"] = "6ea7479cea2e5fac95a2045a6a283d4b",
|
||||
["filetype_functions.lua"] = "bdab365ff7bd2d7d148fdc6b3b78d9b4",
|
||||
["fmt.lua"] = "014768af82d3e7e58437e41335553eb6",
|
||||
["init.lua"] = "560335e3043e97a826fc8aee4b250fbc",
|
||||
["otf.lua"] = "8a95cdb7b582497542069bdd0886776b",
|
||||
["postfix.lua"] = "5e94359e6642b52d8ef6c9df3a90e167",
|
||||
["select_choice.lua"] = "8c924f05ee0d55ab9b0d9e5c603e1a52",
|
||||
["snip_location.lua"] = "bd0f8a7f1c61f6a001fa5781c15839d5",
|
||||
["snippet_list.lua"] = "fe61183934e0bb966b83461febdd1dcb",
|
||||
["treesitter_postfix.lua"] = "42a5143ad3c647d292b2183566fd6776"
|
||||
},
|
||||
["health.lua"] = "b6bd288f728f6897674347ad46917a5b",
|
||||
["init.lua"] = "96451aae98dbaf3ece53873298479172",
|
||||
loaders = {
|
||||
["data.lua"] = "498490d7dfcf2f0374b0d20f429ba6fb",
|
||||
["from_lua.lua"] = "78d20ec3694e16581e21ed4948c26385",
|
||||
["from_snipmate.lua"] = "93e1cdc6e024549d9aa6bc917325de24",
|
||||
["from_vscode.lua"] = "0ff819764a09a735f9ea8ef51413ae83",
|
||||
["fs_watchers.lua"] = "b36b9f60988b568602350c41b032f9e6",
|
||||
["init.lua"] = "d470bc3c7bd4690199cf1c0d214782cf",
|
||||
["snippet_cache.lua"] = "e2b5cf9a46713fb3f108067100e77e0c",
|
||||
["types.lua"] = "89e18f0f21c1e77be74c1cbe85757d11",
|
||||
["util.lua"] = "77a85743643bf4d15cbe91af429908d5"
|
||||
},
|
||||
nodes = {
|
||||
["absolute_indexer.lua"] = "efa73978bd91f2d90f2fc9ef53a9c38c",
|
||||
["choiceNode.lua"] = "c63618056997ec5aec6524fffff7f2fb",
|
||||
["duplicate.lua"] = "454e20ad45dbf371aa7d09aa21861f1c",
|
||||
["dynamicNode.lua"] = "28f4e7a46281dc3a2af0875ffc5ff58c",
|
||||
["functionNode.lua"] = "cf7cb4efb677a139618fd9255734873e",
|
||||
["insertNode.lua"] = "a25a723746e7ab5973901855de1d1f11",
|
||||
["key_indexer.lua"] = "d1c4887dfc10501f09b7851aea25f842",
|
||||
["multiSnippet.lua"] = "2eab1e75c5ee87096f03db006da31844",
|
||||
["node.lua"] = "c1d2f45dd25dcf5c1574ff63e0f9e88c",
|
||||
["restoreNode.lua"] = "9613ce23458968aa12737365dd302be7",
|
||||
["snippet.lua"] = "d6a31a62f45a460bc642822b6d0244f7",
|
||||
["snippetProxy.lua"] = "68262858f0f9a20a41640d5a11c43481",
|
||||
["textNode.lua"] = "c22395ab8305a581f021982cd88e2931",
|
||||
util = {
|
||||
["trig_engines.lua"] = "a023c5ca92103478cbf40b7ffe2de903"
|
||||
},
|
||||
["util.lua"] = "a6be1172f1b37f2018460900b0ab987d"
|
||||
},
|
||||
session = {
|
||||
["enqueueable_operations.lua"] = "2e4f57314f0573601e35943f56e8d4d8",
|
||||
["init.lua"] = "213d2ea8110e267278d62f5853151ceb",
|
||||
snippet_collection = {
|
||||
["init.lua"] = "2d5015eb7cb5717f5aa44fdeebffbe59",
|
||||
["source.lua"] = "17f2f0c590d4deb57ae0e7af20c153ec"
|
||||
}
|
||||
},
|
||||
["snippets.lua"] = "d41d8cd98f00b204e9800998ecf8427e",
|
||||
util = {
|
||||
["_builtin_vars.lua"] = "cb7e73099c5711556f8df8821ca4a182",
|
||||
["auto_table.lua"] = "f9c5f84a99e71df229c4b6506a447727",
|
||||
["dict.lua"] = "83d98b784cfe6ab28c1d3727e7220110",
|
||||
["directed_graph.lua"] = "7eb06677cf726e6be7d64d470660677c",
|
||||
["environ.lua"] = "61b0b01947a335f749e854f039ec77ac",
|
||||
["events.lua"] = "cdac0c08202f1295a0bd9f5ee5909b3b",
|
||||
["ext_opts.lua"] = "55f3ee33870b070d50c3eae516b4724a",
|
||||
["extend_decorator.lua"] = "07576b8535b2729c9d70f5ba5b036a92",
|
||||
["functions.lua"] = "86ccff508ce6b6eeefc455308e7d4994",
|
||||
["jsonc.lua"] = "94fbde2a919a24f3957d004aaf7d136d",
|
||||
["jsregexp.lua"] = "59eb40a43fa328e82b086863dcbfa626",
|
||||
["lazy_table.lua"] = "7b0f31805982e74c3e693fd60ad42ec2",
|
||||
["log.lua"] = "ffe073da229ae489cc72e576c0ab6bee",
|
||||
["mark.lua"] = "135f7a32a6f1031ea0eb80688997f3d3",
|
||||
parser = {
|
||||
["ast_parser.lua"] = "230087c74af6009d8a858259808f3e51",
|
||||
["ast_utils.lua"] = "7013bc099f5ed408c4cd49b29e4ce63c",
|
||||
["init.lua"] = "5ae80471a9893a45b12b77a35ecc8d81",
|
||||
["neovim_ast.lua"] = "08e136ffd26023ef3172ec2aed4ad2e9",
|
||||
["neovim_parser.lua"] = "c25f144947bceed6036e3d40b70bdef0"
|
||||
},
|
||||
["path.lua"] = "3767ba134238fa42469cfcbcfdf16147",
|
||||
["pattern_tokenizer.lua"] = "f4f99d27e6a6fb5385f583abc70beaab",
|
||||
["select.lua"] = "b0a8180922f7995a86ea9df7eabb162e",
|
||||
["str.lua"] = "06645f5bc876c73af9c4fd3296d620e0",
|
||||
["table.lua"] = "f4a54a5775133c776d65643be728cfdb",
|
||||
["time.lua"] = "54483e160266c85209e4399fbfc43e1b",
|
||||
["types.lua"] = "6605cc2d2293f7080d104c63663c0dac",
|
||||
["util.lua"] = "ac9ec42f0d014d908ff24c5af8172335"
|
||||
}
|
||||
}
|
||||
},
|
||||
["luasnip-2.3.0-1.rockspec"] = "51f9eecc66d3003eb668326f1e4a0e68",
|
||||
plugin = {
|
||||
["luasnip.lua"] = "189a598faa80a372be83a52dc57fb491",
|
||||
["luasnip.vim"] = "e3d30107f8659679f6766d579ce5bf56"
|
||||
},
|
||||
syntax = {
|
||||
["snippets.vim"] = "5ea760f9406519fc824e2c941ef4d858"
|
||||
}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
" Syntax highlighting for .snippets files
|
||||
" Hopefully this should make snippets a bit nicer to write!
|
||||
syn match snipComment '^#.*'
|
||||
syn match placeHolder '\${\d\+\(:.\{-}\)\=}' contains=snipCommand
|
||||
syn match tabStop '\$\d\+'
|
||||
syn match snipEscape '\\\\\|\\`'
|
||||
syn match snipCommand '\%(\\\@<!\%(\\\\\)*\)\@<=`.\{-}\%(\\\@<!\%(\\\\\)*\)\@<=`'
|
||||
syn match snippet '^snippet.*' contains=multiSnipText,snipKeyword
|
||||
syn match snippet '^autosnippet.*' contains=multiSnipText,snipKeyword
|
||||
syn match snippet '^extends.*' contains=snipKeyword
|
||||
syn match snippet '^version.*' contains=snipKeyword
|
||||
syn match snippet '^priority.*' contains=snipKeyword,priority
|
||||
syn match priority '\d\+' contained
|
||||
syn match multiSnipText '\S\+ \zs.*' contained
|
||||
syn match snipKeyword '^(snippet|extends|version|autosnippet|priority)'me=s+8 contained
|
||||
" normally we'd want a \s in that group, but that doesn't work => cover common
|
||||
" cases with \t and " ".
|
||||
syn match snipError "^[^#vsaep\t ].*$"
|
||||
|
||||
hi link snippet Identifier
|
||||
hi link snipComment Comment
|
||||
hi link multiSnipText String
|
||||
hi link snipKeyword Keyword
|
||||
hi link snipEscape SpecialChar
|
||||
hi link placeHolder Special
|
||||
hi link tabStop Special
|
||||
hi link snipCommand String
|
||||
hi link snipError Error
|
||||
hi link priority Number
|
||||
@ -1,363 +0,0 @@
|
||||
commands = {}
|
||||
dependencies = {
|
||||
jsregexp = {},
|
||||
luasnip = {
|
||||
["2.3.0-1"] = {
|
||||
{
|
||||
constraints = {
|
||||
{
|
||||
op = ">=",
|
||||
version = {
|
||||
5, 1, string = "5.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "lua"
|
||||
},
|
||||
{
|
||||
constraints = {
|
||||
{
|
||||
op = ">=",
|
||||
version = {
|
||||
0, 0, 5, string = "0.0.5"
|
||||
}
|
||||
},
|
||||
{
|
||||
op = "<=",
|
||||
version = {
|
||||
0, 0, 7, string = "0.0.7"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "jsregexp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
modules = {
|
||||
["luasnip._types"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.config"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.default_config"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras._extra_types"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras._lambda"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras._parser_combinator"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras._treesitter"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.conditions.expand"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.conditions.init"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.conditions.show"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.expand_conditions"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.filetype_functions"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.fmt"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.init"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.otf"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.postfix"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.select_choice"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.snip_location"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.snippet_list"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.extras.treesitter_postfix"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.health"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.init"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.loaders.data"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.loaders.from_lua"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.loaders.from_snipmate"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.loaders.from_vscode"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.loaders.fs_watchers"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.loaders.init"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.loaders.snippet_cache"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.loaders.types"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.loaders.util"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.absolute_indexer"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.choiceNode"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.duplicate"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.dynamicNode"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.functionNode"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.insertNode"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.key_indexer"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.multiSnippet"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.node"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.restoreNode"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.snippet"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.snippetProxy"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.textNode"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.util"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.nodes.util.trig_engines"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.session.enqueueable_operations"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.session.init"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.session.snippet_collection.init"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.session.snippet_collection.source"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.snippets"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util._builtin_vars"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.auto_table"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.dict"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.directed_graph"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.environ"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.events"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.ext_opts"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.extend_decorator"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.functions"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.jsonc"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.jsregexp"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.lazy_table"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.log"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.mark"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.parser.ast_parser"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.parser.ast_utils"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.parser.init"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.parser.neovim_ast"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.parser.neovim_parser"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.path"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.pattern_tokenizer"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.select"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.str"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.table"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.time"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.types"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
},
|
||||
["luasnip.util.util"] = {
|
||||
"luasnip/2.3.0-1"
|
||||
}
|
||||
}
|
||||
repository = {
|
||||
luasnip = {
|
||||
["2.3.0-1"] = {
|
||||
{
|
||||
arch = "installed",
|
||||
commands = {},
|
||||
dependencies = {},
|
||||
modules = {
|
||||
["luasnip._types"] = "luasnip/_types.lua",
|
||||
["luasnip.config"] = "luasnip/config.lua",
|
||||
["luasnip.default_config"] = "luasnip/default_config.lua",
|
||||
["luasnip.extras._extra_types"] = "luasnip/extras/_extra_types.lua",
|
||||
["luasnip.extras._lambda"] = "luasnip/extras/_lambda.lua",
|
||||
["luasnip.extras._parser_combinator"] = "luasnip/extras/_parser_combinator.lua",
|
||||
["luasnip.extras._treesitter"] = "luasnip/extras/_treesitter.lua",
|
||||
["luasnip.extras.conditions.expand"] = "luasnip/extras/conditions/expand.lua",
|
||||
["luasnip.extras.conditions.init"] = "luasnip/extras/conditions/init.lua",
|
||||
["luasnip.extras.conditions.show"] = "luasnip/extras/conditions/show.lua",
|
||||
["luasnip.extras.expand_conditions"] = "luasnip/extras/expand_conditions.lua",
|
||||
["luasnip.extras.filetype_functions"] = "luasnip/extras/filetype_functions.lua",
|
||||
["luasnip.extras.fmt"] = "luasnip/extras/fmt.lua",
|
||||
["luasnip.extras.init"] = "luasnip/extras/init.lua",
|
||||
["luasnip.extras.otf"] = "luasnip/extras/otf.lua",
|
||||
["luasnip.extras.postfix"] = "luasnip/extras/postfix.lua",
|
||||
["luasnip.extras.select_choice"] = "luasnip/extras/select_choice.lua",
|
||||
["luasnip.extras.snip_location"] = "luasnip/extras/snip_location.lua",
|
||||
["luasnip.extras.snippet_list"] = "luasnip/extras/snippet_list.lua",
|
||||
["luasnip.extras.treesitter_postfix"] = "luasnip/extras/treesitter_postfix.lua",
|
||||
["luasnip.health"] = "luasnip/health.lua",
|
||||
["luasnip.init"] = "luasnip/init.lua",
|
||||
["luasnip.loaders.data"] = "luasnip/loaders/data.lua",
|
||||
["luasnip.loaders.from_lua"] = "luasnip/loaders/from_lua.lua",
|
||||
["luasnip.loaders.from_snipmate"] = "luasnip/loaders/from_snipmate.lua",
|
||||
["luasnip.loaders.from_vscode"] = "luasnip/loaders/from_vscode.lua",
|
||||
["luasnip.loaders.fs_watchers"] = "luasnip/loaders/fs_watchers.lua",
|
||||
["luasnip.loaders.init"] = "luasnip/loaders/init.lua",
|
||||
["luasnip.loaders.snippet_cache"] = "luasnip/loaders/snippet_cache.lua",
|
||||
["luasnip.loaders.types"] = "luasnip/loaders/types.lua",
|
||||
["luasnip.loaders.util"] = "luasnip/loaders/util.lua",
|
||||
["luasnip.nodes.absolute_indexer"] = "luasnip/nodes/absolute_indexer.lua",
|
||||
["luasnip.nodes.choiceNode"] = "luasnip/nodes/choiceNode.lua",
|
||||
["luasnip.nodes.duplicate"] = "luasnip/nodes/duplicate.lua",
|
||||
["luasnip.nodes.dynamicNode"] = "luasnip/nodes/dynamicNode.lua",
|
||||
["luasnip.nodes.functionNode"] = "luasnip/nodes/functionNode.lua",
|
||||
["luasnip.nodes.insertNode"] = "luasnip/nodes/insertNode.lua",
|
||||
["luasnip.nodes.key_indexer"] = "luasnip/nodes/key_indexer.lua",
|
||||
["luasnip.nodes.multiSnippet"] = "luasnip/nodes/multiSnippet.lua",
|
||||
["luasnip.nodes.node"] = "luasnip/nodes/node.lua",
|
||||
["luasnip.nodes.restoreNode"] = "luasnip/nodes/restoreNode.lua",
|
||||
["luasnip.nodes.snippet"] = "luasnip/nodes/snippet.lua",
|
||||
["luasnip.nodes.snippetProxy"] = "luasnip/nodes/snippetProxy.lua",
|
||||
["luasnip.nodes.textNode"] = "luasnip/nodes/textNode.lua",
|
||||
["luasnip.nodes.util"] = "luasnip/nodes/util.lua",
|
||||
["luasnip.nodes.util.trig_engines"] = "luasnip/nodes/util/trig_engines.lua",
|
||||
["luasnip.session.enqueueable_operations"] = "luasnip/session/enqueueable_operations.lua",
|
||||
["luasnip.session.init"] = "luasnip/session/init.lua",
|
||||
["luasnip.session.snippet_collection.init"] = "luasnip/session/snippet_collection/init.lua",
|
||||
["luasnip.session.snippet_collection.source"] = "luasnip/session/snippet_collection/source.lua",
|
||||
["luasnip.snippets"] = "luasnip/snippets.lua",
|
||||
["luasnip.util._builtin_vars"] = "luasnip/util/_builtin_vars.lua",
|
||||
["luasnip.util.auto_table"] = "luasnip/util/auto_table.lua",
|
||||
["luasnip.util.dict"] = "luasnip/util/dict.lua",
|
||||
["luasnip.util.directed_graph"] = "luasnip/util/directed_graph.lua",
|
||||
["luasnip.util.environ"] = "luasnip/util/environ.lua",
|
||||
["luasnip.util.events"] = "luasnip/util/events.lua",
|
||||
["luasnip.util.ext_opts"] = "luasnip/util/ext_opts.lua",
|
||||
["luasnip.util.extend_decorator"] = "luasnip/util/extend_decorator.lua",
|
||||
["luasnip.util.functions"] = "luasnip/util/functions.lua",
|
||||
["luasnip.util.jsonc"] = "luasnip/util/jsonc.lua",
|
||||
["luasnip.util.jsregexp"] = "luasnip/util/jsregexp.lua",
|
||||
["luasnip.util.lazy_table"] = "luasnip/util/lazy_table.lua",
|
||||
["luasnip.util.log"] = "luasnip/util/log.lua",
|
||||
["luasnip.util.mark"] = "luasnip/util/mark.lua",
|
||||
["luasnip.util.parser.ast_parser"] = "luasnip/util/parser/ast_parser.lua",
|
||||
["luasnip.util.parser.ast_utils"] = "luasnip/util/parser/ast_utils.lua",
|
||||
["luasnip.util.parser.init"] = "luasnip/util/parser/init.lua",
|
||||
["luasnip.util.parser.neovim_ast"] = "luasnip/util/parser/neovim_ast.lua",
|
||||
["luasnip.util.parser.neovim_parser"] = "luasnip/util/parser/neovim_parser.lua",
|
||||
["luasnip.util.path"] = "luasnip/util/path.lua",
|
||||
["luasnip.util.pattern_tokenizer"] = "luasnip/util/pattern_tokenizer.lua",
|
||||
["luasnip.util.select"] = "luasnip/util/select.lua",
|
||||
["luasnip.util.str"] = "luasnip/util/str.lua",
|
||||
["luasnip.util.table"] = "luasnip/util/table.lua",
|
||||
["luasnip.util.time"] = "luasnip/util/time.lua",
|
||||
["luasnip.util.types"] = "luasnip/util/types.lua",
|
||||
["luasnip.util.util"] = "luasnip/util/util.lua"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1 +1 @@
|
||||
/nix/store/qhhsw7qjik5gh1wkai703p6dq0ydp15r-lua5.1-jsregexp-0.0.7-1 /nix/store/mqbhz05llkddfb5wni0m48kw22ixxps4-lua-5.1.5
|
||||
/nix/store/49605i88r5g5idzd2cbzd9szhjkf65vj-lua5.1-jsregexp-0.0.7-1 /nix/store/3czmrawji85vf8979kll2yx2f1kjkric-lua-5.1.5
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user