Open simonhughxyz opened 6 months ago
Mind providing some more info / filling out the bug report form properly?
I can't really debug this if the only info I have is "it doesn't work."
Mind providing some more info / filling out the bug report form properly?
I can't really debug this if the only info I have is "it doesn't work."
Sorry, I accidentally pressed save before I was finished
No worries, thanks for the info!
I'll look into this ASAP :)
Ah, so you're expecting flatten to allow a nested instance when you use nvim -b
? That's not the intended behavior - what should happen here is that the files will be opened in your current instance, and the nested instance will block until the file is closed.
Ah, so you're expecting flatten to allow a nested instance when you use
nvim -b
? That's not the intended behavior - what should happen here is that the files will be opened in your current instance, and the nested instance will block until the file is closed.
Ok I misunderstood that, but even that functionality does not work. There is no blocking at all.
To be clear, I am trying to use it with password-store to edit my pass files, I thought the -b
option was supposed to solve that issue.
When running EDITOR="nvim --cmd 'let g:flatten_wait=1'" pass edit test
neovim returns a bunch of errors:
Error detected while processing pre-vimrc command line:
E20: Mark not set: 'let
[null-ls] failed to load builtin eslint for method diagnostics; please check your config
Error detected while processing BufEnter Autocommands for "*":
Error executing lua callback: Error executing lua: ....local/share/nvim/lazy/flatten.nvim/lua/flatten/core.lua:125: nvim_exec2(): Vim:E
20: Mark not set: 'let
stack traceback:
[C]: in function 'nvim_exec2'
....local/share/nvim/lazy/flatten.nvim/lua/flatten/core.lua:125: in function <....local/share/nvim/lazy/flatten.nvim/lua/flatte
n/core.lua:93>
stack traceback:
[C]: in function 'exec_on_host'
...local/share/nvim/lazy/flatten.nvim/lua/flatten/guest.lua:59: in function 'send_files'
...local/share/nvim/lazy/flatten.nvim/lua/flatten/guest.lua:149: in function <...local/share/nvim/lazy/flatten.nvim/lua/flatten
/guest.lua:99>
Hmm, it looks like the command isn't being passed properly, but I should look into those errors too. Have you tried it with the environment variable set beforehand?
Like
export EDITOR='nvim --cmd "let g:flatten_wait=1"'
pass edit test
Also, I think you should be using $VISUAL
for this, since that is the editor that will be used for blocking commands as far as I know.
Does not work with export
or $VISUAL
.
However the error only appears when using EDITOR="nvim --cmd 'let g:flatten_wait=1'" pass edit test
the other options don't produce an error, the file opens but the command continues to run with to blocking.
Setting let g:flatten_wait=1
within the root terminal manually does not work either.
Ok, can repro using pass
specifically. I will look into this more now, thanks for clarifying!
pass
seems to user $EDITOR
, not $VISUAL
unlike git and some others.
Also, just a suggestion but it would be nice to also have a option to allow nesting when needed
Try EDITOR='nvim -b' pass edit test
. That works for me. I will look into this... it's confusing because usually blocking edits use $VISUAL
in my experience...
Also, just a suggestion but it would be nice to also have a option to allow nesting when needed
There is :) Check out the nest_if_no_args
option and should_nest()
hook.
Try
EDITOR='nvim -b' pass edit test
. That works for me. I will look into this... it's confusing because usually blocking edits use$VISUAL
in my experience...
It works but before I close the buffer the terminal buffer has this error:
[null-ls] failed to load builtin eslint for method diagnostics; please check your config
Error detected while processing BufEnter Autocommands for "*":
Error executing lua callback: ...local/share/nvim/lazy/flatten.nvim/lua/flatten/guest.lua:25: Vim:Error executing vim.schedule lua call
back: vim/_editor.lua:0: Vim:Failed to run `config` for nvim-dap
stack traceback:
[C]: in function 'nvim_exec2'
vim/_editor.lua: in function 'cmd'
...vim/lazy/todo-comments.nvim/lua/todo-comments/config.lua:187: in function 'colors'
...vim/lazy/todo-comments.nvim/lua/todo-comments/config.lua:133: in function '_setup'
...vim/lazy/todo-comments.nvim/lua/todo-comments/config.lua:92: in function ''
vim/_editor.lua: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
[C]: in function 'sleep'
...local/share/nvim/lazy/flatten.nvim/lua/flatten/guest.lua:25: in function 'maybe_block'
...local/share/nvim/lazy/flatten.nvim/lua/flatten/guest.lua:60: in function 'send_files'
...local/share/nvim/lazy/flatten.nvim/lua/flatten/guest.lua:149: in function <...local/share/nvim/lazy/flatten.nvim/lua/flatten
/guest.lua:99>
stack traceback:
[C]: in function 'sleep'
...local/share/nvim/lazy/flatten.nvim/lua/flatten/guest.lua:25: in function 'maybe_block'
...local/share/nvim/lazy/flatten.nvim/lua/flatten/guest.lua:60: in function 'send_files'
...local/share/nvim/lazy/flatten.nvim/lua/flatten/guest.lua:149: in function <...local/share/nvim/lazy/flatten.nvim/lua/flatten
/guest.lua:99>
Error executing lua callback: .../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:754: Invalid window id: -1
stack traceback:
[C]: in function 'nvim_win_get_cursor'
.../.local/share/nvim/lazy/neorg/lua/neorg/core/modules.lua:754: in function 'create_event'
...azy/neorg/lua/neorg/modules/core/autocommands/module.lua:49: in function '_neorg_module_autocommand_triggered'
...azy/neorg/lua/neorg/modules/core/autocommands/module.lua:77: in function <...azy/neorg/lua/neorg/modules/core/autocommands/m
odule.lua:76>
Hmm, alright. That might be tough for me to repro because it's largely errors from other plugins, but I will try. Seems like they don't like the editor actually blocking. Maybe I can just make it wait without blocking instead.
Btw I will probably make any future changes to the 1.0-dev
branch, so I would suggest using that branch for now if you're comfortable updating your config. Configuration in that branch isn't likely to change much after the breaking changes that I've already made, but the features I want for 1.0 aren't fully complete yet. Config is fully typed and documented in that branch, so should make things easier if you're using lua_ls
.
I can't promise there there won't be breaking changes on that branch until it's merged though, so up to you if you want to switch of course.
https://github.com/willothy/flatten.nvim/issues/95#issuecomment-1979816682
Not sure if related, just wanted to share this with you guys, perhaps it might help!
I faced this exact error whenever I tried to open a file from ranger
.
Ranger has something like this to open text files -> ${VISUAL:-$EDITOR} -- "$@"
Issue is that, nvim --cmd 'let g:flatten_wait=1'
this whole thing was getting treated as command instead of command + arg.
So I had to change my config to -> eval ${VISUAL:-$EDITOR} -- "$@"
so that only nvim
is treated as command and everything else as argument.
Describe the bug None of the blocking options work
To Reproduce Steps to reproduce the behavior:
Expected behavior To allow nested instances
Screenshots NA
Minimal Init
Desktop (please complete the following information):
Additional context I'm using toggle term