Eugeny / tabby

A terminal for a more modern age
https://tabby.sh
MIT License
59.2k stars 3.4k forks source link

Using vim in ssh session, home and end keys do not work #2738

Open justinvson-pd opened 4 years ago

justinvson-pd commented 4 years ago

version: 1.0.112 platform: win32 10.0.17763 plugins: none

If I press end or home in vim while in an SSH session, it will not do anything. When in insert mode, it will exit insert mode and move one to the left or right, depending on if home or end is pressed.

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 4 years ago

why did you close this issue? how did you solve it? i experience same behavior on latest alpha

justinvson-pd commented 4 years ago

I experience it intermittently, at some point it worked so I thought it was fixed. But after I started seeing it again and forgot to reopen. Not fixed.

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 4 years ago

I found 2 workarounds:

1. in Vim you can press twice ^ or $ key while in command mode to jump to start/end of the line

2. 
2.1 go to Terminus settings > shell 
    > new profile > select cygwin
        > add new Environment variable 'HOME' and set to "C:\cygwin\home\<user>" (cygwin's path)
        >rename this profile "Cygwin - As - it - should - be"
    >profile (default) > select "Cygwin - As - it - should - be"

2.2 open new (cygwin) tab and type:
echo "set term=xterm-256color" >> /etc/vimrc #system wide
echo "set term=xterm-256color" >> ~/.vimrc #profile only

Now you can test that it works as expected.

justinvson-pd commented 4 years ago

I don't use cygwin, I ssh into a server running debian 10 directly from terminus and don't even have cygwin installed. I also don't have access to /etc/vimrc.

Using ^ and $ is annoying in edit mode because you have to keep reverting to command mode.

Just editing ~/.vimrc with set term=xterm-256color also didn't work.

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 4 years ago

How is your ~/.vimrc looking? I did a test by only setting term in my profile, not system wide and worked fine.

justinvson-pd commented 4 years ago

Only this line: set term=xterm-256color when I call echo $TERM it prints xterm-256color

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 4 years ago

I tried reproducing it on debian 10. For me after connecting via ssh to it, i could simply use vi or vim and home/end were working as expected. term was set by default to xterm-256color

If you open a vi/vim in terminus while connected to your debian and type :set term, what does it show?

Also what does typing :set term xxx show? (this will give an error and show other builtin options)

Update: you could try also setting to 'builtin_xterm", as it also worked for me. You can try different ones directly in vi/vim without setting it permanently, by typing similar to this

:set term=bultin_xterm
############
user@debian:~$ cat /etc/*lease
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

user@debian:~$ uname -a
Linux debian 4.19.0-11-amd64 #1 SMP Debian 4.19.146-1 (2020-09-17) x86_64 GNU/Linux
justinvson-pd commented 4 years ago

Linux lnxfit03 5.6.0-0.bpo.2-amd64 #1 SMP Debian 5.6.14-2~bpo10+1 (2020-06-09) x86_64 GNU/Linux user@lnxfit03:~$ cat /etc/*lease PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"

term=xterm-256color E518: Unknown option: xxx Press ENTER or type command to continue

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 4 years ago

Can you please type these 2 commands one after another inside vim (when you have it open), not write them in vimrc, or else you get error "E518: Unknown option: xxx" (so you must remove it from the config file, you can use nano to fix it)

:set term
:set term xxx
justinvson-pd commented 4 years ago

:set term term=xterm-256color

I didn't write it into vimrc, I did :set term and :set term=xxx

:set term=xxx E558: Terminal entry not found in terminfo 'xxx' not known. Available builtin terminals are: builtin_amiga builtin_beos-ansi builtin_ansi builtin_pcansi builtin_win32 builtin_vt320 builtin_vt52 builtin_xterm builtin_iris-ansi builtin_debug builtin_dumb

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 4 years ago

ah ok. did you try the builtin_xterm?

justinvson-pd commented 4 years ago

yes, also did not work

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 4 years ago

uh that's quite strange... what vim version do you have and where is it located? Mine looks like this:

~$ vim --version | head -2
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 15 2019 16:41:15)
Included patches: 1-875, 878, 884, 948, 1046, 1365-1368, 1382, 1401

fusion@debian:~$ type vim
vim is hashed (/usr/bin/vim)

fusion@debian:~$ type vi
vi is hashed (/usr/bin/vi)

fusion@debian:~$ ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 20 Oct 14 04:30 /usr/bin/vi -> /etc/alternatives/vi

fusion@debian:~$ ls -l /usr/bin/vim
lrwxrwxrwx 1 root root 21 Oct 14 05:12 /usr/bin/vim -> /etc/alternatives/vim

fusion@debian:~$ ls -l /etc/alternatives/vi
lrwxrwxrwx 1 root root 18 Oct 14 05:12 /etc/alternatives/vi -> /usr/bin/vim.basic

fusion@debian:~$ ls -l /etc/alternatives/vim
lrwxrwxrwx 1 root root 18 Oct 14 05:12 /etc/alternatives/vim -> /usr/bin/vim.basic

Also can you try removing hotkeys for "Beginning of the line" and "End of the line" in terminus settings? I have them removed and works fine.

Just a note, that I am not affiliated with Terminus just wanted to share my experience.

justinvson-pd commented 4 years ago

Removing the hotkeys did the trick, now it works. Thanks.

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 4 years ago

oh glad to hear that. cheers :)

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two weeks unless you comment. Thank you for your contributions.

atrHusK commented 3 years ago

I also ran into this (using Cygwin trough Tabby 1.0.155).

Just setting TERM=xterm-256color indeed works for the cygwin situation. for both local cygwin applications as well as applications run remotely.

As far as I think I know TERM=cygwin points to the capabilities of this special terminal type. I don't think this type is needed anymore with the new Windows pseudo console (ConPTY) because the terminal does not have to provide tricks to let unix tools work as expected in a windows console. So to fix this bug I think it would be best if tabby sets the autodetected cygwin profile to TERM=xterm-256color when the switch for using ConPTY is enabled. This is also more compatible for remote usage because when ssh-ing into remote systems TERM=cygwin is not usually understood (for example 'screen' will usually complain about unknown terminal).

With ConPTY disabled the bug also exists, but in that case I think it should stay on TERM=cygwin because changing it will create other problems for applications.

owent commented 3 years ago

image Just remove Beginning of the line and End of th line hotkeys from Settings->Hotkeys . HOME and END works for me.

atrHusK commented 3 years ago

Already tried that, does not fix anything for vim in cygwin, which is why I mentioned I tested that, but even when it does for you its still best to make sure TERM != cygwin when using ConPTY mode

alanachtenberg commented 2 years ago

Same occurs for me using windows 10 and latest alpha 1.0.169 and git bash. Either vi or vim. Removing hot keys did not seem to help. Also interestingly removing the hot keys home/end did not affect home and end functionality in the bash