-
Notifications
You must be signed in to change notification settings - Fork 18
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
Run vim commands inside yazi.nvim #547
Comments
I also have another idea that might work for your use case 🙂 hold on a bit |
Expose the current working directory as `NVIM_CWD` so that yazi keybindings can use it to offer basic neovim specific functionality when running yazi inside neovim with yazi.nvim. Reference: #547
Expose the current working directory as `NVIM_CWD` so that yazi keybindings can use it to offer basic neovim specific functionality when running yazi inside neovim with yazi.nvim. Reference: #547
Expose the current working directory as `NVIM_CWD` so that yazi keybindings can use it to offer basic neovim specific functionality when running yazi inside neovim with yazi.nvim. Reference: #547
This was implemented in mikavilpas/yazi.nvim#547
Ok, I added a way to get the nvim current working directory to be available to yazi keymappings. I added an example of using it here in my own config feat(yazi): gr uses NVIM_CWD when available |
If it's just communication from Yazi ==> yazi.nvim, maybe DDS would be more convenient. With a key press in Yazi, run a shell command: { on = '<C-t>', run = 'shell "ya pub my-message" --confirm' } And if the user has registered an event for that |
Oh that's a great idea - I can't believe I forgot about that possibility. I'll implement support for that later, I think. 👍🏻 |
Thanks so much for adding that feature! It's really helpful to have the current working directory in Yazi key mappings. Great work! |
> note: DDS means "Data Distribution Service". It's a way for yazi to > communicate with neovim and other processes. > > https://yazi-rs.github.io/docs/dds Issue ===== Yazi is incredibly versatile and can be used for many different things. However, it's too difficult to predict what the needs of every user will be. Power users have no easy way to extend the behaviour of yazi.nvim beyond the features that are built-in. Solution ======== Allow users to subscribe to custom yazi DDS events. These events are possibly not included in yazi by default, but can be published by yazi plugins or by yazi itself. By default, all custom events are ignored. The user can specify which events they want to listen to by setting a new `forwarded_dds_events` (string[], default nil) config option. When an event whose kind is included in this `forwarded_dds_events` list is received, yazi.nvim will emit a neovim autocmd event with the name `YaziDDSCustom`. The event will contain the `type` of the event and the `raw_data` as a string. The user can then set up custom handlers for these events in their neovim config. Solves #547
> note: DDS means "Data Distribution Service". It's a way for yazi to > communicate with neovim and other processes. > > https://yazi-rs.github.io/docs/dds Issue ===== Yazi is incredibly versatile and can be used for many different things. However, it's too difficult to predict what the needs of every user will be. Power users have no easy way to extend the behaviour of yazi.nvim beyond the features that are built-in. Solution ======== Allow users to subscribe to custom yazi DDS events. These events are possibly not included in yazi by default, but can be published by yazi plugins or by other applications using yazi's DDS system. By default, all custom events are ignored. The user can specify which events they want to listen to by setting a new `forwarded_dds_events` (string[], default nil) config option. When an event whose kind is included in this `forwarded_dds_events` list is received, yazi.nvim will emit a neovim autocmd event with the name `YaziDDSCustom`. The event will contain the `type` of the event and the `raw_data` as a string. The user can then set up custom handlers for these events in their neovim config. Solves #547
> note: DDS means "Data Distribution Service". It's a way for yazi to > communicate with neovim and other processes. > > https://yazi-rs.github.io/docs/dds Issue ===== Yazi is incredibly versatile and can be used for many different things. However, it's too difficult to predict what the needs of every user will be. Power users have no easy way to extend the behaviour of yazi.nvim beyond the features that are built-in. Solution ======== Allow users to subscribe to custom yazi DDS events. These events are possibly not included in yazi by default, but can be published by yazi plugins or by other applications using yazi's DDS system. By default, all custom events are ignored. The user can specify which events they want to listen to by setting a new `forwarded_dds_events` (string[], default nil) config option. When an event whose kind is included in this `forwarded_dds_events` list is received, yazi.nvim will emit a neovim autocmd event with the name `YaziDDSCustom`. The event will contain the `type` of the event and the `raw_data` as a string. The user can then set up custom handlers for these events in their neovim config. Solves #547
Ok, I implemented support for this today. I also implemented a pretty cool integration test setup for this, which I'm happy about 🙂 @sxyazi If you don't mind, I would like to ask a question for clarification. I could not get sending the event with [[manager.prepend_keymap]]
on = "<C-e>"
run = """shell 'ya pub MyMessageNoData 2>&1 > ~/Desktop/output.txt' --confirm""" Do you think I might have misunderstood something, or could this be a bug of some kind? edit: the commands that worked can be seen here https://github.com/mikavilpas/yazi.nvim/blob/f8a1f1a5905e5a724ff90f2e2e7d11d246ac11d6/integration-tests/test-environment/.config/yazi/keymap.toml |
Ah, you're right, it should be
|
This command functions effectively in Neovim when yazi.nvim is not open. Is there a method to execute this command while yazi.nvim is open, or to achieve similar functionality using a different key mapping/yazi plugin while yazi.nvim is open? Or can I use vim apis inside yazi plugins?
The text was updated successfully, but these errors were encountered: