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

<C-h> (CTRL-H) does not work in the new TUI #2048

Closed
rainerborene opened this Issue Feb 23, 2015 · 169 comments

Comments

Projects
None yet
@rainerborene
Contributor

rainerborene commented Feb 23, 2015

I use the following mappings on my .nvimrc and it does not work using tmux inside urxvt.

nnoremap <C-h> <C-w>h " only C-h does not work.
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

env output

BROWSER=firefox
COLORFGBG=7;0
COLORTERM=rxvt
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-zNeYXuznrs,guid=844332d151bf76af0ebfba3754e5f937
DESKTOP_SESSION=i3
DESKTOP_STARTUP_ID=i3/i3-sensible-terminal/725-0-arch_TIME89282
DISPLAY=:0
DOCKER_HOST=unix:///var/run/docker.sock
EDITOR=vim
GDMSESSION=i3
GDM_LANG=en_US.utf8
GPG_TTY=/dev/pts/5
GREP_COLOR=97;45
GTK_MODULES=canberra-gtk-module
HG=/usr/bin/hg
LANG=en_US.utf8
LC_MEASUREMENT=pt_BR.utf8
LC_MONETARY=pt_BR.utf8
LC_NUMERIC=pt_BR.utf8
LC_PAPER=pt_BR.utf8
LC_TIME=pt_BR.utf8
LS_COLORS=no=00;37:fi=01;34:di=00;34:ln=00;36:pi=40;33:so=00;35:do=00;35:bd=40;33;01:cd=40;33;01:or=00;05;37;41:mi=00;05;37;41:su=37;41:sg=30;43:tw=30;42:ow=04;34:st=37;44:ex=00;32:*.cmd=00;33:*.exe=00;33:*.com=00;33:*.btm=00;33:*.bat=00;33:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz=01;31:*.bz2=01;31:*.bzip2=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.apk=01;31:*.gem=01;31:*.jpg=00;35:*.JPG=00;35:*.jpeg=00;35:*.gif=00;35:*.bmp=00;35:*.pbm=00;35:*.pgm=00;35:*.ppm=00;35:*.tga=00;35:*.xbm=00;35:*.xpm=00;35:*.tif=00;35:*.tiff=00;35:*.png=00;35:*.svg=00;35:*.svgz=00;35:*.mng=00;35:*.pcx=00;35:*.dl=00;35:*.xcf=00;35:*.xwd=00;35:*.yuv=00;35:*.cgm=00;35:*.emf=00;35:*.eps=00;35:*.CR2=00;35:*.ico=00;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.html=00;32:*.rst=00;32:*.md=00;32:*.patch=00;32:*.diff=00;32:*.tex=00;32:*.doc=00;32:*.xml=00;32:*.xls=00;32:*.xlsx=00;32:*.doc=00;32:*.docx=00;32:*.ppt=00;32:*.pptx=00;32:*.key=00;32:*.pt=01;32:*.tmpl=01;32:*.in=01;32:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.m4a=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:*.mov=01;36:*.mpg=01;36:*.mpeg=01;36:*.m2v=01;36:*.mkv=01;36:*.ogm=01;36:*.mp4=01;36:*.m4v=01;36:*.mp4v=01;36:*.vob=01;36:*.qt=01;36:*.nuv=01;36:*.wmv=01;36:*.asf=01;36:*.rm=01;36:*.rmvb=01;36:*.flc=01;36:*.avi=01;36:*.fli=01;36:*.flv=01;36:*.gl=01;36:*.m2ts=01;36:*.divx=01;36:*.webm=01;36:*.axv=01;36:*.anx=01;36:*.ogv=01;36:*.ogx=01;36:*.conf=00;36:*.cnf=00;36:*.cfg=00;36:*.ini=00;36:*.properties=00;36:*.yaml=00;36:*.vcl=00;36:*.c=00;33:*.cpp=00;33:*.py=00;33:*.coffesscript=00;33:*.js=00;33:*.rb=00;33:*.sh=00;33:*.zsh=00;33:*.env=00;33:*.bash=00;33:*.php=00;33:*.java=00;33:*.zcml=00;33:*.db=00;32:*.sql=00;32:*.json=00;32:*.plist=00;32:*.fs=00;32:*.tex=01;37:*.rdf=01;37:*.owl=01;37:*.n3=01;37:*.ttl=01;37:*.nt=01;37:*.torrent=01;37:*.xml=01;37:*Makefile=01;37:*Rakefile=01;37:*build.xml=01;37:*rc=01;37:*.nfo=01;37:*README=01;37:*README.txt=01;37:*readme.txt=01;37:*README.markdown=01;37:*README.md=01;37:*.ini=01;37:*.yml=01;37:*.cfg=01;37:*.conf=01;37:*.c=01;37:*.cpp=01;37:*.cc=01;37:*.log=01;30:*.bak=01;30:*.aux=01;30:*.lof=01;30:*.lol=01;30:*.lot=01;30:*.out=01;30:*.toc=01;30:*.bbl=01;30:*.blg=01;30:*~=01;30:*#=01;30:*.part=01;30:*.incomplete=01;30:*.swp=01;30:*.tmp=01;30:*.temp=01;30:*.o=01;30:*.obj=01;30:*.pyc=01;30:*.pyo=01;30:*.class=01;30:*.cache=01;30:*.egg-info=01;30:
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
SHELL=/usr/bin/fish
SHLVL=4
SSH_AGENT_PID=746
SSH_AUTH_SOCK=/tmp/ssh-J6jf9XAbiTjD/agent.725
TERM=screen-256color
TERMINFO=/usr/share/terminfo
TMUX=/tmp/tmux-1000/default,1161,11
TMUX_PANE=%27
WINDOWID=23068681
WINDOWPATH=1
WINEARCH=win32
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SESSION_DESKTOP=i3
XDG_SESSION_ID=c2
XDG_VTNR=1
__fish_bin_dir=/usr/bin
__fish_datadir=/usr/share/fish
__fish_help_dir=/usr/share/doc/fish
__fish_runtime_dir=/run/user/1000
__fish_sysconfdir=/etc/fish
fish_greeting=

@rainerborene rainerborene changed the title from map <C-h> <C-w>h does not work in the new TUI to <C-h> does not work in the new TUI Feb 23, 2015

@jwkvam

This comment has been minimized.

Show comment
Hide comment
@jwkvam

jwkvam Feb 23, 2015

I experience the same on OSX with iterm2.

jwkvam commented Feb 23, 2015

I experience the same on OSX with iterm2.

@tarruda

This comment has been minimized.

Show comment
Hide comment
@tarruda

tarruda Feb 23, 2015

Member

what is displayed if you type <c-v><c-h> in insert mode?

Member

tarruda commented Feb 23, 2015

what is displayed if you type <c-v><c-h> in insert mode?

@jwkvam

This comment has been minimized.

Show comment
Hide comment
@jwkvam

jwkvam Feb 23, 2015

With nvim, Commit: 0df6b91
<BS>
With vim 7.4.488
^H
I'm using the same config for both vim and neovim.

jwkvam commented Feb 23, 2015

With nvim, Commit: 0df6b91
<BS>
With vim 7.4.488
^H
I'm using the same config for both vim and neovim.

@rainerborene

This comment has been minimized.

Show comment
Hide comment
@rainerborene

rainerborene Feb 23, 2015

Contributor

Same here. <BS>

Contributor

rainerborene commented Feb 23, 2015

Same here. <BS>

@tarruda

This comment has been minimized.

Show comment
Hide comment
@tarruda

tarruda Feb 23, 2015

Member

any chance you compiled against the wrong libtermkey version? Does rm -rf .deps build && make && build/bin/nvim change anything?

Member

tarruda commented Feb 23, 2015

any chance you compiled against the wrong libtermkey version? Does rm -rf .deps build && make && build/bin/nvim change anything?

@jwkvam

This comment has been minimized.

Show comment
Hide comment
@jwkvam

jwkvam Feb 23, 2015

Same behavior for me.
- downloading... src='https://github.com/neovim/libtermkey/archive/8c0cb7108cc63218ea19aa898968eede19e19603.tar.gz'

jwkvam commented Feb 23, 2015

Same behavior for me.
- downloading... src='https://github.com/neovim/libtermkey/archive/8c0cb7108cc63218ea19aa898968eede19e19603.tar.gz'

@tarruda

This comment has been minimized.

Show comment
Hide comment
@tarruda

tarruda Feb 23, 2015

Member

what is displayed when you press ctrl+h in the cat program?

Member

tarruda commented Feb 23, 2015

what is displayed when you press ctrl+h in the cat program?

@jwkvam

This comment has been minimized.

Show comment
Hide comment
@jwkvam

jwkvam Feb 23, 2015

^H, the same happens with xxd.

jwkvam commented Feb 23, 2015

^H, the same happens with xxd.

@foobacca

This comment has been minimized.

Show comment
Hide comment
@foobacca

foobacca Feb 23, 2015

I use <C-h> for gT (move to tab left) and just tested and it works as expected. And <c-v><c-h> shows ^H

I'm using the PPA version of nvim - tried 0.0.0+git201502201750+6ubuntu14.04.1 and 0.0.0+git201502221955+6ubuntu14.04.1 - both work fine.

I run in tmux in terminator on Ubuntu.

foobacca commented Feb 23, 2015

I use <C-h> for gT (move to tab left) and just tested and it works as expected. And <c-v><c-h> shows ^H

I'm using the PPA version of nvim - tried 0.0.0+git201502201750+6ubuntu14.04.1 and 0.0.0+git201502221955+6ubuntu14.04.1 - both work fine.

I run in tmux in terminator on Ubuntu.

@jwkvam

This comment has been minimized.

Show comment
Hide comment
@jwkvam

jwkvam Feb 23, 2015

FWIW, I bisected the merges and it broke at merge #2039

jwkvam commented Feb 23, 2015

FWIW, I bisected the merges and it broke at merge #2039

@tarruda tarruda self-assigned this Feb 24, 2015

@tarruda

This comment has been minimized.

Show comment
Hide comment
@tarruda

tarruda Feb 24, 2015

Member

@jwkvam that PR didn't change anything related to parsing these keys: https://github.com/neovim/neovim/pull/2039/files

As I said, there was a problem with how libtermkey handled ctrl+h or backspace, but it was fixed in a recent commit: neovim/libtermkey@619c0c1

Member

tarruda commented Feb 24, 2015

@jwkvam that PR didn't change anything related to parsing these keys: https://github.com/neovim/neovim/pull/2039/files

As I said, there was a problem with how libtermkey handled ctrl+h or backspace, but it was fixed in a recent commit: neovim/libtermkey@619c0c1

@geoffharcourt

This comment has been minimized.

Show comment
Hide comment
@geoffharcourt

geoffharcourt Feb 25, 2015

Contributor

Experiencing the same problem on the latest build (61c98e7). I'm in iTerm, and the problem happens both inside and outside of tmux. <c-v><c-h> prints <BS>.

Contributor

geoffharcourt commented Feb 25, 2015

Experiencing the same problem on the latest build (61c98e7). I'm in iTerm, and the problem happens both inside and outside of tmux. <c-v><c-h> prints <BS>.

@geoffharcourt

This comment has been minimized.

Show comment
Hide comment
@geoffharcourt

geoffharcourt Feb 26, 2015

Contributor

One further detail: this problem happens in nvim with a blank .vimrc.

Contributor

geoffharcourt commented Feb 26, 2015

One further detail: this problem happens in nvim with a blank .vimrc.

@acoffman

This comment has been minimized.

Show comment
Hide comment
@acoffman

acoffman Feb 27, 2015

I'm experiencing exactly this same problem.
It happens on a totally clean install with no plugins:

The entire contents of my .nvimrc are

" navigate splits
nmap <silent> <C-k> :wincmd k<CR>
nmap <silent> <C-j> :wincmd j<CR>
nmap <silent> <C-h> :wincmd h<CR>
nmap <silent> <C-l> :wincmd l<CR>

I'm using OSX 10.10.2 with iTerm2 and NVIM 0.0.0-alpha+201502261923. The problem occurs both inside and outside of tmux and also in Terminal.app. All three other bindings work, but <C-h> does not.

acoffman commented Feb 27, 2015

I'm experiencing exactly this same problem.
It happens on a totally clean install with no plugins:

The entire contents of my .nvimrc are

" navigate splits
nmap <silent> <C-k> :wincmd k<CR>
nmap <silent> <C-j> :wincmd j<CR>
nmap <silent> <C-h> :wincmd h<CR>
nmap <silent> <C-l> :wincmd l<CR>

I'm using OSX 10.10.2 with iTerm2 and NVIM 0.0.0-alpha+201502261923. The problem occurs both inside and outside of tmux and also in Terminal.app. All three other bindings work, but <C-h> does not.

@acoffman

This comment has been minimized.

Show comment
Hide comment
@acoffman

acoffman Feb 27, 2015

Oh, and <c-v><c-h> in insert mode prints <BS> in the current buffer.

acoffman commented Feb 27, 2015

Oh, and <c-v><c-h> in insert mode prints <BS> in the current buffer.

@adambiggs

This comment has been minimized.

Show comment
Hide comment
@adambiggs

adambiggs Mar 2, 2015

Same thing here. Default left-navigation key mapping for the vim-tmux-navigator plugin is broken.

iTerm on OSX 10.10.2. With & without Tmux. Also broken in Terminal.app. Works fine in terminal MacVim.

adambiggs commented Mar 2, 2015

Same thing here. Default left-navigation key mapping for the vim-tmux-navigator plugin is broken.

iTerm on OSX 10.10.2. With & without Tmux. Also broken in Terminal.app. Works fine in terminal MacVim.

@lambdahands

This comment has been minimized.

Show comment
Hide comment
@lambdahands

lambdahands Mar 2, 2015

Experiencing this as well.

iTerm on OSX 10.10.2

lambdahands commented Mar 2, 2015

Experiencing this as well.

iTerm on OSX 10.10.2

@af

This comment has been minimized.

Show comment
Hide comment
@af

af Mar 3, 2015

I'm also fighting with trying to bind <C-h>. iTerm2 on OS X 10.10.2, using NVIM-0.0.0-alpha+201503020458.

It's not a good solution, but if you're looking for a workaround, replacing <C-h> with <bs> in my mappings did the trick for me (assuming you don't use the backspace key).

af commented Mar 3, 2015

I'm also fighting with trying to bind <C-h>. iTerm2 on OS X 10.10.2, using NVIM-0.0.0-alpha+201503020458.

It's not a good solution, but if you're looking for a workaround, replacing <C-h> with <bs> in my mappings did the trick for me (assuming you don't use the backspace key).

@geoffharcourt

This comment has been minimized.

Show comment
Hide comment
@geoffharcourt

geoffharcourt Mar 3, 2015

Contributor

I think we have enough reports now no one else needs to confirm there's a problem, so no further need to add on to this thread.

Contributor

geoffharcourt commented Mar 3, 2015

I think we have enough reports now no one else needs to confirm there's a problem, so no further need to add on to this thread.

@justinmk justinmk added the bug label Mar 3, 2015

@kopischke

This comment has been minimized.

Show comment
Hide comment
@kopischke

kopischke Mar 3, 2015

@tarruda as everybody concerned seems to be using OS X, this (somewhat elderly) post might be relevant: it suggests that OS X terminals are defining a different erase character than Linux in the xterm terminfo, thus causing occasional issues with Backspace / Ctrl-h (which is the backspace equivalent when you use Emacs readline keybindings).

kopischke commented Mar 3, 2015

@tarruda as everybody concerned seems to be using OS X, this (somewhat elderly) post might be relevant: it suggests that OS X terminals are defining a different erase character than Linux in the xterm terminfo, thus causing occasional issues with Backspace / Ctrl-h (which is the backspace equivalent when you use Emacs readline keybindings).

@ladislas

This comment has been minimized.

Show comment
Hide comment
@ladislas

ladislas Mar 3, 2015

Another alternative is to use <C-w-h> which does the trick for me :)

ladislas commented Mar 3, 2015

Another alternative is to use <C-w-h> which does the trick for me :)

@ZyX-I

This comment has been minimized.

Show comment
Hide comment
@ZyX-I

ZyX-I Mar 4, 2015

Contributor

@ladislas What is w modifier? Win key?

Contributor

ZyX-I commented Mar 4, 2015

@ladislas What is w modifier? Win key?

@ladislas

This comment has been minimized.

Show comment
Hide comment
@ladislas

ladislas Mar 4, 2015

@ZyX-I my bad, it's <C-w>h which means you have to presse the Ctrlkey + w letter key + h letter key.

It's just from the remap actually... nnoremap <C-h> <C-w>h

ladislas commented Mar 4, 2015

@ZyX-I my bad, it's <C-w>h which means you have to presse the Ctrlkey + w letter key + h letter key.

It's just from the remap actually... nnoremap <C-h> <C-w>h

@LuRsT

This comment has been minimized.

Show comment
Hide comment
@LuRsT

LuRsT Mar 4, 2015

@kopischke, I wasn't going to chime in since there are already a lot of reports for this bug, but I just wanted to add that I'm experiencing the same on Arch linux (Using the AUR package which may be outdated)

Update: I don't have this problem in Ubuntu (using the package from apt-get)

LuRsT commented Mar 4, 2015

@kopischke, I wasn't going to chime in since there are already a lot of reports for this bug, but I just wanted to add that I'm experiencing the same on Arch linux (Using the AUR package which may be outdated)

Update: I don't have this problem in Ubuntu (using the package from apt-get)

@fishman

This comment has been minimized.

Show comment
Hide comment
@fishman

fishman Mar 4, 2015

i'm in archlinux too. this must be because of one the terminal libraries.

in nvim c-h produces <BS> whereas in vim in produces ^H

EDIT: and i've built it manually too, just in case the versions might cause a problem. i also tried it in xterm to see if the issue is rxvt specific

 if has('nvim')
     nmap <BS> <C-W>h
 endif

works for example. though that's a terrible workaround

fishman commented Mar 4, 2015

i'm in archlinux too. this must be because of one the terminal libraries.

in nvim c-h produces <BS> whereas in vim in produces ^H

EDIT: and i've built it manually too, just in case the versions might cause a problem. i also tried it in xterm to see if the issue is rxvt specific

 if has('nvim')
     nmap <BS> <C-W>h
 endif

works for example. though that's a terrible workaround

@tarruda

This comment has been minimized.

Show comment
Hide comment
@tarruda

tarruda Mar 10, 2015

Member

I'd like to dig the cause for this bug but its hard without reproducing locally. Can someone experiencing the problem paste a log of the keys being sent by the TUI? This will help:

diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 00efa28..5542218 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -142,6 +142,7 @@ bool os_isatty(int fd)

 size_t input_enqueue(String keys)
 {
+  fprintf(stderr, "pressed: %s", keys.data);
   char *ptr = keys.data, *end = ptr + keys.size;

   while (rbuffer_available(input_buffer) >= 6 && ptr < end) {

After applying the patch and rebuilding, run ./build/bin/nvim 2> keys.log , press ctrl+h and then paste keys.log here

Member

tarruda commented Mar 10, 2015

I'd like to dig the cause for this bug but its hard without reproducing locally. Can someone experiencing the problem paste a log of the keys being sent by the TUI? This will help:

diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 00efa28..5542218 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -142,6 +142,7 @@ bool os_isatty(int fd)

 size_t input_enqueue(String keys)
 {
+  fprintf(stderr, "pressed: %s", keys.data);
   char *ptr = keys.data, *end = ptr + keys.size;

   while (rbuffer_available(input_buffer) >= 6 && ptr < end) {

After applying the patch and rebuilding, run ./build/bin/nvim 2> keys.log , press ctrl+h and then paste keys.log here

@tarruda

This comment has been minimized.

Show comment
Hide comment
@tarruda

tarruda Mar 10, 2015

Member

I've reproduced the problem in my OSX vm. As the link posted by @kopischke explains, OSX includes wrong terminfo information for xterm-256color(used by iterm), it sets the backspace key description to ctrl+h, which results in libvterm/nvim parsing it as backspace.

My guess is that most programs parse ctrl+h correctly because they ignore the kbs description. One way to work around the problem is to fix the terminfo entry for your terminal by replacing kbs=^H by kbs=\177(ascii del). These commands will create a fixed terminfo entry in your HOME directory:

infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $TERM.ti
tic $TERM.ti
Member

tarruda commented Mar 10, 2015

I've reproduced the problem in my OSX vm. As the link posted by @kopischke explains, OSX includes wrong terminfo information for xterm-256color(used by iterm), it sets the backspace key description to ctrl+h, which results in libvterm/nvim parsing it as backspace.

My guess is that most programs parse ctrl+h correctly because they ignore the kbs description. One way to work around the problem is to fix the terminfo entry for your terminal by replacing kbs=^H by kbs=\177(ascii del). These commands will create a fixed terminfo entry in your HOME directory:

infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $TERM.ti
tic $TERM.ti
@kopischke

This comment has been minimized.

Show comment
Hide comment
@kopischke

kopischke Mar 10, 2015

@tarruda awesome!

OSX includes wrong terminfo information for xterm-256color(used by iterm), it sets the backspace key description to ctrl+h, which results in libvterm/nvim parsing it as backspace

Two notes:

  1. xterm-256-color is also used by recent versions of Terminal.app (Mavericks and above, IIRC)
  2. some Linux distros seem to suffer from the same issue, judging from the comments by @LuRsT and @fishman

kopischke commented Mar 10, 2015

@tarruda awesome!

OSX includes wrong terminfo information for xterm-256color(used by iterm), it sets the backspace key description to ctrl+h, which results in libvterm/nvim parsing it as backspace

Two notes:

  1. xterm-256-color is also used by recent versions of Terminal.app (Mavericks and above, IIRC)
  2. some Linux distros seem to suffer from the same issue, judging from the comments by @LuRsT and @fishman
@tarruda

This comment has been minimized.

Show comment
Hide comment
@tarruda

tarruda Mar 10, 2015

Member

some Linux distros seem to suffer from the same issue, judging from the comments by @LuRsT and @fishman

I imagine thats a good reason to ignore the kbs description. While it may break a terminal that has a working terminfo file and uses a different representation for backspace, I doubt anyone will write such a terminal as it would be incompatible with most programs. cc @leonerd

Member

tarruda commented Mar 10, 2015

some Linux distros seem to suffer from the same issue, judging from the comments by @LuRsT and @fishman

I imagine thats a good reason to ignore the kbs description. While it may break a terminal that has a working terminfo file and uses a different representation for backspace, I doubt anyone will write such a terminal as it would be incompatible with most programs. cc @leonerd

@adambiggs

This comment has been minimized.

Show comment
Hide comment
@adambiggs

adambiggs Mar 10, 2015

Thanks @tarruda! Your workaround fixed the issue for me.

Just wondering, is this something you plan on fixing in NeoVim? Or should I add your workaround as a permanent thing to my dotfiles? (or both?)

adambiggs commented Mar 10, 2015

Thanks @tarruda! Your workaround fixed the issue for me.

Just wondering, is this something you plan on fixing in NeoVim? Or should I add your workaround as a permanent thing to my dotfiles? (or both?)

@khalidchawtany

This comment has been minimized.

Show comment
Hide comment
@khalidchawtany

khalidchawtany Mar 10, 2015

Great, it works now.

khalidchawtany commented Mar 10, 2015

Great, it works now.

@tarruda

This comment has been minimized.

Show comment
Hide comment
@tarruda

tarruda Mar 10, 2015

Member

Just wondering, is this something you plan on fixing in NeoVim? Or should I add your workaround as a permanent thing to my dotfiles? (or both?)

I'm gonna wait for @leonerd's position on this. If he chooses to not ignore kbs I will modify the TUI module to parse ctrl+h before handling the data to libtermkey, which will fix the problem without requiring any changes to terminfo.

Member

tarruda commented Mar 10, 2015

Just wondering, is this something you plan on fixing in NeoVim? Or should I add your workaround as a permanent thing to my dotfiles? (or both?)

I'm gonna wait for @leonerd's position on this. If he chooses to not ignore kbs I will modify the TUI module to parse ctrl+h before handling the data to libtermkey, which will fix the problem without requiring any changes to terminfo.

@jwhitley

This comment has been minimized.

Show comment
Hide comment
@jwhitley

jwhitley Mar 11, 2015

Contributor

I've been experiencing this bug running nvim under tmux on OS X. I did some investigation, and both the screen-256color (under tmux) and xterm-256color (under iTerm2) terminfo entries reproduce this issue. At least it's consistent!?

Contributor

jwhitley commented Mar 11, 2015

I've been experiencing this bug running nvim under tmux on OS X. I did some investigation, and both the screen-256color (under tmux) and xterm-256color (under iTerm2) terminfo entries reproduce this issue. At least it's consistent!?

@adambiggs

This comment has been minimized.

Show comment
Hide comment
@adambiggs

adambiggs Mar 11, 2015

I forgot to test in tmux... @tarruda's workaround fixed it in iTerm, but it's still broken in tmux :(

I'm guessing there's a similar workaround for tmux?

adambiggs commented Mar 11, 2015

I forgot to test in tmux... @tarruda's workaround fixed it in iTerm, but it's still broken in tmux :(

I'm guessing there's a similar workaround for tmux?

@kopischke

This comment has been minimized.

Show comment
Hide comment
@kopischke

kopischke Mar 11, 2015

@adambiggs your tmux config probably sets a different $TERM than your vanilla terminal. Try repeating the workaround steps while in tmux.

kopischke commented Mar 11, 2015

@adambiggs your tmux config probably sets a different $TERM than your vanilla terminal. Try repeating the workaround steps while in tmux.

zackhsi added a commit to zackhsi/dotfiles that referenced this issue Apr 4, 2016

zackhsi added a commit to zackhsi/dotfiles that referenced this issue Apr 6, 2016

@hath995 hath995 referenced this issue Apr 17, 2016

Closed

Mapping <c-h> to <c-w>h doesn't work #4584

1 of 1 task complete
@blueyed

This comment has been minimized.

Show comment
Hide comment
@blueyed

blueyed Apr 19, 2016

Contributor

For me this is only a problem with sudo nvim?!
With Neovim in tmux :send-keys c-h works as expected, but with sudo nvim the :send-keys c-h from tmux will become <BS> in Neovim.

sudo env TERMINFO="$HOME/.terminfo" nvim works though.
~/.terminfo/t/tmux-256color differs from /usr/share/terminfo/t/tmux-256color.
The former is based on Add terminfo files for tmux as per FAQ for italics with 2.1: https://github.com/ThomasAdam/tmux/blob/master/FAQ#L363.

% infocmp -d -A ~/.terminfo -B /usr/share/terminfo tmux-256color
comparing tmux-256color to tmux-256color.
    comparing booleans.
        hs: F:T.
    comparing numbers.
    comparing strings.
        dsl: NULL, '\E]0;\007'.
        fsl: NULL, '^G'.
        kbs: '\177', '^H'.
        tsl: NULL, '\E]0;'.

The kbs for /usr/share/terminfo/t/tmux-256-color probably causes the C-h to be mapped to <BS>?!

Note that Vim (7.4.1689) behaves differently: the mapping is not a problem, but <c-v><bs> will result in ^? (and not <bs> as with Neovim).

I am on Arch Linux, and it appears to use the upstream ncurses 6.0 package verbatim for this.
So every distribution, which does not patch ncurses / the terminfo files seems to be affected?!

Contributor

blueyed commented Apr 19, 2016

For me this is only a problem with sudo nvim?!
With Neovim in tmux :send-keys c-h works as expected, but with sudo nvim the :send-keys c-h from tmux will become <BS> in Neovim.

sudo env TERMINFO="$HOME/.terminfo" nvim works though.
~/.terminfo/t/tmux-256color differs from /usr/share/terminfo/t/tmux-256color.
The former is based on Add terminfo files for tmux as per FAQ for italics with 2.1: https://github.com/ThomasAdam/tmux/blob/master/FAQ#L363.

% infocmp -d -A ~/.terminfo -B /usr/share/terminfo tmux-256color
comparing tmux-256color to tmux-256color.
    comparing booleans.
        hs: F:T.
    comparing numbers.
    comparing strings.
        dsl: NULL, '\E]0;\007'.
        fsl: NULL, '^G'.
        kbs: '\177', '^H'.
        tsl: NULL, '\E]0;'.

The kbs for /usr/share/terminfo/t/tmux-256-color probably causes the C-h to be mapped to <BS>?!

Note that Vim (7.4.1689) behaves differently: the mapping is not a problem, but <c-v><bs> will result in ^? (and not <bs> as with Neovim).

I am on Arch Linux, and it appears to use the upstream ncurses 6.0 package verbatim for this.
So every distribution, which does not patch ncurses / the terminfo files seems to be affected?!

@bryanmaina

This comment has been minimized.

Show comment
Hide comment
@bryanmaina

bryanmaina Apr 20, 2016

@fmoralesc I used imap and it doesn't work.

if has('nvim')
  " Hack to get C-h working in NeoVim
  imap <BS> <C-W>h
endif

The result of verbose imap <BS> is the one expected this time but it still behaves bad.
<C-h> still does <BS>.

i  <BS>          <C-W>h
        Last set from ~/.vim/init.vim

I am also on Arch Linux like @blueyed and I don't use tmux.

bryanmaina commented Apr 20, 2016

@fmoralesc I used imap and it doesn't work.

if has('nvim')
  " Hack to get C-h working in NeoVim
  imap <BS> <C-W>h
endif

The result of verbose imap <BS> is the one expected this time but it still behaves bad.
<C-h> still does <BS>.

i  <BS>          <C-W>h
        Last set from ~/.vim/init.vim

I am also on Arch Linux like @blueyed and I don't use tmux.

@justinmk

This comment has been minimized.

Show comment
Hide comment
@justinmk

justinmk Apr 20, 2016

Member

@aemb You must also inoremap <C-W>h <something>.

Please open troubleshooting questions in new issues or in other forums. This issue does not need more discussion about individual configs.

Member

justinmk commented Apr 20, 2016

@aemb You must also inoremap <C-W>h <something>.

Please open troubleshooting questions in new issues or in other forums. This issue does not need more discussion about individual configs.

@trusktr

This comment has been minimized.

Show comment
Hide comment
@trusktr

trusktr Apr 21, 2016

@aemb See :help map, then learn which mode you want to map for (n = normal, i = insert, etc) and what command you want to map <bs> to in that mode.

trusktr commented Apr 21, 2016

@aemb See :help map, then learn which mode you want to map for (n = normal, i = insert, etc) and what command you want to map <bs> to in that mode.

@siphiuel

This comment has been minimized.

Show comment
Hide comment
@siphiuel

siphiuel Apr 25, 2016

I've started having this issue in Tmux+Neovim after i've modified

set -g default-terminal "xterm-256color"

to

set -g default-terminal "screen-256color"

in .tmux.conf. I am using OS X Terminal.app.

Kudos to @jedahan - export TERMINFO="$HOME/.terminfo" fixed it for me as well.

siphiuel commented Apr 25, 2016

I've started having this issue in Tmux+Neovim after i've modified

set -g default-terminal "xterm-256color"

to

set -g default-terminal "screen-256color"

in .tmux.conf. I am using OS X Terminal.app.

Kudos to @jedahan - export TERMINFO="$HOME/.terminfo" fixed it for me as well.

jcmorrow pushed a commit to jcmorrow/dotfiles that referenced this issue May 3, 2016

Josh Morrow
Make neovim default editor
Because now <c-h> works again thanks to
neovim/neovim#2048 (comment)

expipiplus1 added a commit to expipiplus1/dotfiles that referenced this issue May 6, 2016

@blueyed

This comment has been minimized.

Show comment
Hide comment
@blueyed

blueyed May 9, 2016

Contributor

FWIW, I've found this in tmux source:

/*
 * Check for backspace key using termios VERASE - the terminfo
 * kbs entry is extremely unreliable, so cannot be safely
 * used. termios should have a better idea.
 */
bspace = tty->tio.c_cc[VERASE];
if (bspace != _POSIX_VDISABLE && (key & KEYC_MASK_KEY) == bspace)
    key = (key & KEYC_MASK_MOD) | KEYC_BSPACE;

https://github.com/tmux/tmux/blob/fe4e9470bb504357d073320f5d305b22663ee3fd/tty-keys.c#L625-L632

And it gets set for panes initially: tio2.c_cc[VERASE] = '\177'; (https://github.com/tmux/tmux/blob/fe4e9470bb504357d073320f5d305b22663ee3fd/window.c#L866).

Not sure if it's really helpful, but might give some idea to fix this.

Contributor

blueyed commented May 9, 2016

FWIW, I've found this in tmux source:

/*
 * Check for backspace key using termios VERASE - the terminfo
 * kbs entry is extremely unreliable, so cannot be safely
 * used. termios should have a better idea.
 */
bspace = tty->tio.c_cc[VERASE];
if (bspace != _POSIX_VDISABLE && (key & KEYC_MASK_KEY) == bspace)
    key = (key & KEYC_MASK_MOD) | KEYC_BSPACE;

https://github.com/tmux/tmux/blob/fe4e9470bb504357d073320f5d305b22663ee3fd/tty-keys.c#L625-L632

And it gets set for panes initially: tio2.c_cc[VERASE] = '\177'; (https://github.com/tmux/tmux/blob/fe4e9470bb504357d073320f5d305b22663ee3fd/window.c#L866).

Not sure if it's really helpful, but might give some idea to fix this.

@justinmk

This comment has been minimized.

Show comment
Hide comment
@justinmk

justinmk May 9, 2016

Member

@blueyed Yes, that's the traditional way to avoid this issue (Vim uses the same approach): fall back to termios. We would like to do that, but it requires forking libtermkey (or more ideally, getting a hook in libtickit when libtermkey is merged into libtickit).

Member

justinmk commented May 9, 2016

@blueyed Yes, that's the traditional way to avoid this issue (Vim uses the same approach): fall back to termios. We would like to do that, but it requires forking libtermkey (or more ideally, getting a hook in libtickit when libtermkey is merged into libtickit).

kthibodeaux added a commit to kthibodeaux/.dotfiles that referenced this issue Jun 3, 2016

kthibodeaux pushed a commit to kthibodeaux/.dotfiles that referenced this issue Jun 3, 2016

kthibodeaux added a commit to kthibodeaux/.dotfiles that referenced this issue Jun 4, 2016

Live in tmux
When opening a new shell when tmux is not running then run tmux new

If tmux is already running, give a choice to connect to an existing
session or create a new one (or qQ to not).

With these dotfiles it is not recommended to work outside of tmux due to
neovim/neovim#2048.  While there are many
solutions in the issue thread the one that works best for me is to
rebind c-h in tmux to send the proper command to neovim.  YMMV.

kthibodeaux added a commit to kthibodeaux/.dotfiles that referenced this issue Jun 5, 2016

Fix C-H again
Previous fix for C-H did not allow for navigating left to a different
tmux pane.

By putting the fix here we can be sure that the C-H binding is only
changed when inside of n/vim.

As always, see here for more information:
neovim/neovim#2048 (comment)

razor-x added a commit to rxrc/nvimrc that referenced this issue Jun 16, 2016

miniukof added a commit to miniukof/configfiles that referenced this issue Jun 16, 2016

ifyouseewendy added a commit to ifyouseewendy/dotfiles that referenced this issue Jun 21, 2016

larrylv added a commit to larrylv/dotfiles that referenced this issue Jun 23, 2016

jackfranklin added a commit to jackfranklin/dotfiles that referenced this issue Jun 24, 2016

vilhalmer added a commit to vilhalmer/System that referenced this issue Jul 1, 2016

[profile] Set TERMINFO if appropriate file exists
This adds the ability to include custom terminfo files in this repo,
which will be used when available. I've used it to fix the bug in OS X's
default terminfos which prevents C-h from working correctly in neovim.
As a result, this commit also removes that workaround from init.vim.

The included ti files were generated using the technique in
neovim/neovim#2048 (comment):

infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $TERM.ti && tic $TERM.ti

justjake added a commit to justjake/Dotfiles that referenced this issue Jul 22, 2016

Script to fix nvim Ctrl-H bindings on some systems
This issue crops up because almost all programs special-case backspace
to be ctrl-h.
See neovim/neovim#2048 (comment)

smcabrera added a commit to smcabrera/castillo-cabrera that referenced this issue Jul 30, 2016

akshayjshah added a commit to akshayjshah/dotfiles that referenced this issue Aug 4, 2016

@dojoteef

This comment has been minimized.

Show comment
Hide comment
@dojoteef

dojoteef Aug 9, 2016

I know I'm late to the party, but if anyone is looking for a solution with a more limited scope the approach I used will gracefully fallback to termios settings if needed for your terminal without requiring a global setting.

https://github.com/dojoteef/dotfiles/blob/master/init/50_nvim.sh#L39
https://github.com/dojoteef/dotfiles/blob/master/source/50_editor.sh#L4

dojoteef commented Aug 9, 2016

I know I'm late to the party, but if anyone is looking for a solution with a more limited scope the approach I used will gracefully fallback to termios settings if needed for your terminal without requiring a global setting.

https://github.com/dojoteef/dotfiles/blob/master/init/50_nvim.sh#L39
https://github.com/dojoteef/dotfiles/blob/master/source/50_editor.sh#L4

tdy added a commit to tdy/dots that referenced this issue Aug 11, 2016

tdy added a commit to tdy/dots that referenced this issue Aug 11, 2016

@justinmk

This comment has been minimized.

Show comment
Hide comment
@justinmk

justinmk Aug 22, 2016

Member

For those finding this issue, :CheckHealth now detects this problem and suggests a workaround. The same workaround is mentioned in the FAQ.


Update: @blueyed post to ncurses mailing list: https://lists.gnu.org/archive/html/bug-ncurses/2016-11/msg00022.html


Update: #5758 is an attempt to fix this issue.

Member

justinmk commented Aug 22, 2016

For those finding this issue, :CheckHealth now detects this problem and suggests a workaround. The same workaround is mentioned in the FAQ.


Update: @blueyed post to ncurses mailing list: https://lists.gnu.org/archive/html/bug-ncurses/2016-11/msg00022.html


Update: #5758 is an attempt to fix this issue.

@neovim neovim locked and limited conversation to collaborators Aug 22, 2016

@justinmk justinmk modified the milestones: 0.2, 0.3 Dec 12, 2016

@justinmk justinmk closed this in #5758 Dec 23, 2016

@justinmk

This comment has been minimized.

Show comment
Hide comment
@justinmk

justinmk Dec 23, 2016

Member

This is fixed on master (not released yet). To build from source, you probably need to:

rm -rf .deps build

However master is unstable currently, so most users should wait until the next release.

Member

justinmk commented Dec 23, 2016

This is fixed on master (not released yet). To build from source, you probably need to:

rm -rf .deps build

However master is unstable currently, so most users should wait until the next release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.