Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: (picker) iskeyword not set in help pages #791

Closed
4 tasks done
spreiter opened this issue Jan 30, 2025 · 5 comments · Fixed by #793 or #728
Closed
4 tasks done

bug: (picker) iskeyword not set in help pages #791

spreiter opened this issue Jan 30, 2025 · 5 comments · Fixed by #793 or #728
Labels
bug Something isn't working

Comments

@spreiter
Copy link

spreiter commented Jan 30, 2025

Did you check docs and existing issues?

  • I have read all the snacks.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of snacks.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.11.0-dev-1641+gc7d4a77ff9

Operating system/version

MacOs 15.3

Describe the bug

When I use the picker to search for help, I works nicely, when I open with <CR>. However, if I use <C-s> or <C-v> (default picker keys), the edit_split() and edit_vsplit() seem to behave differently (also edit_tab() is affected). I am not able to follow tags in the help using <C-]>. It turned out that the iskeyword value is not set correctly for those files. The only exception is the main help file, because it has the correct value in the modeline.

This is, how it should be

  iskeyword=!-~,^*,^|,^",192-255

This is what I get out of the value:

  iskeyword=@,48-57,_,192-255

Remark: Using the default way (:h HELPTAG) works correctly as well.

Steps To Reproduce

  1. Open Snacks.picker.help() (with config just <leader>sh)
  2. Use <C-v> or <C-s> to open the selected help file in a split window (still in insert mode)
  3. Check with :verbose set isk

Expected Behavior

iskeyword is correctly set and following tags works.

Repro

-- vim: ts=2 sts=2 sw=2 et
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    {
      "folke/snacks.nvim",
      opts = {
        picker = {
          enabled = true,
          win = {
            -- input window
            input = {
              keys = {
                ['<C-t>'] = { 'edit_tab', mode = { 'i', 'n' } },
              },
            },
          },
        },
      },
      keys = {
        { "<leader>sh", function() Snacks.picker.help() end },
        { '<leader>sn', function() Snacks.picker.files({ cwd = vim.fn.stdpath 'config' }) end },
      },
    },
  },
})
@spreiter spreiter added the bug Something isn't working label Jan 30, 2025
folke added a commit that referenced this issue Jan 30, 2025
@folke folke linked a pull request Jan 30, 2025 that will close this issue
@folke folke closed this as completed in 3564f4f Jan 30, 2025
@spreiter
Copy link
Author

spreiter commented Jan 30, 2025

Thanks. However this call fails on my system.

3564f4f#diff-2462717a8356d82838c600767a44ce8270c21a51e9f636496e54b24073e31c90R376

  dd("help")

Edit:
After deleting this line, vsplit and tab don't work at all.

Edit2:
tab opens in a new tab, but then applies the usual split similar when directly calling :help.

@folke
Copy link
Owner

folke commented Jan 30, 2025

Removed. Was left-over debug.
I actually have a github action that checks for that, but it doesn't seem to work. ha

@spreiter
Copy link
Author

I think splitting it in 2 commands is not suitable. In case of help one would have to concat the commands somehow. Calling :vertical help snacks.nvim.txt works correctly. So adjusting function M.help(picker) in picker/action.lua:355. Is it possible to store some prefix? I am trying to dig through the code, but am still struggling..

@folke
Copy link
Owner

folke commented Jan 30, 2025

I don't get it. Just tested this all again and it works how it should.

@spreiter
Copy link
Author

It does set iskeyword correctly, yes. But both edit_split <C-s> and edit_vsplit <C-v> open it as if there is no split command in advance. And after mapping <C-t> to edit_tab (updated the config above), this is done in a new tab, but only half the window is used.

If this is currently different for you, then I am also not sure. I am running the nightly version of Neovim. Could this be an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants