1

Update generated neovim config

This commit is contained in:
2024-08-15 14:28:54 +02:00
parent 07409c223d
commit 25cfcf2941
3809 changed files with 351157 additions and 0 deletions

View File

@ -0,0 +1,17 @@
name: Release Please
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.PAT }}
release-type: simple
package-name: better-escape.nvim

View File

@ -0,0 +1,43 @@
# Changelog
## [2.3.2](https://github.com/max397574/better-escape.nvim/compare/v2.3.1...v2.3.2) (2024-07-27)
### Bug Fixes
* macro regression ([25a1400](https://github.com/max397574/better-escape.nvim/commit/25a14001e587ce3068b3b2204c330fdd5a09b877))
## [2.3.1](https://github.com/max397574/better-escape.nvim/compare/v2.3.0...v2.3.1) (2024-07-20)
### Bug Fixes
* change nvim_input to nvim_feedkeys ([ea38a94](https://github.com/max397574/better-escape.nvim/commit/ea38a944837e00e4a9f62614cb46bdccf3cda976))
* change nvim_input to nvim_feedkeys for function mappings ([ec832a0](https://github.com/max397574/better-escape.nvim/commit/ec832a05c1f6c7826cc209bede6fbc2d0d50b1c1))
* other plugin's feedkeys ([9cbc693](https://github.com/max397574/better-escape.nvim/commit/9cbc6934e9258dc95405fcb3f7fdab499e5606be))
* unmap after applying configuration, fixes https://github.com/max397574/better-escape.nvim/issues/89 ([975cceb](https://github.com/max397574/better-escape.nvim/commit/975cceb1d7b841f16731862132a0ffb2acda3f8b))
## [2.3.0](https://github.com/max397574/better-escape.nvim/compare/v2.2.0...v2.3.0) (2024-07-09)
### Features
* add `default_mappings` option and update docs ([7b35162](https://github.com/max397574/better-escape.nvim/commit/7b351629d4f08039977e290961915d916a985aa3))
### Bug Fixes
* clear_mappings' postion ([3dbf3e1](https://github.com/max397574/better-escape.nvim/commit/3dbf3e1626d9180c4f42e3aa39dd47a1c046cd8b))
* log the endkey not the startkey ([#74](https://github.com/max397574/better-escape.nvim/issues/74)) ([3b41a90](https://github.com/max397574/better-escape.nvim/commit/3b41a905799577e3259ead9056bcabb72dedf537))
## [2.2.0](https://github.com/max397574/better-escape.nvim/compare/v2.1.1...v2.2.0) (2024-07-08)
### Features
* add release please ([769c1e2](https://github.com/max397574/better-escape.nvim/commit/769c1e2d349731cb0d78da440a68b50485140d64))
### Bug Fixes
* make the sequence &lt;subkey&gt;<key><subkey> work ([#70](https://github.com/max397574/better-escape.nvim/issues/70)) ([9ba7653](https://github.com/max397574/better-escape.nvim/commit/9ba7653f376da79e858dc5f413157621d0b507c7))

View File

@ -0,0 +1,9 @@
local M = {}
function M.get()
return {
GrugFarResultsMatch = { link = "IncSearch" },
}
end
return M

View File

@ -0,0 +1,9 @@
local M = {}
function M.get()
return {
NvimSurroundHighlight = { bg = U.darken(C.peach, 0.6, C.base), style = { "bold" } },
}
end
return M

View File

@ -0,0 +1,27 @@
local M = {}
-- markdown.nvim highlight groups:
-- https://github.com/MeanderingProgrammer/markdown.nvim?tab=readme-ov-file#colors
function M.get()
local groups = {
RenderMarkdownCode = { bg = C.surface0 },
RenderMarkdownCodeInline = { bg = C.surface1 },
RenderMarkdownBullet = { fg = C.sky },
RenderMarkdownTableHead = { fg = C.blue },
RenderMarkdownTableRow = { fg = C.lavender },
}
local syntax = require("catppuccin.groups.syntax").get()
local base = not O.transparent_background and C.base or nil
for i = 1, 6 do
local color = syntax["rainbow" .. i].fg
groups["RenderMarkdownH" .. i] = { fg = color }
groups["RenderMarkdownH" .. i .. "Bg"] = { bg = U.darken(color, 0.30, base) }
end
return groups
end
return M

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/rokucommunity/brighterscript-formatter",
description = "A code formatter for BrighterScript (and BrightScript).",
},
command = "bsfmt",
args = { "$FILENAME", "--write" },
stdin = false,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://caramel.run/manual/reference/cli/fmt.html",
description = "Format Caramel code.",
},
command = "caramel",
args = { "fmt", "$FILENAME" },
stdin = false,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/cockroachdb/crlfmt",
description = "Formatter for CockroachDB's additions to the Go style guide.",
},
command = "crlfmt",
args = { "-w", "$FILENAME" },
stdin = false,
}

View File

@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/terrastruct/d2",
description = "D2 is a modern diagram scripting language that turns text to diagrams.",
},
command = "d2",
args = { "fmt", "-" },
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://dcm.dev/docs/cli/formatting/fix/",
description = "Fixes issues produced by dcm analyze, dcm check-unused-code or dcm check-dependencies commands.",
},
command = "dcm",
args = { "fix", "$FILENAME" },
stdin = false,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://dcm.dev/docs/cli/formatting/format/",
description = "Formats .dart files.",
},
command = "dcm",
args = { "format", "$FILENAME" },
stdin = false,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://pypi.org/project/docformatter/",
description = "docformatter automatically formats docstrings to follow a subset of the PEP 257 conventions.",
},
command = "docformatter",
args = { "--in-place", "$FILENAME" },
stdin = false,
}

View File

@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/LilSpazJoekp/docstrfmt",
description = "reStructuredText formatter.",
},
command = "docstrfmt",
stdin = true,
}

View File

@ -0,0 +1,12 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/thlorenz/doctoc",
description = "Generates table of contents for markdown files inside local git repository.",
},
command = "doctoc",
stdin = false,
args = {
"$FILENAME",
},
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/sile/efmt",
description = "Erlang code formatter.",
},
command = "efmt",
args = { "-" },
stdin = true,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/WhatsApp/erlfmt",
description = "An automated code formatter for Erlang.",
},
command = "erlfmt",
args = { "-w", "$FILENAME" },
stdin = false,
}

View File

@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/wvermin/findent",
description = "Indent, relabel and convert Fortran sources.",
},
command = "findent",
stdin = true,
}

View File

@ -0,0 +1,26 @@
---@return nil|string
local function get_format_script()
return vim.api.nvim_get_runtime_file("scripts/format-queries.lua", false)[1]
end
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/nvim-treesitter/nvim-treesitter/blob/main/CONTRIBUTING.md#formatting",
description = "Tree-sitter query formatter.",
},
condition = function()
local ok = pcall(vim.treesitter.language.inspect, "query")
return ok and get_format_script() ~= nil
end,
command = "nvim",
args = function()
local script = get_format_script()
assert(script)
-- Manually set the runtimepath to put nvim-treesitter first. The format-queries script relies
-- on the nvim-treesitter parser; the one bundled with Neovim may be outdated.
local rtp = vim.fn.fnamemodify(script, ":h:h")
return { "-c", "set rtp^=" .. rtp, "-l", script, "$FILENAME" }
end,
stdin = false,
}

View File

@ -0,0 +1,14 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/fortran-lang/fprettify",
description = "Auto-formatter for modern fortran source code.",
},
command = "fprettify",
args = {
-- --silent is recommended for editor integrations https://github.com/fortran-lang/fprettify?tab=readme-ov-file#editor-integration
"--silent",
"-",
},
stdin = true,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/gluon-lang/gluon",
description = "Code formatting for the gluon programming language.",
},
command = "gluon",
args = { "fmt", "$FILENAME" },
stdin = false,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://grain-lang.org/docs/tooling/grain_cli#grain-format",
description = "Code formatter for the grain programming language.",
},
command = "grain",
args = { "format", "$FILENAME" },
stdin = true,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/mihaimaruseac/hindent",
description = "Haskell pretty printer.",
},
command = "hindent",
args = { "$FILENAME" },
stdin = false,
}

View File

@ -0,0 +1,11 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://imba.io/",
description = "Code formatter for the Imba programming language.",
},
command = "imba",
stdin = false,
-- `-f` is used to ignore the git status of the file.
args = { "fmt", "-f", "$FILENAME" },
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://www.kcl-lang.io/docs/tools/cli/kcl/fmt",
description = "The KCL Format tool modifies the files according to the KCL code style.",
},
command = "kcl",
args = { "fmt", "$FILENAME" },
stdin = false,
}

View File

@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://repo.or.cz/llf.git",
description = "A LaTeX reformatter / beautifier.",
},
command = "llf",
stdin = true,
}

View File

@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/Koihik/LuaFormatter",
description = "Code formatter for Lua.",
},
command = "lua-format",
stdin = true,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://nickel-lang.org/",
description = "Code formatter for the Nickel programming language.",
},
command = "nickel",
stdin = false,
args = { "format", "$FILENAME" },
}

View File

@ -0,0 +1,12 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/nvuillam/npm-groovy-lint",
description = "Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle files using command line.",
},
command = "npm-groovy-lint",
args = { "--fix", "$FILENAME" },
-- https://github.com/nvuillam/npm-groovy-lint/blob/14e2649ff7ca642dba3e901c17252b178bea8b1b/lib/groovy-lint.js#L48
exit_codes = { 0, 1 }, -- 1 = expected error
stdin = false,
}

View File

@ -0,0 +1,15 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/google/pyink",
description = "A Python formatter, forked from Black with a few different formatting behaviors.",
},
command = "pyink",
args = {
"--stdin-filename",
"$FILENAME",
"--quiet",
"-",
},
stdin = true,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/dzhu/rstfmt",
description = "A formatter for reStructuredText.",
},
command = "rstfmt",
args = { "$FILENAME" },
stdin = false,
}

View File

@ -0,0 +1,9 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/nrempel/sleek",
description = "Sleek is a CLI tool for formatting SQL.",
},
command = "sleek",
stdin = true,
}

View File

@ -0,0 +1,10 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/haskell/stylish-haskell",
description = "Haskell code prettifier.",
},
command = "stylish-haskell",
args = {},
stdin = true,
}

View File

@ -0,0 +1,11 @@
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/realm/SwiftLint",
description = "A tool to enforce Swift style and conventions.",
},
command = "swiftlint",
stdin = true,
args = { "lint", "--use-stdin", "--fix", "--format" },
cwd = require("conform.util").root_file({ ".swiftlint.yml", "Package.swift" }),
}

View File

@ -0,0 +1,52 @@
local config_files = {
"vsg_config.yaml",
"vsg_config.yml",
"vsg_config.json",
"vsg.yaml",
"vsg.yml",
"vsg.json",
".vsg_config.yaml",
".vsg_config.yml",
".vsg_config.json",
".vsg.yaml",
".vsg.yml",
".vsg.json",
}
local function find_config(dirname)
local paths = {
dirname,
(os.getenv("XDG_CONFIG_HOME") or os.getenv("HOME") .. "/.config") .. "/vsg",
}
for _, path in ipairs(paths) do
local config = vim.fs.find(config_files, {
path = path,
upward = path == dirname,
})[1]
if config then
return config
end
end
end
---@type conform.FileFormatterConfig
return {
meta = {
url = "https://github.com/jeremiah-c-leary/vhdl-style-guide",
description = "Style guide enforcement for VHDL.",
},
command = "vsg",
stdin = false,
args = function(_, ctx)
local args = { "-of", "syntastic", "--fix", "-f", "$FILENAME" }
local config_file = find_config(ctx.dirname)
if config_file then
table.insert(args, "-c")
table.insert(args, config_file)
end
return args
end,
}

View File

@ -0,0 +1,13 @@
return {
elixir = "ex",
graphql = "gql",
javascript = "js",
javascriptreact = "jsx",
markdown = "md",
perl = "pl",
python = "py",
ruby = "rb",
rust = "rs",
typescript = "ts",
typescriptreact = "tsx",
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 zimbatm and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,29 @@
direnv.vim - yup
================
This plugin aim is to integrate [Direnv][direnv] and (Neo)Vim. Because Vim can
shell out to other tools it's nice if the environment is in sync with the usual
shell.
See detail in the [doc][].
Install
-------
Clone the repository to load by [packages][].
```sh
git clone https://github.com/direnv/direnv.vim \
~/.vim/pack/foo/start/direnv.vim
```
Or use your favorite plugin manager.
TODO
----
- Allow/deny authorization mechanism.
[direnv]: https://direnv.net
[packages]: https://vimhelp.org/repeat.txt.html#packages
[doc]: https://github.com/direnv/direnv.vim/blob/master/doc/direnv.txt

View File

@ -0,0 +1,138 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: zimbatm <http://zimbatm.com/> & Hauleth <lukasz@niemier.pl>
" Version: 0.3
scriptencoding utf-8
let s:direnv_cmd = get(g:, 'direnv_cmd', '/nix/store/1mrvvx2ygfyfz8sn3gg5f3qidvd9s8j1-direnv-2.34.0/bin/direnv')
let s:direnv_interval = get(g:, 'direnv_interval', 500)
let s:direnv_max_wait = get(g:, 'direnv_max_wait', 5)
let s:direnv_auto = get(g:, 'direnv_auto', 1)
let s:job_status = { 'running': 0, 'stdout': [], 'stderr': [] }
if !exists('g:direnv_silent_load')
let g:direnv_silent_load = 0
endif
function! direnv#auto() abort
return s:direnv_auto
endfunction
function! direnv#post_direnv_load() abort
call direnv#extra_vimrc#load()
doautocmd User DirenvLoaded
endfunction
function! direnv#on_stdout(_, data, ...) abort
if a:data != ['']
call extend(s:job_status.stdout, a:data)
end
endfunction
function! direnv#on_stderr(_, data, ...) abort
if a:data != ['']
call extend(s:job_status.stderr, a:data)
end
endfunction
function! direnv#on_exit(_, status, ...) abort
let s:job_status.running = 0
if !g:direnv_silent_load
for l:m in s:job_status.stderr
if l:m isnot# ''
echom l:m
endif
endfor
endif
exec join(s:job_status.stdout, "\n")
call direnv#post_direnv_load()
endfunction
function! direnv#job_status_reset() abort
let s:job_status['stdout'] = []
let s:job_status['stderr'] = []
endfunction
function! direnv#err_cb(_, data) abort
call direnv#on_stderr(0, split(a:data, "\n", 1))
endfunction
function! direnv#out_cb(_, data) abort
call direnv#on_stdout(0, split(a:data, "\n", 1))
endfunction
function! direnv#exit_cb(_, status) abort
call direnv#on_exit(0, a:status)
endfunction
if has('nvim')
let s:job =
\ {
\ 'on_stdout': 'direnv#on_stdout',
\ 'on_stderr': 'direnv#on_stderr',
\ 'on_exit': 'direnv#on_exit'
\ }
else
let s:job =
\ {
\ 'out_cb': 'direnv#out_cb',
\ 'err_cb': 'direnv#err_cb',
\ 'exit_cb': 'direnv#exit_cb'
\ }
endif
function! direnv#export() abort
call s:export_debounced.do()
endfunction
function! direnv#export_core() abort
if !executable(s:direnv_cmd)
echom 'No Direnv executable, add it to your PATH or set correct g:direnv_cmd'
return
endif
let l:cmd = [s:direnv_cmd, 'export', 'vim']
if has('nvim')
call jobstart(l:cmd, s:job)
elseif has('job') && has('channel')
if !has('timers')
if s:job_status.running
return
endif
let s:job_status.running = 1
endif
call direnv#job_status_reset()
call job_start(l:cmd, s:job)
else
let l:tmp = tempname()
echom system(printf(join(l:cmd).' '.&shellredir, l:tmp))
exe 'source '.l:tmp
call delete(l:tmp)
call direnv#post_direnv_load()
endif
endfunction
let s:export_debounced = {'id': 0, 'counter': 0}
if has('timers')
function! s:export_debounced.call(...)
let self.id = 0
let self.counter = 0
call direnv#export_core()
endfunction
function! s:export_debounced.do()
call timer_stop(self.id)
if self.counter < s:direnv_max_wait
let self.counter = self.counter + 1
let self.id = timer_start(s:direnv_interval, self.call)
else
call self.call()
endif
endfunction
else
function! s:export_debounced.do()
call direnv#export_core()
endfunction
endif

View File

@ -0,0 +1,56 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: JINNOUCHI Yasushi <me@delphinus.dev>
" Version: 0.2
let s:direnv_edit_mode = get(g:, 'direnv_edit_mode', 'edit')
function! direnv#edit#envrc() abort
if $DIRENV_DIR !=# ''
let l:envrc_dir = substitute($DIRENV_DIR, '^-', '', '')
else
let l:envrc_dir = getcwd()
endif
let l:envrc = l:envrc_dir . '/.envrc'
if !filereadable(l:envrc)
echom 'new .envrc file will be created:' l:envrc_dir
endif
call direnv#edit#execute(l:envrc)
endfunction
function! direnv#edit#direnvrc() abort
if $XDG_CONFIG_HOME ==# ''
let l:direnvrc_dir = $HOME . '/.config/direnv'
else
let l:direnvrc_dir = $XDG_CONFIG_HOME . '/direnv'
endif
if filereadable(l:direnvrc_dir . '/direnvrc')
let l:direnvrc = l:direnvrc_dir . '/direnvrc'
elseif filereadable($HOME . '/.direnvrc')
let l:direnvrc = $HOME . '/.direnvrc'
else
let l:direnvrc = l:direnvrc_dir . '/direnvrc'
if !isdirectory(l:direnvrc_dir)
let l:result = direnv#edit#mkdir(l:direnvrc_dir)
if !l:result
echoerr 'Vim cannot create the directory:' l:direnvrc_dir
return
endif
endif
endif
if !filereadable(l:direnvrc)
echom 'new direnvrc file will be created:' l:direnvrc
endif
call direnv#edit#execute(l:direnvrc)
endfunction
function! direnv#edit#mkdir(dir) abort
if !exists('*mkdir')
return 0
endif
let l:result = mkdir(a:dir, 'p', 0700)
return l:result
endfunction
function! direnv#edit#execute(file) abort
execute ':' . s:direnv_edit_mode a:file
endfunction

View File

@ -0,0 +1,28 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: JINNOUCHI Yasushi <me@delphinus.dev>
" Version: 0.2
" load() sources local vimrc's described in $EXTRA_VIMRC
function! direnv#extra_vimrc#load() abort
let b:direnv_loaded_extra_vimrcs = get(b:, 'direnv_loaded_extra_vimrcs', {})
if $DIRENV_EXTRA_VIMRC !=# ''
for l:path in split($DIRENV_EXTRA_VIMRC, ':')
if filereadable(l:path) && !has_key(b:direnv_loaded_extra_vimrcs, l:path)
execute 'source' l:path
let b:direnv_loaded_extra_vimrcs[l:path] = 1
endif
endfor
endif
endfunction
" check() checks $DIRENV_DIR and call load()
function! direnv#extra_vimrc#check() abort
if $DIRENV_DIR !=# ''
let l:filedir = expand('%:p:h')
let l:direnv_dir = substitute($DIRENV_DIR, '^-', '', '')
" TODO think about Windows?
if stridx(l:filedir, l:direnv_dir) == 0
call direnv#post_direnv_load()
endif
endif
endfunction

View File

@ -0,0 +1,167 @@
*direnv.txt* Plugin to integrate Direnv and (Neo)Vim
Author: zimbatm <http://zimbatm.com/>
delphinus <me@delphinus.dev>
License: MIT License
=============================================================================
CONTENTS *direnv-contents*
INTRODUCTION |direnv-introduction|
INSTALLATION |direnv-installation|
EXTRA VIMRC |direnv-installation|
COMMANDS |direnv-commands|
CONFIGURATION |direnv-configuration|
CAVEATS |direnv-caveats|
=============================================================================
INTRODUCTION *direnv-introduction*
This plugin aim is to integrate Direnv and (Neo)Vim.
*direnv-introduction-features*
Features~
* Run Direnv's hook appropriately every when Vim changes its current
directory.
* Run your local `.vimrc` in the current directory when `use vim` directive
exists in `.envrc`.
* Add |ftdetect|, |ftplugin|, and |syntax| to make easy to write your own `.envrc`'s.
=============================================================================
INSTALLATION *direnv-installation*
Clone the repository to load by |packages|.
*direnv-installation-forvim*
For Vim~
>
git clone https://github.com/direnv/direnv.vim \
~/.vim/pack/foo/start/direnv.vim
<
*direnv-installation-forneovim*
For Neovim~
>
git clone https://github.com/direnv/direnv.vim \
~/.local/share/nvim/site/pack/foo/start/direnv.vim
Or you can use any plugin manager you like.
=============================================================================
EXTRA VIMRC *direnv-extravimrc*
When you use `use vim` directive in the `.envrc`, you can source `.vimrc.local`
(in default) in changing the current directory of Vim.
>
# in your .envrc (Direnv settings)
use vim
# you can set your own filename
use vim .my-vimrc
With `use vim` directives, Direnv sets the paths in `$DIRENV_EXTRA_VIMRC`
environmental variable. This plugin reads the variable and sources them.
Internally, this plugin remembers the sourced filenames and does not source it
again even when `DirenvExport` is called in the same buffer.
NOTE: Unlike the other features of Direnv, this “sourcing” is irreversible.
You should NOT change settings globally in your `.vimrc.local` because it
affects other windows/buffers.
>
" in your .vimrc.local
" This sets the value only for the window you are in.
setlocal scrolloff=3
" Also set buffer-local variable for this use.
let b:ale_fixers = ['prettier', 'eslint']
=============================================================================
COMMANDS *direnv-commands*
`:DirenvExport` *direnv-commands-direnvexport*
Run the Direnv command and load the valid settings. This command will be
executed automatically (and asynchronously) by |autocmd| events in default.
NOTE: The kind of events this command will be called depends on your (Neo)
Vim's version. See |direnv-caveats|.
`:EditDirenvrc` *direnv-commands-editdirenvrc*
Open the global setting file for the Direnv command. This searches files
ordered below.
* `$XDG_CONFIG_HOME/direnv/direnvrc`
* `~/.config/direnv/direnvrc`
* `~/.direnvrc`
`:EditEnvrc` *direnv-commands-editenvrc*
Open the detected `.envrc` if found or a new buffer to edit `.envrc` on the
current directory otherwise.
=============================================================================
CONFIGURATION *direnv-configuration*
All configuration variables must be set before loading the plugin (typically
in your `.vimrc` or `init.vim`).
`g:direnv_auto` *direnv-configuration-direnvauto*
It will not execute |direnv-commands-direnvexport| automatically if the value
is `0`. Default: `1`.
>
" Call DirenvExport on your demand
let g:direnv_auto = 0
`g:direnv_edit_mode` *direnv-configuration-direnveditmode*
Select the command to open buffers to edit. Default: `'edit'`.
>
" split the window before editing files
let g:direnv_edit_mode = 'split'
" split vertically
let g:direnv_edit_mode = 'vsplit'
`g:direnv_silent_load` *direnv-configuration-direnvsilentload*
Stop echoing output from Direnv command. Default: `0`.
>
" Silently call the Direnv command
let g:direnv_silent_load = 1
=============================================================================
AUTOCMD EVENTS *direnv-autocmdevents*
`DirenvLoaded` *direnv-autocmdevents-direnvloaded*
This plugin calls this |User| event just after sourcing extra vimrc (See
|direnv-extravimrc|).
>
" Announce when loaded extra vimrc's
autocmd User DirenvLoaded :echo 'loaded extra vimrc'
=============================================================================
CAVEATS *direnv-caveats*
Environmental variable keys~
The Vimscript syntax seems to limit keys to alphanumeric characters. If any
environmental variable key is something different, the plugin might fail.
Autocmd events to be called~
The newer Vim builds (>8.0.1459) & Neovim have |Dirchanged| that is fired on
directory changes. Direnv command will be fired only on |VimEnter| &
|DirChanged| with them.
For older Vim's, there is a fallback that it fires on each |BufEnter|. This is
not an ideal solution, but for now we have no other solutions.
Asynchronous loading~
Due to asynchronous calls for Direnv, it can happen that variables from
`.envrc` will not be available yet, if you work too fast.
=============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl

View File

@ -0,0 +1,19 @@
direnv-autocmdevents direnv.txt /*direnv-autocmdevents*
direnv-autocmdevents-direnvloaded direnv.txt /*direnv-autocmdevents-direnvloaded*
direnv-caveats direnv.txt /*direnv-caveats*
direnv-commands direnv.txt /*direnv-commands*
direnv-commands-direnvexport direnv.txt /*direnv-commands-direnvexport*
direnv-commands-editdirenvrc direnv.txt /*direnv-commands-editdirenvrc*
direnv-commands-editenvrc direnv.txt /*direnv-commands-editenvrc*
direnv-configuration direnv.txt /*direnv-configuration*
direnv-configuration-direnvauto direnv.txt /*direnv-configuration-direnvauto*
direnv-configuration-direnveditmode direnv.txt /*direnv-configuration-direnveditmode*
direnv-configuration-direnvsilentload direnv.txt /*direnv-configuration-direnvsilentload*
direnv-contents direnv.txt /*direnv-contents*
direnv-extravimrc direnv.txt /*direnv-extravimrc*
direnv-installation direnv.txt /*direnv-installation*
direnv-installation-forneovim direnv.txt /*direnv-installation-forneovim*
direnv-installation-forvim direnv.txt /*direnv-installation-forvim*
direnv-introduction direnv.txt /*direnv-introduction*
direnv-introduction-features direnv.txt /*direnv-introduction-features*
direnv.txt direnv.txt /*direnv.txt*

View File

@ -0,0 +1,5 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: JINNOUCHI Yasushi <me@delphinus.dev>
" Version: 0.2
autocmd BufRead,BufNewFile .envrc*,.direnvrc*,direnvrc* setfiletype direnv

View File

@ -0,0 +1,15 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: JINNOUCHI Yasushi <me@delphinus.dev>
" Version: 0.2
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
setlocal commentstring=#\ %s
augroup direnv-buffer
autocmd! * <buffer>
autocmd BufWritePost <buffer> DirenvExport
augroup END

View File

@ -0,0 +1,37 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: zimbatm <http://zimbatm.com/> & Hauleth <lukasz@niemier.pl>
" Version: 0.2
if exists('g:loaded_direnv') || &compatible || v:version < 700
finish
endif
let g:loaded_direnv = 1
" MacVim (vim 8.0) with patches 1-1272 throws an error if a job option is given
" extra fields that it does not recognize. If the job ran even with the error
" message, this could be fixed with `silent!`, but the job doesn't run.
"
" To fix this, we give `vim` an empty `s:job` dictionary that calls back to the
" `s:job_status` dictionary. `nvim` gets `s:job` set as `s:job_status`.
command! -nargs=0 DirenvExport call direnv#export()
command! -nargs=0 EditDirenvrc call direnv#edit#direnvrc()
command! -nargs=0 EditEnvrc call direnv#edit#envrc()
if direnv#auto()
augroup direnv_rc
au!
autocmd VimEnter * DirenvExport
autocmd BufEnter * call direnv#extra_vimrc#check()
" need this to avoid an error on loading
autocmd User DirenvLoaded :
if exists('##DirChanged')
autocmd DirChanged * DirenvExport
else
autocmd BufEnter * DirenvExport
endif
augroup END
endif
" vi: fdm=marker sw=2 sts=2 et

View File

@ -0,0 +1,89 @@
" direnv.vim - support for direnv <http://direnv.net>
" Author: JINNOUCHI Yasushi <me@delphinus.dev>
" Version: 0.2
if exists('b:current_syntax')
finish
endif
" To use syntax for bash in sh.vim, set the g:is_bash value temporarily.
let s:current = get(g:, 'is_bash', '__NO_VALUE__')
let g:is_bash = 1
runtime! syntax/sh.vim
if s:current ==# '__NO_VALUE__'
unlet g:is_bash
else
let g:is_bash = s:current
endif
unlet s:current
let b:current_syntax = 'direnv'
" Func: with commands {{{
" `has` func takes one argument that represents a CLI command.
syn keyword direnvCommandFunc has nextgroup=direnvCommand,shSingleQuote,shDoubleQuote skipwhite
hi def link direnvCommandFunc shStatement
" command name is almost the same as direnvPath, but has a different color.
syn region direnvCommand start=/[^'"[:space:]]/ skip=/\\./ end=/\([][(){}#`'";\\[:space:]]\)\@=\|$/ contained nextgroup=shComment skipwhite
hi def link direnvCommand shCommandSub
" }}}
" Func: with paths {{{
" These funcs takes one argument that represents a file/dir path.
syn keyword direnvPathFunc dotenv dotenv_if_exists env_vars_required fetchurl join_args user_rel_path on_git_branch find_up has source_env source_env_if_exists source_up source_up_if_exists source_url PATH_add MANPATH_add load_prefix watch_file watch_dir semver_search strict_env unstrict_env nextgroup=direnvPath,shSingleQuote,shDoubleQuote skipwhite
hi def link direnvPathFunc shStatement
" path string can end before non-escaped [, ], (, ), {, }, #, `, ', ", ;, \, and spaces.
syn region direnvPath start=/[^'"[:space:]]/ skip=/\\./ end=/\([][(){}#`'";\\[:space:]]\)\@=\|$/ contained nextgroup=shComment skipwhite
hi def link direnvPath Directory
" `expand_path` takes one or two arguments that represents a dir path.
syn keyword direnvExpandPathFunc expand_path nextgroup=direnvExpandPathRel,shSingleQuote,shDoubleQuote skipwhite
hi def link direnvExpandPathFunc shStatement
syn region direnvExpandPathRel start=/[^'"[:space:]]/ skip=/\\./ end=/\%(\s\|\_$\)/ contained nextgroup=direnvPath,shSingleQuote,shDoubleQuote skipwhite
hi def link direnvExpandPathRel Directory
" `path_add` takes two arguments that represents a variable name and a dir
" path.
syn keyword direnvPathAddFunc PATH_add MANPATH_add PATH_rm path_rm path_add nextgroup=direnvVar skipwhite
hi def link direnvPathAddFunc shStatement
syn match direnvVar /\S\+/ nextgroup=direnvPath,shSingleQuote,shDoubleQuote contained skipwhite
hi def link direnvVar shCommandSub
" }}}
" Func: use {{{
syn keyword direnvUseFunc use use_flake use_guix use_julia use_nix use_node use_nodenv use_rbenv use_vim rvm nextgroup=direnvUseCommand skipwhite
hi def link direnvUseFunc shStatement
" `use rbenv/nix/guix` takes several arguments.
syn match direnvUseCommand /\S\+/ contained
hi def link direnvUseCommand shCommandSub
" }}}
" Func: layout {{{
" `layout` takes one argument that represents a language name.
syn keyword direnvLayoutFunc layout layout_anaconda layout_go layout_julia layout_node layout_perl layout_php layout_pipenv layout_pyenv layout_python layout_python2 layout_python3 layout_ruby nextgroup=direnvLayoutLanguage,direnvLayoutLanguagePath skipwhite
hi def link direnvLayoutFunc shStatement
syn keyword direnvLayoutLanguage go node perl python3 ruby contained
hi def link direnvLayoutLanguage shCommandSub
" `layout python` takes one more argument that represents a file path.
syn keyword direnvLayoutLanguagePath python nextgroup=direnvPath,shSingleQuote,shDoubleQuote contained skipwhite
hi def link direnvLayoutLanguagePath shCommandSub
" }}}
" Func: others {{{
" `direnv_load` takes several arguments.
syn keyword direnvFunc direnv_apply_dump direnv_layout_dir direnv_load direnv_version log_error log_status
hi def link direnvFunc shStatement
" }}}
syn cluster direnvStatement contains=direnvCommandFunc,direnvPathFunc,direnvExpandPathFunc,direnvPathAddFunc,direnvUseFunc,direnvLayoutFunc,direnvFunc
syn cluster shArithParenList add=@direnvStatement
syn cluster shCommandSubList add=@direnvStatement
" vim:se fdm=marker:

View File

@ -0,0 +1,7 @@
root = true
[*]
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8

View File

@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/folke/flash.nvim/discussions
about: Use Github discussions instead

View File

@ -0,0 +1,16 @@
## Description
<!-- Describe the big picture of your changes to communicate to the maintainers
why we should accept this pull request. -->
## Related Issue(s)
<!--
If this PR fixes any issues, please link to the issue here.
- Fixes #<issue_number>
-->
## Screenshots
<!-- Add screenshots of the changes if applicable. -->

View File

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View File

@ -0,0 +1,8 @@
name: "PR Labeler"
on:
- pull_request_target
jobs:
labeler:
uses: folke/github/.github/workflows/labeler.yml@main
secrets: inherit

View File

@ -0,0 +1,18 @@
name: PR Title
on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened
- ready_for_review
permissions:
pull-requests: read
jobs:
pr-title:
uses: folke/github/.github/workflows/pr.yml@main
secrets: inherit

View File

@ -0,0 +1,11 @@
name: Stale Issues & PRs
on:
schedule:
- cron: "30 1 * * *"
jobs:
stale:
if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner)
uses: folke/github/.github/workflows/stale.yml@main
secrets: inherit

View File

@ -0,0 +1,13 @@
name: Update Repo
on:
workflow_dispatch:
schedule:
# Run every hour
- cron: "0 * * * *"
jobs:
update:
if: contains(fromJSON('["folke", "LazyVim"]'), github.repository_owner)
uses: folke/github/.github/workflows/update.yml@main
secrets: inherit

View File

@ -0,0 +1,3 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
nvim -u tests/minit.lua -l lua/flash/docs.lua

View File

@ -0,0 +1,3 @@
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
nvim -l tests/minit.lua --minitest

View File

@ -0,0 +1,15 @@
#!/usr/bin/env -S nvim -l
vim.env.LAZY_STDPATH = ".tests"
vim.env.LAZY_PATH = vim.fs.normalize("~/projects/lazy.nvim")
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
-- Setup lazy.nvim
require("lazy.minit").setup({
spec = {
{
dir = vim.uv.cwd(),
opts = {},
},
},
})

View File

@ -0,0 +1,37 @@
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'
}
}

View File

@ -0,0 +1,53 @@
rock_manifest = {
doc = {
["gitsigns.txt"] = "ed2c2a9eac117833753afc9dd55adcf4"
},
["gitsigns.nvim-scm-1.rockspec"] = "a9b165d604ce401cfeea760a9366418d",
lua = {
gitsigns = {
["actions.lua"] = "ac0661d45e50424f5f59924528b1c031",
["async.lua"] = "ab34c767e5b6c917335d19f2acc6fd36",
["attach.lua"] = "44664690d66389b4487d934ebcad98e6",
["blame.lua"] = "05feea95e221a2409a8d44334c47529f",
["cache.lua"] = "523c72aa06168f06b3ecd34fd04cbe9d",
cli = {
["argparse.lua"] = "fb6c9ffda01b2090f3c252ecaf00f68a"
},
["cli.lua"] = "00273191aa1ca467c5edbd9531f8fd9d",
["config.lua"] = "8743742b5a5b0a0713f0352ff4e88db0",
["current_line_blame.lua"] = "48e477d836e39ab98e58c2b027dd9db8",
["debounce.lua"] = "5a28036b5ac45c1f93f9883b855e564f",
debug = {
["log.lua"] = "f7e994b68e9cbcf91adfeb5bc379d7b1"
},
["debug.lua"] = "6a819b17a531b74ee11622145097afae",
["diff.lua"] = "0c462ae71c77899e81da151dcfdf77eb",
["diff_ext.lua"] = "31454455cd645f1518d8363446e8d0f6",
["diff_int.lua"] = "8e73883f55811dcb68ad481d389aa687",
["diffthis.lua"] = "aaac58016e9982bb14e942f9e4e24c52",
git = {
["blame.lua"] = "e779f4344bcc41cdb92c1a1be5eb2815",
["cmd.lua"] = "449c03c67b7ae516babc41d6da0dc66e",
["repo.lua"] = "1efe3178f64b77e0fc22cad55d9586a0",
["version.lua"] = "068a582ed4565978eb1f6eb089a6fa6c"
},
["git.lua"] = "0d3e8859ff8cf7ebd3beb739b64a8c49",
["highlight.lua"] = "f0bf039b629818fbfae8a6fad161f9a2",
["hunks.lua"] = "ee058ee8b056b055cd8404460ca6921f",
["manager.lua"] = "f6e7e2430f2f28a4dbcfd2479f2c8480",
["message.lua"] = "523ee4df9da4a7fa9b5ab2100eb27ac4",
["popup.lua"] = "2fcf3052f95d81cb5c0bb04ca4e06aae",
["repeat.lua"] = "798544de97c774bc8e10eecfd6479585",
["signs.lua"] = "a22dd6943d762dffcdbb8d2db4d885bb",
["status.lua"] = "a229a7213a3fbecfcf2d98aaf587fcab",
system = {
["compat.lua"] = "05d2b6d08602fba46be9b540288091e7"
},
["system.lua"] = "d73fac4f6e734cc8ce9f13d6be027503",
["test.lua"] = "082f7c7a556bf27352a378d047b8e79b",
["util.lua"] = "d30ad092850bd48a1446ce069320f5a7",
["watcher.lua"] = "978875698d84bc1f715c55fefa72bcc1"
},
["gitsigns.lua"] = "bf3f49482d8340f4be41060d7f461fd1"
}
}

View File

@ -0,0 +1,173 @@
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.blame"] = {
"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.blame"] = {
"gitsigns.nvim/scm-1"
},
["gitsigns.git.cmd"] = {
"gitsigns.nvim/scm-1"
},
["gitsigns.git.repo"] = {
"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.blame"] = "gitsigns/blame.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.blame"] = "gitsigns/git/blame.lua",
["gitsigns.git.cmd"] = "gitsigns/git/cmd.lua",
["gitsigns.git.repo"] = "gitsigns/git/repo.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"
}
}
}
}
}

View File

@ -0,0 +1,400 @@
local async = require('gitsigns.async')
local cache = require('gitsigns.cache').cache
local log = require('gitsigns.debug.log')
local util = require('gitsigns.util')
local api = vim.api
local hash_colors = {} --- @type table<integer,string>
local ns = api.nvim_create_namespace('gitsigns_blame_win')
local ns_hl = api.nvim_create_namespace('gitsigns_blame_win_hl')
--- Convert a hex char to a rgb color component
---
--- Taken from vim-fugitive:
--- Avoid color components lower than 0x20 and higher than 0xdf to help
--- avoid colors that blend into the background, light or dark.
--- @param x string hex char
--- @return integer
local function mod(x)
local y = tonumber(x, 16)
return math.min(0xdf, 0x20 + math.floor((y * 0x10 + (15 - y)) * 0.75))
end
--- Taken from vim-fugitive
--- Use 3 characters of the commit hash, limiting the maximum total colors to
--- 4,096.
--- @param sha string
--- @return string
local function get_hash_color(sha)
local r, g, b = sha:match('(%x)%x(%x)%x(%x)')
local color = mod(r) * 0x10000 + mod(g) * 0x100 + mod(b)
if hash_colors[sha] then
return hash_colors[sha]
end
local hl_name = string.format('GitSignsBlameColor.%s%s%s', r, g, b)
api.nvim_set_hl(0, hl_name, { fg = color })
hash_colors[color] = hl_name
return hl_name
end
---@param amount integer
---@param text string
---@return string
local function lalign(amount, text)
local len = vim.str_utfindex(text)
return text .. string.rep(' ', math.max(0, amount - len))
end
local chars = {
first = '',
mid = '',
last = '',
single = '',
}
local M = {}
--- @param blame table<integer,Gitsigns.BlameInfo?>
--- @param win integer
--- @param main_win integer
--- @param buf_sha string
local function render(blame, win, main_win, buf_sha)
local max_author_len = 0
for _, blame_info in pairs(blame) do
max_author_len = math.max(max_author_len, (vim.str_utfindex(blame_info.commit.author)))
end
local lines = {} --- @type string[]
local last_sha --- @type string?
local cnt = 0
local commit_lines = {} --- @type table<integer,true>
for i, hl in pairs(blame) do
local sha = hl.commit.abbrev_sha
local next_sha = blame[i + 1] and blame[i + 1].commit.abbrev_sha or nil
if sha == last_sha then
cnt = cnt + 1
local c = sha == next_sha and chars.mid or chars.last
lines[i] = cnt == 1 and string.format('%s %s', c, hl.commit.summary) or c
else
cnt = 0
commit_lines[i] = true
lines[i] = string.format(
'%s %s %s %s',
chars.first,
sha,
lalign(max_author_len, hl.commit.author),
util.expand_format('<author_time>', hl.commit)
)
end
last_sha = sha
end
local win_width = #lines[1]
api.nvim_win_set_width(win, win_width + 1)
local bufnr = api.nvim_win_get_buf(win)
local main_buf = api.nvim_win_get_buf(main_win)
api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
-- Apply highlights
for i, blame_info in ipairs(blame) do
local hash_color = get_hash_color(blame_info.commit.abbrev_sha)
api.nvim_buf_set_extmark(bufnr, ns, i - 1, 0, {
end_col = commit_lines[i] and 12 or 1,
hl_group = hash_color,
})
if commit_lines[i] then
local width = string.len(lines[i])
api.nvim_buf_set_extmark(bufnr, ns, i - 1, width - 10, {
end_col = width,
hl_group = 'Title',
})
else
api.nvim_buf_set_extmark(bufnr, ns, i - 1, 2, {
end_row = i,
end_col = 0,
hl_group = 'Comment',
})
end
if buf_sha == blame_info.commit.sha then
api.nvim_buf_set_extmark(bufnr, ns, i - 1, 0, {
line_hl_group = '@markup.italic',
})
end
if commit_lines[i] and commit_lines[i + 1] then
api.nvim_buf_set_extmark(bufnr, ns, i - 1, 0, {
virt_lines = {
{ { chars.last, hash_color }, { ' ' }, { blame[i].commit.summary, 'Comment' } },
},
})
local fillchar = string.rep(vim.opt.fillchars:get().diff or '-', 1000)
api.nvim_buf_set_extmark(main_buf, ns, i - 1, 0, {
virt_lines = { { { fillchar, 'Comment' } } },
virt_lines_leftcol = true,
})
end
end
end
--- @param blame table<integer,Gitsigns.BlameInfo?>
--- @param win integer
--- @param revision? string
--- @param parent? boolean
local function reblame(blame, win, revision, parent)
local blm_win = api.nvim_get_current_win()
local lnum = unpack(api.nvim_win_get_cursor(blm_win))
local sha = blame[lnum].commit.sha
if parent then
sha = sha .. '^'
end
if sha == revision then
return
end
vim.cmd.quit()
api.nvim_set_current_win(win)
require('gitsigns').show(
sha,
vim.schedule_wrap(function()
local bufnr = api.nvim_get_current_buf()
local ok = vim.wait(1000, function()
return cache[bufnr] ~= nil
end)
if not ok then
error('Timeout waiting for attach')
end
async.run(M.blame)
end)
)
end
--- @param win integer
--- @param open 'vsplit'|'tabnew'
--- @param bcache Gitsigns.CacheEntry
local show_commit = async.create(3, function(win, open, bcache)
local cursor = api.nvim_win_get_cursor(win)[1]
local sha = bcache.blame[cursor].commit.sha
local res = bcache.git_obj.repo:command({ 'show', sha })
async.scheduler()
local commit_buf = api.nvim_create_buf(true, true)
api.nvim_buf_set_name(commit_buf, bcache:get_rev_bufname(sha, true))
api.nvim_buf_set_lines(commit_buf, 0, -1, false, res)
vim.cmd[open]({ mods = { keepalt = true } })
api.nvim_win_set_buf(0, commit_buf)
vim.bo[commit_buf].filetype = 'git'
end)
--- @param augroup integer
--- @param wins integer[]
local function sync_cursors(augroup, wins)
local cursor_save --- @type integer?
---@param w integer
local function sync_cursor(w)
local b = api.nvim_win_get_buf(w)
api.nvim_create_autocmd('BufLeave', {
buffer = b,
group = augroup,
callback = function()
cursor_save = unpack(api.nvim_win_get_cursor(w))
end,
})
api.nvim_create_autocmd('BufEnter', {
group = augroup,
buffer = b,
callback = function()
local cur_cursor, cur_cursor_col = unpack(api.nvim_win_get_cursor(w))
if cursor_save and cursor_save ~= cur_cursor then
api.nvim_win_set_cursor(w, { cursor_save, vim.o.startofline and 0 or cur_cursor_col })
end
end,
})
end
for _, w in ipairs(wins) do
sync_cursor(w)
end
end
--- @param name string
--- @param items [string, string][]
local function menu(name, items)
local max_len = 0
for _, item in ipairs(items) do
max_len = math.max(max_len, #item[1]) --- @type integer
end
for _, item in ipairs(items) do
local item_nm, action = item[1], item[2]
local pad = string.rep(' ', max_len - #item_nm)
local lhs = string.format('%s%s (%s)', item_nm, pad, action):gsub(' ', [[\ ]])
local cmd = string.format('nmenu <silent> ]%s.%s %s', name, lhs, action)
vim.cmd(cmd)
end
end
--- @async
M.blame = function()
local __FUNC__ = 'blame'
local bufnr = api.nvim_get_current_buf()
local win = api.nvim_get_current_win()
local bcache = cache[bufnr]
if not bcache then
log.dprint('Not attached')
return
end
bcache:get_blame()
local blame = assert(bcache.blame)
-- Save position to align 'scrollbind'
local top = vim.fn.line('w0') + vim.wo.scrolloff
local current = vim.fn.line('.')
vim.cmd.vsplit({ mods = { keepalt = true, split = 'aboveleft' } })
local blm_win = api.nvim_get_current_win()
local blm_bufnr = api.nvim_create_buf(false, true)
api.nvim_win_set_buf(blm_win, blm_bufnr)
render(blame, blm_win, win, bcache.git_obj.revision)
local blm_bo = vim.bo[blm_bufnr]
blm_bo.buftype = 'nofile'
blm_bo.bufhidden = 'wipe'
blm_bo.modifiable = false
blm_bo.filetype = 'gitsigns-blame'
local blm_wlo = vim.wo[blm_win][0]
blm_wlo.foldcolumn = '0'
blm_wlo.foldenable = false
blm_wlo.number = false
blm_wlo.relativenumber = false
blm_wlo.scrollbind = true
blm_wlo.signcolumn = 'no'
blm_wlo.spell = false
blm_wlo.winfixwidth = true
blm_wlo.wrap = false
if vim.wo[win].winbar ~= '' and blm_wlo.winbar == '' then
local name = api.nvim_buf_get_name(bufnr)
blm_wlo.winbar = vim.fn.fnamemodify(name, ':.')
end
if vim.fn.exists('&winfixbuf') then
blm_wlo.winfixbuf = true
end
vim.cmd(tostring(top))
vim.cmd('normal! zt')
vim.cmd(tostring(current))
vim.cmd('normal! 0')
local cur_wlo = vim.wo[win][0]
local cur_orig_wlo = { cur_wlo.foldenable, cur_wlo.scrollbind, cur_wlo.wrap }
cur_wlo.foldenable = false
cur_wlo.scrollbind = true
cur_wlo.wrap = false
vim.cmd.redraw()
vim.cmd.syncbind()
vim.keymap.set('n', '<CR>', function()
vim.cmd.popup(']GitsignsBlame')
end, {
desc = 'Open blame context menu',
buffer = blm_bufnr,
})
vim.keymap.set('n', 'r', function()
reblame(blame, win, bcache.git_obj.revision)
end, {
desc = 'Reblame at commit',
buffer = blm_bufnr,
})
vim.keymap.set('n', 'R', function()
reblame(blame, win, bcache.git_obj.revision, true)
end, {
desc = 'Reblame at commit parent',
buffer = blm_bufnr,
})
vim.keymap.set('n', 's', function()
show_commit(blm_win, 'vsplit', bcache)
end, {
desc = 'Show commit in a vertical split',
buffer = blm_bufnr,
})
vim.keymap.set('n', 'S', function()
show_commit(blm_win, 'tabnew', bcache)
end, {
desc = 'Show commit in a new tab',
buffer = blm_bufnr,
})
menu('GitsignsBlame', {
{ 'Reblame at commit', 'r' },
{ 'Reblame at commit parent', 'R' },
{ 'Show commit (vsplit)', 's' },
{ ' (tab)', 'S' },
})
local group = api.nvim_create_augroup('GitsignsBlame', {})
api.nvim_create_autocmd({ 'CursorMoved', 'BufLeave' }, {
buffer = blm_bufnr,
group = group,
callback = function()
api.nvim_buf_clear_namespace(blm_bufnr, ns_hl, 0, -1)
api.nvim_buf_clear_namespace(bufnr, ns_hl, 0, -1)
end,
})
-- Highlight the same commit under the cursor
api.nvim_create_autocmd('CursorMoved', {
buffer = blm_bufnr,
group = group,
callback = function()
local cursor = unpack(api.nvim_win_get_cursor(blm_win))
local cur_sha = blame[cursor].commit.abbrev_sha
for i, info in pairs(blame) do
if info.commit.abbrev_sha == cur_sha then
api.nvim_buf_set_extmark(blm_bufnr, ns_hl, i - 1, 0, {
line_hl_group = '@markup.strong',
})
end
end
end,
})
api.nvim_create_autocmd('WinClosed', {
pattern = tostring(blm_win),
group = group,
callback = function()
api.nvim_buf_clear_namespace(bufnr, ns, 0, -1)
cur_wlo.foldenable, cur_wlo.scrollbind, cur_wlo.wrap = unpack(cur_orig_wlo)
end,
})
sync_cursors(group, { win, blm_win })
end
return M

View File

@ -0,0 +1,268 @@
local uv = vim.uv or vim.loop
local error_once = require('gitsigns.message').error_once
local log = require('gitsigns.debug.log')
--- @class Gitsigns.CommitInfo
--- @field author string
--- @field author_mail string
--- @field author_time integer
--- @field author_tz string
--- @field committer string
--- @field committer_mail string
--- @field committer_time integer
--- @field committer_tz string
--- @field summary string
--- @field sha string
--- @field abbrev_sha string
--- @field boundary? true
--- @class Gitsigns.BlameInfoPublic: Gitsigns.BlameInfo, Gitsigns.CommitInfo
--- @field body? string[]
--- @field hunk_no? integer
--- @field num_hunks? integer
--- @field hunk? string[]
--- @field hunk_head? string
--- @class Gitsigns.BlameInfo
--- @field orig_lnum integer
--- @field final_lnum integer
--- @field commit Gitsigns.CommitInfo
--- @field filename string
--- @field previous_filename? string
--- @field previous_sha? string
local NOT_COMMITTED = {
author = 'Not Committed Yet',
author_mail = '<not.committed.yet>',
committer = 'Not Committed Yet',
committer_mail = '<not.committed.yet>',
}
local M = {}
--- @param file string
--- @return Gitsigns.CommitInfo
local function not_committed(file)
local time = os.time()
return {
sha = string.rep('0', 40),
abbrev_sha = string.rep('0', 8),
author = 'Not Committed Yet',
author_mail = '<not.committed.yet>',
author_tz = '+0000',
author_time = time,
committer = 'Not Committed Yet',
committer_time = time,
committer_mail = '<not.committed.yet>',
committer_tz = '+0000',
summary = 'Version of ' .. file,
}
end
--- @param file string
--- @param lnum integer
--- @return Gitsigns.BlameInfo
function M.get_blame_nc(file, lnum)
return {
orig_lnum = 0,
final_lnum = lnum,
commit = not_committed(file),
filename = file,
}
end
---@param x any
---@return integer
local function asinteger(x)
return assert(tonumber(x))
end
--- @param readline fun(): string?
--- @param commits table<string,Gitsigns.CommitInfo>
--- @param result table<integer,Gitsigns.BlameInfo>
local function incremental_iter(readline, commits, result)
local line = assert(readline())
--- @type string, string, string, string
local sha, orig_lnum_str, final_lnum_str, size_str = line:match('(%x+) (%d+) (%d+) (%d+)')
assert(sha)
local orig_lnum = asinteger(orig_lnum_str)
local final_lnum = asinteger(final_lnum_str)
local size = asinteger(size_str)
--- @type table<string,string|true>
local commit = commits[sha] or {
sha = sha,
abbrev_sha = sha:sub(1, 8),
}
--- @type string, string
local previous_sha, previous_filename
line = assert(readline())
-- filename terminates the entry
while not line:match('^filename ') do
local key, value = line:match('^([^%s]+) (.*)')
if key == 'previous' then
previous_sha, previous_filename = line:match('^previous (%x+) (.*)')
elseif key then
key = key:gsub('%-', '_') --- @type string
if vim.endswith(key, '_time') then
value = tonumber(value)
end
commit[key] = value
else
commit[line] = true
if line ~= 'boundary' then
log.dprintf("Unknown tag: '%s'", line)
end
end
line = assert(readline())
end
local filename = assert(line:match('^filename (.*)'))
-- New in git 2.41:
-- The output given by "git blame" that attributes a line to contents
-- taken from the file specified by the "--contents" option shows it
-- differently from a line attributed to the working tree file.
if
commit.author_mail == '<external.file>'
or commit.author_mail == 'External file (--contents)'
then
commit = vim.tbl_extend('force', commit, NOT_COMMITTED)
end
commits[sha] = commit
for j = 0, size - 1 do
result[final_lnum + j] = {
final_lnum = final_lnum + j,
orig_lnum = orig_lnum + j,
commit = commits[sha],
filename = filename,
previous_filename = previous_filename,
previous_sha = previous_sha,
}
end
end
--- @param data string
--- @return string[]
local function data_to_lines(data)
local lines = vim.split(data, '\n')
if lines[#lines] == '' then
lines[#lines] = nil
end
return lines
end
--- @param f fun(readline: fun(): string?))
--- @return fun(data: string?)
local function bufferred_line_reader(f)
--- @param data string?
return coroutine.wrap(function(data)
if not data then
return
end
local data_lines = data_to_lines(data)
local i = 0
local function readline(peek)
if not data_lines[i + 1] then
data = coroutine.yield()
if not data then
return
end
data_lines = data_to_lines(data)
i = 0
end
if peek then
return data_lines[ i+ 1]
end
i = i + 1
return data_lines[i]
end
while readline(true) do
f(readline)
end
end)
end
--- @param obj Gitsigns.GitObj
--- @param lines string[]
--- @param lnum? integer
--- @param revision? string
--- @param opts? Gitsigns.BlameOpts
--- @return table<integer, Gitsigns.BlameInfo>
function M.run_blame(obj, lines, lnum, revision, opts)
local ret = {} --- @type table<integer,Gitsigns.BlameInfo>
if not obj.object_name or obj.repo.abbrev_head == '' then
-- 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 = not_committed(obj.file)
for i in ipairs(lines) do
ret[i] = {
orig_lnum = 0,
final_lnum = i,
commit = commit,
filename = obj.file,
}
end
return ret
end
local args = { 'blame', '--contents', '-', '--incremental' }
opts = opts or {}
if opts.ignore_whitespace then
args[#args + 1] = '-w'
end
if lnum then
vim.list_extend(args, { '-L', lnum .. ',+1' })
end
if opts.extra_opts then
vim.list_extend(args, opts.extra_opts)
end
local ignore_file = obj.repo.toplevel .. '/.git-blame-ignore-revs'
if uv.fs_stat(ignore_file) then
vim.list_extend(args, { '--ignore-revs-file', ignore_file })
end
args[#args + 1] = revision
args[#args + 1] = '--'
args[#args + 1] = obj.file
local commits = {} --- @type table<string,Gitsigns.CommitInfo>
local reader = bufferred_line_reader(function(readline)
incremental_iter(readline, commits, ret)
end)
--- @param data string?
local function on_stdout(_, data)
reader(data)
end
local _, stderr = obj.repo:command(args, { stdin = lines, stdout = on_stdout, ignore_error = true })
if stderr then
error_once('Error running git-blame: ' .. stderr)
return {}
end
return ret
end
return M

View File

@ -0,0 +1,72 @@
local async = require('gitsigns.async')
local log = require('gitsigns.debug.log')
local system = require('gitsigns.system').system
--- @type fun(cmd: string[], opts?: vim.SystemOpts): vim.SystemCompleted
local asystem = async.wrap(3, system)
--- @class Gitsigns.Git.JobSpec : vim.SystemOpts
--- @field ignore_error? boolean
--- @async
--- @param args string[]
--- @param spec? Gitsigns.Git.JobSpec
--- @return string[] stdout, string? stderr
local function git_command(args, spec)
spec = spec or {}
local cmd = {
'git',
'--no-pager',
'--no-optional-locks',
'--literal-pathspecs',
'-c',
'gc.auto=0', -- Disable auto-packing which emits messages to stderr
unpack(args),
}
if spec.text == nil then
spec.text = true
end
-- Fix #895. Only needed for Nvim 0.9 and older
spec.clear_env = true
--- @type vim.SystemCompleted
local obj = asystem(cmd, spec)
if not spec.ignore_error and obj.code > 0 then
log.eprintf(
"Received exit code %d when running command\n'%s':\n%s",
obj.code,
table.concat(cmd, ' '),
obj.stderr
)
end
local stdout_lines = vim.split(obj.stdout or '', '\n')
if spec.text then
-- If stdout ends with a newline, then remove the final empty string after
-- the split
if stdout_lines[#stdout_lines] == '' then
stdout_lines[#stdout_lines] = nil
end
end
if log.verbose then
log.vprintf('%d lines:', #stdout_lines)
for i = 1, math.min(10, #stdout_lines) do
log.vprintf('\t%s', stdout_lines[i])
end
end
if obj.stderr == '' then
obj.stderr = nil
end
return stdout_lines, obj.stderr
end
return git_command

View File

@ -0,0 +1,265 @@
local async = require('gitsigns.async')
local git_command = require('gitsigns.git.cmd')
local log = require('gitsigns.debug.log')
local util = require('gitsigns.util')
local system = require('gitsigns.system').system
local check_version = require('gitsigns.git.version').check
--- @type fun(cmd: string[], opts?: vim.SystemOpts): vim.SystemCompleted
local asystem = async.wrap(3, system)
local uv = vim.uv or vim.loop
--- @class Gitsigns.RepoInfo
--- @field gitdir string
--- @field toplevel string
--- @field detached boolean
--- @field abbrev_head string
--- @class Gitsigns.Repo : Gitsigns.RepoInfo
---
--- Username configured for the repo.
--- Needed for to determine "You" in current line blame.
--- @field username string
local M = {}
--- Run git command the with the objects gitdir and toplevel
--- @async
--- @param args string[]
--- @param spec? Gitsigns.Git.JobSpec
--- @return string[] stdout, string? stderr
function M:command(args, spec)
spec = spec or {}
spec.cwd = self.toplevel
local args1 = { '--git-dir', self.gitdir }
if self.detached then
vim.list_extend(args1, { '--work-tree', self.toplevel })
end
vim.list_extend(args1, args)
return git_command(args1, spec)
end
--- @param base string?
--- @return string[]
function M:files_changed(base)
--- @type string[]
local results
if base and base ~= ':0' then
results = self:command({ 'diff', '--name-status', base })
for i, result in ipairs(results) do
results[i] = vim.split(string.gsub(result, '\t', ' '), ' ', { plain = true })[2]
end
return results
else
results = self:command({ 'status', '--porcelain', '--ignore-submodules' })
local ret = {} --- @type string[]
for _, line in ipairs(results) do
if line:sub(1, 2):match('^.M') then
ret[#ret + 1] = line:sub(4, -1)
end
end
return ret
end
end
--- @param encoding string
--- @return boolean
local function iconv_supported(encoding)
-- TODO(lewis6991): needs https://github.com/neovim/neovim/pull/21924
if vim.startswith(encoding, 'utf-16') then
return false
elseif vim.startswith(encoding, 'utf-32') then
return false
end
return true
end
--- Get version of file in the index, return array lines
--- @param object string
--- @param encoding? string
--- @return string[] stdout, string? stderr
function M:get_show_text(object, encoding)
local stdout, stderr = self:command({ 'show', object }, { text = false, ignore_error = true })
if encoding and encoding ~= 'utf-8' and iconv_supported(encoding) then
for i, l in ipairs(stdout) do
stdout[i] = vim.iconv(l, encoding, 'utf-8')
end
end
return stdout, stderr
end
--- @async
function M:update_abbrev_head()
local info = M.get_info(self.toplevel)
if not info then
log.eprintf('Could not get info for repo at %s', self.gitdir)
return
end
self.abbrev_head = info.abbrev_head
end
--- @async
--- @private
--- @param info Gitsigns.RepoInfo
--- @return Gitsigns.Repo
local function new(info)
local self = setmetatable({}, { __index = M })
for k, v in
pairs(info --[[@as table<string,any>]])
do
---@diagnostic disable-next-line:no-unknown
self[k] = v
end
self.username = self:command({ 'config', 'user.name' }, { ignore_error = true })[1]
return self
end
--- @type table<string,[integer,Gitsigns.Repo]?>
local repo_cache = setmetatable({}, { __mode = 'v' })
--- @async
--- @param dir string
--- @param gitdir? string
--- @param toplevel? string
--- @return Gitsigns.Repo?
function M.get(dir, gitdir, toplevel)
local info = M.get_info(dir, gitdir, toplevel)
if not info then
return
end
gitdir = info.gitdir
if not repo_cache[gitdir] then
repo_cache[gitdir] = {1, new(info)}
else
local refcount = repo_cache[gitdir][1]
repo_cache[gitdir][1] = refcount + 1
end
return repo_cache[gitdir][2]
end
function M:unref()
local gitdir = self.gitdir
local repo = repo_cache[gitdir]
if not repo then
-- Already reclaimed by GC
return
end
local refcount = repo[1]
if refcount <= 1 then
repo_cache[gitdir] = nil
else
repo_cache[gitdir][1] = refcount - 1
end
end
local has_cygpath = jit and jit.os == 'Windows' and vim.fn.executable('cygpath') == 1
--- @generic S
--- @param path S
--- @return S
local function normalize_path(path)
if path and has_cygpath and not uv.fs_stat(path) then
-- If on windows and path isn't recognizable as a file, try passing it
-- through cygpath
path = asystem({ 'cygpath', '-aw', path }).stdout
end
return path
end
--- @async
--- @param gitdir? string
--- @param head_str string
--- @param cwd string
--- @return string
local function process_abbrev_head(gitdir, head_str, cwd)
if not gitdir then
return head_str
end
if head_str == 'HEAD' then
local short_sha = git_command({ 'rev-parse', '--short', 'HEAD' }, {
ignore_error = true,
cwd = cwd,
})[1] or ''
if log.debug_mode and short_sha ~= '' then
short_sha = 'HEAD'
end
if
util.path_exists(gitdir .. '/rebase-merge')
or util.path_exists(gitdir .. '/rebase-apply')
then
return short_sha .. '(rebasing)'
end
return short_sha
end
return head_str
end
--- @async
--- @param cwd string
--- @param gitdir? string
--- @param toplevel? string
--- @return Gitsigns.RepoInfo?
function M.get_info(cwd, gitdir, toplevel)
-- Does git rev-parse have --absolute-git-dir, added in 2.13:
-- https://public-inbox.org/git/20170203024829.8071-16-szeder.dev@gmail.com/
local has_abs_gd = check_version({ 2, 13 })
-- Wait for internal scheduler to settle before running command (#215)
async.scheduler()
local args = {}
if gitdir then
vim.list_extend(args, { '--git-dir', gitdir })
end
if toplevel then
vim.list_extend(args, { '--work-tree', toplevel })
end
vim.list_extend(args, {
'rev-parse',
'--show-toplevel',
has_abs_gd and '--absolute-git-dir' or '--git-dir',
'--abbrev-ref',
'HEAD',
})
local stdout = git_command(args, {
ignore_error = true,
cwd = toplevel or cwd,
})
if not stdout[1] then
return
end
local toplevel_r = normalize_path(stdout[1])
local gitdir_r = normalize_path(stdout[2])
if not has_abs_gd then
gitdir_r = assert(uv.fs_realpath(gitdir_r))
end
return {
toplevel = toplevel_r,
gitdir = gitdir_r,
abbrev_head = process_abbrev_head(gitdir_r, stdout[3], cwd),
detached = toplevel_r and gitdir_r ~= toplevel_r .. '/.git',
}
end
return M

View File

@ -0,0 +1,580 @@
==============================================================================
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 `haskell-tools.Opts` table, in your neovim configuration.
Example:
>
---@type haskell-tools.Opts
vim.g.haskell_tools = {
---@type haskell-tools.tools.Opts
tools = {
-- ...
},
---@type haskell-tools.lsp.ClientOpts
hls = {
on_attach = function(client, bufnr)
-- Set keybindings, etc. here.
end,
-- ...
},
---@type haskell-tools.dap.Opts
dap = {
-- ...
},
}
<
Note: `vim.g.haskell_tools` can also be a function that returns a 'haskell-tools.Opts' table.
haskell-tools.Opts *haskell-tools.Opts*
Fields: ~
{tools?} (haskell-tools.tools.Opts)
haskell-tools module options.
{hls?} (haskell-tools.lsp.ClientOpts)
haskell-language-server client options.
{dap?} (haskell-tools.dap.Opts)
debug adapter config for nvim-dap.
haskell-tools.tools.Opts *haskell-tools.tools.Opts*
Fields: ~
{codeLens?} (haskell-tools.codeLens.Opts)
LSP codeLens options.
{hoogle?} (haskell-tools.hoogle.Opts)
Hoogle type signature search options.
{hover?} (haskell-tools.hover.Opts)
LSP hover options.
{definition?} (haskell-tools.definition.Opts) LSP go-to-definition options.
{repl?} (haskell-tools.repl.Opts)
GHCi repl options.
{tags?} (haskell-tools.fast-tags.Opts)
fast-tags module options.
{log?} (haskell-tools.log.Opts)
haskell-tools logger options.
haskell-tools.codeLens.Opts *haskell-tools.codeLens.Opts*
Fields: ~
{autoRefresh?} (fun():boolean|boolean)
(default: `true`) Whether to auto-refresh code-lenses.
haskell-tools.hoogle.Opts *haskell-tools.hoogle.Opts*
Fields: ~
{mode?} (haskell-tools.hoogle.Mode)
Use a telescope with a local hoogle installation or a web backend,
or use the browser for hoogle signature search?
haskell-tools.hoogle.Mode *haskell-tools.hoogle.Mode*
Type: ~
"auto"|"telescope-local"|"telescope-web"|"browser"
haskell-tools.hover.Opts *haskell-tools.hover.Opts*
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.
haskell-tools.definition.Opts *haskell-tools.definition.Opts*
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|).
haskell-tools.repl.Opts *haskell-tools.repl.Opts*
Fields: ~
{handler?} (fun():haskell-tools.repl.Handler|haskell-tools.repl.Handler)
`'builtin'`: Use the simple builtin repl.
`'toggleterm'`: Use akinsho/toggleterm.nvim.
{prefer?} (fun():haskell-tools.repl.Backend|haskell-tools.repl.Backend)
Prefer cabal or stack when both stack and cabal project files are present?
{builtin?} (haskell-tools.repl.builtin.Opts)
Configuration for the builtin repl.
{auto_focus?} (boolean)
Whether to auto-focus the repl on toggle or send. If unset, the handler decides.
haskell-tools.repl.Handler *haskell-tools.repl.Handler*
Type: ~
"builtin"|"toggleterm"
haskell-tools.repl.Backend *haskell-tools.repl.Backend*
Type: ~
"cabal"|"stack"
haskell-tools.repl.builtin.Opts *haskell-tools.repl.builtin.Opts*
Fields: ~
{create_repl_window?} (fun(view:haskell-tools.repl.View):fun(mk_repl_cmd:mk_ht_repl_cmd_fun))
How to create the repl window.
Should return a function that calls one of the |haskell-tools.repl.View|'s functions.
haskell-tools.repl.View *haskell-tools.repl.View*
Fields: ~
{create_repl_split?} (fun(opts:haskell-tools.repl.view.Opts):mk_ht_repl_cmd_fun)
Create the REPL in a horizontally split window.
{create_repl_vsplit?} (fun(opts:haskell-tools.repl.view.Opts):mk_ht_repl_cmd_fun)
Create the REPL in a vertically split window.
{create_repl_tabnew?} (fun(opts:haskell-tools.repl.view.Opts):mk_ht_repl_cmd_fun)
Create the REPL in a new tab.
{create_repl_cur_win?} (fun(opts:haskell-tools.repl.view.Opts):mk_ht_repl_cmd_fun)
Create the REPL in the current window.
haskell-tools.repl.view.Opts *haskell-tools.repl.view.Opts*
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_ht_repl_cmd_fun *mk_ht_repl_cmd_fun*
Type: ~
fun():string[]|nil
haskell-tools.fast-tags.Opts *haskell-tools.fast-tags.Opts*
Fields: ~
{enable?} (boolean|fun():boolean)
Enabled by default if the `fast-tags` executable is found.
{package_events?} (string[])
The |autocmd| events to trigger package tag generation.
haskell-tools.log.Opts *haskell-tools.log.Opts*
Fields: ~
{level?} (number|string)
The log level.
See: ~
|vim.log.levels|
haskell-tools.lsp.ClientOpts *haskell-tools.lsp.ClientOpts*
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.
haskell-tools.dap.Opts *haskell-tools.dap.Opts*
Fields: ~
{cmd?} (string[])
The command to start the debug adapter server with.
{logFile?} (string)
Log file path for detected configurations.
{logLevel?} (haskell-tools.debugAdapter.LogLevel)
The log level for detected configurations.
{auto_discover?} (boolean|haskell-tools.dap.AddConfigOpts) Set to `false` to disable auto-discovery of launch configurations. `true` uses the default configurations options`.
haskell-tools.debugAdapter.LogLevel *haskell-tools.debugAdapter.LogLevel*
Type: ~
"Debug"|"Info"|"Warning"|"Error"
haskell-tools.dap.AddConfigOpts *haskell-tools.dap.AddConfigOpts*
Fields: ~
{autodetect} (boolean)
Whether to automatically detect launch configurations for the project.
{settings_file_pattern} (string)
File name or pattern to search for.
Defaults to 'launch.json'.
==============================================================================
haskell-language-server LSP client tools *haskell-tools.lsp*
The following commands are available:
* `:Hls start` - Start the LSP client.
* `:Hls stop` - Stop the LSP client.
* `:Hls restart` - Restart the LSP client.
* `:Hls evalAll` - Evaluate all code snippets in comments.
haskell-tools.load_hls_settings.Opts *haskell-tools.load_hls_settings.Opts*
Fields: ~
{settings_file_pattern} (string|nil) File name or pattern to search for. Defaults to 'hls.json'
haskell-tools.Hls *haskell-tools.Hls*
*Hls.load_hls_settings*
Hls.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} (haskell-tools.load_hls_settings.Opts|nil)
Returns: ~
(table) hls_settings
See: ~
|https://haskell-language-server.readthedocs.io/en/latest/configuration.html|
Hls.start({bufnr}) *Hls.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
Hls.stop({bufnr}) *Hls.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
Hls.restart({bufnr}) *Hls.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
Hls.buf_eval_all({bufnr}) *Hls.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*
haskell-tools.dap.LaunchConfiguration *haskell-tools.dap.LaunchConfiguration*
haskell-tools.Dap *haskell-tools.Dap*
*Dap.discover_configurations*
Dap.discover_configurations({bufnr}, {opts})
Discover nvim-dap launch configurations for haskell-debug-adapter.
Parameters: ~
{bufnr} (number|nil) The buffer number
{opts} (haskell-tools.dap.AddConfigOpts|nil)
Returns: ~
(nil)
==============================================================================
haskell-tools Hoogle search *haskell-tools.hoogle*
haskell-tools.Hoogle *haskell-tools.Hoogle*
Hoogle.hoogle_signature({options}) *Hoogle.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:
* `:Haskell repl toggle {file?}` - Toggle a GHCi repl.
* `:Haskell repl quit` - Quit the current repl.
* `:Haskell repl load {file?}` - Load a Haskell file into the repl.
* `:Haskell repl reload` - Reload the current repl.
* `:Haskell repl paste_type {register?}` - Query the repl for the type of |registers| {register}
* `:Haskell repl cword_type` - Query the repl for the type of |cword|
* `:Haskell repl paste_info {register?}` - Query the repl for the info on |registers| {register}
* `:Haskell repl cword_info` - Query the repl for info on |cword|
haskell-tools.Repl *haskell-tools.Repl*
Repl.buf_mk_repl_cmd() *Repl.buf_mk_repl_cmd*
Create the command to create a repl for the current buffer.
Returns: ~
(table|nil) command
Repl.operator() *Repl.operator*
See: ~
|operatorfunc|
Repl.paste({reg}) *Repl.paste*
Paste from register `reg` to the REPL
Parameters: ~
{reg} (string|nil) register (defaults to '"')
Repl.paste_type({reg}) *Repl.paste_type*
Query the REPL for the type of register `reg`
Parameters: ~
{reg} (string|nil) register (defaults to '"')
Repl.cword_type() *Repl.cword_type*
Query the REPL for the type of word under the cursor
Repl.paste_info({reg}) *Repl.paste_info*
Query the REPL for info on register `reg`
Parameters: ~
{reg} (string|nil) register (defaults to '"')
Repl.cword_info() *Repl.cword_info*
Query the REPL for the type of word under the cursor
Repl.load_file({filepath}) *Repl.load_file*
Load a file into the REPL
Parameters: ~
{filepath} (string) The absolute file path
Repl.reload() *Repl.reload*
Reload the repl
==============================================================================
haskell-tools Project module *haskell-tools.project*
The following commands are available:
* `:Haskell projectFile` - Open the project file for the current buffer (cabal.project or stack.yaml).
* `:Haskell packageYaml` - Open the package.yaml file for the current buffer.
* `:Haskell packageCabal` - Open the *.cabal file for the current buffer.
haskell-tools.Project *haskell-tools.Project*
Project.root_dir({project_file}) *Project.root_dir*
Get the project's root directory
Parameters: ~
{project_file} (string) The path to a project file
Returns: ~
(string|nil)
Project.open_package_yaml() *Project.open_package_yaml*
Open the package.yaml of the package containing the current buffer.
Returns: ~
(nil)
Project.open_package_cabal() *Project.open_package_cabal*
Open the *.cabal file of the package containing the current buffer.
Returns: ~
(nil)
Project.open_project_file() *Project.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*
*haskell-tools.tags.generate_project_tags.Opts*
haskell-tools.tags.generate_project_tags.Opts
Fields: ~
{refresh} (boolean) Whether to refresh the tags if they have already been generated
haskell-tools.FastTags *haskell-tools.FastTags*
for the project (default: true)
*FastTags.generate_project_tags*
FastTags.generate_project_tags({path}, {opts})
Generates tags for the current project
Parameters: ~
{path} (string|nil) File path
{opts} (haskell-tools.tags.generate_project_tags.Opts|nil) Options
FastTags.generate_package_tags({path}) *FastTags.generate_package_tags*
Generate tags for the package containing `path`
Parameters: ~
{path} (string|nil) File path
==============================================================================
haskell-tools Logging *haskell-tools.log*
The following commands are available:
* `:Haskell log setLevel` - Set the haskell-tools.nvim and LSP client log level.
* `:Haskell log openLog` - Open the haskell-tools.nvim log file.
* `:Haskell log openHlsLog` - Open the haskell-language-server log file.
haskell-tools.Log *haskell-tools.Log*
Log.get_hls_logfile() *Log.get_hls_logfile*
Get the haskell-language-server log file
Returns: ~
(string) filepath
Log.get_logfile() *Log.get_logfile*
Get the haskell-tools.nvim log file path.
Returns: ~
(string) filepath
Log.nvim_open_hls_logfile() *Log.nvim_open_hls_logfile*
Open the haskell-language-server log file
Returns: ~
(nil)
Log.nvim_open_logfile() *Log.nvim_open_logfile*
Open the haskell-tools.nvim log file.
Returns: ~
(nil)
Log.set_level() *Log.set_level*
Returns: ~
(nil)
See: ~
|vim.log.levels|
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@ -0,0 +1,40 @@
local git_ref = '4.0.0'
local modrev = '4.0.0'
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-' .. '4.0.0',
}
if modrev == 'scm' or modrev == 'dev' then
source = {
url = repo_url:gsub('https', 'git')
}
end
build = {
type = 'builtin',
copy_directories = { 'doc', 'ftplugin' } ,
}

View File

@ -0,0 +1,73 @@
rock_manifest = {
doc = {
["haskell-tools.txt"] = "727cc3d507969c15da72d8fc078b8f5c"
},
ftplugin = {
["cabal.lua"] = "4f72e96d3601fed58fd4a24e9633172d",
["cabalproject.lua"] = "4f72e96d3601fed58fd4a24e9633172d",
["haskell.lua"] = "4f72e96d3601fed58fd4a24e9633172d",
["lhaskell.lua"] = "4f72e96d3601fed58fd4a24e9633172d"
},
["haskell-tools.nvim-4.0.0-1.rockspec"] = "d9f68f3f100a893c53e199412b290aca",
lua = {
["haskell-tools"] = {
["commands.lua"] = "196ecaed184ea3aac299908789ec907c",
config = {
["check.lua"] = "25ad72d0043d59c98fea0d7262bc3af6",
["init.lua"] = "c5de71c6a83b03f9b3281eb153bb0a4e",
["internal.lua"] = "ad38f5368950178cce22d6328f87104e"
},
dap = {
["init.lua"] = "c6c938e8b498b5204d94e698c463a453",
["internal.lua"] = "d31fbe6dc31b3cc94916fa5d7a042902"
},
["deps.lua"] = "bc917d0fb10a9c6b9f57838ad6c15770",
["health.lua"] = "2973c5710025bea8a5eb7fadaf291050",
hoogle = {
["helpers.lua"] = "cbbd886b653824acfad1f6ee9f3e24a5",
["init.lua"] = "ab7621676750cb3bfa7c0a4598ac8bfc",
["local.lua"] = "b2a230bfe523fbf20a1e25b35b99b77b",
["web.lua"] = "acf3c84bf67b25fa37de256e83f3fabc"
},
["init.lua"] = "a47dd52851320ba781a3d37301cc0068",
["internal.lua"] = "9b5503d7a3f874c2e1227b2613449661",
log = {
["init.lua"] = "34e3645981b674afbfedb4bb38c1c720",
["internal.lua"] = "abf7c2d2f5397138bfe53bfea4f8f22f"
},
lsp = {
["definition.lua"] = "04348f8215b227a5da688b92e1cfe23b",
["eval.lua"] = "69614508eab450ad811c9cbdd46130a9",
["helpers.lua"] = "db4e09ce2ad6c821a562a672c34fc353",
["hover.lua"] = "2aa35d13516fa0aadb38c128c0e2f636",
["init.lua"] = "fa1e72e1227141163ece82c07371ddd3"
},
["os.lua"] = "9ac35aebb3f78518df747a54d376b301",
["parser.lua"] = "e68b0de6ec66c30918ec6a1008ed4884",
project = {
["cabal.lua"] = "278495ec4fae050d00d8c777b21d7225",
["helpers.lua"] = "02d5e2b6261082776a01edcdd91acb09",
["init.lua"] = "4a382b5d3ae48ed5d58089fe641bcd6d",
["stack.lua"] = "9c013778ee77288578963b22b25b77e1"
},
repl = {
["builtin.lua"] = "bb346659484daab7f479f35d4c12b688",
["init.lua"] = "e262c0947f43a68b2fe3ff64e5e555d4",
["toggleterm.lua"] = "61c197873d8e659bfcc8a903d1c73261"
},
["strings.lua"] = "61ee9372c3074bf51f2619b9e135910d",
["tags.lua"] = "65d95ec2dc2c55e28aab5f8a1e71eb56",
types = {
["internal.lua"] = "0360b137c2d65a32ea862f498154af7b"
}
},
telescope = {
_extensions = {
ht = {
["extension.lua"] = "040c10b48645d3230bba5952281ea858"
},
["ht.lua"] = "ebd1a0ec34353b6b42b5e6012ff69dd9"
}
}
}
}

View File

@ -0,0 +1,173 @@
commands = {}
dependencies = {
["haskell-tools.nvim"] = {
["4.0.0-1"] = {
{
constraints = {
{
op = ">=",
version = {
5, 1, string = "5.1"
}
}
},
name = "lua"
}
}
}
}
modules = {
["haskell-tools.commands"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.config.check"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.config.init"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.config.internal"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.dap.init"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.dap.internal"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.deps"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.health"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.hoogle.helpers"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.hoogle.init"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.hoogle.local"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.hoogle.web"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.init"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.internal"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.log.init"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.log.internal"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.lsp.definition"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.lsp.eval"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.lsp.helpers"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.lsp.hover"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.lsp.init"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.os"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.parser"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.project.cabal"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.project.helpers"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.project.init"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.project.stack"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.repl.builtin"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.repl.init"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.repl.toggleterm"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.strings"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.tags"] = {
"haskell-tools.nvim/4.0.0-1"
},
["haskell-tools.types.internal"] = {
"haskell-tools.nvim/4.0.0-1"
},
["telescope._extensions.ht"] = {
"haskell-tools.nvim/4.0.0-1"
},
["telescope._extensions.ht.extension"] = {
"haskell-tools.nvim/4.0.0-1"
}
}
repository = {
["haskell-tools.nvim"] = {
["4.0.0-1"] = {
{
arch = "installed",
commands = {},
dependencies = {},
modules = {
["haskell-tools.commands"] = "haskell-tools/commands.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"
}
}
}
}
}

View File

@ -0,0 +1,40 @@
local git_ref = '4.0.0'
local modrev = '4.0.0'
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-' .. '4.0.0',
}
if modrev == 'scm' or modrev == 'dev' then
source = {
url = repo_url:gsub('https', 'git')
}
end
build = {
type = 'builtin',
copy_directories = { 'doc', 'ftplugin' } ,
}

View File

@ -0,0 +1,223 @@
local HtCommands = {}
local ht = require('haskell-tools')
---@class haskell-tools.Subcommand
---
---The command implementation
---@field impl fun(args: string[], opts: vim.api.keyset.user_command)
---
---Command completions callback, taking the lead of the subcommand's arguments
---Or a list of subcommands
---@field complete? string[] | fun(subcmd_arg_lead: string): string[]
---
---Whether this command supports a bang!
---@field bang? boolean
---@param arg_lead string
local function complete_haskell_files(arg_lead)
vim.print(arg_lead)
return vim
.iter(vim.list_extend(vim.fn.getcompletion(arg_lead, 'file'), vim.fn.getcompletion(arg_lead, 'buffer')))
:filter(function(file_path)
local ext = vim.fn.fnamemodify(file_path, ':e')
return ext == 'hs' or ext == ''
end)
:totable()
end
---@param args? string[]
---@return string?
local function get_single_opt_arg(args)
if type(args) ~= 'table' then
return
end
if #args > 1 then
require('haskell-tools.log.internal').warn { 'Too many arguments!', args }
end
return #args > 0 and args[1] or nil
end
---@param args? string[]
---@return string
local function get_filepath_arg(args)
if not args or #args == 0 then
return vim.api.nvim_buf_get_name(0)
end
vim.validate('filepath', args[1], 'string')
local filepath = vim.fn.expand(args[1])
---@cast filepath string
return filepath
end
---@type table<string, haskell-tools.Subcommand>
local command_tbl = {
packageYaml = {
impl = function()
ht.project.open_package_yaml()
end,
},
packageCabal = {
impl = function()
ht.project.open_package_cabal()
end,
},
projectFile = {
impl = function()
ht.project.open_project_file()
end,
},
}
---@param name string The name of the subcommand
---@param subcmd_tbl table<string, haskell-tools.Subcommand> The subcommand's subcommand table
local function register_subcommand_tbl(name, subcmd_tbl)
command_tbl[name] = {
impl = function(args, ...)
local subcmd = subcmd_tbl[table.remove(args, 1)]
subcmd.impl(args, ...)
end,
complete = function(subcmd_arg_lead)
local subcmd, next_arg_lead = subcmd_arg_lead:match('^(%S+)%s(.*)$')
if subcmd and next_arg_lead and subcmd_tbl[subcmd] and subcmd_tbl[subcmd].complete then
return subcmd_tbl[subcmd].complete(next_arg_lead)
end
if subcmd_arg_lead and subcmd_arg_lead ~= '' then
return vim
.iter(subcmd_tbl)
---@param subcmd_name string
:filter(function(subcmd_name)
return subcmd_name:find(subcmd_arg_lead) ~= nil
end)
:totable()
end
return vim.tbl_keys(subcmd_tbl)
end,
}
end
---@type table<string, haskell-tools.Subcommand>
local repl_subcommands = {
toggle = {
impl = function(args)
local filepath = get_filepath_arg(args)
ht.repl.toggle(filepath)
end,
complete = complete_haskell_files,
},
load = {
impl = function(args)
local filepath = get_filepath_arg(args)
ht.repl.load_file(filepath)
end,
complete = complete_haskell_files,
},
quit = {
impl = ht.repl.quit,
},
reload = {
impl = ht.repl.reload,
},
paste_type = {
impl = function(args)
local reg = get_single_opt_arg(args)
ht.repl.paste_type(reg)
end,
},
cword_type = {
impl = ht.repl.cword_type,
},
paste_info = {
impl = function(args)
local reg = get_single_opt_arg(args)
ht.repl.paste_info(reg)
end,
},
cword_info = {
impl = ht.repl.cword_info,
},
}
-- TODO: Smarter completions. load, quit and reload should only be suggested when a repl is active
register_subcommand_tbl('repl', repl_subcommands)
local log_command_tbl = {
openHlsLog = {
impl = function()
ht.log.nvim_open_hls_logfile()
end,
},
openLog = {
impl = function()
require('haskell-tools').log.nvim_open_logfile()
end,
},
setLevel = {
impl = function(args)
local level = vim.fn.expand(args[1])
---@cast level string
require('haskell-tools').log.set_level(tonumber(level) or level)
end,
complete = function(arg_lead)
local levels = vim.tbl_keys(vim.log.levels)
return vim.tbl_filter(function(command)
return command:find(arg_lead) ~= nil
end, levels)
end,
},
}
register_subcommand_tbl('log', log_command_tbl)
---@generic K, V
---@param predicate fun(V):boolean
---@param tbl table<K, V>
---@return K[]
local function tbl_keys_by_value_filter(predicate, tbl)
local ret = {}
for k, v in pairs(tbl) do
if predicate(v) then
ret[k] = v
end
end
return vim.tbl_keys(ret)
end
local function haskell_cmd(opts)
local fargs = opts.fargs
local cmd = fargs[1]
local args = #fargs > 1 and vim.list_slice(fargs, 2, #fargs) or {}
local command = command_tbl[cmd]
if not command then
vim.notify('Haskell: Unknown command: ' .. cmd, vim.log.levels.ERROR)
return
end
command.impl(args, opts)
end
function HtCommands.init()
vim.api.nvim_create_user_command('Haskell', haskell_cmd, {
nargs = '+',
desc = 'haskell-tools.nvim commands',
complete = function(arg_lead, cmdline, _)
local commands = cmdline:match("^['<,'>]*Haskell!") ~= nil
-- bang!
and tbl_keys_by_value_filter(function(command)
return command.bang == true
end, command_tbl)
or vim.tbl_keys(command_tbl)
local subcmd, subcmd_arg_lead = cmdline:match("^['<,'>]*Haskell[!]*%s(%S+)%s(.*)$")
if subcmd and subcmd_arg_lead and command_tbl[subcmd] and command_tbl[subcmd].complete then
return command_tbl[subcmd].complete(subcmd_arg_lead)
end
if cmdline:match("^['<,'>]*Haskell[!]*%s+%w*$") then
return vim.tbl_filter(function(command)
return command:find(arg_lead) ~= nil
end, commands)
end
end,
bang = false, -- might change
})
end
return HtCommands

View File

@ -0,0 +1,13 @@
" 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 cms< fdm< fde<"
setlocal foldmethod=expr foldexpr=getline(v:lnum)=~'^#\\\|^e\\\|^p'?0:getline(v:lnum)!~'^\\t\\\|^\ \\\|^$'?'>1':1
setlocal commentstring=#\ %s
setlocal nospell

View File

@ -0,0 +1,37 @@
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' } ,
}

View File

@ -0,0 +1,90 @@
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",
})

View File

@ -0,0 +1,23 @@
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

View File

@ -0,0 +1,116 @@
rock_manifest = {
doc = {
["luasnip.txt"] = "ab6768dea4b13a6eec600fa0b60b72c9"
},
ftplugin = {
["snippets.vim"] = "f8c461751ad539fc449c15a85bf70be4"
},
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"] = "8425d97d59a85f5681207dac0461618d",
["fs_watchers.lua"] = "b36b9f60988b568602350c41b032f9e6",
["init.lua"] = "d470bc3c7bd4690199cf1c0d214782cf",
["snippet_cache.lua"] = "e2b5cf9a46713fb3f108067100e77e0c",
["types.lua"] = "89e18f0f21c1e77be74c1cbe85757d11",
["util.lua"] = "904465f8563d532168be374ca9203c6f"
},
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"] = "daeb3f35704d8dca029cfffc5fd5f1c4"
}
}

View File

@ -0,0 +1,28 @@
" 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 '^priority.*' contains=snipKeyword,priority
syn match priority '\d\+' contained
syn match multiSnipText '\S\+ \zs.*' contained
syn match snipKeyword '^\%(snippet\|extends\|autosnippet\|priority\)' contained
" normally we'd want a \s in that group, but that doesn't work => cover common
" cases with \t and " ".
syn match snipError '^[^#saep\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

View File

@ -0,0 +1,363 @@
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"
}
}
}
}
}

View File

@ -0,0 +1,51 @@
name: Bug report
description: Report a problem
labels: [bug]
body:
- type: checkboxes
attributes:
label: Contributing guidelines
options:
- label: I have read [CONTRIBUTING.md](https://github.com/echasnovski/mini.nvim/blob/main/CONTRIBUTING.md)
required: true
- label: I have read [CODE_OF_CONDUCT.md](https://github.com/echasnovski/mini.nvim/blob/main/CODE_OF_CONDUCT.md)
required: true
- label: I have updated 'mini.nvim' to latest version
required: true
- type: input
attributes:
label: "Module(s)"
description: "List one or several modules this bug is coming from"
validations:
required: true
- type: textarea
attributes:
label: "Description"
description: "A short description of a problem"
validations:
required: true
- type: input
attributes:
label: "Neovim version"
description: "Something like `0.5`, `0.5.1`, Neovim nightly (please, include latest commit)"
validations:
required: true
- type: textarea
attributes:
label: "Steps to reproduce"
description: "Steps to reproduce using as minimal config as possible"
value: |
1. `nvim -nu minimal.lua`
2. ...
validations:
required: true
- type: textarea
attributes:
label: "Expected behavior"
description: "A description of behavior you expected"
- type: textarea
attributes:
label: "Actual behavior"
description: "A description of behavior you observed (feel free to include images, gifs, etc.)"
validations:
required: true

View File

@ -0,0 +1 @@
blank_issues_enabled: true

View File

@ -0,0 +1,24 @@
name: Feature request
description: Describe a feature you want to see
labels: [feature-request]
body:
- type: checkboxes
attributes:
label: Contributing guidelines
options:
- label: I have read [CONTRIBUTING.md](https://github.com/echasnovski/mini.nvim/blob/main/CONTRIBUTING.md)
required: true
- label: I have read [CODE_OF_CONDUCT.md](https://github.com/echasnovski/mini.nvim/blob/main/CODE_OF_CONDUCT.md)
required: true
- type: input
attributes:
label: "Module(s)"
description: "List one or several modules this feature is related to"
validations:
required: true
- type: textarea
attributes:
label: "Description"
description: "A concise and justified description of a feature"
validations:
required: true

View File

@ -0,0 +1,2 @@
- [ ] I have read [CONTRIBUTING.md](https://github.com/echasnovski/mini.nvim/blob/main/CONTRIBUTING.md)
- [ ] I have read [CODE_OF_CONDUCT.md](https://github.com/echasnovski/mini.nvim/blob/main/CODE_OF_CONDUCT.md)

View File

@ -0,0 +1,85 @@
name: Linting and style checking
on:
push:
branches-ignore: [ sync, stable ]
pull_request:
branches-ignore: [ sync, stable ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }}
cancel-in-progress: true
jobs:
stylua:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: v0.19.0
# CLI arguments
args: --color always --check .
gendoc:
name: Document generation
runs-on: ubuntu-latest
steps:
- name: Install Neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
- uses: actions/checkout@v4
- name: Generate documentation
run: make --silent documentation
- name: Check for changes
run: if [[ -n $(git status -s) ]]; then exit 1; fi
lintcommit:
name: Lint commits
runs-on: ubuntu-latest
env:
LINTCOMMIT_STRICT: true
steps:
- name: Install Neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Lint new commits
run: make --silent lintcommit-ci
case-sensitivity:
name: File case sensitivity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check Case Sensitivity
uses: credfeto/action-case-checker@v1.2.1
checkout:
# Test possibility of checking out and setting up 'mini.nvim' on non-Linux
# This can guard from possible problems:
# - Long file names (particularly from reference screenshots).
name: Test checkout
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup neovim
uses: rhysd/action-setup-vim@v1
with:
# Uses latest stable by default
neovim: true
- name: Test setup
run: make basic_setup

View File

@ -0,0 +1,39 @@
name: Run tests
on:
push:
branches-ignore: [ sync, stable ]
paths: [ 'colors/**', 'lua/**', 'tests/**' ]
pull_request:
branches-ignore: [ sync, stable ]
paths: [ 'colors/**', 'lua/**', 'tests/**' ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }}
cancel-in-progress: true
jobs:
build:
name: Run tests
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
neovim_version: ['v0.8.3', 'v0.9.5', 'v0.10.0', 'nightly']
# include:
# - os: macos-latest
# neovim_version: v0.10.0
# - os: windows-latest
# neovim_version: v0.10.0
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup neovim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: ${{ matrix.neovim_version }}
- name: Run tests
run: make test

View File

@ -0,0 +1,2 @@
doc/tags
dual

View File

@ -0,0 +1,19 @@
repos:
- repo: local
hooks:
- id: stylua
name: StyLua
language: system
entry: stylua
types: [lua]
- id: gendocs
name: Gendocs
language: system
entry: make --silent documentation
types: [lua]
- id: lintcommit
name: LintCommit
language: system
entry: nvim
args: ['--headless', '--noplugin', '-u', 'scripts/lintcommit.lua', '--']
stages: ['commit-msg']

View File

@ -0,0 +1,7 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "Always"
collapse_simple_statement = "Always"

View File

@ -0,0 +1 @@
dual

View File

@ -0,0 +1,682 @@
# Version 0.13.0.9000
- Stop official support of Neovim 0.7.
- Update help files to use code blocks with language annotation, as it results in a better code highlighting. Implies enabled tree-sitter highlighting in 'help' filetype:
- It is default in Neovim>=0.10.
- Tree-sitter parser is built-in in Neovim 0.9.x, needs manual enabling via `vim.treesitter.start()`.
- Has visual regressions on Neovim 0.8.0 and 0.8.1 without enabled tree-sitter (code blocks are highlighted as normal text). Use 0.8.2 or newer.
- Universally prefer 'mini.icons' module over 'nvim-tree/nvim-web-devicons'.
## mini.doc
- BREAKING FEATURE: update `afterlines_to_code()` to result into Lua code block in help file by using `>lua` at the start instead of `>`. NOTE: users need enabled `help` tree-sitter parser (which is default on Neovim>=0.9) for code blocks to have proper highlighting.
## mini.extra
- FEATURE: update `pickers.oldfiles()` to have `current_dir` option which if `true` shows files only from picker's working directory. By @abeldekat, PR #997.
- FEATURE: make `git_hunks`, `list`, and `lsp` pickers show icons. Scopes `document_symbol` and `workspace_symbol` in `lsp` picker show icon based on LSP kind (requires set up 'mini.icons'), others - based on path data.
- BREAKING FEATURE: use "│" as line/position separator instead of ":". This aligns with changes in 'mini.pick' and makes line/position more easily visible.
## mini.hipatterns
- BREAKING FEATURE: update `compute_hex_color_group()` to compute based on combination of `hex_color` and `style`, opposed to just `hex_color`. This allows simultaneous usage of several styles in user's custom highlighters.
## mini.hues
- FEATURE: implement `apply_palette()` (to compliment `make_palette()`) providing a way to tweak applied palette before applying it.
## mini.files
- FEATURE: prefer using 'mini.icons' as icon provider.
## mini.icons
- Introduction of a new module.
## mini.misc
- FEATURE: implement `setup_termbg_sync()` to set up terminal background synchronization (removes possible "frame" around current Neovim instance).
## mini.pick
- FEATURE: prefer using 'mini.icons' as icon provider.
- BREAKING: encoding line or position in string items has changed:
- Use "\0" (null character; use "\000" form if it is in a string before digit) instead of ":" as delimiter. This makes it work with files similar to ":" position encoding (like "time_12:34:56"). This only matters for custom sources which provide line or position in string items.
- Update `default_show()` to display "│" character instead of "\0" in item's string representation (previously was ":"). In particular, this changes how line/position is displayed in `grep` and `grep_live` built-in pickers. This change was done because "│" is more visible as separator.
## mini.starter
- BREAKING: change filetype of Starter buffer from 'starter' to 'ministarter'. This is a more robust value and more aligned with other modules.
## mini.statusline
- BREAKING FEATURE: update `section_fileinfo()` to show non-empty filetype even in not normal buffers (like plugin's scratch buffers, help, quickfix, etc.). Previously it showed nothing, which was a mistake as filetype can be a valuable information.
- FEATURE: prefer using 'mini.icons' as icon provider for `section_fileinfo()`.
## mini.surround
- BREAKING FEATURE: adding surrounding in linewise mode now also ignores trailing whitespace on the last line (same as it ignores indent on the first line).
## mini.tabline
- FEATURE: prefer using 'mini.icons' as icon provider.
# Version 0.13.0
## mini.comment
- BREAKING FEATURE: blank lines are now completely ignored when deciding the toggling action. In practice this means that if target block consists only from commented and/or blank lines, it will be uncommented rather than commented.
- BREAKING: Whitespace in comment parts is now treated more explicitly. In particular:
- Default `options.pad_comment_parts = true` now more explicitly means that any value of 'commentstring' is transformed so that comment parts have exactly single space inner padding.
Example: any `/*%s*/`, ` /* %s */ `, or `/* %s */` is equivalent to having `/* %s */`.
- Detection of whether consecutive lines are commented or not does not depend on whitespace in comment parts. Uncommenting is first attempted with exact comment parts and falls back on trying its trimmed parts.
Example of toggling comment on single line with `/* %s */` 'commentstring' value:
- `/* this is commented */` -> `this is commented`.
- `/*this is also commented */` -> `this is also commented ` (notice trailing space).
- Commenting blank lines is done with trimmed comments parts, while uncommenting explicitly results into empty lines.
- FEATURE: Support dot-repeat after initial commenting is done for visual selection; repeating is done for same relative range.
## mini.deps
- FEATURE: add `MiniDepsMsgBreaking` highlight group for messages indicating a breaking change in a conventional commit style.
## mini.diff
- Introduction of a new module.
## mini.files
- FEATURE: add new `MiniFilesExplorerOpen` and `MiniFilesExplorerClose` events.
## mini.git
- Introduction of a new module.
## mini.hues
- BREAKING FEATURE: update some highlight groups for better usability:
- `DiffChange` and `DiffText` - make changed diff lines have colored background.
- `Folded` - make folds differ from `CursorLine`.
- `QuickFixLine` - make current quickfix item differ from `CursorLine`.
## mini.map
- FEATURE: add `gen_integration.diff()` which highlights general diff hunks from 'mini.diff'.
## mini.pick
- BREAKING: stop trying to parse path for special format ("path:row" and "path:row:col") if supplied inside a table item. This made impossible working with paths containing ":".
- FEATURE: respect general URI format for paths inside table items.
- Update `builtin.files()` to use table items when string item might be ambiguous.
## mini.starter
- Explicitly block all events in `open()` during startup for a better performance.
## mini.statusline
- BREAKING: `section_diagnostics()` now depends only on defined diagnostic. This means:
- Something is shown **only** if there is any diagnostic actually present in the buffer. No diagnostic entries - nothing is shown.
Previously it did not show if there was no LSP servers attached (as initially diagnostics came only from LSP) or buffer was not normal.
- Fallback icon is "Diag" instead of "LSP".
- FEATURE: `section_diagnostics()` now supports `signs` table option to customize signs for severity levels.
- BREAKING FEATURE: `section_git()` now prefers using data from 'mini.git' with fallback on pure HEAD data from 'lewis6991/gistigns.nvim'.
- FEATURE: add `section_diff()` to show data from 'mini.diff' with fallback on diff data from 'lewis6991/gistigns.nvim'.
- FEATURE: add `section_lsp()` to show indicator of LSP servers attached to the buffer.
- BREAKING FEATURE: update default active content:
- Add `section_diff()` (shows diff data near  icon) following refactor of `section_git()`.
- Add `section_lsp()` (shows number of attached LSP servers near 󰰎 icon) following refactor of `section_diagnostics()`.
## mini.tabline
- FEATURE: Implement `config.format` for custom label formatting.
## mini.test
- BREAKING FEATURE: child process is now created with extra `--headless --cmd "set lines=24 columns=80"` arguments making it headless but still reasonably similar to fully functioning Neovim during interactive usage. This change should generally not break a lot of things, while enabling a faster and more robust test execution.
# Version 0.12.0
## mini.basics
- BREAKING: Remove `<C-z>` mapping, as it is more useful in most terminal emulators for suspending Neovim process (to later resume with `fg` command). To correct latest misspelled word, use mappings like this:
```lua
vim.keymap.set('n', '<C-z>', '[s1z=', { desc = 'Correct latest misspelled word' })
vim.keymap.set('i', '<C-z>', '<C-g>u<Esc>[s1z=`]a<C-g>u', { desc = 'Correct latest misspelled word' })
```
- FEATURE: Add `tab:> ` to 'listchars' option when `options.extra_ui` is set. This prevents showing `^I` instead of a tab and actual value comes from Neovim's default.
- FEATURE: Set `termguicolors` only on Neovim<0.10, as later versions should have it on by default (if terminal emulator supports it).
## mini.comment
- FEATURE: Hooks are now called with data about commenting action.
## mini.deps
Introduction of a new module.
## mini.doc
- BREAKING: Stop using `:echo` to display messages and warnings in favor of `vim.notify()`.
- BREAKING: Update default `write_post` hook to not display current time in success message.
- Update to include space before `~` in generated section headings.
## mini.files
- FEATURE: Update `go_in()` to have `close_on_file` option.
- Show warning if action is set to override existing path.
## mini.hues
- BREAKING FEATURE: Update verbatim text (`@text.literal` and `@markup.raw`) color to be distinctive instead of dimmed.
- FEATURE: Add support for new standard tree-sitter captures on Neovim>=0.10 (see https://github.com/neovim/neovim/pull/27067).
## mini.misc
- Update `bench_time()` to use `vim.loop.hrtime()` (as better designed for benchmarking) instead of `vim.loop.gettimeofday()`.
## mini.notify
Introduction of a new module.
## mini.pick
- FEATURE: Implement `window.prompt_cursor` and `window.prompt_prefix` config options.
- FEATURE: Update `builtin.help()` to use tree-sitter highlighting (if there is any).
## mini.sessions
- FEATURE: Update `read()` to first `write()` current session (if there is any).
## mini.starter
- FEATURE: Add `sections.pick()` with 'mini.pick' pickers.
## mini.statusline
- BREAKING FEATURE: Add `search_count` section to default active content.
## mini.visits
Introduction of a new module.
# Version 0.11.0
## mini.base16
- BREAKING: Stop supporting deprecated 'HiPhish/nvim-ts-rainbow2'.
## mini.bufremove
- BREAKING FEATURE: Applying `delete()` and `wipeout()` without `force` in a modified buffer now asks for confirmation instead of declining and showing message.
## mini.clue
- FEATURE: `config.window.config` now can be callable returning window config.
## mini.comment
- FEATURE: Implement `config.mappings.comment_visual` to configure mapped keys in Visual mode.
## mini.completion
- FEATURE: Start adding `C` flag to `shortmess` option on Neovim>=0.9. By @yamin-shihab, PR #554.
## mini.extra
Introduction of a new module.
## mini.files
- BREAKING: Opening file which is present in unlisted buffer now makes the buffer listed.
- BREAKING: Highlight in preview now is not enabled if file is sufficiently large.
- FEATURE: Explorer now tracks if focus is lost and properly closes on detection.
- FEATURE: Implement `MiniFilesCursorLine` highlight group.
## mini.hipatterns
- FEATURE: Allow `pattern` in highlighter definitions to be an array to highlight several patterns under the same highlighter name.
- FEATURE: Implement `extmark_opts` in highlighter definitions for a more control over extmarks placed at matches.
- BREAKING: Field `priority` in highlighter definitions is soft deprecated in favor of `extmark_opts = { priority = <value> }`.
- FEATURE: Update `compute_hex_color_group()` to allow `style = 'fg'`.
- FEATURE: Update `gen_highlighter.hex_color()` to allow `style = 'inline'` (requires Neovim>=0.10 with support of inline extmarks).
- FEATURE: Implement `get_matches()` to get buffer matches.
## mini.hues
- BREAKING: Stop supporting deprecated 'HiPhish/nvim-ts-rainbow2'.
## mini.map
- FEATURE: Implement `config.window.zindex` to configure z-index of map window.
## mini.misc
- FEATURE: `setup_auto_root()` and `find_root()` now have `fallback` argument to be applied when no root is found with `vim.fn.find()`.
## mini.pick
Introduction of a new module.
## mini.starter
- FEATURE: `show_path` in `sections.recent_files()` can now be callable for more control on how full path is displayed.
## mini.test
- BREAKING: Error in any "pre" hook now leads to test case not being executed (with note).
- BREAKING FEATURE: `child.get_screenshot()` now by default calls `:redraw` prior to computing screenshot. Can be disabled by new `opts.redraw` argument.
- FEATURE: New method `child.lua_func()` can execute simple functions inside child process and return the result (stasjok, #437).
- FEATURE: `expect.reference_screenshot()` now has `ignore_lines` option allowing to ignore specified lines during screenshot compare.
# Version 0.10.0
## mini.ai
- FEATURE: Allow `vis_mode` field in custom texobject region to force Visual mode with which textobject is selected.
## mini.animate
- FEATURE: Add `MiniAnimateNormalFloat` highlight group to tweak highlighting of `open` and `close` animations.
## mini.base16
- FEATURE: Add 'HiPhish/rainbow-delimiters.nvim' integration.
## mini.basics
- BREAKING: Remove `<C-w>` mapping in Terminal mode, as it is more useful inside terminal emulator itself.
## mini.bracketed
- FEATURE: Add `add_to_jumplist` option to relevant targets (which move cursor and don't already add to jumplist).
## mini.bufremove
- BREAKING: Create normal buffer instead of scratch when there is no reasonable target to focus (#394).
## mini.clue
Introduction of a new module.
## mini.files
Introduction of a new module.
## mini.hues
- FEATURE: Add 'HiPhish/rainbow-delimiters.nvim' integration.
## mini.jump2d
- FEATURE: Add `gen_union_spotter()` to allow combining separate spotters into one.
## mini.operators
Introduction of a new module.
## mini.pairs
- FEATURE: Allow `false` in `config.mappings` to not map the key.
## mini.surround
- FEATURE: Update `add` (`sa`) with ability to replicate left and right parts by respecting `[count]`. In Normal mode two kinds of `[count]` is respected: one for operator (replicates left and right parts) and one for textobject/motion. In Visual mode `[count]` replicates parts.
# Version 0.9.0
- Stop official support of Neovim 0.6.
- Use Lua API to create autocommands. Stop exporting functions only related to autocommands.
- Use Lua API to create default highlight groups.
- Use `vim.keymap` to deal with mappings. Stop exporting functions only related to mappings.
- Add 'randomhue' color scheme.
## mini.base16
- FEATURE: Add new integrations:
- Lsp semantic tokens.
- 'folke/lazy.nvim'.
- 'folke/noice.nvim'.
- 'kevinhwang91/nvim-ufo'.
- BREAKING FEATURE: Stop supporting archived 'p00f/nvim-ts-rainbow' in favor of 'HiPhish/nvim-ts-rainbow2'.
## mini.basics
- Add dot-repeat support for adding empty lines (`go` and `gO` mappings).
## mini.colors
Introduction of a new module.
## mini.comment
- FEATURE: Use tree-sitter information about locally active language to infer 'commentstring' option value.
- FEATURE: Add `options.custom_commentstring` option for a more granular customization of comment structure.
- FEATURE: Add `get_commentstring()` function representing built-in logic of computing relevant 'commentstring'.
## mini.hipatterns
Introduction of a new module.
## mini.hues
Introduction of a new module.
# Version 0.8.0
- Add and implement design principle for silencing module by setting `config.silent = true`. It is now present in modules capable of showing non-error feedback:
- mini.ai
- mini.align
- mini.basics
- mini.bufremove
- mini.doc
- mini.jump
- mini.jump2d
- mini.starter
- mini.surround
- mini.test
## mini.bracketed
Introduction of a new module.
## mini.comment
- FEATURE: Add `options.start_of_line` option which controls whether to recognize as comment only lines without indent.
- FEATURE: Add `options.ignore_blank_line` option which controls whether to ignore blank lines.
- FEATURE: Add `options.pad_comment_parts` option which controls whether to ensure single space pad for comment leaders.
## mini.doc
- FEATURE: Add `config.hooks.write_pre` hook to be executed before writing to a file.
## mini.indentscope
- FEATURE: Add `MiniIndentscopeSymbolOff` highlight group to be used if scope's indent is not multiple of 'shiftwidth'.
- FEATURE: Add `draw.priority` option to control priority of scope line draw.
## mini.jump2d
- FEATURE: Add `view.n_steps_ahead` option which controls how many steps ahead to show. Appearance is controlled by new `MiniJump2dSpotAhead` highlight group.
- FEATURE: Add `view.dim` option which controls whether to dim lines with at least one jump spot. Appearance is controlled by new `MiniJump2dDim` highlight group.
- FEATURE: Add `MiniJump2dSpotUnique` highlight group to be used for spots with unique label for next step.
## mini.pairs
- FEATURE: Both `MiniPairs.br()` and `MiniPairs.cr()` can now take a key which will be used instead of default `<BS>` and `<CR>`.
## mini.sessions
- FEATURE: `setup()` now creates global directory at path `config.directory` if it doesn't exist.
- All actions now keep list of detected sessions up to date.
## mini.splitjoin
Introduction of a new module.
## mini.surround
- FEATURE: Add `respect_selection_type` option which, when enabled, makes adding and deleting surrounding respect selection type:
- Linewise adding places surrounding parts on separate lines while indenting surrounded lines once.
- Deleting surrounding which looks like a result of linewise adding will act to revert it: delete lines with surrounding parts and dedent surrounded lines once.
- Blockwise adding places surrounding parts on whole edges, not only start and end of selection.
# Version 0.7.0
- Start dual distribution. Every module is now distributed both as part of 'mini.nvim' library and as standalone plugin (in separate git repository).
## mini.ai
- BREAKING FEATURE: In `MiniAi.gen_spec.argument()` option `separators` (plural; array of characters) is soft deprecated in favor of `separator` (singular; Lua pattern) option.
## mini.animate
Introduction of new module.
## mini.basics
Introduction of a new module.
## mini.completion
- BREAKING: `MiniCompletion.config.window_dimensions` is renamed to `MiniCompletion.config.window` to be able to handle more general configuration.
- FEATURE: Add `MiniCompletion.config.window.info.border` and `MiniCompletion.config.window.signature.border` which can be used to define border of info and signature floating windows respectively.
## mini.indentscope
- BREAKING: `MiniIndentscopePrefix` is now not used (deprecated). It was initially introduced as a way to properly show scope indicator on empty lines. It had a drawback of overshadowing 'listchars' symbols (see #125) and vertical guides from 'lukas-reineke/indent-blankline.nvim'. As the other implementation approach was found by @mivort (see #161), `MiniIndentscopePrefix` is no longer needed and no overshadowing is done.
- BREAKING: `MiniIndentscope.gen_animation` is now a table (for consistency with other `gen_*` functions in 'mini.nvim'). See "Migrate from function type" section of `:h MiniIndentscope.gen_animation`. Calling it as function will be available until next release.
## mini.misc
- FEATURE: Add `MiniMisc.setup_auto_root()` and `MiniMisc.find_root()` for root finding functionality. NOTE: requires Neovim>=0.8.
- FEATURE: Add `MiniMisc.setup_restore_cursor()` for automatically restoring latest cursor position on file reopen. By @cryptomilk, PR #198.
## mini.move
Introduction of new module.
# Version 0.6.0
- Stop official support of Neovim 0.5.
- Make all messages use colors and not cause hit-enter-prompt.
## mini.align
Introduction of new module.
## mini.base16
- FEATURE: Add support for many plugin integrations.
- FEATURE: Implement `MiniBase16.config.plugins` for configuring plugin integrations.
- BREAKING: Change some 'mini.nvim' highlights:
- `MiniCompletionActiveParameter` now highlights with background instead of underline.
- `MiniJump2dSpot` now explicitly defined to use plugin's palette.
- `MiniStarterItemPrefix` and `MiniStarterQuery` are now bold for better visibility.
- BREAKING: Update highlight for changed git diff to be more visible and to comply more with general guidelines.
## mini.jump
- BREAKING: Allow cursor to be positioned past the end of previous/current line (#113).
## mini.map
Introduction of new module.
## mini.starter
- Item evaluation is now prepended with query reset, as it is rarely needed any more (#105).
- All hooks are now called with `(content, buf_id)` signature allowing them properly use current window layout.
## mini.surround
- BREAKING FEATURE: update 'mini.surround' to share as much with 'mini.ai' as possible. This provides more integrated experience while enabling more useful features. Details:
- Custom surrounding specification for input action has changed. Instead of `{ find = <string>, extract = <string> }` it is now `{ <function or composed pattern> }`. Previous format will work until the next release. See more in help file.
- Algorithm for finding surrounding is now more powerful. It allows searching for more complex surroundings (via composed patterns or array of region pairs) and respects `v:count`.
- Multiline input and output surroundings are now supported.
- Opening brackets (`(`, `[`, `{`, `<`) now include whitespace in surrounding: input surrounding selects all inner edge whitespace, output surrounding is padded with single space.
- Surrounding identifier `i` ("interactive") is soft deprecated in favor of `?` ("user prompt").
- New surrounding aliases:
- `b` for "brackets". Input - any of balanced `()`, `[]` `{}`. Output - `()`.
- `q` for "quotes". Input - any of `"`, `'`, `` ` ``. Output - `""`.
- Three new search methods `'prev'`, `'next'`, and `'nearest'` for finding non-covering previous and next surrounding.
- BREAKING FEATURE: Implement "last"/"next" extended mappings which force `'prev'` or `'next'` search method. Controlled with `config.mappings.suffix_last` and `config.mappings.suffix_next`respectively. This also means that custom surroundings with identifier equal to "last"/"next" mappings suffixes (defaults to 'l' and 'n') will work only with long enough delay after typing action mapping.
- FEATURE: Implement `MiniSurround.gen_spec` with generators of common surrounding specifications (like `MiniSurround.gen_spec.input.treesitter` for tree-sitter based input surrounding).
# Version 0.5.0
- Update all tests to use new 'mini.test' module.
- FEATURE: Implement buffer local configuration. This is done with `vim.b.mini*_config` buffer variables.
- Add new `minicyan` color scheme.
## mini.ai
Introduction of new module.
## mini.comment
- FEATURE: Now hooks can be used to terminate further actions by returning `false` (#108).
## mini.indentscope
- BREAKING: Soft deprecate `vim.b.miniindentscope_options` in favor of using `options` field of `miniindentscope_config`.
## mini.sessions
- FEATURE: Hooks are now called with active session data as argument.
## mini.starter
- FEATURE: Now it is possible to open multiple Starter buffers at the same time (#82). This comes with several changes which won't affect most users:
- BREAKING: `MiniStarter.content` is deprecated. Use `MiniStarter.get_content()`.
- All functions dealing with Starter buffer now have `buf_id` as argument (no breaking behavior).
## mini.statusline
- FEATURE: Implement `config.use_icons` which controls whether to use icons by default.
## mini.test
Introduction of new module.
## mini.trailspace
- FEATURE: Implement `MiniTrailspace.trim_last_lines()`.
# Version 0.4.0
- Update all modules to supply mapping description for Neovim>=0.7.
- Add new module 'mini.jump2d'.
- Cover all modules with extensive tests.
## mini.comment
- FEATURE: Implement `config.hooks` with `pre` and `post` hooks (executed before and after successful commenting). Fixes #50, #59.
## mini.completion
- Implement support for `additionalTextEdits` (issue #61).
## mini.jump
- FEATURE: Implement idle timeout to stop jumping automatically (@annenpolka, #56).
- FEATURE: Implement `MiniJump.state`: table with useful model-related information.
- BREAKING: Soft deprecate `config.highlight_delay` in favor of `config.delay.highlight`.
- Update process of querying target symbol: show help message after delay, allow `<C-c>` to stop selecting target.
## mini.jump2d
Introduction of new module.
## mini.pairs
- Create mappings for `<BS>` and `<CR>` in certain mode only after some pair is registered in that mode.
## mini.sessions
- FEATURE: Implement `MiniSessions.select()` to select session interactively and perform action on it.
- FEATURE: Implement `config.hooks` to execute hook functions before and after successful action.
- BREAKING: All feedback about incorrect behavior is now an error instead of message notifications.
## mini.starter
- Allow `config.header` and `config.footer` be any value, which will be converted to string via `tostring()`.
- Update query logic to not allow queries which result into no items.
- Add `<C-n>` and `<C-p>` to default mappings.
## mini.statusline
- BREAKING: change default icon for `MiniStatusline.section_diagnostics()` from ﯭ to  due to former having issues in some terminal emulators.
## mini.surround
- FEATURE: Implement `config.search_method`.
- FEATURE: Implement custom surroundings via `config.custom_surroundings`.
- FEATURE: Implement `MiniSurround.user_input()`.
- BREAKING: Deprecate `config.funname_pattern` option in favor of manually modifying `f` surrounding.
- BREAKING: Always move cursor to the right of left surrounding in `add()`, `delete()`, and `replace()` (instead of moving only if it was on the same line as left surrounding).
- Update process of getting user input: allow `<C-c>` to cancel and make empty string a valid input.
## mini.tabline
- FEATURE: Implement `config.tabpage_section`.
- BREAKING: Show listed buffers also in case of multiple tabpages (instead of using builtin behavior).
- Show quickfix/loclist buffers with special `*quickfix*` label.
# Version 0.3.0
- Update all modules to have annotations formatted for 'mini.doc'.
## mini.cursorword
- Current word under cursor now can be highlighted differently.
## mini.doc
Introduction of new module.
## mini.indentscope
Introduction of new module.
## mini.starter
- Implement `MiniStarter.set_query()` and make `<Esc>` mapping for resetting query.
# Version 0.2.0
## mini.base16
- Use new `Diagnostic*` highlight groups in Neovim 0.6.0.
## mini.comment
- Respect tab indentation (#20).
## mini.jump
Introduction of new module.
## mini.pairs
- Implement pair registration with custom mapping functions. More detailed:
- Implement `MiniPairs.map()`, `MiniPairs.map_buf()`, `MiniPairs.unmap()`, `MiniPairs.unmap_buf()` to (un)make mappings for pairs which automatically register them for `<BS>` and `<CR>`. Note, that this has a minor break of previous behavior: now `MiniPairs.bs()` and `MiniPairs.cr()` don't have any input argument. But default behavior didn't change.
- Allow setting global pair mappings inside `config` of `MiniPairs.setup()`.
## mini.sessions
Introduction of new module.
## mini.starter
Introduction of new module.
## mini.statusline
- Implement new section `MiniStatusline.section_searchcount()`.
- Update `section_diagnostics` to use `vim.diagnostic` in Neovim 0.6.0.
# Version 0.1.0
- Initial stable version.

View File

@ -0,0 +1,132 @@
# Contributor Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
`evgeni <dot> chasnovski |at| gmail >dot< com` .
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations

View File

@ -0,0 +1,282 @@
# Contributing
Thank you for your willingness to contribute to 'mini.nvim'. It means a lot!
You can make contributions in the following ways:
- **Mention it** somehow to help reach broader audience. This helps a lot.
- **Create a GitHub issue**. It can be one of the following types:
- **Bug report**. Describe your actions in a reproducible way along with their effect and what you expected should happen. Before making one, please make your best efforts to make sure that it is not an intended behavior (not described in documentation as such).
- **Feature request**. A concise and justified description of what one or several modules should be able to do. Before making one, please make your best efforts to make sure that it is not a feature that won't get implemented (these should be described in documentation; for example: block comments in 'mini.comment').
- **Create a pull request (PR)**. It can be one of the following types:
- **Code related**. For example, fix a bug or implement a feature. **Before even starting one, please make sure that it is aligned with project vision and goals**. The best way to do so is to receive positive feedback from maintainer on your initiative in one of the GitHub issues (existing or created by you). Please, make sure to regenerate latest help file and that all tests pass (see later sections).
- **Documentation related**. For example, fix typo/wording in 'README.md', code comments or annotations (which are used to generate Neovim documentation; see later section). Feel free to make these without creating a GitHub issue.
- **Add plugin integration to 'mini.base16' and 'mini.hues' modules**.
- **Add explicit support to other colorschemes**. Every 'mini.nvim' module supports any colorscheme right out of the box. This is done by making most highlight groups be linked to a semantically similar builtin highlight group. Other groups are hard-coded based on personal preference. However, these choices might be out of tune with a particular colorscheme. Updating as many colorschemes as possible to have explicit 'mini.nvim' support is highly appreciated. For your convenience, there is a list of all highlight groups in later section of this file.
- **Participate in [discussions](https://github.com/echasnovski/mini.nvim/discussions)**.
All well-intentioned, polite, and respectful contributions are always welcome! Thanks for reading this!
## Commit messages
- Try to make commit message as concise as possible while giving enough information about nature of a change. Think about whether it will be easy to understand in one year time when browsing through commit history.
- Single commit should change either zero or one module, or affect all modules (i.e. enforcing some universal rule but not necessarily change files). Changes for two or more modules should be split in several module-specific commits.
- Use [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) style:
- Messages should have the following structure:
```
<type>[optional scope][!]: <description>
<empty line>
[optional body]
<empty line>
[optional footer(s)]
```
- `<type>` is **mandatory** and can be one of:
- `ci` - change in how automation (GitHub actions, dual distribution scripts, etc.) is done.
- `docs` - change in user facing documentation (help, README, CONTRIBUTING, etc.).
- `feat` - adding new user facing feature.
- `fix` - resolving user facing issue.
- `refactor` - change in code or documentation that should not affect users.
- `style` - change in convention of how something should be done (formatting, wording, etc.) and its effects.
- `test` - change in tests.
For temporary commits which later should be squashed (when working on PR, for example), use `fixup` type.
- `[optional scope]`, if present, should be done in parenthesis `()`. If commit changes single module (as it usually should), using scope with module name is **mandatory**. If commit enforces something for all modules, use `ALL` scope.
- Breaking change, if present, should be expressed with `!` before `:`.
- `<description>` is a change overview in imperative, present tense ("change" not "changed" nor "changes"). Should result into first line under 72 characters. Should start with not capitalized word and NOT end with sentence ending punctuation (i.e. one of `.,?!;`).
- `[optional body]`, if present, should contain details and motivation about the change in plain language. Should be formatted to have maximum 80 characters in line.
- `[optional footer(s)]`, if present, should be instruction(s) to Git or Github. Use "Resolve #xxx" on separate line if this commit resolves issue or PR.
- Use module's function and field names without module's name. Like `add()` and not `MiniSurround.add()`.
Examples:
```
feat(deps): add folds in update confirmation buffer
```
```
fix(jump): make operator not delete one character if target is not found
One main goal is to do that in a dot-repeatable way, because this is very
likely to be repeated after an unfortunate first try.
Resolve #688
```
```
refactor(bracketed): do not source 'vim.treesitter' on `require()`
Although less explicit, this considerably reduces startup footprint of
'mini.bracketed' in isolation.
```
```
feat(hues)!: update verbatim text to be distinctive
```
```
test(ALL): update screenshots to work on Nightly
```
### Automated commit linting
- To lint messages of already done commits, execute `scripts/lintcommit-ci.sh <git-log-range>`. For example, to lint currently latest commit use `scripts/lintcommit-ci.sh HEAD~..HEAD`.
- To lint commit message before doing commit, install [`pre-commit`](https://pre-commit.com/#install) and enable it with `pre-commit install --hook-type commit-msg` (from the root directory). NOTE: requires `nvim` executable. If it throws (usually descriptive) error - recommit with proper message.
## Generating help file
If your contribution updates annotations used to generate help file, please regenerate it. You can make this with one of the following (assuming current directory being project root):
- From command line execute `make documentation`.
- Inside Neovim instance run `:luafile scripts/minidoc.lua` or `:lua require('mini.doc').generate()`.
## Testing
If your contribution updates code and you use Linux (not Windows or MacOS), please make sure that it doesn't break existing tests. If it adds new functionality or fixes a recognized bug, add new test case(s). There are two ways of running tests:
- From command line:
- Execute `make test` to run all tests (with `nvim` as executable).
- Execute `FILE=tests/test_xxx.lua make test_file` to run tests only from file `tests/test_xxx.lua` (with `nvim` as executable).
- If you have multiple Neovim executables (say, `nvim_07`, `nvim_08`, `nvim_09`, `nvim_010`), you can use `NVIM_EXEC` variable to tests against multiple versions like this:
`NVIM_EXEC="nvim_07 nvim_08 nvim_09 nvim_010" make test` or `NVIM_EXEC="nvim_07 nvim_08 nvim_09 nvim_010" FILE=tests/test_xxx.lua make test_file`.
- Inside Neovim instance execute `:lua require('mini.test').setup(); MiniTest.run()` to run all tests or `:lua require('mini.test').setup(); MiniTest.run_file()` to run tests only from current buffer.
This plugin uses 'mini.test' to manage its tests. For a more hands-on introduction, see [TESTING.md](TESTING.md).
**Notes**:
- If you have Windows or MacOS and want to contribute code related change, make your best effort to not break existing behavior. It will later be tested automatically after making Pull Request. The reason for this distinction is that tests are not well designed to be run on those operating systems.
- If new functionality relies on an external dependency (`git` CLI tool, LSP server, etc.), use mocking (writing Lua code which emulates dependency usage as close as reasonably possible). For examples, take a look at tests for 'mini.pick', 'mini.completion', and 'mini.statusline'.
- There is a certain number of tests that are flaky (i.e. will sometimes report an error due to other reasons than actual functionality being broke). It is usually the ones which test time related functionality (i.e. that certain action was done after specific amount of delay).
A commonly used way to know if the test is flaky is that it fails on non-nightly Neovim version yet there were no changes to its tested module after it had passed in the past. For example, some 'mini.animate' test is shown to break but there were no changes to it since test passed in CI couple of days before.
In case there is some test breaking which reasonably should not, rerun that test (or the whole file) at least several times.
## Formatting
This project uses [StyLua](https://github.com/JohnnyMorganz/StyLua) version 0.19.0 for formatting Lua code. Before making changes to code, please:
- [Install StyLua](https://github.com/JohnnyMorganz/StyLua#installation). NOTE: use `v0.19.0`.
- Format with it. Currently there are two ways to do this:
- Manually run `stylua .` from the root directory of this project.
- Install [`pre-commit`](https://pre-commit.com/#install) and enable it with `pre-commit install` (from the root directory). This will auto-format relevant code before making commits.
## List of highlight groups
Here is a list of all highlight groups defined inside 'mini.nvim' modules. See documentation in 'doc' directory to find out what they are used for.
- 'mini.animate':
- `MiniAnimateCursor`
- `MiniAnimateNormalFloat`
- 'mini.clue':
- `MiniClueBorder`
- `MiniClueDescGroup`
- `MiniClueDescSingle`
- `MiniClueNextKey`
- `MiniClueNextKeyWithPostkeys`
- `MiniClueSeparator`
- `MiniClueTitle`
- 'mini.completion':
- `MiniCompletionActiveParameter`
- 'mini.cursorword':
- `MiniCursorword`
- `MiniCursorwordCurrent`
- 'mini.deps':
- `MiniDepsChangeAdded`
- `MiniDepsChangeRemoved`
- `MiniDepsHint`
- `MiniDepsInfo`
- `MiniDepsMsgBreaking`
- `MiniDepsPlaceholder`
- `MiniDepsTitle`
- `MiniDepsTitleError`
- `MiniDepsTitleSame`
- `MiniDepsTitleUpdate`
- 'mini.diff':
- `MiniDiffSignAdd`
- `MiniDiffSignChange`
- `MiniDiffSignDelete`
- `MiniDiffOverAdd`
- `MiniDiffOverChange`
- `MiniDiffOverContext`
- `MiniDiffOverDelete`
- 'mini.files':
- `MiniFilesBorder`
- `MiniFilesBorderModified`
- `MiniFilesCursorLine`
- `MiniFilesDirectory`
- `MiniFilesFile`
- `MiniFilesNormal`
- `MiniFilesTitle`
- `MiniFilesTitleFocused`
- 'mini.hipatterns':
- `MiniHipatternsFixme`
- `MiniHipatternsHack`
- `MiniHipatternsNote`
- `MiniHipatternsTodo`
- 'mini.icons':
- `MiniIconsAzure`
- `MiniIconsBlue`
- `MiniIconsCyan`
- `MiniIconsGreen`
- `MiniIconsGrey`
- `MiniIconsOrange`
- `MiniIconsPurple`
- `MiniIconsRed`
- `MiniIconsYellow`
- 'mini.indentscope':
- `MiniIndentscopeSymbol`
- `MiniIndentscopeSymbolOff`
- 'mini.jump':
- `MiniJump`
- 'mini.jump2d':
- `MiniJump2dDim`
- `MiniJump2dSpot`
- `MiniJump2dSpotAhead`
- `MiniJump2dSpotUnique`
- 'mini.map':
- `MiniMapNormal`
- `MiniMapSymbolCount`
- `MiniMapSymbolLine`
- `MiniMapSymbolView`
- 'mini.notify':
- `MiniNotifyBorder`
- `MiniNotifyNormal`
- `MiniNotifyTitle`
- 'mini.operators':
- `MiniOperatorsExchangeFrom`
- 'mini.pick':
- `MiniPickBorder`
- `MiniPickBorderBusy`
- `MiniPickBorderText`
- `MiniPickIconDirectory`
- `MiniPickIconFile`
- `MiniPickHeader`
- `MiniPickMatchCurrent`
- `MiniPickMatchMarked`
- `MiniPickMatchRanges`
- `MiniPickNormal`
- `MiniPickPreviewLine`
- `MiniPickPreviewRegion`
- `MiniPickPrompt`
- 'mini.starter':
- `MiniStarterCurrent`
- `MiniStarterFooter`
- `MiniStarterHeader`
- `MiniStarterInactive`
- `MiniStarterItem`
- `MiniStarterItemBullet`
- `MiniStarterItemPrefix`
- `MiniStarterSection`
- `MiniStarterQuery`
- 'mini.statusline':
- `MiniStatuslineDevinfo`
- `MiniStatuslineFileinfo`
- `MiniStatuslineFilename`
- `MiniStatuslineInactive`
- `MiniStatuslineModeCommand`
- `MiniStatuslineModeInsert`
- `MiniStatuslineModeNormal`
- `MiniStatuslineModeOther`
- `MiniStatuslineModeReplace`
- `MiniStatuslineModeVisual`
- 'mini.surround':
- `MiniSurround`
- 'mini.tabline':
- `MiniTablineCurrent`
- `MiniTablineFill`
- `MiniTablineHidden`
- `MiniTablineModifiedCurrent`
- `MiniTablineModifiedHidden`
- `MiniTablineModifiedVisible`
- `MiniTablineTabpagesection`
- `MiniTablineVisible`
- 'mini.test':
- `MiniTestEmphasis`
- `MiniTestFail`
- `MiniTestPass`
- 'mini.trailspace':
- `MiniTrailspace`

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Evgeni Chasnovski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,188 @@
# Maintaining
This document contains knowledge about specifically maintaining 'mini.nvim'. It assumes general knowledge about how Open Source and GitHub issues/PRs work.
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to generate help files, run tests, and format.
## General advice
- Follow common boilerplate code as much as possible when creating new module, as it makes easier to use "search and replace" in the long term. This includes:
- Documentation at the beginning: describing module, its setup, highlight groups, similar plugins, disabling, `setup()`, and `config`.
- Create and use `H` helper table at the beginning to allow having exported code written before helpers (severely improves readability).
- Structure of `setup()` function with its helper functions: `H.setup_config()`, `H.apply_config()`, `H.create_autocommands()`, `H.create_default_hl()`, `H.create_user_commands()`.
- Use module's `H.get_config()` and `H.is_disabled()` helpers. They both should respect buffer local configuration.
- From time to time some test cases will break on Neovim Nightly. This is usually due to the following reasons:
- There was an intended change in Neovim Nightly to which affected module(s) should adapt. Update module and/or tests.
- There was a change in Neovim Nightly disrupting only tests (usually screenshots due to changed way of how highlight attributes are computed). Update test: ideally so that it passes on all versions, but testing some parts only on Nightly is allowed if needed (usually by regenerating screenshot on Nightly and verifying it only on versions starting from it).
- There was an unintended change in Neovim Nightly which breaks functionality it should not break. Create an issue in ['neovim/neovim' repo](https://github.com/neovim/neovim). If the issue is not resolved for a long-ish time (i.e. more than a week) try to make tests pass and/or adapt the code to new behavior.
## Maintainer setup
Mandatory:
- Have `nvim` executable for latest stable release.
- Install [`git`](https://www.git-scm.com).
- Install [`StyLua`](https://github.com/JohnnyMorganz/StyLua) with version described in [CONTRIBUTING.md](CONTRIBUTING.md).
- Install [`make`](https://www.gnu.org/software/make/).
Recommended:
- Have executables for all supported Neovim versions. For example, `nvim_07`, `nvim_08`, `nvim_09`, `nvim_010`. This is useful for running tests on multiple versions.
- Install [`lua-language-server`](https://github.com/LuaLS/lua-language-server).
- Install [`pre-commit`](https://pre-commit.com/#install) and enable it with `pre-commit install` and `pre-commit install --hook-type commit-msg` (run from repository's root).
- Set up 'mini.doc' and 'mini.test' and make mappings for the following frequently used commands:
- `'<Cmd>lua MiniDoc.generate()<CR>'` - to generate documentation.
- `'<Cmd>lua MiniTest.run_at_location()<CR>'` - to run test under cursor.
- `'<Cmd>lua MiniTest.run_file()<CR>'` - to run current test file.
## Supported Neovim versions
Aim for supporting 4 latest minor Neovim releases: current stable, current Nightly, and two latest stable releases.
For example, if 0.9.x is current stable, then all latest patch versions of 0.7, 0.8, 0.9 should be supported plus Nightly (0.10.0).
NOTE: some modules can have less supported versions during their release **only** if it is absolutely necessary for the core functionality.
## Dual distribution
Modules of 'mini.nvim' are distributed both as part of 'mini.nvim' repository and each one in its standalone repository. All development takes place in 'mini.nvim' while being synced to standalone ones. This is done by having special `sync` branch which points to the latest commit which was synced to standalone repositories.
Usual workflow involves performing these steps after every commit in 'mini.nvim':
- Check out to `main` branch.
- Ensure there are no immediate defects. Usually it means to wait until all CI checks passed.
- Run `make dual_sync`. This should:
- Create 'dual' directory if doesn't exist yet.
- Pull standalone repositories in 'dual/repos'.
- Create patches in 'dual/patches' and apply them for standalone repositories.
See 'scripts/dual_sync.sh' for more details.
- Run `make dual_log` to make sure that all and correct patches were applied. If some commit touches files from several modules, it results into commits for every affected standalone repository.
- Run `make dual_push`. This should:
- Push updates for affected standalone repositories.
- Clean up 'dual/patches'.
- Update `sync` branch to point to latest commit and push it to `origin`.
## Typical workflow for adding change
- Solve the problem.
- If change is in code, write test which breaks before problem is solved and passes after.
- If change introduces new config setting, consult with [dedicated checklist](#adding-new-config-settings).
- If change is worth to be seen by users (notable/breaking feature/fix), update 'CHANGELOG.md' following formatting from previous versions.
- Make sure that all tests in affected module(s) pass in all supported versions. See [Maintainer setup](#maintainer-setup) and ['Testing' section in CONTRIBUTING.md](CONTRIBUTING.md#testing).
- Stage and commit changes into a separate Git branch. Push the branch.
- Make sure that all CI pass.
- Merge branch into `main` branch. Push `main`.
- Make sure that all CI pass (again).
- Synchronize dual distribution:
- `make dual_sync` to sync.
- `make dual_log` and look at changes which are about to be applied to standalone repositories. Make sure that they are what you'd expect.
- `make dual_push` to push changes to standalone repositories.
## Typical workflow for processing a GitHub issue
- Add label with module name issue is about (if any). If issue is worded politely and/or with much details, thank user for opening an issue.
- Make sure the underlying problem is valid, i.e. it can be reproduced and the root cause is in this project. If it can not be reproduced, politely explain that and ask for more reproduction details. If the cause is not related to the project, politely explain that, close an issue, and direct towards the real root cause.
- Check already existing issues for possible duplicates. If there is at least one, review its reasoning before making decision about the current issue.
- Decide whether and how an issue should be resolved. Use ["General principles"](README.md#general-principles), module's help and code documentation while making the decision.
- If decision is to not resolve, politely explain that and close an issue (possibly mentioning similar reasoning in the past).
- If decision is to resolve, resolve the issue while putting `Resolve #xxx` at the bottom of commit message.
## Typical workflow for processing GitHub pull request
- Add label with module name pull request (PR) is about (if any). If PR is worded politely, thank user for doing that.
- Make sure the PR is valid, i.e. resolves an issue or adds a feature any of which aligns with the project. Ideally, it should have been agreed in the prior created issue (as per [CONTRIBUTING.md](CONTRIBUTING.md)).
- Review PR code and iterate towards making it have enough code quality. Use first steps of ["Typical workflow for adding change"](#typical-workflow-for-adding-change) as reference. **Note**: if what is left to do requires some overly specific project knowledge (i.e. can be done _much_ quicker if you know how, but requires non-trivial amount of reading/discovering first time), consider merging PR in a new separate branch and finish it manually (usually with preserving original commit authorship).
- When change is of enough quality, merge it and proceed treating it as regular change.
## Stopping support for old Neovim version
Begin the process of stopping official support for outdated Neovim version shortly after (week or two) the release of the new stable one. Usually it is stopping support for Neovim 0.x (say, 0.8) shortly after the release of 0.(x+3).0 (say, 0.11.0). The deprecation should be done in two stages:
- Stage 1, soft deprecation (to notify old version users about upcoming support drop):
- Add version of the following code snippet at the beginning of `setup()` function body in **every** module:
```lua
-- TODO: Remove after Neovim=0.8 support is dropped
if vim.fn.has('nvim-0.8') == 0 then
vim.notify(
'(mini.ai) Neovim<0.9 is soft deprecated (module works but not supported).'
.. ' It will be deprecated after next "mini.nvim" release (module might not work).'
.. ' Please update your Neovim version.'
)
end
```
- Modify CI to not test on Neovim 0.x.
- Update README and repo description to indicate new oldest supported Neovim version.
- Wait for a considerable amount of time (at least about a month) *and* a new 'mini.nvim' stable release (so that there is no actual deprecation in the stable release).
- Stage 2, deprecation:
- Remove all notification snippets added in Stage 1.
- Adjust code that is conditioned on `vim.fn.has('nvim-0.x')`.
- Adjust code/comments/documentation that contains any combination of `Neovim{<,<=,=,>=,>}{0.x,0.(x+1)}` (like `Neovim<0.x`, `Neovim>=0.(x+1)`, etc.).
- Add entry "Stop official support of Neovim 0.x." in 'CHANGELOG.md' at the start of current development version block.
## Adding new config settings
- Add code which uses new setting.
- Add default value to `Mini*.config` definition.
- Update module's `H.setup_config()` with type check of new setting.
- Update tests to test default config value and its type check.
- Regenerate help file.
- Update module's README in 'readmes' directory.
- Possibly update demo for it to be aligned with current config values.
- Update 'CHANGELOG.md'. In module's section of current version add line starting with `- FEATURE: Implement ...`.
## Adding new color scheme plugin integration
- Update color scheme module file in a way similar to other already added plugins:
- Add definitions for highlight groups.
- Add plugin entry in a list of supported plugins in help annotations.
- Add plugin entry in a module's README.
- Regenerate documentation (see [corresponding section in CONTRIBUTING.md](CONTRIBUTING.md#generating-help-file)).
## Adding new module
- Add Lua source code in 'lua' directory.
- Add tests in 'tests' directory. Use 'tests/dir-xxx' name for module-specific non-test helpers.
- Update 'lua/init.lua' to mention new module: both in initial table of contents and list of modules.
- Update 'scripts/basic-setup_init.lua' to include new module.
- Update 'scripts/dual_sync.sh' to include new module.
- Update 'scripts/minidoc.lua' to generate separate help file.
- Generate help files.
- Add README to 'readmes' directory. NOTE: comment out mentions of `stable` branch, as it won't work during beta-testing.
- Update main README to mention new module in table of contents.
- Update 'CHANGELOG.md' to mention introduction of new module.
- Update 'CONTRIBUTING.md' to mention new highlight groups (if there are any).
- Commit changes with message 'feat(xxx): add NEW MODULE'. NOTE: it is cleaner to synchronize standalone repositories prior to this commit.
- If there are new highlight groups, follow up with adding explicit support in color scheme modules.
- Make standalone plugin:
- Create new empty GitHub repository. Disable Issues and limit PRs.
- Synchronize standalone repositories. It should have created new git repository with single initial commit.
- Make sure that all tracked files are synchronized. For list of tracked files see 'scripts/dual_sync.sh'. Initially they are 'doc/mini-xxx.txt', 'lua/mini/xxx.lua', 'LICENSE', and 'readmes/mini-xxx.md' (copied to be 'README.md' in standalone repository).
- Make sure that 'README.md' in standalone repository has appropriate relative links (see patch script).
- **Amend** initial commit and push.
- Push `main` and sync dual distribution.
## Making stable release
There is no clear guidelines for when a stable (minor) release should be made. Mostly "when if feels right" but "not too often". If it has to be put in words, it is something like "After 3 new modules have finished beta-testing or 4 months, whichever is sooner". No patch releases have been made yet.
Checklist:
- Check for `TODO`s about actions to be done *before* release.
- Update READMEs of new modules to mention `stable` branch.
- Bump version in 'CHANGELOG.md'. Commit.
- Checkout to `new_release` branch and push to check in CI. **Proceed only if it is successful**.
- Merge `new_release` to `main` and push it.
- Synchronize standalone repositories.
- Make annotated tag: `git tag -a v0.xx.0 -m 'Version 0.xx.0'`. Push it.
- Check that all CI has passed.
- Make GitHub release. Get description from copying entries of version's 'CHANGELOG.md' section.
- Move `stable` branch to point at new tag (`git branch --force stable` when on latest tag's commit). Push it.
- Release standalone repositories. It should be enough to use 'scripts/dual_release.sh' like so:
```
# REPLACE `xx` with your version number
TAG_NAME="v0.xx.0" TAG_MESSAGE="Version 0.xx.0" make dual_release
```
- Use development version in 'CHANGELOG.md' ('0.xx.0.9000'). Commit.
- Check for `TODO`s about actions to be done *after* release.

View File

@ -0,0 +1,46 @@
GROUP_DEPTH ?= 1
NVIM_EXEC ?= nvim
all: test documentation
test:
for nvim_exec in $(NVIM_EXEC); do \
printf "\n======\n\n" ; \
$$nvim_exec --version | head -n 1 && echo '' ; \
$$nvim_exec --headless --noplugin -u ./scripts/minimal_init.lua \
-c "lua require('mini.test').setup()" \
-c "lua MiniTest.run({ execute = { reporter = MiniTest.gen_reporter.stdout({ group_depth = $(GROUP_DEPTH) }) } })" ; \
done
test_file:
for nvim_exec in $(NVIM_EXEC); do \
printf "\n======\n\n" ; \
$$nvim_exec --version | head -n 1 && echo '' ; \
$$nvim_exec --headless --noplugin -u ./scripts/minimal_init.lua \
-c "lua require('mini.test').setup()" \
-c "lua MiniTest.run_file('$(FILE)', { execute = { reporter = MiniTest.gen_reporter.stdout({ group_depth = $(GROUP_DEPTH) }) } })" ; \
done
documentation:
$(NVIM_EXEC) --headless --noplugin -u ./scripts/minimal_init.lua -c "lua require('mini.doc').generate()" -c "qa!"
lintcommit-ci:
export LINTCOMMIT_STRICT=true && chmod u+x scripts/lintcommit-ci.sh && scripts/lintcommit-ci.sh
basic_setup:
$(NVIM_EXEC) --headless --noplugin -u ./scripts/basic-setup_init.lua
dual_sync:
chmod u+x scripts/dual_sync.sh && scripts/dual_sync.sh
dual_log:
chmod u+x scripts/dual_log.sh && scripts/dual_log.sh
dual_push:
chmod u+x scripts/dual_push.sh && scripts/dual_push.sh
git branch --force sync
git push origin sync
rm -r dual/patches
dual_release:
chmod u+x scripts/dual_release.sh && scripts/dual_release.sh "$(TAG_NAME)" "$(TAG_MESSAGE)"

View File

@ -0,0 +1,173 @@
<img src="logo.png" width="800em"/> <br>
<!-- badges: start -->
[![GitHub license](https://badgen.net/github/license/echasnovski/mini.nvim)](https://github.com/echasnovski/mini.nvim/blob/main/LICENSE)
[![GitHub tag](https://badgen.net/github/tag/echasnovski/mini.nvim)](https://github.com/echasnovski/mini.nvim/tags/)
[![Current version](https://badgen.net/badge/Current%20version/development/cyan)](https://github.com/echasnovski/mini.nvim/blob/main/CHANGELOG.md)
<!-- badges: end -->
Library of 40+ independent Lua modules improving overall [Neovim](https://github.com/neovim/neovim) (version 0.8 and higher) experience with minimal effort. They all share same configuration approaches and general design principles.
Think about this project as "Swiss Army knife" among Neovim plugins: it has many different independent tools (modules) suitable for most common tasks. Each module can be used separately without any startup and usage overhead.
If you want to help this project grow but don't know where to start, check out [contributing guides](CONTRIBUTING.md) or leave a Github star for 'mini.nvim' project and/or any its standalone Git repositories.
## Table of contents
- [Installation](#installation)
- [Modules](#modules)
- [General principles](#general-principles)
- [Plugin colorschemes](#plugin-colorschemes)
- [Planned modules](#planned-modules)
## Installation
There are two branches to install from:
- `main` (default, **recommended**) will have latest development version of plugin. All changes since last stable release should be perceived as being in beta testing phase (meaning they already passed alpha-testing and are moderately settled).
- `stable` will be updated only upon releases with code tested during public beta-testing phase in `main` branch.
Here are code snippets for some common installation methods:
- Manually with `git clone` (compatible with [mini.deps](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-deps.md)):
```lua
-- Put this at the top of 'init.lua'
local path_package = vim.fn.stdpath('data') .. '/site'
local mini_path = path_package .. '/pack/deps/start/mini.nvim'
if not vim.loop.fs_stat(mini_path) then
vim.cmd('echo "Installing `mini.nvim`" | redraw')
local clone_cmd = {
'git', 'clone', '--filter=blob:none',
-- Uncomment next line to use 'stable' branch
-- '--branch', 'stable',
'https://github.com/echasnovski/mini.nvim', mini_path
}
vim.fn.system(clone_cmd)
vim.cmd('packadd mini.nvim | helptags ALL')
end
```
- With [folke/lazy.nvim](https://github.com/folke/lazy.nvim):
| Branch | Code snippet |
|--------|------------------------------------------------------|
| Main | `{ 'echasnovski/mini.nvim', version = false },` |
| Stable | `{ 'echasnovski/mini.nvim', version = '*' },` |
- With [junegunn/vim-plug](https://github.com/junegunn/vim-plug):
| Branch | Code snippet |
|--------|--------------------------------------------------------|
| Main | `Plug 'echasnovski/mini.nvim'` |
| Stable | `Plug 'echasnovski/mini.nvim', { 'branch': 'stable' }` |
- Every module is also distributed as a standalone Git repository. Check out module's information for more details.
**Important**: don't forget to call module's `setup()` (if required) to enable its functionality.
**Note**: if you are on Windows, there might be problems with too long file paths (like `error: unable to create file <some file name>: Filename too long`). Try doing one of the following:
- Enable corresponding git global config value: `git config --system core.longpaths true`. Then try to reinstall.
- Install plugin in other place with shorter path.
## Modules
If you are browsing without particular objective and don't know which module to look at:
- To improve your editing experience, start with 'mini.ai', 'mini.operators', 'mini.pairs', 'mini.surround'.
- To improve your general workflow, start with 'mini.bracketed', 'mini.files', 'mini.jump2d', 'mini.pick'.
- To make your Neovim more beautiful, start with 'mini.animate', 'mini.hues', 'mini.icons', 'mini.notify'.
| Module | Description | Overview | Details |
|------------------|------------------------------------------|---------------------------------------|---------------------------------------|
| mini.ai | Extend and create `a`/`i` textobjects | [README](readmes/mini-ai.md) | [Help file](doc/mini-ai.txt) |
| mini.align | Align text interactively | [README](readmes/mini-align.md) | [Help file](doc/mini-align.txt) |
| mini.animate | Animate common Neovim actions | [README](readmes/mini-animate.md) | [Help file](doc/mini-animate.txt) |
| mini.base16 | Base16 colorscheme creation | [README](readmes/mini-base16.md) | [Help file](doc/mini-base16.txt) |
| mini.basics | Common configuration presets | [README](readmes/mini-basics.md) | [Help file](doc/mini-basics.txt) |
| mini.bracketed | Go forward/backward with square brackets | [README](readmes/mini-bracketed.md) | [Help file](doc/mini-bracketed.txt) |
| mini.bufremove | Remove buffers | [README](readmes/mini-bufremove.md) | [Help file](doc/mini-bufremove.txt) |
| mini.clue | Show next key clues | [README](readmes/mini-clue.md) | [Help file](doc/mini-clue.txt) |
| mini.colors | Tweak and save any color scheme | [README](readmes/mini-colors.md) | [Help file](doc/mini-colors.txt) |
| mini.comment | Comment lines | [README](readmes/mini-comment.md) | [Help file](doc/mini-comment.txt) |
| mini.completion | Completion and signature help | [README](readmes/mini-completion.md) | [Help file](doc/mini-completion.txt) |
| mini.cursorword | Autohighlight word under cursor | [README](readmes/mini-cursorword.md) | [Help file](doc/mini-cursorword.txt) |
| mini.deps | Plugin manager | [README](readmes/mini-deps.md) | [Help file](doc/mini-deps.txt) |
| mini.diff | Work with diff hunks | [README](readmes/mini-diff.md) | [Help file](doc/mini-diff.txt) |
| mini.doc | Generate Neovim help files | [README](readmes/mini-doc.md) | [Help file](doc/mini-doc.txt) |
| mini.extra | Extra 'mini.nvim' functionality | [README](readmes/mini-extra.md) | [Help file](doc/mini-extra.txt) |
| mini.files | Navigate and manipulate file system | [README](readmes/mini-files.md) | [Help file](doc/mini-files.txt) |
| mini.fuzzy | Fuzzy matching | [README](readmes/mini-fuzzy.md) | [Help file](doc/mini-fuzzy.txt) |
| mini.git | Git integration | [README](readmes/mini-git.md) | [Help file](doc/mini-git.txt) |
| mini.hipatterns | Highlight patterns in text | [README](readmes/mini-hipatterns.md) | [Help file](doc/mini-hipatterns.txt) |
| mini.hues | Generate configurable color scheme | [README](readmes/mini-hues.md) | [Help file](doc/mini-hues.txt) |
| mini.icons | Icon provider | [README](readmes/mini-icons.md) | [Help file](doc/mini-icons.txt) |
| mini.indentscope | Visualize and work with indent scope | [README](readmes/mini-indentscope.md) | [Help file](doc/mini-indentscope.txt) |
| mini.jump | Jump to next/previous single character | [README](readmes/mini-jump.md) | [Help file](doc/mini-jump.txt) |
| mini.jump2d | Jump within visible lines | [README](readmes/mini-jump2d.md) | [Help file](doc/mini-jump2d.txt) |
| mini.map | Window with buffer text overview | [README](readmes/mini-map.md) | [Help file](doc/mini-map.txt) |
| mini.misc | Miscellaneous functions | [README](readmes/mini-misc.md) | [Help file](doc/mini-misc.txt) |
| mini.move | Move any selection in any direction | [README](readmes/mini-move.md) | [Help file](doc/mini-move.txt) |
| mini.notify | Show notifications | [README](readmes/mini-notify.md) | [Help file](doc/mini-notify.txt) |
| mini.operators | Text edit operators | [README](readmes/mini-operators.md) | [Help file](doc/mini-operators.txt) |
| mini.pairs | Autopairs | [README](readmes/mini-pairs.md) | [Help file](doc/mini-pairs.txt) |
| mini.pick | Pick anything | [README](readmes/mini-pick.md) | [Help file](doc/mini-pick.txt) |
| mini.sessions | Session management | [README](readmes/mini-sessions.md) | [Help file](doc/mini-sessions.txt) |
| mini.splitjoin | Split and join arguments | [README](readmes/mini-splitjoin.md) | [Help file](doc/mini-splitjoin.txt) |
| mini.starter | Start screen | [README](readmes/mini-starter.md) | [Help file](doc/mini-starter.txt) |
| mini.statusline | Statusline | [README](readmes/mini-statusline.md) | [Help file](doc/mini-statusline.txt) |
| mini.surround | Surround actions | [README](readmes/mini-surround.md) | [Help file](doc/mini-surround.txt) |
| mini.tabline | Tabline | [README](readmes/mini-tabline.md) | [Help file](doc/mini-tabline.txt) |
| mini.test | Test Neovim plugins | [README](readmes/mini-test.md) | [Help file](doc/mini-test.txt) |
| mini.trailspace | Trailspace (highlight and remove) | [README](readmes/mini-trailspace.md) | [Help file](doc/mini-trailspace.txt) |
| mini.visits | Track and reuse file system visits | [README](readmes/mini-visits.md) | [Help file](doc/mini-visits.txt) |
## General principles
- **Design**. Each module is designed to solve a particular problem targeting balance between feature-richness (handling as many edge-cases as possible) and simplicity of implementation/support. Granted, not all of them ended up with the same balance, but it is the goal nevertheless.
- **Independence**. Modules are independent of each other and can be run without external dependencies. Although some of them may need dependencies for full experience.
- **Structure**. Each module is a submodule for a placeholder "mini" module. So, for example, "surround" module should be referred to as "mini.surround". As later will be explained, this plugin can also be referred to as "MiniSurround".
- **Setup**:
- Each module you want to use should be enabled separately with `require(<name of module>).setup({})`. Possibly replace `{}` with your config table or omit altogether to use defaults. You can supply only parts of config, the rest will be inferred from defaults.
- Call to module's `setup()` always creates a global Lua object with coherent camel-case name: `require('mini.surround').setup()` creates `_G.MiniSurround`. This allows for a simpler usage of plugin functionality: instead of `require('mini.surround')` use `MiniSurround` (or manually `:lua MiniSurround.*` in command line); available from `v:lua` like `v:lua.MiniSurround`. Considering this, "module" and "Lua object" names can be used interchangeably: 'mini.surround' and 'MiniSurround' will mean the same thing.
- Each supplied `config` table is stored in `config` field of global object. Like `MiniSurround.config`.
- Values of `config` which affect runtime activity can be changed on the fly to have effect. For example, `MiniSurround.config.n_lines` can be changed during runtime; but changing `MiniSurround.config.mappings` won't have any effect (as mappings are created once during `setup()`).
- **Buffer local configuration**. Each module can be additionally configured to use certain runtime config settings locally to buffer. See `mini.nvim-buffer-local-config` section in help file for more information.
- **Disabling**. Each module's core functionality can be disabled globally or locally to buffer. See "Disabling" section in module's help page for more details. See `mini.nvim-disabling-recipes` section in main help file for common recipes.
- **Silencing**. Each module providing non-error feedback can be configured to not do that by setting `config.silent = true` (either inside `setup()` call or on the fly).
- **Highlighting**. Appearance of module's output is controlled by certain set of highlight groups (see `:h highlight-groups`). By default they usually link to some semantically close built-in highlight group. Use `:highlight` command or `vim.api.nvim_set_hl()` Lua function to customize highlighting. To see a more calibrated look, use 'mini.hues', 'mini.base16', or plugin's colorscheme.
- **Stability**. Each module upon release is considered to be relatively stable: both in terms of setup and functionality. Any non-bugfix backward-incompatible change will be released gradually as much as possible.
- **Not filetype/language specific**. Including functionality which needs several filetype/language specific implementations is an explicit no-goal of this project. This is mostly due to the potential increase in maintenance to keep implementation up to date. However, any part which might need filetype/language specific tuning should be designed to allow it by letting user set proper buffer options and/or local configuration.
## Plugin colorschemes
This plugin comes with several color schemes (all have both dark and light variants):
- `randomhue` - random background and foreground of the same hue with medium saturation.
- `minicyan` - cyan and grey main colors with medium contrast and saturation palette.
- `minischeme` - blue and yellow main colors with high contrast and saturation palette.
Activate them as regular `colorscheme` (for example, `:colorscheme randomhue` or `:colorscheme minicyan`). You can see how they look in [demo of 'mini.hues'](readmes/mini-hues.md#demo) or [demo of 'mini.base16'](readmes/mini-base16.md#demo).
## Planned modules
This is the list of modules I currently intend to implement eventually (as my free time and dedication will allow), in alphabetical order:
- 'mini.cycle' - cycle through alternatives with pre-defined rules. Something like [monaqa/dial.nvim](https://github.com/monaqa/dial.nvim) and [AndrewRadev/switch.vim](https://github.com/AndrewRadev/switch.vim)
- 'mini.keymap' - utilities to make non-trivial mappings (like [max397574/better-escape.nvim](https://github.com/max397574/better-escape.nvim) and dot-repeatable mappings).
- 'mini.snippets' - work with snippets. Something like [L3MON4D3/LuaSnip](https://github.com/L3MON4D3/LuaSnip) but only with more straightforward functionality.
- 'mini.statuscolumn' - customizable 'statuscolumn'.
- 'mini.terminals' - coherently manage terminal windows and send text from buffers to terminal windows. Something like [kassio/neoterm](https://github.com/kassio/neoterm).
- 'mini.quickfix' - fuzzy search and preview of quickfix entries. Possibly with some presets for populating quickfix list (like files, help tags, etc.). Similar to [kevinhwang91/nvim-bqf](https://github.com/kevinhwang91/nvim-bqf).

Some files were not shown because too many files have changed in this diff Show More