The learning curve for Emacs is difficult but challenging. I have been using Emacs for a few years now. But I am still a beginner using less than 5 different keys of the Emacs capabilities.
Few Emacs shortcuts are very useful and I shall summarized them below.
Etags
Etags are useful feature that could quickly tag files to be used in Emacs and vi.
Example:
#etags file1.c file2.h
This will generate a TAGS in the directory. Once you execute the opened file in emacs with require"Alt+.", the message "Find tag: (default printf)" will appear. Then it will ask you the TAGS file. Visit tags table: (default TAGS ~/test/). If the tag table can be found, the cursor will jump to the definition. To get back to the original cursor position, use "Alt+Shift+*".
Search
Searching for a text in Emacs is easy. Forward search using "Ctrl+s" and I-search: will appear.
Reverse the search using "Ctrl+r" and I-search backward: will appear.
To repeat the search, just press "Ctrl-s" or "Ctrl-r" repeatedly.
Cut and Paste
This is a complex operation using keyboard which requires lots of practice.
On the required line, "Ctrl+space" to start the cursor mark. Mark set will appear to indicate the operation is correct. The next command is sort of an invisible command. But rest assured that it just worked. Then move the cursor to the end location. "Esc" then "w" to copy the information from the start of the cursor to current cursor position. This completes the copy operation.
Next, is the paste operation. Go to the required location and "Cltr+y" will paste(a.k.a yank) the buffer(a.k.a clipboard) information.
Undo
This operation is very important because it will undo any mistake that you have made.
In most Emacs book, it is written in "C-x-u" which means "Ctrl-u" + "u".
Saving the file
"Ctrl-x" + "Ctrl-s" will save the current file.
Exit Emacs
"Mx-Ctrl-c" or "Cltr-x" + "Ctrl-c"
Extra Programming feature of Emacs
Splitting the Window
"Ctrl-x 2" will split current window into 2.
"Cltr-x o" will switch the cursor between the two windows.
"M-x shell" will open up the shell. M is "Alt key"
No comments:
Post a Comment