AckslD / nvim-neoclip.lua

Clipboard manager neovim plugin with telescope integration
944 stars 20 forks source link

Start neoclip in normal mode #74

Closed lars-vc closed 1 year ago

lars-vc commented 1 year ago

I had this binding and this used to start neoclip in normal mode, I don't really have a usecase for insert mode for neoclip since I never want to search in my clipboard history. But a bit ago this binding broke and it always starts in insert mode now. Is there any way to fix this? nnoremap <leader>fn <cmd>Telescope neoclip plus<cr><Esc>

AckslD commented 1 year ago

Hi @lars-vc! Is this the case only for the neoclip extension only or for all of Telescope?

AckslD commented 1 year ago

Also, when you say the binding broke, does it just not do anything or is there an error?

AckslD commented 1 year ago

This is probably related to the fact that telescope starts asynchronously. I had a similar issue when writing the tests where I had to but a small sleep between starting telescope and performing any key-presses. See for example: https://github.com/AckslD/nvim-neoclip.lua/blob/5520ad7b24b0c4bc0b5371eef2492e787aa59a3a/tests/plenary/neoclip_spec.lua#L317

AckslD commented 1 year ago

Possibly related https://github.com/nvim-telescope/telescope.nvim/issues/1939

lars-vc commented 1 year ago

Hi, thanks for the quick reply! It appears this is indeed the case for all of telescopes pickers (this is the only one I needed normal mode for) and ye there is no error, the escape just doesn't get executed in the picker. Ill look at the resources you provided and report back!

lars-vc commented 1 year ago

Mmmh, so it seems this can't be solved using what telescope provides, since the default settings don't apply to extensions. For example, setting a different layout_strategy for neoclip is also impossible. So using the on_complete is impossible. Telescope now also has an option called initial_mode to set the initial mode, but once again this only works for the default pickers. So I think something will need to be implemented in neoclip for this setting to work? Bit unfortunate that those settings don't get inherited automatically.

AckslD commented 1 year ago

Hmm I see, I'm not really an expert on telescope extensions so maybe I implemented something wrong :)

gabrielflorit commented 1 year ago

I love this plugin and would definitely like seeing an option to start it in normal mode.

zakpaw commented 1 year ago

I think I found a good solution!

:Telescope neoclip initial_mode=normal

Added in this issue: https://github.com/nvim-telescope/telescope.nvim/issues/409

lars-vc commented 1 year ago

I think I found a good solution!

:Telescope neoclip initial_mode=normal

Added in this issue: nvim-telescope/telescope.nvim#409

Have you found a way to get it working using this? I experimented with this when I created the issue and couldn't get it to work (can't get it to work rn either) Because the command you suggested just throws errors for me.

zakpaw commented 1 year ago

I think I found a good solution!

:Telescope neoclip initial_mode=normal

Added in this issue: nvim-telescope/telescope.nvim#409

Have you found a way to get it working using this? I experimented with this when I created the issue and couldn't get it to work (can't get it to work rn either) Because the command you suggested just throws errors for me.

I binded this command with another flag theme=dropdown to a key and everything works as intended - neoclip opens in normal mode. Maybe try updating?

lars-vc commented 1 year ago

Could you share the whole command? Because I get this image image And everything is updated

zakpaw commented 1 year ago

Could you share the whole command? Because I get this image image And everything is updated

Here: :Telescope neoclip plus theme=dropdown initial_mode=normal

Does :Telescope neoclip work at all for you? The error would suggest that you didn't install neoclip or didn't add it as telescope extension.

lars-vc commented 1 year ago

I swear to god it just magically works now????? Im just gonna accept it ig

zakpaw commented 1 year ago

Glad I could help :)

AckslD commented 1 year ago

Thanks both and happy to see that it is working :)