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

Numeric pad Enter key does not work - Mac Logitech K750 keyboard #1163

Closed
ajaygautam opened this issue Dec 16, 2020 · 13 comments
Closed

Numeric pad Enter key does not work - Mac Logitech K750 keyboard #1163

ajaygautam opened this issue Dec 16, 2020 · 13 comments

Comments

@ajaygautam
Copy link

Ever since I have switched to powerlevel10K for my zsh... the num-pad Enter key does not work!

Keyboard works fine: zsh -f has confirmed that the key works fine.

Please see attached image:
k750

Thanks

@romkatv
Copy link
Owner

romkatv commented Dec 16, 2020

Try disabling powerlevel10k and leaving all other config files unchanged. Does it fix the issue?

@ajaygautam
Copy link
Author

Yes. That fixes the issue.
that’s what zsh -f does.
looking forward to a solution.

Thanks

@romkatv
Copy link
Owner

romkatv commented Dec 18, 2020

Yes. That fixes the issue.
that’s what zsh -f does.

No, that's not what zsh -f does.

Please attach your ~/.zshrc.

@ajaygautam
Copy link
Author

I see!
I commented out everything that seemed related with PowerLevel10k... Issue still persists! Wonder if this is a zsh issue.

My .zshrc

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/Users/fbao7qw/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
#ZSH_THEME="robbyrussell"
ZSH_THEME="powerlevel10k/powerlevel10k"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

@romkatv
Copy link
Owner

romkatv commented Dec 18, 2020

I commented out everything that seemed related with PowerLevel10k... Issue still persists!

Can you confirm that disabling powerlevel10k without changing anything else doesn't resolve the issue?

Wonder if this is a zsh issue.

This is most likely caused by Oh My Zsh when it changes the TTY to application (a.k.a. cooked) mode. You can verify it like this:

  1. Run zsh -f
  2. Verify that Enter on the numpad works.
  3. Run echoti smkx
  4. Verify that Enter on the numpad doesn't work.
  5. Run echoti rmkx
  6. Verify that Enter on the numpad works.

Please let me know whether this actually behaves this way or not.

@ajaygautam
Copy link
Author

ajaygautam commented Dec 18, 2020

Confirmed that disabling powerlevel10k without changing anything else doesn't resolve the issue.

echoti smkx breaks the keyboard.

Should I file this issue with On My Zsh?

Thanks for the help debugging this.

@romkatv
Copy link
Owner

romkatv commented Dec 18, 2020

Should I file this issue with On My Zsh?

This might be fixable on your end. Try the following:

  1. Run zsh -f
  2. Run echoti smkx
  3. Press Ctrl+V followed by Enter on the numpad.
  4. Post a screenshot.

@ajaygautam
Copy link
Author

ajaygautam commented Dec 18, 2020

Here it is:
zsh

@romkatv
Copy link
Owner

romkatv commented Dec 18, 2020

That's odd. So the result is exactly the same whether you press Enter on the numpad or the other Enter?

Edit: I see that you've updated the screenshot. Now that makes more sense. You can fix the issue by adding the following lines to your ~/.zshrc:

# Translate numpad keys to their twin counterparts.
() {
  local keymap
  for keymap in emacs viins vicmd; do
    bindkey -M $keymap -s '^[OM' '^M'  # enter
    bindkey -M $keymap -s '^[Ok' '+'
    bindkey -M $keymap -s '^[Om' '-'
    bindkey -M $keymap -s '^[Oj' '*'
    bindkey -M $keymap -s '^[Oo' '/'
    bindkey -M $keymap -s '^[OX' '='
  done
}

You need to add this below source $ZSH/oh-my-zsh.sh.

Run exec zsh after modifying ~/.zshrc for it to take effect. This is how you generally should reload zsh after modifying rc files.

Let me know if it works.

@ajaygautam
Copy link
Author

Thanks very much. This worked! Turns out... my whole keypad side wasn't working... this is what I ended up with (PS: The + key mapping was wrong too):

() {
  local keymap
  for keymap in emacs viins vicmd; do
    bindkey -M $keymap -s '^[OM' '^M'  # enter
    bindkey -M $keymap -s '^[Om' '-' 
    bindkey -M $keymap -s '^[Oj' '*' 
    bindkey -M $keymap -s '^[Oo' '/' 
    bindkey -M $keymap -s '^[OX' '=' 

    bindkey -M $keymap -s '^[Ol' '+' 
    bindkey -M $keymap -s '^[Ow' '7' 
    bindkey -M $keymap -s '^[Ox' '8' 
    bindkey -M $keymap -s '^[Oy' '9' 
    bindkey -M $keymap -s '^[Ot' '4' 
    bindkey -M $keymap -s '^[Ou' '5' 
    bindkey -M $keymap -s '^[Ov' '6' 
    bindkey -M $keymap -s '^[Oq' '1' 
    bindkey -M $keymap -s '^[Or' '2' 
    bindkey -M $keymap -s '^[Os' '3' 
    bindkey -M $keymap -s '^[Op' '0' 
    bindkey -M $keymap -s '^[On' '.' 
  done
}

@ajaygautam
Copy link
Author

Still... I think oh my zsh should fix this. It works with zsh -f, vim, pretty much everything else... Should also auto work with OMZ!

@romkatv
Copy link
Owner

romkatv commented Dec 18, 2020

Still... I think oh my zsh should fix this. It works with zsh -f, vim, pretty much everything else... Should also auto work with OMZ!

You can open an issue. I don't have an opinion or a preference. I don't use OMZ myself.

Closing as resolved.

@romkatv romkatv closed this as completed Dec 18, 2020
@ejkitchen
Copy link

For me a much better answer was found here:

https://vi.stackexchange.com/questions/11581/why-doesnt-my-numpad-work-right-in-my-terminal

For Terminal:

Preferences > Profiles > Advanced > uncheck Allow VT100 application keypad mode

For iTerm2

Preferences > Profiles > Keys > Load Preset… > xterm with Numeric Keypad

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

No branches or pull requests

3 participants