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

Feature: layout similar to Telescopes .get_cursor() layout for spelling, LSP actions etc #1356

Closed
1 task done
benfrain opened this issue Jul 25, 2024 · 9 comments
Closed
1 task done
Labels
feature request New feature

Comments

@benfrain
Copy link

benfrain commented Jul 25, 2024

Have you RTFM'd?

  • I have done proper research

Feature Request

Recently swapped to fzf-lua and like it a lot. The only thing I really miss from Telescope is its get_cursor() theme option which is cursor relative and pops up a smaller window to select from. It is great for spelling suggestions and LSP code actions. Wonder if that is something that could potentially be added? Here is the original issue for the feature on Telescope: nvim-telescope/telescope.nvim#878

@benfrain benfrain added the feature request New feature label Jul 25, 2024
@ibhagwan
Copy link
Owner

Already exists: :FzfLua <xxx> winopts.relative=cursor

@benfrain
Copy link
Author

Already exists: :FzfLua <xxx> winopts.relative=cursor

Is this in the docs? Just tried and it doesn't seem to do anything

km.set(
  "n",
  "<leader>s",
  ':lua require("fzf-lua").spell_suggest({ winopts = { relative = cursor } })',
  { desc = "Spell Suggesting" }
)

@ibhagwan
Copy link
Owner

Already exists: :FzfLua <xxx> winopts.relative=cursor

Is this in the docs? Just tried and it doesn't seem to do anything

km.set(
  "n",
  "<leader>s",
  ':lua require("fzf-lua").spell_suggest({ winopts = { relative = cursor } })',
  { desc = "Spell Suggesting" }
)

Not in the docs but can be found in issues, it’s an argument to nvim_open_win, the way you set it up won’t work you have no variable named cursor, winopts.relative is a string argument so you have to wrap cursor in single or double quotes, i.e 'cursor'

@ibhagwan
Copy link
Owner

See #545 (comment)

@benfrain
Copy link
Author

benfrain commented Jul 25, 2024

That's perfect, thanks. Just in case it helps future travellers, here is some copy and paste goodness:

Spelling

vim.keymap.set(
  "n",
  "<leader>s",
  ":lua require'fzf-lua'.spell_suggest({ winopts = {relative='cursor',row=1.01, col=0, height=0.2, width=0.2} })<cr>",
  { desc = "Spelling Suggestions" }
)

Code Actions

vim.keymap.set(
  "n",
  "<leader>ca",
    ":lua require'fzf-lua'.lsp_code_actions({ winopts = {preview={hidden='hidden'},relative='cursor',row=1.01, col=0, height=0.2, width=0.4} })<cr>",
  { desc = "Code Actions" }
)

@ibhagwan
Copy link
Owner

Ty @benfrain

@benfrain
Copy link
Author

By the way, just recorded a video on migrating from Telescope to FZF-LUA https://youtu.be/pJincazaOaw

@ibhagwan
Copy link
Owner

By the way, just recorded a video on migrating from Telescope to FZF-LUA https://youtu.be/pJincazaOaw

Great video @benfrain! While quickly skimming through I think you make a good case for changing the defaults for at least spell suggest to be relative to cursor.

LSP code actions might be a bit different as some might like a bigger window due to the preview of text edits.

@ibhagwan
Copy link
Owner

@benfrain, 1ac27d5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature
Projects
None yet
Development

No branches or pull requests

2 participants