:: [cs485] Important Emacs commands ::
HOME


[Date Prev][Date Next][Date Index]

[cs485] Important Emacs commands


Here are some of the important keys for emacs... The last page of the
attached Emacs tutorial also contains a similar summary, but I guess i would
prefer to use my own exp.. I am attaching this document with this file
though..

Here are some more links.
http://mia.ece.uic.edu/~papers/refcard.html ::: This is a better version and
more detailed version of what i am goiung to say in the below mail.

http://www.fnal.gov/docs/products/emacs/emacs/emacs_toc.html

I still can't figure out how to get the source-code to be color coded for
emacs in text mode.. Will have to get an update on this.


Regards
Shashank


file can be opened in text mode using the following command:
%>emacs -nw test.txt

Once the file is open the followin commands can be used for saving the file

C-x C-s Will save the current buffer into the corresponding file
C-x C-c will exit from emacs.. If some buffers are not saved, it will prompt
the user to save it.
C-g     to cancel the the command and go back to entering text.

Moving between charcaters.
----------------------------

C-b   Moving back one character.
C-f     Moving forward one character
C-p    Moving one line up
C-n    Moving one line down
C-a    Moving to the beginging  of the line
C-e    Moving to the end of the line
C-v    Scrolling one page down
M-v    Scroling one page up
M-<    MMoving to the beging of the buffer
M->    Moving to the end of the buffer
M-e            Moving one sentence Backward
            Moving one sentence Forward.

Esc  x  this makes emacs to prompt you to enter a command.. Enter
"goto-line" .. Now emacase will ask for line number


Deleting cahracters and lines or blocks of lines
------------------------------------------------
Delete  key    Use this to delete one character to the left of the cursor,
same as Backspace key (I need to change this)
M-Delete key    use this to delete one word to the left of the cursor

C-d     Use this to delete a character on the right of the cursor, same as
delete key (I need to change this key-mapping too)
M-d     use this to delete one word to the right of the cursor

C-k     to delete all characters upto the end of line

COPY - Paste FUNCTIONALITY
---------------------------
C-Space Bar     To mark the begining region to be cut
C-w                 to actually cut that region
C-y     Paste the previously cut lines at the cursor location

UNDO
-------
C-x u     Undo last changes.. many changes can be undone.

GOTO LINE NUMBER
-------------------------
M-149     Press the ALT key and press 1, 4, 9 .. This command is followed by
C-n to repeat C-n 149 times.

Searching for TEXT:
--------------------
C-s     Will open the mini buffer.This is incremental search. For eg. if you
type "shashank" it will take match that incrementally.
            Search can be repeated by pressing C-s again and again. This
will search in forward direction
C-r     will search in backward direction'


M-%    This will make emacs prompt for the string to search-and-replace.
Enter this string and press <Enter>.. Then emacs will ask you for the string
to replace. Enter the other string and press <Enter>
             Emacs will find the first occurence and wait for your reply.
            press 'y' or "space bar" if u want to replace this occurence.
            press 'n' or "delete" to not replace this occurence and go to
the next
            press "!" to replace all occurences.
            press "Enter" to quit the string replacement.

Inserting an ENTIRE file
------------------------
C-x i     This will prompt you for the file name. Enter the file name. The
contents of the file will be inserted at the position of the cursor.

Opnening more than one files:
-----------------------------
C-x 2 or  -- This will split your text screen horizontally.. You will se the
same file again.
C-x 3     --- This will split your text screen vertically.. You will see the
same file
C-x o   -- This wilkl toggle bettween your two buffers,.
C-x C-f will allow you to open another file in the other buffer. (In text
mode only two buffers can be openend at a time .. i think)


COmpiling C++ Programs from withingh EMACS:
--------------------------------------------------
open the c++ program using C-x C-f control keys
Esc-x  This will make emacs prompt for a command.. enter "compile" .. then
emacs will prompt for the default compilation option..
            the default is "make -k" ..If you have a makefile alreday there
in there in the home directory, just type make..
            else u can enter "g++ -o prog1 prog1.cpp"











****************************************************************************
****************************



















Attachment: getting-started-emacs.pdf
Description: Adobe PDF document