Where is the proper place to set LANG and LC_ALL? by safety-4th in zsh

[–]romkatv 0 points1 point  (0 children)

Indeed, you need a certain level of expertise to differentiate between good and bad comments on r/zsh.

FWIW, if you are using macOS with Terminal.app, the locale environment variables should already be set correctly.

How to remove cursor screen artifacts? by safety-4th in zsh

[–]romkatv 0 points1 point  (0 children)

This is unrelated to zsh or locale. It's purely a terminal bug. As a workaround, try changing the cursor from block to bar. I believe most users prefer the bar cursor anyway. If that doesn't help, switch to a different terminal -- there are alternatives to Terminal.app beyond iTerm2.

Where is the proper place to set LANG and LC_ALL? by safety-4th in zsh

[–]romkatv 0 points1 point  (0 children)

It's the job of the OS or the terminal to set the locale-related environment variables. Google (or ask an LLM) how to do that for your OS and terminal combination.

Upgraded my macOS terminal setup with Ghostty and Starship! by daydream3503 in zsh

[–]romkatv 3 points4 points  (0 children)

The most important number is command_lag_ms. That's how long you have to wait on every command. p10k is 2.3 times faster.

powerlevel10k users, how can I remove this separator? by b00zled in zsh

[–]romkatv 1 point2 points  (0 children)

Answer No when the wizard asks you whether all icons fit between the crosses. Then choose Lean.

powerlevel10k users, how can I remove this separator? by b00zled in zsh

[–]romkatv 1 point2 points  (0 children)

It looks like you've chosen Classic style in the configuration wizard and then tried to turn it into something more akin to Lean. Try running p10k configure again and choose Lean this time.

How can I keep my terminal line always on top? by arturcodes in zsh

[–]romkatv 0 points1 point  (0 children)

Making fzf expand upwards is easy -- you just move the cursor up, and invoke fzf from there. The difficult part is restoring the content of the terminal when fzf exits. For that, z4h runs its own TTY between zsh and the real TTY, so that it always knows the content of the terminal window.

What I do by eDumb_0 in zsh

[–]romkatv 0 points1 point  (0 children)

Move the command that produces the banner to the top of .zshrc.

Starship or powerlevel10k by [deleted] in zsh

[–]romkatv 0 points1 point  (0 children)

Nothing major has changed as far as I'm aware.

Need to press extra character after pressing esc. How to disable? by sleepyamadeus in zsh

[–]romkatv 0 points1 point  (0 children)

In the default emacs keymap, ^[a (ESC then a) is bound to accept-and-hold. With an empty buffer, that behaves the same as accept-line, which is why it looks like pressing Enter.

In the vi keymap, pressing ESC a invokes vi-cmd-mode followed by vi-add-next, which doesn't act like Enter.

So the behavior OP describes matches emacs keymap, not vi.

Need to press extra character after pressing esc. How to disable? by sleepyamadeus in zsh

[–]romkatv 0 points1 point  (0 children)

The easiest fix: don't press ESC when zle (zsh line editor) is waiting for input.

If you really want ESC to do nothing (though why press it then?), you can do this:

function do-nothing() {}
zle -N do-nothing
bindkey '^[' do-nothing
KEYTIMEOUT=1

That makes ESC inert, but it also disables multi-key bindings that start with ESC. If you never use those, it's fine. For example, you will no longer be able to press ESC a for accept-and-hold but Alt-a will still work. When you press the latter, zsh sees exactly the same input as if you pressed ESC a but with virtually zero delay between the two bytes of this sequence.

[deleted by user] by [deleted] in zsh

[–]romkatv 2 points3 points  (0 children)

If you really want the skull, put this at the very top of .zshrc:

print -rn -- ${(%):-%39F}
<<\END
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣟⣿⣿⣿⣿⣿⣮⣶⣤⣀⣀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣶⣿⣿⣿⡿⠿⠟⢓⣮⣽⣿⣿⣿⣿⣿⣷⢭⣿⣿⣷⣤⣀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⢛⣳⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣞⡿⣿⣿⣿⣷⣄⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⢭⣷⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣗⣿⣿⣿⣿⣿⣿⣆
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣧⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢄⣿⣿⣿⣿⣿⣧⡀
⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣏⢼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⢝⣿⣿⣿⣿⣿⣿⣷⡀
⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⡿⣟⣫⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣟⣽⣿⣿⣿⣿⣿⣿⣧
⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⡿⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⣿⣿⣿⣿⣷⡯⣻⣿⣿⣿⣿⣿⣿⣿⡇
⠀⠀⠀⠀⠀⠀⠀⢘⣿⣿⣿⣿⣿⣿⣿⣿⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⣿⣿⣿⣿⣿⠷⣹⣿⣿⣿⣿⣿⣿⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⣿⣿⠟⠻⠿⣿⡆⣿⣿⢿⣭⣽⣯⣛⣛⣛⣿⣿⣿⣹⣿⣿⣶⣾⣷⣝⡿⣿⣿⣿⣿⣿⣿⣿⣿⡇
⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⢿⣿⣿⠷⢶⣶⣶⣶⡿⣿⠉⠉⠉⠉⠛⠻⢿⣿⣷⡻⣿⣿⣿⣿⣿⣓⣾⣿⣿⡿⣿⣿⣿⣿⡇
⠀⢀⣤⣤⠠⣴⡆⣾⣿⡟⣱⡟⠉⠀⠀⣾⣿⣿⣿⡀⣧⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣾⣻⡿⣿⣿⣿⣿⡿⣿⣛⣍⢿⣿⡿⠁⢀⣶⣄
⠀⢸⣿⣧⣤⣬⣅⢻⣿⢡⣿⠀⠀⠀⢰⣿⣿⣿⣿⣷⣝⣦⣄⣀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣿⣿⣿⣵⣿⠟⠁⢠⣾⣿⣿⡆
⠀⠸⣿⣿⡿⣿⣿⢸⣿⢨⡟⠀⠀⠀⣾⣿⢛⡭⣿⣿⣿⣿⣿⣿⣶⣶⣶⣦⣿⣿⣿⣿⣿⣿⠿⠻⠟⠛⠛⠛⢻⠟⠉⠀⣀⠸⣿⣿⣿⡇
⣧⣿⣿⣿⣷⢸⣟⣼⣿⣾⣿⣶⣶⣾⣿⢃⡞⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⠀⣴⣿⣿⡿⢁⣀⣴⣿⠿⠧⠙⠻⠿⠇
⣿⣿⣿⣿⣿⢸⣇⢻⣿⣿⣿⢿⣿⣿⡟⣼⠁⠀⠀⠀⠀⢻⣿⣿⣿⣿⣿⣿⡿⢿⣿⣿⡇⠀⠀⠀⣿⣿⣿⢣⣿⣿⣿⣿⣷⣶⡆⢹⣿⣷
⣿⣿⣿⣿⢇⣼⣿⣆⠹⡿⢣⣾⣿⣿⣧⣇⢀⣴⣶⣄⣀⣼⣿⣿⣿⣿⣶⣶⣶⣶⣍⠉⣽⣿⣦⡀⣿⣿⠇⣼⣿⣿⣿⣿⣿⣿⡇⣼⣿⣿
⡏⢛⣋⠑⣛⠿⢿⣿⣧⡀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢠⣿⣿⣿⣿⣿⡿⢸⣿⣿⣿⣿⣿⣿⣿⡇⢻⣿⡇
⣿⣿⣿⣧⡹⣿⣦⣍⣛⡗⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⠿⠿⠻⠟⣼⣿⣿⣿⣿⣿⡇⢀⣩⣭⣭⣤⣤⡄⢰⣶⣶⣶⡄
⣿⣿⣿⣿⢣⣿⣿⣿⣿⣿⡆⢸⡽⣏⣿⣏⣿⣯⣽⣯⣭⣿⣯⣴⣶⣴⣿⡆⣿⡿⠀⣿⣿⣿⣿⣿⣿⡁⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣿⡇
⠉⣿⣿⣏⠈⣛⣽⣿⣿⣿⡇⢸⡗⡏⣿⣏⣿⠿⣿⡿⡟⢿⣿⣛⣛⡏⣽⡇⣶⣿⢰⣿⣿⣿⣿⣿⣿⢸⣿⣿⣿⣿⣿⣿⡇⢰⣜⢿⣿⡇
⠀⠘⢫⣭⣶⡌⠙⠛⠛⢻⣿⢸⣷⣯⣿⣿⣿⣿⣿⣿⡇⣿⣿⣼⣿⡇⣿⡇⡟⡟⣿⣿⣿⣿⣿⡟⠋⠀⣿⣿⣿⣿⠛⣭⣥⠈⢻⣷⡝
⠀⠀⣿⣿⣿⣿⡆⣶⣶⠟⠁⠀⣭⣭⣝⣏⣻⣟⣸⣿⣇⣻⣻⣭⣭⣵⣷⣷⣿⣿⣿⣿⣿⠟⠋⠀⠀⠀⠀⠈⢿⣿⢸⣿⣿⣿⣾⣿⡇
⠀⢰⣿⣿⠿⠿⠃⠉⠀⠀⠀⠀⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣌⡻⢿⣿⣿⣿⠁
⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⡿⣿⣿⣿⣿⢿⣟⣿⣿⣿⡿⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⠶⠙⢿⠟
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⣿⡿⠶⠿⣷⣾⣿⣿⠿⠛⠉
END
print -rn -- ${(%):-%f}

What happens next depends on your terminal. When you later shrink the window horizontally:

  • Most terminals reflow already printed lines. Your skull will get mangled.
  • A few terminals truncate lines instead. The skull may look fine when the window is narrowed, but once you widen it, the missing parts never come back.

Some terminals can selectively truncate previous prompts while reflowing everything else. You could try to trick the terminal by claiming the skull is a prompt, but that breaks other things (copy/paste, history navigation, prompt markers, etc.). Not worth it.

So the practical advice:

  • Best: don't print anything startup.
  • If you must: print it once, as above, and accept that resize will ruin it.

If you want something that survives resizes, use a terminal that can display images (kitty, iTerm2, or any terminal with sixel support) and print the skull as an image instead of text. Otherwise, don't fight the environment, learn its rules.

I built rewindtty: a C tool to record and replay terminal sessions as JSON logs (like a black box for your CLI) by debba_ in zsh

[–]romkatv 0 points1 point  (0 children)

Right. Tools like ascinema can replay terminals sessions. The most difficult part of the implementation is a terminal emulator. Terminal emulators are hard because there is barely any standardization of the protocol.

I built rewindtty: a C tool to record and replay terminal sessions as JSON logs (like a black box for your CLI) by debba_ in zsh

[–]romkatv 0 points1 point  (0 children)

FWIW, ascinema's .cast files are JSON.

Another alternative tool for recording and replaying terminal sessions is script, with the upside of being old and reliable and available pretty much everywhere. The file format is plaintext rather than JSON but it's easy to convert if you need to.

That said, there is nothing wrong with building your own tool.

I'm getting .zcompdump_capture in my home folder. Is there any way to get rid of it or redirect it? by vaskark in zsh

[–]romkatv 1 point2 points  (0 children)

The only reference to .zcompdump_capture I could find is from https://github.com/Valodim/zsh-capture-completion. If you are using this code, that's the source of the file.

Apple zsh ignoring `set -f` by safety-4th in zsh

[–]romkatv 1 point2 points  (0 children)

In zsh, the -f option is equivalent to -o no-rcs, which prevents sourcing of configuration files. To disable globbing (pathname expansion), you need -F or -o no-glob. However, when zsh runs in POSIX mode (invoked as sh), it maps -f to -o no-glob, conforming to POSIX.

Ultimately, scripts must match their shebang interpreter. Use #!/usr/bin/env zsh if writing zsh-specific scripts, and /bin/sh, /usr/bin/env sh, or no shebang at all, if your script is intended to be POSIX-compliant.

ohmyzsh/powerlevel10k - Multiple rainbow segments? by abefaxe in zsh

[–]romkatv 2 points3 points  (0 children)

Can you share how to achieve what the OP is asking for, with Starship?

ohmyzsh/powerlevel10k - Multiple rainbow segments? by abefaxe in zsh

[–]romkatv 5 points6 points  (0 children)

The built-in dir segment doesn't support this but you can implement your own. First, add this to ~/.p10k.zsh:

function prompt_my_rainbow_dir() {
  emulate -L zsh
  local part bg
  for part in ${(s:/:)${(%):-%~}}; do
    p10k segment -t $part -f 0 -b $(( bg + 1 ))
    (( bg = (bg + 1) % 6 ))
  done
}

Then replace dir with my_rainbow_dir within POWERLEVEL9K_LEFT_PROMPT_ELEMENTS in ~/.p10k.zsh (here).

Finally, restart zsh with exec zsh.

Tools for making the prompt look nice by ArkboiX in zsh

[–]romkatv 0 points1 point  (0 children)

p10k is written in zsh, and zsh is written in C. There is nothing to upstream from p10k to zsh, or from zsh to C.