LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-25-2002, 06:26 AM   #1
comptut
LQ Newbie
 
Registered: Oct 2002
Distribution: red hat 8.0
Posts: 1

Rep: Reputation: 0
Unhappy vi and emacs


need help with using vi or emacs. trying create a file in my home directory. use either emacs or vi to just write anything in the editor and save to the newly created file. i was under the impression that when i wanted to save the editor message i would write :w with the filename to be saved and the name of the directory to be saved in. i am apparently doing something incorrectly because i cannot get it to save. please help..
 
Old 10-25-2002, 07:10 AM   #2
NSKL
Senior Member
 
Registered: Jan 2002
Location: Rome, Italy ; Novi Sad, Srbija; Brisbane, Australia
Distribution: Ubuntu / ITOS2008
Posts: 1,207

Rep: Reputation: 47
With emacs:
^C-x ^C-w will save and exit emacs after modifying a buffer.
Try searching google for a emacs tutorial (or do the excellent one that comes with emacs already) and search fro a emacs reference card with all the common commands.
HTH
-NSKL
 
Old 10-25-2002, 09:17 AM   #3
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
How do you use vi to save the file to a specified location? Are you out of edit mode? Esc :w filename
 
Old 10-25-2002, 09:21 AM   #4
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
Also make sure you have write permissons to the directory you want your file to be saved in
 
Old 10-26-2002, 05:05 PM   #5
adam_boz
Member
 
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538

Rep: Reputation: 30
I have a couple of files I use for reference on emacs and vi. here's what they say:

emacs:

**** "<C>" here means <ctrl>, "<M>" means "meta" or "Alt"

<C>-x <C>-f => "find" file, (open file)
<C>-g => universal "stop"-- good for when you mess up w/ commands
<esc><esc><esc> => same as <C>-g
<C>-x <C>-s => save file
<C>-x <C>-b => buffers list
<C>-x b => switch buffer
<C>-x a "#" => number of buffer windows
<C>-x o => move cursor to other buffer window
<C>-<M>-v => scroll other window
<C>-v => move foreward one screen
<M>-v => move back one screen
<C>-s => foreward search
<C>-r => reverse search
<F10> => pull down menu options... use arrows and <enter> to select

vim:

"i" => insert mode

"Esc" => normal mode

in insert mode, it's just like a normal text-editor.

some basic normal mode commands:

:q! => quit w/out saving
:w <file> => write to <file> (<file> only needed once)
:wq => write and quit
dw => delete word
d$ => delet to end of line
dd => delet whole line
u => undo command
<ctrl>-g => show location & status of file
:<command> => execute <command> (in bash... ex: mkdir)


Also, when you open up emacs, hit "ctrl-h t" for the tutor, and for vim, there's the "vimtutor" command (type from command line... not from inside vim)
 
Old 10-26-2002, 06:10 PM   #6
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
I always specify the name of the new file on the command line when starting vi/emacs. That way I can just ESC :w or CTRL-x CTRL-s without needing to think about filenames again.

I opened this thread half expecting to see a holy war about Emacs vs Vi!

cheres

Jamie..
 
Old 10-26-2002, 06:30 PM   #7
adam_boz
Member
 
Registered: Jul 2002
Location: Santa Cruz, CA
Distribution: lfs
Posts: 538

Rep: Reputation: 30
hehe... yeah me too. I've seen some really bloody battles out there on the subject.

I personally use vi if I am going to make some quick changes, and use emacs for anything more than that.

to each his own
 
  


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
where is the .emacs file in the emacs source code tarball? aizkorri Programming 2 01-13-2007 02:05 PM
emacs not responding to .emacs file in Mandriva 2005 LE. Please help LaptopLinux Mandriva 1 06-08-2005 08:36 AM
Emacs. shayan_tabrizi Linux - Software 1 07-23-2004 07:02 AM
edb (emacs database) won't open file - emacs 20 & 21 tip184 Linux - Software 0 04-03-2004 07:31 AM
Emacs HELP! sathyan Programming 6 07-18-2003 02:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:29 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