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

Can't edit scrollback in neovim #2302

Closed
TheButlah opened this issue Mar 17, 2023 · 12 comments
Closed

Can't edit scrollback in neovim #2302

TheButlah opened this issue Mar 17, 2023 · 12 comments

Comments

@TheButlah
Copy link

TheButlah commented Mar 17, 2023

Basic information

❯ zellij --version
zellij 0.35.2
❯ stty size
48 105
❯ uname -av
Darwin ryan-macbook.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:46 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6020 arm64

List of programs you interact with:

❯ nvim --version
NVIM v0.8.3
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Ventura-arm64.local

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.8.3/share/nvim"

Run :checkhealth for more info

❯ starship --version
starship 1.13.1
branch:
commit_hash:
build_time:2023-03-10 23:42:58 -05:00
build_env:rustc 1.68.0 (2c8cc3432 2023-03-06),stable-aarch64-apple-darwin

Screenshot 2023-03-17 at 7 47 42 PM

Neovim config is the default one (i.e. no config).

❯ cat ~/.zshenv
. "$HOME/.cargo/env"
export EDITOR="$(which nvim)"

❯ cat ~/.zshrc
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

plugins=(
        git
        zsh-autosuggestions
)

source $ZSH/oh-my-zsh.sh

# Use starship prompt
eval "$(starship init zsh)"
# Open Zellij in every shell
eval "$(zellij setup --generate-auto-start zsh)"

Further information
The scrollback gets edited correctly when recording with asciinema and then opening zellij, but if I instead open zellij without asciinema recording, the scrollback edit just goes to an empty file:

Screenshot 2023-03-17 at 7 59 16 PM

I type :q to quit nvim, and get this:
Screenshot 2023-03-17 at 8 01 32 PM
Then I type it again, and it exits.

@imsnif
Copy link
Member

imsnif commented Mar 18, 2023

How did you set up neovim as your scrollback editor? could you paste the configuration here? Be it through $SHELL or through scrollback_editor?

@TheButlah
Copy link
Author

TheButlah commented Mar 18, 2023

How did you set up neovim as your scrollback editor? could you paste the configuration here? Be it through $SHELL or through scrollback_editor?

I used the $EDITOR env var, which I set in .zshenv

❯ cat ~/.zshenv
. "$HOME/.cargo/env"
export EDITOR="$(which nvim)"

@TheButlah
Copy link
Author

TheButlah commented Mar 26, 2023

Is there any further information I can provide?
I tried the same thing with Ctrl-x Ctrl-e in bash/zsh, and that works properly. So I believe the problem is in zellij and not my neovim.

@imsnif
Copy link
Member

imsnif commented Mar 27, 2023

On the flipside, this works perfectly for me and lots of other users - so I can point the finger the other way :)

I'd try to make the problem smaller to find out what the issue is. eg. make the path absolute rather than using a shell invocation with which. I believe you as the user are the best positioned person to get to the bottom of this. Apologies that I can't give you more direct help, this project is quite big with lots of users and I'm only one person.

@TheButlah
Copy link
Author

I'll try creating a more minimal reproducible example

@imsnif
Copy link
Member

imsnif commented Mar 31, 2023

I'm pretty sure this is now fixed in main, will be released in the next release.

@imsnif imsnif closed this as completed Mar 31, 2023
@TheButlah
Copy link
Author

TheButlah commented Apr 3, 2023

Installing the latest version of zellij from git (63d6711) did not solve this issue.

@imsnif
Copy link
Member

imsnif commented Apr 3, 2023

Could you please copy the literal string you're setting up as your editor? Otherwise it's just guesswork :)

@TheButlah
Copy link
Author

TheButlah commented Apr 3, 2023

I did some further exploration, and I've identified that the scrollback fails only when starship is used as the terminal prompt. Should I rename this issue or open a separate issue for that? Should I open an issue on starship's repo instead? I can't tell if its a zellij issue or a starship one.

ryan@ryan-macbook ~ % cat ~/.zshrc
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

plugins=(
        git
        zsh-autosuggestions
)

source $ZSH/oh-my-zsh.sh

# Use starship prompt. If the following line is uncommented, scrollback editing will fail.
# eval "$(starship init zsh)"
# Open Zellij in every shell
eval "$(zellij setup --generate-auto-start zsh)"

# enable vi keys
set -o vi

# Used by espressif toolchain for rust
source /Users/ryan/export-esp.sh

# Fast node manager
eval "$(fnm env --use-on-cd)"
ryan@ryan-macbook ~ % cat ~/.zshenv
. "$HOME/.cargo/env"
export VISUAL="/opt/homebrew/bin/nvim"
ryan@ryan-macbook ~ % zellij --version
zellij 0.36.0
ryan@ryan-macbook ~ % starship --version
starship 1.13.1
branch:
commit_hash:
build_time:2023-03-10 23:42:58 -05:00
build_env:rustc 1.68.0 (2c8cc3432 2023-03-06),stable-aarch64-apple-darwin
ryan@ryan-macbook ~ %

@TheButlah
Copy link
Author

TheButlah commented Apr 3, 2023

ok I reran the test, being sure to pkill zellij and fully exit the terminal between attempts. It looks like the issue is unrelated to starship, but rather is as you originally mentioned - its due to the $(which nvim) that was originally present in the .zshenv.

I think some environment variables must have still been in the zellij server when I attempted the previous message, which gave misleading results.

By starting from a truly clean slate with pkill, I only can reproduce the issue when I use export VISUAL="$(which nvim)". I'll just be sure to pass an absolute path in the future, I suppose.

Thanks for your patience, sorry for not being as thorough as I could be in my reproduction!

@imsnif
Copy link
Member

imsnif commented Apr 3, 2023

No worries, glad it's working. Would still be curious to know what was in that which nvim that was causing this

@TheButlah
Copy link
Author

TheButlah commented Apr 3, 2023

Typing which nvim evaluates to /opt/homebrew/bin/nvim, at least when I run it on the command line normally. Not sure if it has a different value when evaluated in the .zshenv script

I added echo $(which nvim) > /Users/ryan/tmp.txt in my .zshenv and it seems to evaluate to the same thing.

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

No branches or pull requests

2 participants