Is it powerlevel10k that provides navigation using arrow keys?

I just installed a new Manjaro on my desktop and I also have an older one on my laptop. The one I have on my laptop was installed a few years ago and I’m trying to replicate similar features on my new desktop.

As for the terminal, both are using zsh and pwoerlevel10k. It’s just that the older laptop has a feature that I grow used to but I cannot replicate it on my desktop. On my laptop, when using the terminal, I can press tab twice and then use the arrow keys to navigate through the provided options. I’m not sure but I believe this is a feature provided by powerlevel10k and I have that I my desktop as well but it does not let me navigate the choices using arrow keys.

Can someone please help understand what am I missing?

Thanks

Powerlevel10k is a ZSH theme. It sounds like you have manjaro-zsh-config installed on both machines, however whatever you did on your laptop is not included in the default configuration.

This is what happens when typing pacman -S manjaro- and pressing tab twice:

zsh: do you wish to see all 139 possibilities (35 lines)? 

Check your ~/.zshrc on both machines and see what the difference is.

1 Like

My laptop’s OS is older than manjaro-zsh-config. I installed it before zsh was Manjaro’s default terminal. I had to install and configure zsh (including p10k) manually.

Looking at my laptop’s .zshrc, I see mentions of compinstall which I think has something to do with the auto-complete that I mentioned.

BTW, it’s different from what you’ve mentioned. It looks something like this:

In this example, I typed cd and double tabs, then I used the arrow keys to move the highlight over opt/. You can go in any of the 4 directions (up, down, left, and right) any number of times that you want. It’s really practical.

Oh, sorry. Brain out of order, perhaps. Yes, that functionality is included. See the ZSH plugins that manjaro-zsh-config depends on. I think that’s zsh-autosuggestions.

See the plugins section of the default config

This is what I have

## Plugins section
# Load completion definitions
if [[ -r /usr/share/zsh/site-functions ]]; then
  source /usr/share/zsh/site-functions
fi

if [[ -r $HOME/.local/share/zsh/site-functions ]]; then
  source $HOME/.local/share/zsh/site-functions
fi

# Use autosuggestion
if [[ -r /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then
  source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
  ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
  ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
fi

# Use syntax highlighting
if [[ -r /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then
  source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi

# Use history substring search
if [[ -r /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh ]]; then
  source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
  # bind UP and DOWN arrow keys to history substring search
  zmodload zsh/terminfo
  bindkey "$terminfo[kcuu1]" history-substring-search-up
  bindkey "$terminfo[kcud1]" history-substring-search-down
  bindkey '^[[A' history-substring-search-up
  bindkey '^[[B' history-substring-search-down
fi

# zsh-auto-notify
if [[ -r /usr/share/zsh/plugins/zsh-auto-notify/auto-notify.plugin.zsh ]]; then
  source /usr/share/zsh/plugins/zsh-auto-notify/auto-notify.plugin.zsh
  # Set threshold to XX seconds (default 10 seconds)
  export AUTO_NOTIFY_THRESHOLD=30
fi
1 Like

Well, I see that I have some config already in place in the /usr/share/zsh/manjaro-zsh-config file. And also, in my ~/.zshrc:

# Source manjaro-zsh-configuration
if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
  source /usr/share/zsh/manjaro-zsh-config
fi

But still, the feature I mentioned is not there. Makes me wonder what am I missing!?

These are the entries in my old laptop’s .zshrc:

# The following lines were added by compinstall
zstyle :compinstall filename '/home/mehran/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

# If NumLock is off, translate keys to make them appear the same as with NumLock on.
bindkey -s '^[OM' '^M'  # enter
bindkey -s '^[Ok' '+'
bindkey -s '^[Om' '-'
bindkey -s '^[Oj' '*'
bindkey -s '^[Oo' '/'
bindkey -s '^[OX' '='

# If someone switches our terminal to application mode (smkx), translate keys to make
# them appear the same as in raw mode (rmkx).
bindkey -s '^[OH' '^[[H'  # home
bindkey -s '^[OF' '^[[F'  # end
bindkey -s '^[OA' '^[[A'  # up
bindkey -s '^[OB' '^[[B'  # down
bindkey -s '^[OD' '^[[D'  # left
bindkey -s '^[OC' '^[[C'  # right

# TTY sends different key codes. Translate them to regular.
bindkey -s '^[[1~' '^[[H'  # home
bindkey -s '^[[4~' '^[[F'  # end

autoload -Uz up-line-or-beginning-search
autoload -Uz down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search

bindkey '^?'      backward-delete-char          # bs         delete one char backward
bindkey '^[[3~'   delete-char                   # delete     delete one char forward
bindkey '^[[H'    beginning-of-line             # home       go to the beginning of line
bindkey '^[[F'    end-of-line                   # end        go to the end of line
bindkey '^[[1;5C' forward-word                  # ctrl+right go forward one word
bindkey '^[[1;5D' backward-word                 # ctrl+left  go backward one word
bindkey '^H'      backward-kill-word            # ctrl+bs    delete previous word
bindkey '^[[3;5~' kill-word                     # ctrl+del   delete next word
bindkey '^J'      backward-kill-line            # ctrl+j     delete everything before cursor
bindkey '^[[D'    backward-char                 # left       move cursor one char backward
bindkey '^[[C'    forward-char                  # right      move cursor one char forward
bindkey '^[[A'    up-line-or-beginning-search   # up         prev command in history
bindkey '^[[B'    down-line-or-beginning-search # down       next command in history

bindkey "^[[5~" history-beginning-search-backward
bindkey "^[[6~" history-beginning-search-forward

But I don’t see anything related to the feature. Maybe that feature is from some other plugin!? Right now, after I press the tab twice, if I want to iterate through the choices I have to use the tab again. And arrow keys have no function.

I think what you want is called autocompletion with an arrow-key driven interface in the Arch Wiki:
https://wiki.archlinux.org/title/Zsh#Command_completion

It’s a zsh feature, nothing to do with Powerlevel10k, as already pointed out.

Add this line to your ~/.zshrc file and start a new shell (close and re-open the terminal):

zstyle ':completion:*' menu select
5 Likes

Thanks, @bill_t . That was it. I wish this was enabled by default in Manjaro. Specially since it’s already installed and all is missing is the command you’ve mentioned.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.