Thursday, 19 November 2009

Emacs Commands

Select: keep the cursor in the right place from where to copy then press
ctrl space and then use arrow keys to select text of any length.

Copy: alt + w

Cut: ctrl + u

Undo: ctrl + _
OR
ctrl + x u

Paste: ctrl + y
Select all: ctrl + x h
Indenting region: Select the region or the complete text and then type the following command in the mini buffer.
indent-region

Accessing Mini Buffer: Mini buffer can be accessed by different commands which are as follows:
1. press meta key OR
2. alt + x
3. esc + x

Kill line: ctrl + k
this command will kill the complete line following the cursor. A line can be killed and the pasted on another place.

Save: ctrl + x + s

Open File: ctrl + x + f

Open two(2) vertical buffers: It can be done by multiple commands

1. f2 2
2. ctrl + x 3

Open more then two(2) vertical buffers:
ctrl + x 3 
Open two(2) horizontal buffers: ctrl + x 2

Switch From one to the other Buffer: ctrl + x o

Keep one buffer and close all others:
1. f2 1.
2. ctrl +x 1

Syntax Highlighting: goto options in the menu bar and select the first option "syntax highlighting (Global Font Lock Mode)"

Commenting Multiple lines: first select the lines and then press ctrl + cc

Search: press ctrl + s and then type the word in the mini-buffer. Press ctrl + s and it will go to the found word. pressing ctrl + s will go to the next similar word.

Move one(1) char Backward: ctrl + b

Move One(1) char Forward: ctrl + f

Move One(1) Word forward:
1. esc + f
2. Alt + f

Move One(1) Word backward:
1. esc + b
2. Alt + b

Replace all next occurrences of a string: 
Type the command: query-replace
Enter the string to be replaced and then substitute. This will replace all the next occurrences of the string to be replaced. 

Close Emacs: ctrl + x + c

Compile C++ Program within Emacs: Perform the following commands
1. Atl+x  Or esc x (To access mini buffer)
2. compile
3. g++ -o anyname program_name.cc 

No comments:

Post a Comment