Refresh generated neovim config
This commit is contained in:
@ -6,7 +6,10 @@ body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**Before** reporting an issue, make sure to read the [documentation](https://github.com/folke/flash.nvim) and search [existing issues](https://github.com/folke/flash.nvim/issues). Usage questions such as ***"How do I...?"*** belong in [Discussions](https://github.com/folke/flash.nvim/discussions) and will be closed.
|
||||
**Before** reporting an issue, make sure to read the [documentation](https://github.com/folke/flash.nvim)
|
||||
and search [existing issues](https://github.com/folke/flash.nvim/issues).
|
||||
|
||||
Usage questions such as ***"How do I...?"*** belong in [Discussions](https://github.com/folke/flash.nvim/discussions) and will be closed.
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Did you check docs and existing issues?
|
||||
@ -14,6 +17,8 @@ body:
|
||||
options:
|
||||
- label: I have read all the flash.nvim docs
|
||||
required: true
|
||||
- label: I have updated the plugin to the latest version before submitting this issue
|
||||
required: true
|
||||
- label: I have searched the existing issues of flash.nvim
|
||||
required: true
|
||||
- label: I have searched the existing issues of plugins related to this issue
|
||||
@ -57,33 +62,15 @@ body:
|
||||
label: Repro
|
||||
description: Minimal `init.lua` to reproduce this issue. Save as `repro.lua` and run with `nvim -u repro.lua`
|
||||
value: |
|
||||
-- DO NOT change the paths and don't remove the colorscheme
|
||||
local root = vim.fn.fnamemodify("./.repro", ":p")
|
||||
vim.env.LAZY_STDPATH = ".repro"
|
||||
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
|
||||
|
||||
-- set stdpaths to use .repro
|
||||
for _, name in ipairs({ "config", "data", "state", "cache" }) do
|
||||
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
|
||||
end
|
||||
|
||||
-- bootstrap lazy
|
||||
local lazypath = root .. "/plugins/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
|
||||
end
|
||||
vim.opt.runtimepath:prepend(lazypath)
|
||||
|
||||
-- install plugins
|
||||
local plugins = {
|
||||
"folke/tokyonight.nvim",
|
||||
{ "folke/flash.nvim", opts = {} },
|
||||
-- add any other plugins here
|
||||
}
|
||||
require("lazy").setup(plugins, {
|
||||
root = root .. "/plugins",
|
||||
require("lazy.minit").repro({
|
||||
spec = {
|
||||
{ "folke/flash.nvim", opts = {} },
|
||||
-- add any other plugins here
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd.colorscheme("tokyonight")
|
||||
-- add anything else here
|
||||
render: Lua
|
||||
render: lua
|
||||
validations:
|
||||
required: false
|
||||
|
||||
@ -1,72 +1,14 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
# os: [ubuntu-latest, windows-latest]
|
||||
os: [ubuntu-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install Neovim
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p /tmp/nvim
|
||||
wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage -O /tmp/nvim/nvim.appimage
|
||||
cd /tmp/nvim
|
||||
chmod a+x ./nvim.appimage
|
||||
./nvim.appimage --appimage-extract
|
||||
echo "/tmp/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH
|
||||
- name: Run Tests
|
||||
run: |
|
||||
nvim --version
|
||||
[ ! -d tests ] && exit 0
|
||||
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/init.lua', sequential = true}"
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: tests
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: panvimdoc
|
||||
uses: kdheepak/panvimdoc@main
|
||||
with:
|
||||
vimdoc: flash.nvim
|
||||
version: "Neovim >= 0.8.0"
|
||||
demojify: true
|
||||
treesitter: true
|
||||
- name: Push changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "chore(build): auto-generate vimdoc"
|
||||
commit_user_name: "github-actions[bot]"
|
||||
commit_user_email: "github-actions[bot]@users.noreply.github.com"
|
||||
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
|
||||
release:
|
||||
name: release
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
needs:
|
||||
- docs
|
||||
- tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: google-github-actions/release-please-action@v3
|
||||
id: release
|
||||
with:
|
||||
release-type: simple
|
||||
package-name: flash.nvim
|
||||
- uses: actions/checkout@v3
|
||||
- name: tag stable versions
|
||||
if: ${{ steps.release.outputs.release_created }}
|
||||
run: |
|
||||
git config user.name github-actions[bot]
|
||||
git config user.email github-actions[bot]@users.noreply.github.com
|
||||
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git"
|
||||
git tag -d stable || true
|
||||
git push origin :stable || true
|
||||
git tag -a stable -m "Last Stable Release"
|
||||
git push origin stable
|
||||
ci:
|
||||
uses: folke/github/.github/workflows/ci.yml@main
|
||||
secrets: inherit
|
||||
with:
|
||||
plugin: flash.nvim
|
||||
repo: folke/flash.nvim
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
tt.*
|
||||
.tests
|
||||
doc/tags
|
||||
debug
|
||||
.repro
|
||||
foo.*
|
||||
*.log
|
||||
data
|
||||
/.repro
|
||||
/.tests
|
||||
/build
|
||||
/debug
|
||||
/doc/tags
|
||||
foo.*
|
||||
node_modules
|
||||
tt.*
|
||||
|
||||
@ -1,5 +1,37 @@
|
||||
# Changelog
|
||||
|
||||
## [2.1.0](https://github.com/folke/flash.nvim/compare/v2.0.0...v2.1.0) (2024-07-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **prompt:** add `flash.prompt()` to get the prompt text ([#347](https://github.com/folke/flash.nvim/issues/347)) ([f226e02](https://github.com/folke/flash.nvim/commit/f226e02306e6968604aaffe4d3d5c106ce460a4f))
|
||||
* **treesitter:** opt-out selection of the smallest node with flash.treesitter() by specifying autojump = false ([#276](https://github.com/folke/flash.nvim/issues/276)) ([daa06cd](https://github.com/folke/flash.nvim/commit/daa06cda13bea0f04a1a120d5f8e7ec32752be19))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **state:** abort to use Util.exit() ([#324](https://github.com/folke/flash.nvim/issues/324)) ([e7ab1e4](https://github.com/folke/flash.nvim/commit/e7ab1e4003aec864a8fc87f19a4032a2a453479e))
|
||||
* **treesitter:** process all trees. Closes [#275](https://github.com/folke/flash.nvim/issues/275) ([51f3ee1](https://github.com/folke/flash.nvim/commit/51f3ee13d2c031bb04b78fb324b8ad33e33fdc1f))
|
||||
|
||||
## [2.0.0](https://github.com/folke/flash.nvim/compare/v1.18.3...v2.0.0) (2024-07-05)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* **search:** flash is now no longer enabled by default during search. Enable it in your config, or use toggle.
|
||||
|
||||
### Features
|
||||
|
||||
* **char:** add auto-jump/auto-motion option when using labels, closes [#183](https://github.com/folke/flash.nvim/issues/183) ([#281](https://github.com/folke/flash.nvim/issues/281)) ([b14120a](https://github.com/folke/flash.nvim/commit/b14120a4b55c34a83baf40650b8612b411c81ef4))
|
||||
* **search:** flash is now no longer enabled by default during search. Enable it in your config, or use toggle. ([2411de6](https://github.com/folke/flash.nvim/commit/2411de6fd773ab5b902cf04f2dccfe3baadff229))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Don't exit in regular search mode when there is no result ([#277](https://github.com/folke/flash.nvim/issues/277)) ([518c047](https://github.com/folke/flash.nvim/commit/518c047031e3dee0b22fad2b23d75deb7ecd826e))
|
||||
* use real cursors on Neovim >= 0.10. See [#345](https://github.com/folke/flash.nvim/issues/345) ([7ba2298](https://github.com/folke/flash.nvim/commit/7ba2298eb196826442ce68cc6ec0cae2d7d4dbe1))
|
||||
|
||||
## [1.18.3](https://github.com/folke/flash.nvim/compare/v1.18.2...v1.18.3) (2024-05-03)
|
||||
|
||||
|
||||
|
||||
@ -292,13 +292,18 @@ Install the plugin with your preferred package manager:
|
||||
end,
|
||||
search = { wrap = false },
|
||||
highlight = { backdrop = true },
|
||||
jump = { register = false },
|
||||
jump = {
|
||||
register = false,
|
||||
-- when using jump labels, set to 'true' to automatically jump
|
||||
-- or execute a motion when there is only one match
|
||||
autojump = false,
|
||||
},
|
||||
},
|
||||
-- options used for treesitter selections
|
||||
-- `require("flash").treesitter()`
|
||||
treesitter = {
|
||||
labels = "abcdefghijklmnopqrstuvwxyz",
|
||||
jump = { pos = "range" },
|
||||
jump = { pos = "range", autojump = true },
|
||||
search = { incremental = false },
|
||||
label = { before = true, after = true, style = "inline" },
|
||||
highlight = {
|
||||
@ -319,6 +324,7 @@ Install the plugin with your preferred package manager:
|
||||
},
|
||||
-- options for the floating window that shows the prompt,
|
||||
-- for regular jumps
|
||||
-- `require("flash").prompt()` is always available to get the prompt text
|
||||
prompt = {
|
||||
enabled = true,
|
||||
prefix = { { "⚡", "FlashPromptIcon" } },
|
||||
@ -405,7 +411,8 @@ Install the plugin with your preferred package manager:
|
||||
- **jump**: `require("flash").jump(opts?)` opens **flash** with the given options
|
||||
- type any number of characters before typing a jump label
|
||||
- **VS Code**: some functionality is changed/disabled when running **flash** in **VS Code**:
|
||||
- `prompt` is disabled
|
||||
- `prompt` is disabled. You can use `require("flash").prompt()` to get the
|
||||
prompt text and integrate it into the statusline.
|
||||
- `highlights` are set to different defaults that will actually work in VS Code
|
||||
|
||||
## 📡 API
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*flash.nvim.txt* For Neovim >= 0.8.0 Last change: 2024 June 04
|
||||
*flash.nvim.txt* For Neovim Last change: 2024 July 22
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *flash.nvim-table-of-contents*
|
||||
@ -281,13 +281,18 @@ Default Settings ~
|
||||
end,
|
||||
search = { wrap = false },
|
||||
highlight = { backdrop = true },
|
||||
jump = { register = false },
|
||||
jump = {
|
||||
register = false,
|
||||
-- when using jump labels, set to 'true' to automatically jump
|
||||
-- or execute a motion when there is only one match
|
||||
autojump = false,
|
||||
},
|
||||
},
|
||||
-- options used for treesitter selections
|
||||
-- `require("flash").treesitter()`
|
||||
treesitter = {
|
||||
labels = "abcdefghijklmnopqrstuvwxyz",
|
||||
jump = { pos = "range" },
|
||||
jump = { pos = "range", autojump = true },
|
||||
search = { incremental = false },
|
||||
label = { before = true, after = true, style = "inline" },
|
||||
highlight = {
|
||||
@ -308,6 +313,7 @@ Default Settings ~
|
||||
},
|
||||
-- options for the floating window that shows the prompt,
|
||||
-- for regular jumps
|
||||
-- `require("flash").prompt()` is always available to get the prompt text
|
||||
prompt = {
|
||||
enabled = true,
|
||||
prefix = { { "⚡", "FlashPromptIcon" } },
|
||||
@ -390,7 +396,8 @@ USAGE *flash.nvim-flash.nvim-usage*
|
||||
- type any number of characters before typing a jump label
|
||||
- **VS Code**some functionality is changed/disabled when running **flash** in
|
||||
**VS Code**
|
||||
- `prompt`is disabled
|
||||
- `prompt`is disabled. You can use `require("flash").prompt()` to get the
|
||||
prompt text and integrate it into the statusline.
|
||||
- `highlights` are set to different defaults that will actually work in VS Code
|
||||
|
||||
|
||||
|
||||
@ -33,4 +33,9 @@ function M.toggle(enabled)
|
||||
return Search.toggle(enabled)
|
||||
end
|
||||
|
||||
---@return string
|
||||
function M.prompt()
|
||||
return require("flash.prompt").prompt or ""
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@ -216,7 +216,7 @@ local defaults = {
|
||||
-- `require("flash").treesitter()`
|
||||
treesitter = {
|
||||
labels = "abcdefghijklmnopqrstuvwxyz",
|
||||
jump = { pos = "range" },
|
||||
jump = { pos = "range", autojump = true },
|
||||
search = { incremental = false },
|
||||
label = { before = true, after = true, style = "inline" },
|
||||
highlight = {
|
||||
@ -237,6 +237,7 @@ local defaults = {
|
||||
},
|
||||
-- options for the floating window that shows the prompt,
|
||||
-- for regular jumps
|
||||
-- `require("flash").prompt()` is always available to get the prompt text
|
||||
prompt = {
|
||||
enabled = true,
|
||||
prefix = { { "⚡", "FlashPromptIcon" } },
|
||||
@ -313,10 +314,7 @@ function M.get(...)
|
||||
o.label = vim.tbl_deep_extend("force", o.label or {}, o.highlight.label)
|
||||
---@diagnostic disable-next-line: no-unknown
|
||||
o.highlight.label = nil
|
||||
vim.notify_once(
|
||||
"flash: `opts.highlight.label` is deprecated, use `opts.label` instead",
|
||||
vim.log.levels.WARN
|
||||
)
|
||||
vim.notify_once("flash: `opts.highlight.label` is deprecated, use `opts.label` instead", vim.log.levels.WARN)
|
||||
end
|
||||
for _, field in ipairs({ "autohide", "jump_labels" }) do
|
||||
if type(o[field]) == "function" then
|
||||
|
||||
@ -124,12 +124,7 @@ function M.update(state)
|
||||
-- dont show the label if the cursor is on the same position
|
||||
-- in the same window
|
||||
-- and the label is not a range
|
||||
if
|
||||
cursor[1] == row + 1
|
||||
and cursor[2] == col
|
||||
and match.win == state.win
|
||||
and state.opts.jump.pos ~= "range"
|
||||
then
|
||||
if cursor[1] == row + 1 and cursor[2] == col and match.win == state.win and state.opts.jump.pos ~= "range" then
|
||||
return
|
||||
end
|
||||
if match.fold then
|
||||
|
||||
@ -80,10 +80,7 @@ function M.remote_op(match, state, register)
|
||||
vim.cmd("normal! v")
|
||||
vim.api.nvim_win_set_cursor(match.win, match.end_pos)
|
||||
else
|
||||
vim.api.nvim_win_set_cursor(
|
||||
match.win,
|
||||
state.opts.jump.pos == "start" and match.pos or match.end_pos
|
||||
)
|
||||
vim.api.nvim_win_set_cursor(match.win, state.opts.jump.pos == "start" and match.pos or match.end_pos)
|
||||
end
|
||||
|
||||
-- otherwise, use the remote window's cursor position
|
||||
@ -196,9 +193,7 @@ function M._jump(match, state, opts)
|
||||
offset = 1
|
||||
end
|
||||
|
||||
pos = Pos(
|
||||
require("flash.util").offset_pos(vim.api.nvim_win_get_buf(match.win), pos, { 0, offset or 0 })
|
||||
)
|
||||
pos = Pos(require("flash.util").offset_pos(vim.api.nvim_win_get_buf(match.win), pos, { 0, offset or 0 }))
|
||||
pos[2] = math.max(0, pos[2])
|
||||
|
||||
vim.api.nvim_win_set_cursor(match.win, pos)
|
||||
|
||||
@ -50,10 +50,7 @@ function M:reset()
|
||||
skip[l] = true
|
||||
end
|
||||
end
|
||||
if
|
||||
not self.state.opts.search.max_length
|
||||
or #self.state.pattern() < self.state.opts.search.max_length
|
||||
then
|
||||
if not self.state.opts.search.max_length or #self.state.pattern() < self.state.opts.search.max_length then
|
||||
for _, win in pairs(self.state.wins) do
|
||||
self.labels = self:skip(win, self.labels)
|
||||
end
|
||||
|
||||
@ -46,8 +46,7 @@ function M.new()
|
||||
}, M.motions[M.motion])
|
||||
|
||||
-- never show the current match label
|
||||
opts.highlight.groups.current = M.motion:lower() == "f" and opts.highlight.groups.label
|
||||
or opts.highlight.groups.match
|
||||
opts.highlight.groups.current = M.motion:lower() == "f" and opts.highlight.groups.label or opts.highlight.groups.match
|
||||
|
||||
-- exclude the motion labels so we can use them for next/prev
|
||||
opts.labels = opts.labels:gsub(M.motion:lower(), "")
|
||||
@ -241,7 +240,7 @@ function M.jump(key)
|
||||
M.state:update({ force = true })
|
||||
|
||||
if M.jump_labels then
|
||||
if (Config.get("char").jump.autojump and #M.state.results == 1) then
|
||||
if Config.get("char").jump.autojump and #M.state.results == 1 then
|
||||
M.state:hide()
|
||||
return M.state
|
||||
end
|
||||
|
||||
@ -9,7 +9,7 @@ local M = {}
|
||||
---@field node TSNode
|
||||
---@field depth? number
|
||||
|
||||
---@param win window
|
||||
---@param win number
|
||||
---@param pos? Pos
|
||||
function M.get_nodes(win, pos)
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
@ -18,7 +18,7 @@ function M.get_nodes(win, pos)
|
||||
|
||||
local nodes = {} ---@type TSNode[]
|
||||
|
||||
local ok, tree = pcall(vim.treesitter.get_parser, buf)
|
||||
local ok, parser = pcall(vim.treesitter.get_parser, buf)
|
||||
if not ok then
|
||||
vim.notify(
|
||||
"No treesitter parser for this buffer with filetype=" .. vim.bo[buf].filetype,
|
||||
@ -27,20 +27,25 @@ function M.get_nodes(win, pos)
|
||||
)
|
||||
vim.api.nvim_input("<esc>")
|
||||
end
|
||||
if not (ok and tree) then
|
||||
if not (ok and parser) then
|
||||
return {}
|
||||
end
|
||||
|
||||
do
|
||||
-- get all ranges of the current node and its parents
|
||||
local node = tree:named_node_for_range({ pos[1] - 1, pos[2], pos[1] - 1, pos[2] }, {
|
||||
ignore_injections = false,
|
||||
})
|
||||
parser:for_each_tree(function(tstree, tree)
|
||||
if not tstree then
|
||||
return
|
||||
end
|
||||
-- get all ranges of the current node and its parents
|
||||
local node = tree:named_node_for_range({ pos[1] - 1, pos[2], pos[1] - 1, pos[2] }, {
|
||||
ignore_injections = true,
|
||||
})
|
||||
|
||||
while node do
|
||||
nodes[#nodes + 1] = node
|
||||
node = node:parent() ---@type TSNode
|
||||
end
|
||||
while node do
|
||||
nodes[#nodes + 1] = node
|
||||
node = node:parent() ---@type TSNode
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- convert ranges to matches
|
||||
@ -63,14 +68,12 @@ function M.get_nodes(win, pos)
|
||||
-- then move it to the last character of the last line.
|
||||
if match.end_pos[1] > line_count then
|
||||
match.end_pos[1] = line_count
|
||||
match.end_pos[2] =
|
||||
#vim.api.nvim_buf_get_lines(buf, match.end_pos[1] - 1, match.end_pos[1], false)[1]
|
||||
match.end_pos[2] = #vim.api.nvim_buf_get_lines(buf, match.end_pos[1] - 1, match.end_pos[1], false)[1]
|
||||
elseif match.end_pos[2] == -1 then
|
||||
-- If the end points to the start of the next line, move it to the
|
||||
-- end of the previous line.
|
||||
-- Otherwise operations include the first character of the next line
|
||||
local line =
|
||||
vim.api.nvim_buf_get_lines(buf, match.end_pos[1] - 2, match.end_pos[1] - 1, false)[1]
|
||||
local line = vim.api.nvim_buf_get_lines(buf, match.end_pos[1] - 2, match.end_pos[1] - 1, false)[1]
|
||||
match.end_pos[1] = match.end_pos[1] - 1
|
||||
match.end_pos[2] = #line
|
||||
end
|
||||
@ -121,11 +124,13 @@ function M.jump(opts)
|
||||
current = m
|
||||
end
|
||||
end
|
||||
current = state:jump(current)
|
||||
if state.opts.jump.autojump then
|
||||
current = state:jump(current)
|
||||
end
|
||||
|
||||
state:loop({
|
||||
abort = function()
|
||||
vim.cmd([[normal! v]])
|
||||
Util.exit()
|
||||
end,
|
||||
actions = {
|
||||
[";"] = function()
|
||||
@ -174,7 +179,11 @@ function M.search(opts)
|
||||
end)
|
||||
|
||||
local state = Repeat.get_state("treesitter-search", opts)
|
||||
state:loop()
|
||||
state:loop({
|
||||
abort = function()
|
||||
Util.exit()
|
||||
end,
|
||||
})
|
||||
return state
|
||||
end
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
local Config = require("flash.config")
|
||||
|
||||
---@class Flash.Prompt
|
||||
---@field win window
|
||||
---@field buf buffer
|
||||
---@field win number
|
||||
---@field buf number
|
||||
---@field prompt string
|
||||
local M = {}
|
||||
|
||||
local ns = vim.api.nvim_create_namespace("flash_prompt")
|
||||
@ -47,6 +48,8 @@ function M.show()
|
||||
end
|
||||
|
||||
function M.hide()
|
||||
M.prompt = ""
|
||||
|
||||
if M.win and vim.api.nvim_win_is_valid(M.win) then
|
||||
vim.api.nvim_win_close(M.win, true)
|
||||
M.win = nil
|
||||
@ -58,8 +61,8 @@ function M.hide()
|
||||
end
|
||||
|
||||
---@param pattern string
|
||||
function M.set(pattern)
|
||||
M.show()
|
||||
---@param show boolean
|
||||
function M.set(pattern, show)
|
||||
local text = vim.deepcopy(Config.prompt.prefix)
|
||||
text[#text + 1] = { pattern }
|
||||
|
||||
@ -67,6 +70,15 @@ function M.set(pattern)
|
||||
for _, item in ipairs(text) do
|
||||
str = str .. item[1]
|
||||
end
|
||||
|
||||
M.prompt = str
|
||||
|
||||
if not show then
|
||||
return
|
||||
end
|
||||
|
||||
M.show()
|
||||
|
||||
vim.api.nvim_buf_set_lines(M.buf, 0, -1, false, { str })
|
||||
vim.api.nvim_buf_clear_namespace(M.buf, ns, 0, -1)
|
||||
local col = 0
|
||||
|
||||
@ -56,11 +56,7 @@ function M.setup()
|
||||
local ok, err = pcall(state.update, state)
|
||||
if not ok then
|
||||
vim.schedule(function()
|
||||
vim.notify(
|
||||
"Flash error during redraw:\n" .. err,
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "flash.nvim" }
|
||||
)
|
||||
vim.notify("Flash error during redraw:\n" .. err, vim.log.levels.ERROR, { title = "flash.nvim" })
|
||||
end)
|
||||
end
|
||||
end
|
||||
@ -217,9 +213,7 @@ function M:check_jump(pattern)
|
||||
return
|
||||
end
|
||||
local chars = vim.fn.strchars(pattern)
|
||||
if
|
||||
pattern:find(self.pattern(), 1, true) == 1 and chars == vim.fn.strchars(self.pattern()) + 1
|
||||
then
|
||||
if pattern:find(self.pattern(), 1, true) == 1 and chars == vim.fn.strchars(self.pattern()) + 1 then
|
||||
local label = vim.fn.strcharpart(pattern, chars - 1, 1)
|
||||
if self:jump(label) then
|
||||
return true
|
||||
@ -349,8 +343,8 @@ end
|
||||
---@param opts? Flash.Step.Options
|
||||
function M:step(opts)
|
||||
opts = opts or {}
|
||||
if self.opts.prompt.enabled and not M.is_search() then
|
||||
Prompt.set(self.pattern())
|
||||
if not M.is_search() then
|
||||
Prompt.set(self.pattern(), self.opts.prompt.enabled)
|
||||
end
|
||||
local actions = opts.actions or self.opts.actions or {}
|
||||
local c = self:get_char()
|
||||
@ -394,7 +388,7 @@ function M:step(opts)
|
||||
end
|
||||
|
||||
-- exit if no results and not in regular search mode
|
||||
if #self.results == 0 and not self.pattern:empty() and self.pattern.mode ~= 'search' then
|
||||
if #self.results == 0 and not self.pattern:empty() and self.pattern.mode ~= "search" then
|
||||
if self.opts.search.incremental then
|
||||
vim.api.nvim_input(c)
|
||||
end
|
||||
|
||||
@ -1 +1,4 @@
|
||||
std="vim"
|
||||
|
||||
[lints]
|
||||
mixed_table="allow"
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 100
|
||||
column_width = 120
|
||||
[sort_requires]
|
||||
enabled = true
|
||||
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
local M = {}
|
||||
|
||||
function M.root(root)
|
||||
local f = debug.getinfo(1, "S").source:sub(2)
|
||||
return vim.fn.fnamemodify(f, ":p:h:h") .. "/" .. (root or "")
|
||||
end
|
||||
|
||||
---@param plugin string
|
||||
function M.load(plugin)
|
||||
local name = plugin:match(".*/(.*)")
|
||||
local package_root = M.root(".tests/site/pack/deps/start/")
|
||||
if not vim.loop.fs_stat(package_root .. name) then
|
||||
print("Installing " .. plugin)
|
||||
vim.fn.mkdir(package_root, "p")
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--depth=1",
|
||||
"https://github.com/" .. plugin .. ".git",
|
||||
package_root .. "/" .. name,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
vim.cmd([[set runtimepath=$VIMRUNTIME]])
|
||||
vim.opt.runtimepath:append(M.root())
|
||||
vim.opt.packpath = { M.root(".tests/site") }
|
||||
M.load("nvim-lua/plenary.nvim")
|
||||
vim.env.XDG_CONFIG_HOME = M.root(".tests/config")
|
||||
vim.env.XDG_DATA_HOME = M.root(".tests/data")
|
||||
vim.env.XDG_STATE_HOME = M.root(".tests/state")
|
||||
vim.env.XDG_CACHE_HOME = M.root(".tests/cache")
|
||||
end
|
||||
|
||||
M.setup()
|
||||
@ -1,3 +0,0 @@
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/sh
|
||||
|
||||
nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests {minimal_init = 'tests//init.lua', sequential = true}"
|
||||
@ -8,42 +8,14 @@ any = true
|
||||
[jit]
|
||||
any = true
|
||||
|
||||
[[describe.args]]
|
||||
type = "string"
|
||||
[[describe.args]]
|
||||
type = "function"
|
||||
|
||||
[[it.args]]
|
||||
type = "string"
|
||||
[[it.args]]
|
||||
type = "function"
|
||||
|
||||
[[before_each.args]]
|
||||
type = "function"
|
||||
[[after_each.args]]
|
||||
type = "function"
|
||||
|
||||
[assert.is_not]
|
||||
[assert]
|
||||
any = true
|
||||
|
||||
[[assert.equals.args]]
|
||||
type = "any"
|
||||
[[assert.equals.args]]
|
||||
type = "any"
|
||||
[[assert.equals.args]]
|
||||
type = "any"
|
||||
required = false
|
||||
[describe]
|
||||
any = true
|
||||
|
||||
[[assert.same.args]]
|
||||
type = "any"
|
||||
[[assert.same.args]]
|
||||
type = "any"
|
||||
[it]
|
||||
any = true
|
||||
|
||||
[[assert.truthy.args]]
|
||||
type = "any"
|
||||
|
||||
[[assert.spy.args]]
|
||||
type = "any"
|
||||
|
||||
[[assert.stub.args]]
|
||||
type = "any"
|
||||
[before_each.args]
|
||||
any = true
|
||||
|
||||
Reference in New Issue
Block a user