LinuxQuestions.org
Visit Jeremy's Blog.
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 01-06-2004, 12:22 PM   #1
Mugatu
Member
 
Registered: Dec 2003
Location: VA
Distribution: Ubuntu
Posts: 193

Rep: Reputation: 30
using backspace or delete in vi


i'm used to using vi in other distros. how do i use the backspace or delete key when using vi in slackware 9.1? when i press them nothing happens at all. is there a better CLI editor i should be using?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-06-2004, 12:45 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 253Reputation: 253Reputation: 253
Use or try these while in command mode:

x - deletes one character at a time
dd - deletes the whole current line
 
Old 01-06-2004, 02:42 PM   #3
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,897

Rep: Reputation: 577Reputation: 577Reputation: 577Reputation: 577Reputation: 577Reputation: 577
You might try using the text editor 'joe'.
I use vi all the time as it's fast and present in all distros in some form or another. In Slackware it is actually 'elvis' in others maybe something else which is wha they don' always act the same. Something I only found out recently is that vi will render html files as well!
'x' deletes characters under the cursor and to the right of the cursor(one at a time)
 
Old 01-06-2004, 06:35 PM   #4
Kovacs
Member
 
Registered: Jul 2003
Distribution: FreeBSD 8.2 RELEASE
Posts: 607

Rep: Reputation: 31
Personally I link vim rather than elvis to vi. As root:
rm /usr/bin/vi
ln -s /usr/bin/vim /usr/bin/vi

Then as your regular user make a file called .vimrc in your home directory, with these contents:

set backspace=indent,eol,start
fixdel

And you can now use backspace when you run vi (which is now really vim).

In my .vimrc I also have:
syntax enable
set number
set autoindent
set tabstop=4

which enables syntax highlighting, shows line numbers, autoindents your code and sets the tab length to 4 characters. There are tons of other options, have a look on the vim website.

There is also an integrated tutorial in vim, it takes about 30 mins and is well worth it to introduce you to some of vim's less than intuitive features... it's a great editor once you get the hang of it.
 
Old 01-07-2004, 05:24 AM   #5
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,897

Rep: Reputation: 577Reputation: 577Reputation: 577Reputation: 577Reputation: 577Reputation: 577
Yes vim is also nice. Maybe it was 'jed' I meant to suggest instead of joe. I haven't used them, just know that thex are there in Slack 9.1. One other trick, though for vi- it can be called from within 'less'. This is nice for viewing and then editing files, since if you make a typo in vi, a file will be created with the name you typed. So instead of directly calling a file in vi: vi /etc/X11/XF86Config, I call it with 'less':
less /etc/X11/XF86Config then when i find the section I want to edit just type 'vi' (within less). After exiting vi witn ':q!' or ':wq' it returns you to 'less'. a much safer way to quickly edit files. You have posted are probably familiar with these tricks, but I post them for the benefit of others who may not know.
 
Old 01-07-2004, 07:45 AM   #6
Mugatu
Member
 
Registered: Dec 2003
Location: VA
Distribution: Ubuntu
Posts: 193

Original Poster
Rep: Reputation: 30
joe worked, and at least it will let me use my backspace and delete keys i'll give vim a try as well. thanx for all the input
 
Old 01-07-2004, 09:51 AM   #7
malo_umoran
Member
 
Registered: Dec 2003
Distribution: Desktop: Slackware 13.1 &13.37 | Server: Debian 6.0
Posts: 270

Rep: Reputation: 32
Re: using backspace or delete in vi

Quote:
Originally posted by Mugatu
i'm used to using vi in other distros. how do i use the backspace or delete key when using vi in slackware 9.1? when i press them nothing happens at all. is there a better CLI editor i should be using?

backspace or delete are not standard vi commands.

* ctrl+x deletes char
* d$ deletes rest of the line
* dG deletes rest of the file
* dd deletes line and puts the line in the clipboard
* 5dd deletes line + 4 next lines

etc.

M.
 
Old 01-07-2004, 11:42 AM   #8
ringwraith
Senior Member
 
Registered: Sep 2003
Location: Indiana
Distribution: Slackware-current
Posts: 1,261

Rep: Reputation: 53
I think the most userfriendly of the console based text editors is pico or nano. Just be sure to use pico -w on the config files. I use both it and elvis for all my text editing needs
 
Old 01-07-2004, 03:13 PM   #9
Astro
Member
 
Registered: Jan 2003
Location: Ballston Lake, NY
Distribution: Slackware, Debian
Posts: 662

Rep: Reputation: 30
I grabbed a very very nice .vimrc file from somewhere and I can't remember the site or I would post it. It seems to be a problem with terminal emulation as to the backspace problem... for instance.... in console you can backspace fine, however in say Gnome-terminal it doesn't work so well where as in rxvt it works fine. Not sure how to correct this though, and I havn't had much time, but theres my $0.02
 
Old 01-07-2004, 07:42 PM   #10
Kovacs
Member
 
Registered: Jul 2003
Distribution: FreeBSD 8.2 RELEASE
Posts: 607

Rep: Reputation: 31
You should be able to fix that with these two lines in .vimrc:

set backspace=indent,eol,start
fixdel
 
Old 10-20-2004, 02:46 PM   #11
slackwaresux
LQ Newbie
 
Registered: Oct 2004
Posts: 5

Rep: Reputation: 0
Quote:
Originally posted by Kovacs
Personally I link vim rather than elvis to vi. As root:
rm /usr/bin/vi
ln -s /usr/bin/vim /usr/bin/vi

Then as your regular user make a file called .vimrc in your home directory, with these contents:

set backspace=indent,eol,start
fixdel

And you can now use backspace when you run vi (which is now really vim).

In my .vimrc I also have:
syntax enable
set number
set autoindent
set tabstop=4

which enables syntax highlighting, shows line numbers, autoindents your code and sets the tab length to 4 characters. There are tons of other options, have a look on the vim website.

There is also an integrated tutorial in vim, it takes about 30 mins and is well worth it to introduce you to some of vim's less than intuitive features... it's a great editor once you get the hang of it.

After hours of frustration, that worked!!! You're a genius, thanks man!!!
 
Old 10-20-2004, 05:28 PM   #12
slackwaresux
LQ Newbie
 
Registered: Oct 2004
Posts: 5

Rep: Reputation: 0
Actually your solution worked but then I had to start from scratch, when I created the .vimrc file, now the "delete" key does not work. Could you explain the reason why?

Thanks for the help.
 
Old 10-20-2004, 09:04 PM   #13
levicc00123
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 94

Rep: Reputation: 15
Here's what did the trick for me:

Code:
:set nocp
:map <BS> ^H
set backspace=indent,eol,start
fixdel
:syntax enable
:set number
:set autoindent
:set tabstop=4
 
Old 10-21-2004, 12:01 AM   #14
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 51
What I would recommend is to copy /usr/share/vim/vim63/vimrc_sample.vim to ~/.vimrc
That will give you all nice things
 
Old 06-01-2018, 04:16 PM   #15
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,960

Rep: Reputation: 55
A question: what has .vimrc to do with vi?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:52 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration