Comments (6)
in terms of supporting command pass-through I haven't yet figured out a way to do that
This is such a great coincidence, I was about to post this in a discussion thread, but I think it's relevant enough to post it here.
I'm looking to solve a very similar problem, and I found a way to read all the arguments passed to the nested nvim instance.
I'm using the v:argv
variable, which sounds the same as the argv
function, exept that v:argv
includes way more data.
For example, when open neovim in diff mode:
nvim -d file-a.txt file-b.txt
I get the following through vim.v.argv
:
{ "<HOME>/.nix-profile/bin/nvim",
"--cmd", "let g:loaded_node_provider=0 | let g:loaded_python_provider=0 | let g:python3_host_prog='/nix/store/2j5i0n338vrw9w1jwhmfgfxhnbncr27h-neovim-0.8.1/bin/nvim-python3' | let g:ruby_host_prog='/nix/store/2j5i0n338vrw9w1jwhmfgfxhnbncr27h-neovim-0.8.1/bin/nvim-ruby'",
"--cmd", "set packpath^=/nix/store/vncf2y1mpg3m8iii6dngmjvsinb732sg-vim-pack-dir",
"--cmd", "set rtp^=/nix/store/vncf2y1mpg3m8iii6dngmjvsinb732sg-vim-pack-dir",
"-d", "file-a.txt", "file-b.txt" }
Which gets lets me know that -d
was trying to start a diff mode for the passed files.
I haven't figured out how to get only the commands actually passed by the user. But for the time being, that does what I need.
See my fork: davidmh@311b4a2
And this is how I use it: https://github.com/davidmh/dot-files/blob/main/nvim/fnl/own/plugin/flatten.fnl#L20-L30
Some things I haven't worked through, which I like to address before sending a PR:
- Get the actual commands passed by the user, not the extra commands shown in the output
- Have options like
-b
automatically enable blocking, or just let the nested session run as usual.
In my use case, the diff mode is meant to be used with the approvals.
It could be an option like:
{
ignore_for_options = {'-b'}
}
What do you think?
from flatten.nvim.
Thank you so much! That's super helpful, will look through your fork and get working on integrating v:argv tomorrow.
As far as a PR goes, that would be very welcome, but I would like to avoid adding argument flags that aren't already Neovim args, so that using flatten is as much like using default Neovim as possible. I would consider adding args for specific use cases such as blocking if enough people seem to prefer that to setting a global though, so if you submit a PR it would be ideal for the functionality to be enabled by a global or module-local var instead of an argument directly, so that I/we can decide on which direction to go in based on how the general user base responds to the idea.
Thanks!
from flatten.nvim.
Yes, sorry, I should've been more clear - I meant that I'd like to keep all arguments the same functionally as well as semantically, but it seems like including that but
allowing users to opt out through a config option would work very well. Thank you for contributing, I'll review the PR today!
from flatten.nvim.
This is something I've been looking into - definitely Manpage support is something I could hard code as an edge case, but in terms of supporting command pass-through I haven't yet figured out a way to do that. I am actively looking though and will absolutely implement that when I'm able.
I'll look for a solution for manpages in the short term though, thanks for reporting!
Until then, probably best to just use Man <topic>
from the parent instance's command-line.
from flatten.nvim.
That makes sense, maybe a better way to enable blocking programmatically would be to introduce a callback function to determine the blocking before the files are sent from within the nested session.
from flatten.nvim.
As far as a PR goes, that would be very welcome, but I would like to avoid adding argument flags that aren't already Neovim args, so that using flatten is as much like using default Neovim as possible
I'm just re-reading this. The flag I mentioned (-b) already exists in neovim, what I was proposing was to opt out of flatten through a config option in the flatten config. The user would start neovim as they always do.
I'll tune up the fork to include a new callback: config.callbacks.should_block(vim.v.argv)
to be used as a fallback to vim.g.flatten_wait
.
I would be happy to also work on dispatching other commands, like the +Man something
in this issue.
from flatten.nvim.
Related Issues (20)
- Customizable host address detection HOT 3
- Strange behavior when using git rebase in toggleterm with flatten.nvim HOT 7
- Bug with plugins that automatically change cwd
- Provide options for when Wezterm/kitty windows should nest HOT 7
- [Bug] File opened in another nvim instance HOT 7
- Commits on August 10 Don't respect the window --> open setting HOT 1
- Use `v:parent` channel if/when merged
- When there is space in the filename the filename passed to neovim is escaped HOT 2
- Use vim.rpc* instead of vim.fn.rpc*
- Should `wezterm` and `kitty` integration be disabled by default?
- Todo: separate remote file and remote command logic
- Todo: Use libuv and async for pipes where possible
- Option to return to the terminal after closing a file HOT 19
- Combining with `gf` HOT 3
- Breaking changes on main (flatten.nvim 1.0.0)
- How to avoid swap file warning E325? HOT 1
- Support quickfix mode HOT 6
- `nvim --cmd 'let g:flatten_wait=1' file1` does not work, neither does `-b` HOT 17
- Option to have wezterm only flatten if in the same pane HOT 1
- Doesn't seem to work when using tmux inside of the nested terminal HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flatten.nvim.