SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Although I started with Slackware v9.0 and began using vi then, I can't recall how it functioned back then in terms of the Delete and Backspace keys. That said, since v12 iirc the stock vim that comes with each release has very handy default configs from my POV. I can delete a character or a series of characters with the Delete key without ever having invoked "i" insert mode and then save that with the ordinary ":wq" command, without ever having entered insert mode. I know that's only one keystroke and a very minor issue but the point is Delete key does delete and rather handily in modern vim. Perhaps there is a way to utilize a more modern version in your older system. It certainly would be trivial to try.
I say vi's default behavior in what respects to the backspace key is weird. The name of the key implies its function: go back one space. But vi does not seem to agree. If you edit a new file (with vi), type some letters (except Enter), save and quit. Then reedit it and press A (that will send the cursor to the end of the line) and you now press the backspace key, you'll see nothing happens! It is this behavior that keeps people away from vi and throus them in the arms of vim.
I have read many posts regarding this strange default behavior of the backspace key but none of them has ever been of any use to me. I think it would be intelligent on the part of the developers (if vi is still being maintained) to make the default behavior of the backspace key that which it has in vim (which on the other hand is logical) and, if someone wants to make it do those strange things, then write the appropriate line in its config file which, by the way, I don't know which it is (I mean, has vi a cofiguration file like .vimrc in vim?).
One thing is still odder. I have vi installed by default in Debian 9. Then I installed vim and wrote this ~/.bashrc:
Code:
semoi@debian:~$ cat .vimrc
set backspace=indent,eol,start
fixdel
semoi@debian:~$
Now I ran vi and found the backspace key behaved as in vim (normal behavior). Excelent I said, and uninstalled vim. But then vi reverted to its old behavior. Does this mean when I installed vim vi became a link to vim?
I say vi's default behavior in what respects to the backspace key is weird. The name of the key implies its function: go back one space. But vi does not seem to agree. If you edit a new file (with vi), type some letters (except Enter), save and quit. Then reedit it and press A (that will send the cursor to the end of the line) and you now press the backspace key, you'll see nothing happens! It is this behavior that keeps people away from vi and throus them in the arms of vim.
You've put vi (elvis) into insert mode. Insert mode will not delete previously existing text. You could hit Esc, and then start hitting 'x' to delete characters.
Quote:
I have read many posts regarding this strange default behavior of the backspace key but none of them has ever been of any use to me. I think it would be intelligent on the part of the developers (if vi is still being maintained) to make the default behavior of the backspace key that which it has in vim (which on the other hand is logical) and, if someone wants to make it do those strange things, then write the appropriate line in its config file which, by the way, I don't know which it is (I mean, has vi a cofiguration file like .vimrc in vim?).
Conversely, I find vim to behave strangely compared with the classic vi that I used on Unix. Elvis is pretty close to that, but I suppose we could have nvi, which is actually derived from what was used back then.
A real vi user does not need the cursor keys or the backspace key anyway.
Quote:
One thing is still odder. I have vi installed by default in Debian 9. Then I installed vim and wrote this ~/.bashrc:
Code:
semoi@debian:~$ cat .vimrc
set backspace=indent,eol,start
fixdel
semoi@debian:~$
Now I ran vi and found the backspace key behaved as in vim (normal behavior). Excelent I said, and uninstalled vim. But then vi reverted to its old behavior. Does this mean when I installed vim vi became a link to vim?
vi might be a symlink to vim on Debian. In fact, that would not surprise me.
You've put vi (elvis) into insert mode. Insert mode will not delete previously existing text. You could hit Esc, and then start hitting 'x' to delete characters.
But if I want to delete 15 chars behind the cursor I should hit 'x' 15 times to erase them. In vim (in the default setting) I only have to hit the backspace key once and hold it down until all chars have been deleted. I think that's economy.
Quote:
vi might be a symlink to vim on Debian. In fact, that would not surprise me.
In fact what makes the behavior of vi to emulate that of vim is this (if you have vim installed):
Code:
root@debian:~# whereis vi
vi: /usr/bin/vi /usr/share/man/man1/vi.1.gz
root@debian:~# ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 20 May 30 14:52 /usr/bin/vi -> /etc/alternatives/vi
root@debian:~# ls -l /etc/alternatives/vi
lrwxrwxrwx 1 root root 18 Jun 2 16:52 /etc/alternatives/vi -> /usr/bin/vim.basic
root@debian:~#
So it seems it is vim.basic who is being executed!
But if I want to delete 15 chars behind the cursor I should hit 'x' 15 times to erase them. In vim (in the default setting) I only have to hit the backspace key once and hold it down until all chars have been deleted. I think that's economy.
You could hit: 15x
Quote:
In fact what makes the behavior of vi to emulate that of vim is this (if you have vim installed):
Code:
root@debian:~# whereis vi
vi: /usr/bin/vi /usr/share/man/man1/vi.1.gz
root@debian:~# ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 20 May 30 14:52 /usr/bin/vi -> /etc/alternatives/vi
root@debian:~# ls -l /etc/alternatives/vi
lrwxrwxrwx 1 root root 18 Jun 2 16:52 /etc/alternatives/vi -> /usr/bin/vim.basic
root@debian:~#
So it seems it is vim.basic who is being executed!
But if I want to delete 15 chars behind the cursor I should hit 'x' 15 times to erase them. In vim (in the default setting) I only have to hit the backspace key once and hold it down until all chars have been deleted. I think that's economy.
In fact what makes the behavior of vi to emulate that of vim is this (if you have vim installed):
Code:
root@debian:~# whereis vi
vi: /usr/bin/vi /usr/share/man/man1/vi.1.gz
root@debian:~# ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 20 May 30 14:52 /usr/bin/vi -> /etc/alternatives/vi
root@debian:~# ls -l /etc/alternatives/vi
lrwxrwxrwx 1 root root 18 Jun 2 16:52 /etc/alternatives/vi -> /usr/bin/vim.basic
root@debian:~#
So it seems it is vim.basic who is being executed!
Not to be elitist or anything, but if you are wanting to press and hold backspace to delete a bunch of characters in vi/vim, you are doing it wrong. I recommend you learn the proper keyboard shortcuts. You will be much more productive.
(As far as being elitist is concerned, I'm not that hardcore. I use vim instead of elvis.)
Last edited by montagdude; 06-02-2018 at 04:44 PM.
But what if you make a mistake while typing and type a j instead of a k? You are in insert mode. OK. You have not to exit insert mode. You just hit one key: backspace!
But what if you make a mistake while typing and type a j instead of a k? You are in insert mode. OK. You have not to exit insert mode. You just hit one key: backspace!
Well yeah, but we were talking about deleting 15 characters, not 1.
But if I want to delete 15 chars behind the cursor I should hit 'x' 15 times to erase them. In vim (in the default setting) I only have to hit the backspace key once and hold it down until all chars have been deleted. I think that's economy.
Or hit 'x' once and hold it down until all chars have been deleted.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.