Linux - NewbieThis 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
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.
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..
Location: Rome, Italy ; Novi Sad, Srbija; Brisbane, Australia
Distribution: Ubuntu / ITOS2008
Posts: 1,207
Rep:
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
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)
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.