Skip to content

Commit

Permalink
Merge branch 'ibhagwan:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
towry authored Apr 14, 2024
2 parents 7aaa3da + 344b309 commit b39ffe3
Show file tree
Hide file tree
Showing 69 changed files with 5,690 additions and 1,832 deletions.
36 changes: 0 additions & 36 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

88 changes: 88 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: 🐞 Bug Report
description: File a bug/issue
labels: [bug]
title: "Bug: "
body:
- type: markdown
attributes:
value: |
**Before submitting an issue, please make sure to search the [Issues](https://github.com/ibhagwan/fzf-lua/issues)/[Discussions](https://github.com/ibhagwan/fzf-lua/discussions) and read the [Wiki](https://github.com/ibhagwan/fzf-lua/wiki) including the [Advanced section](https://github.com/ibhagwan/fzf-lua/wiki/Advanced) (if relevant)**
Many esoteric and lesser known options can be found by searching the above links, if you still have questions after that please use the [Discussions page](https://github.com/ibhagwan/fzf-lua/discussions), rest assured I will answer your quesion in the same priority as if it was an issue.
- type: checkboxes
attributes:
label: RTFM Checklist
description: |-
Please make sure to search the issues first and check only the relevant boxes below, if you don't think your issue is relevant to the Wiki/Advanced API or you aren't well versed in `fzf` (or unsure what that means) do not check these boxes, this mostly helps me understand where you're coming from so I can better assist you when troubleshooting.
options:
- label: I have searched exisiting issues / discussions
required: true
- label: I have read the Wiki including the Advanced section
required: false
- label: I have read `man fzf` / I am well versed in shell fzf
required: false
- type: input
attributes:
label: "Operating system"
placeholder: "e.g. Linux, Windows, Mac, etc"
validations:
required: true
- type: input
attributes:
label: "Shell"
placeholder: "e.g. bash, zsh, fish, etc"
validations:
required: true
- type: input
attributes:
label: "Neovim version (`nvim --version`)"
placeholder: "NVIM v0.10.0-dev-2739+ge2224a793"
validations:
required: true
- type: input
attributes:
label: "Fzf version (`fzf --version`)"
placeholder: "e.g. 0.48.1 (d579e33)"
validations:
required: true
- type: input
attributes:
label: "Output of `:lua print(os.getenv('FZF_DEFAULT_OPTS'))`"
placeholder: "e.g. --layout=reverse ..."
validations:
required: true
- type: checkboxes
attributes:
label: "Is the problem reproducible with `mini.sh`?"
description: |-
**Please mark a single checbox from the below options.**
Unless you're on Windows, you can quickly test fzf-lua with minimal config in its own sandbox by running the below command in the shell:
```sh
sh -c "$(curl -s https://raw.githubusercontent.com/ibhagwan/fzf-lua/main/scripts/mini.sh)"
```
options:
- label: My issue is reproducible with `mini.sh`
required: false
- label: My issue **IS NOT** reproducible with `mini.sh`
required: false
- label: I have not tested with `mini.sh` (not relevant, requires LSP, Windows, etc)
required: false

- type: textarea
id: config
attributes:
label: Fzf-lua configuration
description: Fzf-lua setup options
render: lua
value: |-
```lua
require('fzf-lua').setup({
})
```
- type: textarea
attributes:
label: Describe the bug / steps to reproduce
description: |-
Please describe your issue with as much details as you can, let me know what you've tested and your findings, bonus points if you can provide reproduction steps / code as this will help me get to the solution faster.
validations:
required: true
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question or start a discussion
url: https://github.com/ibhagwan/fzf-lua/discussions
about: Use Github discussions instead
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 💡 Feature Request
description: Suggest a new feature or improvement
labels: [feature request]
title: "Feature: "
body:
- type: markdown
attributes:
value: |
**Before submitting a feature request, please make sure to search the [Issues](https://github.com/ibhagwan/fzf-lua/issues)/[Discussions](https://github.com/ibhagwan/fzf-lua/discussions) and read the [Wiki](https://github.com/ibhagwan/fzf-lua/wiki) including the [Advanced section](https://github.com/ibhagwan/fzf-lua/wiki/Advanced) (if relevant)**
Many esoteric and lesser known options can be found by searching the above links, if you still have questions after that please use the [Discussions page](https://github.com/ibhagwan/fzf-lua/discussions), rest assured I will answer your quesion in the same priority as if it was an issue.
- type: checkboxes
attributes:
label: Have you RTFM'd?
description: Please search the issues/discussions and read the Wiki first
options:
- label: I have done proper research
required: true
- type: textarea
id: feature
attributes:
label: Feature Request
description: |-
Please describe your request with as much details as you can. Helpful examples can include how your request works in other plugins/software as well as links to discussions/issues and implementation details if such exist.
validations:
required: true
2 changes: 1 addition & 1 deletion .github/workflows/luarocks-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Get new commit count
run: echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_ENV
- name: LuaRocks Upload
uses: nvim-neorocks/luarocks-tag-release@v3
uses: nvim-neorocks/luarocks-tag-release@v5
if: ${{ env.NEW_COMMIT_COUNT > 0 }}
env:
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/sync_remote.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on: [push, delete]

jobs:
push:
runs-on: ubuntu-latest
if: github.repository == 'ibhagwan/fzf-lua'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sync remote repositories
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GIT_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
# Ignore hosts keys, since we accept them as-is
git config --global core.sshCommand 'ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
# Codeberg
git remote add codeberg ssh://[email protected]/ibhagwan/fzf-lua.git
git push --tags --force --prune codeberg 'refs/remotes/origin/*:refs/heads/*'
# GitLab
git remote add gitlab ssh://[email protected]/ibhagwan/fzf-lua.git
git push --tags --force --prune gitlab 'refs/remotes/origin/*:refs/heads/*'
39 changes: 0 additions & 39 deletions .luarc.json

This file was deleted.

31 changes: 31 additions & 0 deletions .luarc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
"runtime.version": "LuaJIT",
"diagnostics": {
"enable": true,
"globals": ["vim"],
"neededFileStatus": {
"codestyle-check": "Any"
},
"disable": ["need-check-nil", "missing-parameter", "cast-local-type"]
},
"workspace": {
"library": [
"lua",
"$VIMRUNTIME/lua",
"${3rd}/luv/library",
"$XDG_DATA_HOME/nvim/lazy/plenary.nvim/lua",
"$LOCALAPPDATA/nvim-data/lazy/plenary.nvim/lua"
],
"checkThirdParty": false,
"maxPreload": 2000,
"preloadFileSize": 1000,
"ignoreDir": ["tests/"]
},
"type": {
"weakNilCheck": true,
"weakUnionCheck": true,
"castNumberToInteger": true
},
"telemetry.enable": false
}
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ PLENARY-REPO=https://github.com/nvim-lua/plenary.nvim.git

.PHONY: test
test:
nvim --headless --noplugin -u tests/minimal_init.vim -c "lua require('plenary.test_harness').test_directory('tests/', { minimal_init = 'tests/minimal_init.vim', sequential = true, timeout = 120000 })"
nvim --headless --noplugin -u tests/minimal_init.lua -c "lua require('plenary.test_harness').test_directory('tests/', { minimal_init = 'tests/minimal_init.lua', sequential = true, timeout = 120000 })"

# run with `make FILE=tests/path_spec.lua test-file`
.PHONY: test-file
test-file:
nvim --headless --noplugin -u tests/minimal_init.vim -c "lua require('plenary.busted').run(vim.loop.cwd()..'/'..[[$(FILE)]])"
nvim --headless --noplugin -u tests/minimal_init.lua -c "lua require('plenary.busted').run(vim.loop.cwd()..'/'..[[$(FILE)]])"


.PHONY: plenary
Expand All @@ -18,5 +19,5 @@ plenary:
git clone $(PLENARY-REPO) $(PLENARY-DIR); \
else \
echo "Updating plenary.nvim..."; \
git -C $(PLENARY-DIR) pull; \
git -C $(PLENARY-DIR) pull --rebase; \
fi
57 changes: 57 additions & 0 deletions README-Win.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## Windows Known Issues and Limitations

As fzf-lua is bound by the same constraints, please read
[fzf's Windows Wiki page](https://github.com/junegunn/fzf/wiki/Windows).

It took a lot of work to make everything work exactly as it does on *NIX/OSX.
Fzf-lua attempts to overcome inherent fzf Windows woes (escaping, etc) by using
our command proxy wrapper and working around the issues using lua code.

### Single quotes in commands / options

On Windows, single quotes `'` in command arguments are treated as a string literal,
that means that wrapping arguments with single quotes does not translate into a single
string the same way a double quoted argument is treated, i.e. `'foo bar' != "foo bar"`.

To avoid issues, make sure none of your `cmd`'s `rg_opts`, `fd_opts`, `preview`, etc
contains single hyphens that should be treated as quotes, this is probably the case
if you copied old fzf-lua defaults into your `setup` options.

### live_grep_native

When using `live_grep_native` we are sending the `rg` command directly
to fzf (without the fzf-lua wrapper) and are therefore bound by fzf's escaping
requirements.

For example, `^` is a special escape character on windows and also a regex special
character. Say we wanted to search for all lines that start with "local", we would
run:
```lua
-- we use `no_esc` to tell rg we're using a regex
:FzfLua live_grep no_esc=true search=^local
```

However, when using the native version we need to escape the caret twice:
```lua
:FzfLua live_grep no_esc=true search=^^local
```

More so, I couldn't find a way to send special regex chars `[(|.*^$` as the backslash
is always doubled by fzf's `{q}`<sub><sup>&ast; see bottom note</sup></sub>.

For example, if we run:
```cmd
break | fzf --ansi --disabled --bind="change:reload:rg --line-number --column --color=always {q}"
```

And try to search for the literal `[` by typing `\[`, we get the error:
```
[Command failed: rg --line-number --column --color=always ^"\\[^"]
```

If we double the blackslashes by typing `\\[` we get the error:
```
[Command failed: rg --line-number --column --color=always ^"\\\\[^"]
```

<sub><sup>&ast; upstream issue: https://github.com/junegunn/fzf/issues/3626</sup></sub>
Loading

0 comments on commit b39ffe3

Please sign in to comment.