LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-01-2018, 06:17 PM   #16
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled

Quote:
Originally Posted by stf92 View Post
A question: what has .vimrc to do with vi?
Did you notice that the previous post of this thread is more than 13 years old?

Furthermore the answer has been given in post #4, more that 14 years ago!

Last edited by Didier Spaier; 06-01-2018 at 06:20 PM.
 
1 members found this post helpful.
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-01-2018, 06:44 PM   #17
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
So?
 
1 members found this post helpful.
Old 06-01-2018, 06:56 PM   #18
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 4,784

Rep: Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434Reputation: 4434
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.

Edit : NecroOOPS!

Last edited by enorbet; 06-01-2018 at 06:57 PM.
 
Old 06-01-2018, 07:42 PM   #19
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
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?

Last edited by stf92; 06-01-2018 at 07:55 PM.
 
Old 06-01-2018, 09:46 PM   #20
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,504

Rep: Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461
Quote:
Originally Posted by stf92 View Post
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.
 
3 members found this post helpful.
Old 06-02-2018, 03:16 PM   #21
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
Quote:
Originally Posted by volkerdi View Post
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!
 
Old 06-02-2018, 03:27 PM   #22
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,504

Rep: Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461
Quote:
Originally Posted by stf92 View Post
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!
The theory was correct, then.
 
Old 06-02-2018, 04:43 PM   #23
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by stf92 View Post
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.
 
Old 06-02-2018, 05:10 PM   #24
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
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!
 
Old 06-02-2018, 07:52 PM   #25
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by stf92 View Post
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.
 
Old 06-03-2018, 03:19 AM   #26
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,783

Rep: Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460
Quote:
Originally Posted by stf92 View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Backspace & delete key issues stefaandk Linux - Newbie 3 07-29-2005 01:10 AM
FreeBSD Backspace and Delete keys joel112 *BSD 1 06-19-2005 06:28 AM
Tried to delete file as root but it says I don't have permission to delete it! beejayzed Mandriva 23 03-12-2004 02:46 AM
backspace changes line, doesn't delete lugoteehalt Linux - General 2 10-22-2003 04:51 AM
vi won't backspace or delete in terminal JamesM Linux - Software 1 08-18-2003 09:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration