<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d8334277\x26blogName\x3dSriram\x27s+Blog\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://metallicatony.blogspot.com/search\x26blogLocale\x3den\x26v\x3d2\x26homepageUrl\x3dhttp://metallicatony.blogspot.com/\x26vt\x3d6147907796332168684', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Sunday, February 07, 2010

Emacs

I use windows port of GNU emacs (23.1.1) in my work windows PC for most of the programming. Some of the common commands that everyone would tend to use

C-v Move forward one screenful
M-v Move backward one screenful
C-l Redisplay all text and center the text on the cursor to the center of screen
C-p Previous Line
C-n Next Line
C-b Move backward by one character
C-f Move forward by one character
M-b Move backward by a word
M-f Move forward by a word
C-a Move to the beginning of a line
C-e Move to the end of a line
M-a Move to the beginning of a sentence
M-e Move to the end of a sentence
M-<> Move to the end of file
C-d Delete a character
M-d Kill the next word
C-k Kill from cursor to the end of line
M-k Kill from cursor to the end of sentence
C- C-w Kill text between two positions
C- M-w Copy text between two positions
C-y Yank killed text
C-y M-y Yank the text that was killed before the last one
C-x u Undo (C-x u 5 Undoes 5 times)
C-x C-f Find a file
C-x C-s Save file
C-x C-w Save as file
C-s Incremental search
C-r Reverse search
C-x C-b List of buffers
C-x b foo Open foo buffer
C-x b Shift between buffers
C-x s Save a buffer staying in a different buffer
C-x k Kill a buffer
M-x replace string Replace a string
M-x text mode Applies text mode
C-x 2 Split window into 2
C-x o Loop through windows
C-x 1 Delete all but one window
C-u 50 # Inserts # 50 times (C-u is repeat command)
C-u 50 C-f Moves forward by 50 characters


Note: C - Control key, M - Meta key (Alt)

Download my .emacs file. It has most of the customizations and features enabled. The other win ports that are extremely useful are diff and aspell (that i use through emacs). GIMP is one more.

Labels:

1 Comments:

Blogger PRK said...

> C-x u Undo (C-x u 5 Undoes 5 times)

I use C-_ for undo which is faster for multiple undos.

> M-x replace string Replace a string

You might want to try M-% for query-replace and go for replace all if you decide to do that.

Other common keystrokes that I use include but not limited to the following.

C-j Insert a newline, then indent according to major mode.
C-o Insert a newline and leave point before it.
M-g g Goto line, counting from line 1 at beginning of buffer.
M-^ Join this line to previous and fix up whitespace at join.
M-| Execute string command in inferior shell with region as input.
C-x ( Record subsequent keyboard input, defining a keyboard macro.
C-x ) Finish defining a keyboard macro.
C-x e Call last keyboard macro, ending it first if currently being defined.

And on and on and on...


Emacs is addictive. Sometimes, I am not even aware of what keystrokes I hit for certain functions. They are locked in my muscle memory. I had to go slowly to recollect what keystrokes they are.

7:33 AM  

Post a Comment

<< Home