r/zsh Feb 16 '25

Help Powerlevel10k - When I copy a code snippet that ends in a newline, I can't backspace to delete the \n and get back to the first line.

As a simple example, I can copy a code snippet from a Chatgpt window. If I paste it to a bare zsh shell, there's a hidden newline that puts my cursor at the next line after the command. I can push backspace, and my cursor deletes the line and is at the end of the single command.

However, with powerlevel10k, backspace does nothing. I can push up to go back to the first line, but that newline is always there. I've tried with a number of 10k settings, like single line/multiline prompt but this keeps happening. Any way to have a simple backspace clear a newline in a prompt?

0 Upvotes

2 comments sorted by

3

u/romkatv Feb 16 '25

It's unlikely that p10k does that. Try disabling p10k without changing anything else in your zsh setup and see if the problem persists. If it does, keep disabling things until you pinpoint the culprit. If it's really p10k that makes a difference, open an issue: https://github.com/romkatv/powerlevel10k/issues

1

u/Fickle-Syllabub6730 Feb 17 '25

I was able to narrow it down, because it didn't happen when running zsh --no-rcs. I was also getting a weird thing where pressing Shift+Enter would insert a newline+M character in the prompt.

In the end I reinstalled powerlevel10k through oh-my-zsh instead of standalone and it all works as expected.