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

jump to start of line not working #4308

Closed
Gibheer opened this issue Feb 21, 2016 · 39 comments
Closed

jump to start of line not working #4308

Gibheer opened this issue Feb 21, 2016 · 39 comments

Comments

@Gibheer
Copy link

Gibheer commented Feb 21, 2016

  • Neovim version: 0.1.2
  • Operating system: FreeBSD
  • Terminal emulator: rxvt+tmux

Actual behaviour

I just switched from vim to nvim and the home/pos 1 and end key do not work anymore with my original configuration. They do work in vim.

Expected behaviour

What I would expect is that the curser would jump to the start of the line using home/pos 1 key and jump to the last character of the line with the end key.

Steps to reproduce

Open a vimrc with comments or a markdown file and position the curser somewhere in the middle of a line. Then press home/pos 1 and nothing happens. The same with the end key.

@justinmk
Copy link
Member

Sounds like a termcap or other configuration issue. There are existing closed issues related to this, but it's long been solved. #2028

@leon-barrett
Copy link

@justinmk I'm seeing this issue too, on Ubuntu 15.04. I hear you say that this has "long been solved," but if so, why are people suddenly reporting this bug again? I think either it was never solved in linux or there has been a regression.

What should I do now? Though "it's long been solved", it's clearly broken for me and some other linux users. Will filing a new bug help?

I can reproduce in Ubuntu 15.04 in tmux using neovim Ubuntu build 0.1.2ubuntu1+git201603111733+2366+17~ubuntu15.04.1.

@justinmk
Copy link
Member

What are the repro steps using nvim -u NONE ?

@leon-barrett
Copy link

Steps:

  • run gnome-terminal or xterm
  • in terminal, run tmux
  • in tmux, run nvim -u NONE
  • in nvim, enter "i12"
  • in nvim, press

Expected behavior: cursor moves over "1"
Actual behavior: cursor remains over "2"

@justinmk
Copy link
Member

<Home> works just fine in insert mode, normal mode, etc., for me--but I don't have xterm nor gnome-terminal.

Unless this problem is present for all users of xterm or all users of gnome-terminal, those repro steps don't provide enough information (version of libvte, which is used by gnome-terminal, might be helpful).

As I said above, most likely this is a terminfo issue: dependent on your distro and/or your own configuration.

@leon-barrett
Copy link

Presumably, you don't have xterm or gnome-terminal because you're using a Mac. All the people reporting this issue lately have not been using Macs. The reporter of this issue is using FreeBSD. I'm using Ubuntu 15.04. The people complaining in linked issue #2028 are using "ubuntu 15.04", "ubuntu 16.04", "Ubuntu 14.04", and "Junest".

Those reproduction steps seem to happen for a fair number of users of linux--you've now gotten 6 bug reports for the same problem since December.

My guess is that there is no issue when running NeoVim in tmux on a Mac. That's great. However, I wish you would not dismiss the issue just because you're having no problem when using it on a different system.

@fmoralesc
Copy link
Contributor

I just tried this on gnome-terminal (vte3 0.42.4)/tmux and I can't reproduce it.

@leon-barrett
Copy link

Hmm. It looks like even when I run tmux, my TERM is set to xterm. If I set TERM to screen, then <Home> works.

Perhaps that's true for other people who've had this problem? @Gibheer and @marcosnils, you're the most recent reporters--can you experiment with TERM to see if that helps?

@justinmk
Copy link
Member

@marcosnils
Copy link

@leon-barrett @justinmk my TERM is set to xterm-256color. I need it this way as there are some stuff (like vim color scheme) which needs this variable to render properly. Using classic vim I didn't have any problems with this, in neovim it's not working.

@justinmk
Copy link
Member

@marcosnils If you have TERM=xterm-256color then your case must be different--unless it really doesn't match your terminfo or something.

Using classic vim I didn't have any problems with this, in neovim it's not working.

Only the <Home> is a problem for you? Maybe this is another case where Vim checked termios for a fallback.

@marcosnils
Copy link

Only the is a problem for you? Maybe this is another case where Vim checked termios for a fallback.

< End > doesn't work either

@wsdjeg
Copy link
Contributor

wsdjeg commented Mar 12, 2016

@marcosnils in insert modo what is the out put <ctrl + v> <home>?

@marcosnils
Copy link

@wsdjeg <Right>

@wsdjeg
Copy link
Contributor

wsdjeg commented Mar 12, 2016

@leon-barrett as I know in ubuntu 14.04 gnome-terminal do not works well, you can not use ctrl+home goto the gegin of the file ,also can not use ctrl+end goto the end if the file,but home and end should works well,by the way ,I think you can update you gnome-terminal to 3.16.2,it is the best version I use.

@wsdjeg
Copy link
Contributor

wsdjeg commented Mar 12, 2016

@marcosnils so that is why you can not use home goto the begin of the line,the terminal send wrong char to neovim

@marcosnils
Copy link

@wsdjeg my bad, I wasn't pressing the correct combination. <ctrl+v> <home> doesn't print anything. It works with vim though.

@wsdjeg
Copy link
Contributor

wsdjeg commented Mar 12, 2016

sorry I do not use tmux,and my os is ubuntu 15.10 gnome-terminal 3.16.2, everything works well ,so I can not confirm it is an issue of neovim.
can you have a try with out tmux,and disable the hotkey of gnome-terminal.
also what is your terminal version?

@justinmk
Copy link
Member

my TERM is set to xterm-256color.

@marcosnils In the other issue you mentioned you're using tmux. So you have TERM=xterm-256color in tmux? That's not going to work. It's nice that it works in Vim, but it's probably an accident.

@marcosnils
Copy link

@justinmk just confirmed that if I change the TERM to screen works correctly.

@justinmk
Copy link
Member

Ok. Try screen-256color if you run into issues (this is what tmux recommends).

@leon-barrett
Copy link

@justinmk Thanks for adding it to the wiki.

@guiniol
Copy link

guiniol commented Jun 29, 2016

I don't want to open yet a bug report, but I still have this issue.
neovim: 0.1.4
rxvt-unicode (with TERM rxvt-unicode-256color) with zsh.

The bug seems to come from these lines in my Xdefault

urxvt*keysym.Home: \033[1~
urxvt*keysym.End: \033[4~
urxvt*keysym.KP_Home: \033[1~
urxvt*keysym.KP_End:  \033[4~

I had to put them to get another application to work (fzf)

Everything works fine in tmux (screen-256color).

infocmp gives 7&8 instead of 1&4. It does give 1&4 for tmux.
Also, if I change my Xdefault to 7&8, or if I remove them, home and end work in neovim (but not in fzf). It changes nothing in tmux, and bot applications work.

I'm really at a loss there, so if anyone has any tips on how to get out of this mess, I'd appreciate it.
Of course, I'll also ask in fzf, and report here if I find a solution.

@justinmk
Copy link
Member

We don't have very good support for rxvt right now.

I have a question: What is the reason for using rxvt these days? Only reason I ever heard was "it's, like, fast", but I doubt very much that there are not xterm-compatible alternatives that are as "fast" and have similar features.

I genuinely would like to find out if there is a reason for us to spend time trying to support rxvt and its variants.

@guiniol
Copy link

guiniol commented Jun 29, 2016

Honestly, mostly for a few scripts that I have keybound. They allow me to cut/paste, open url, change font size etc.. from the keyboard. Also, I use i3 (window manager only, no desktop env), and the 'all keyboard" integrates nicely with my workflow, and urxvt doesn't require my installing gnome or kde or whatever. I haven't tried to change for a little while, so these maybe solved. I have no idea how widespread urxvt usage is, but I work at a small company and the other two guys were also using urxvt when I arrived.

Do you have any suggestions on which terms I could try to move to?

@justinmk
Copy link
Member

I've heard good things about http://st.suckless.org . The readme mentions clipboard support.

They allow me to cut/paste, open url

Isn't xdg-open the standard way to open URLs on linux?

@guiniol
Copy link

guiniol commented Jun 29, 2016

what I mean is that I press a shortcut and I can select a url in the history and then it opens it via xdg-open. No need for a mouse.

I'll take a look but I seem to recall st doesn't have a configuration file and requires compiling instead, which would be annoying when changing system, updates, etc...

@justinmk
Copy link
Member

For future reference, @guiniol's problem was resolved here: junegunn/fzf#279 (comment)

@guiniol
Copy link

guiniol commented Jun 29, 2016

@justinmk thanks. Forgot to mention it...

EDIT: reading the code from fzf, it seems that it assumes the values of escape sequences instead of getting them from terminfo, so that's the source of the problem here.

@arashm
Copy link

arashm commented Aug 28, 2016

I fixed my issue by removing TERM=xterm-256color from my shell rc file, and just using set -g default-terminal "screen-256color" on tmux.conf. Now both Home and End button works for me on neovim + tmux.

@novel
Copy link

novel commented Oct 1, 2017

Looks like I'm having a similar issue in a similar environment.

I have FreeBSD 12-CURRENT, tmux, rxvt, nvim 0.2.0.

I have TERM=screen-256color configured via set -g default-terminal "screen-256color" in tmux.conf.

When I'm running nvim -u NONE and try keys with , I get:

Home: nothing
End: nothing

though:

Ctrl-Home: <C-Home>
Ctrl-End: <C-Ends>

Any ideas what could be wrong here?

$ env|grep TERM    
TERM=screen-256color
COLORTERM=rxvt
TERMINFO=/usr/local/share/misc/terminfo.db
$ LC_ALL=C ls -l ${TERMINFO}
-rw-r--r--  1 root  wheel  5079040 Oct  1 08:24 /usr/local/share/misc/terminfo.db
$

PS Home/End keys work fine in vim in the same environment.

@justinmk
Copy link
Member

justinmk commented Oct 1, 2017

See :help $TERM (in master/0.2.1) and #6014 (comment)

@novel I see that you have TERMINFO env var set, so unibilium should use that. What happens if you unset that?

@novel
Copy link

novel commented Oct 1, 2017

TERMINFO="" nvim -u NONE -- nothing changes
TERMINFO="" vim -u NONE -- still works
TERM="tmux-256color" TERMINFO="" nvim -u NONE -- nothing changes
TERM="tmux-256color" TERMINFO="" vim -u NONE -- still works, but prints

zsh: can't find terminal definition for tmux-256color                                                     
zsh: can't find terminal definition for tmux-256color 

@justinmk
Copy link
Member

justinmk commented Oct 1, 2017

Try something other than rxvt, or just use vim. rxvt is a waste of time.

@novel
Copy link

novel commented Oct 1, 2017

It looks like the problem is not in rxvt but in unibilium on FreeBSD.

From unibi_from_term(3), it's checking various directories ($TERMINFO, $HOME/.terminfo, $TERMINFO_DIRS) for a filename matching $TERM.

However, on FreeBSD I have on 'screen-256color' (or anything like that), I only have this /usr/local/share/misc/terminfo.db that's installed by the ncurses port. I guess I need to figure out how to install these terminfo files or how to make unibilium use existing db file.

@jamessan
Copy link
Member

jamessan commented Oct 1, 2017

It looks like the problem is not in rxvt but in unibilium on FreeBSD.

You're probably running into mauke/unibilium#25.

@novel
Copy link

novel commented Oct 1, 2017

I was able to workaround it by going to /usr/ports/devel/linux-c6-ncurses-base && make extract and copying over terminfo from there to /usr/local/share/misc/terminfo.

Then things work fine when running it like TERMINFO="/usr/local/share/misc/terminfo" nvim.

I'm not sure why FreeBSD's devel/ncurses port does not install these files.

@novel
Copy link

novel commented Oct 1, 2017

You're probably running into mauke/unibilium#25.

I'm not sure if that's the same thing. FreeBSD uses original ncurses (at least the port version, didn't check the base), but uses a single db file (terminfo.db) instead of a directory tree with one file per each $TERM type. terminfo.db is a Berkeley DB hash file, not cdb(5) as mentioned there, probably that's a different thing.

@indera
Copy link

indera commented Dec 8, 2017

This is what worked for me:

== add in ~/screenrc
term "screen-256color"

-- remove line from ~/.bashrc
TERM=xterm-256color

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