How do I make Emacs “typeover” or “overwrite” instead of inserting? i.e. change from insert mode to overwrite mode, like Esc + r in vim
Answer:
M-x overwrite-mode (a minor mode). This toggles overwrite-mode on and off, so exiting from overwrite-mode is as easy as another M-x overwrite-mode.
On some systems, Insert toggles overwrite-mode on and off.
Friday, 30 December 2016
Thursday, 29 December 2016
Absolute Beginner's Guide to Emacs 4
How to copy and paste a whole file in emacs?
Suppose you are in the middle of a file.
(1) navigate to the first character of the file : Use Meta + < (i.e., Meta key + shift + , )
(2) Enter "Ctrl + Space " to activate the select mode
(3) navigate to the last character of the file : Use Meta + > (i.e., Meta key + shift + . )
(4) Enter "Meta + w" to copy
(5) Enter "Ctrl + y" to paste.
Note what is Meta key ?
On Mac is Mac key, On other keyboard is the Alt key, some old keyboard may use ESC key
Suppose you are in the middle of a file.
(1) navigate to the first character of the file : Use Meta + < (i.e., Meta key + shift + , )
(2) Enter "Ctrl + Space " to activate the select mode
(3) navigate to the last character of the file : Use Meta + > (i.e., Meta key + shift + . )
(4) Enter "Meta + w" to copy
(5) Enter "Ctrl + y" to paste.
Note what is Meta key ?
On Mac is Mac key, On other keyboard is the Alt key, some old keyboard may use ESC key
Tuesday, 27 December 2016
More efficient emacs combination keys.
To move the cursor around more quickly, you should avoid using keys
like "pageup" "pagedown", "home" "end", because it will cause your hand
to leave the standard typing position. Instead you should use the
equivalent keys for them:
Like the following left keys all have an equivalent combo on the right, which are faster:
C-up ---> m - {
C-down --> M -}
C-left --> M - b
C-right --> M - f
home --> C - a
end --> C - e
pageup --> M - v
pagedown --> C - v
Like the following left keys all have an equivalent combo on the right, which are faster:
C-up ---> m - {
C-down --> M -}
C-left --> M - b
C-right --> M - f
home --> C - a
end --> C - e
pageup --> M - v
pagedown --> C - v
Friday, 23 December 2016
Absolute Beginner's Guide to Emacs 3
Opening, saving, and closing buffers
To open a file and load it into a buffer, useC-x C-f, which will
open a prompt in the mini-buffer that says “Find file:
~/path/to/current/directory/”. Just as with switching buffers, you can
press the tab key to list the files in the directory you have
specified if you need to.Find file: ~/learn/shell/
Find file: ~/learn/shell/zip.sh
Press enter, and a new buffer will be created with the file you specified:
File Edit Options Buffers Tools Sh-Script Help
#!/bin/bash
# Zip all the arguments with for loop
for i in $@; do
zip archive "$i"
done
-UU-:----F1 zip.sh All L1 (Shell-script[bash]) -------------------------------------------
Indentation setup for shell type bash
If you make changes to the buffer and you want to save it back to the file on disk, use
C-x C-s:Wrote /home/jtony/learn/shell/zip.sh
Thursday, 22 December 2016
Absolute Beginner's Guide to Emacs 2
The three most important keyboard shortcuts to know are
You can’t see the other buffers until you tell Emacs to view them through a window. To do this, use the
(Remember that if you want to cancel the current operation, i.e. you decide you don’t want to switch buffers after all, you can use
There are a few relevant key commands for manipulating windows:
C-h C-h
(help), C-g (quit), and M-x (run command). The help command
will put you in a position to figure out how to do something if you’re
stuck, and the quit command will cancel an operation (for example, if
you are entering a command at the mini-buffer, C-g will quit the
mini-buffer and move the point back to the buffer you were in
previously – see the next section for more details on buffers and the
mini-buffer). The run command will let you run any command in Emacs;
you probably won’t need to use it much right away, but it’s good to
know if you run into a scenario where you do need to run a command.You can’t see the other buffers until you tell Emacs to view them through a window. To do this, use the
C-x b key combination. This
will move the point to the mini-buffer and display a message that
looks like “Switch to buffer (default *scratch*)”:(Remember that if you want to cancel the current operation, i.e. you decide you don’t want to switch buffers after all, you can use
C-g
to quit the mini-buffer).There are a few relevant key commands for manipulating windows:
C-x 0: close the active windowC-x 1: close all windows except the active windowC-x 2: split the active window vertically into two horizontal windowsC-x 3: split the active window horizontally into two vertical windowsC-x o: change active window to next window
Wednesday, 21 December 2016
Absolute Beginner's Guide to Emacs 1
Although in standard terminology the running instance of Emacs would
be called a window, in Emacs terminology it is called a
frame. Within Emacs itself, there is a window in which we see the
welcome “GNU Emacs” buffer (more on windows and buffers in a bit).
The blinking black cursor (over the W in “Welcome”) is called the point. Not only is it like a cursor in your standard text editor (where the text is inserted when you type), but it is the location where you will sometimes need to run functions as well (e.g., “change the word that the point is currently in to be uppercase”). We’ll come back to this later.
The grey bar at the bottom of the screen is the status bar and displays various information about the point and the active buffer (there is one status bar per window). The white space below that is called the mini-buffer and will occasionally display status messages (e.g., after saving a file), and is also the place where you enter Emacs commands.
Referred link:
http://www.jesshamrick.com/2012/09/10/absolute-beginners-guide-to-emacs/
The blinking black cursor (over the W in “Welcome”) is called the point. Not only is it like a cursor in your standard text editor (where the text is inserted when you type), but it is the location where you will sometimes need to run functions as well (e.g., “change the word that the point is currently in to be uppercase”). We’ll come back to this later.
The grey bar at the bottom of the screen is the status bar and displays various information about the point and the active buffer (there is one status bar per window). The white space below that is called the mini-buffer and will occasionally display status messages (e.g., after saving a file), and is also the place where you enter Emacs commands.
Referred link:
http://www.jesshamrick.com/2012/09/10/absolute-beginners-guide-to-emacs/
Monday, 19 December 2016
Emacs 9: Official tutorial 8
Completion is a way to avoid unnecessary typing. For instance, if you
want to switch to the *Messages* buffer, you can type C-x b *M<Tab>
and Emacs will fill in the rest of the buffer name as far as it can
determine from what you have already typed. Completion also works for
command names and file names. Completion is described in the Emacs
manual in the node called "Completion".
The end of the tutorial.
want to switch to the *Messages* buffer, you can type C-x b *M<Tab>
and Emacs will fill in the rest of the buffer name as far as it can
determine from what you have already typed. Completion also works for
command names and file names. Completion is described in the Emacs
manual in the node called "Completion".
The end of the tutorial.
Sunday, 18 December 2016
Emacs 8 Offical Tutorial Part 7
Here are some other useful C-h options:
C-h f Describe a function. You type in the name of the
function.
Line 1038
C-h f Describe a function. You type in the name of the
function.
Line 1038
Thursday, 15 December 2016
vim regular expression substituation
e.g. replace .LBB5_7, .LBB2_3 with .LBB
:%s#.LBB\(.\+\)#.LBB#gc
:%s#.LBB\(.\+\)#.LBB#gc
Sunday, 11 December 2016
How to show git statistics for a local change?
jtony@genoa:~/src/llvm$ git diff --stat
lib/Target/PowerPC/PPCExpandISEL.cpp | 202 ++++++++++++++++++++++++++++++++++++++++++------------------------------------------------
1 file changed, 95 insertions(+), 107 deletions(-)
jtony@genoa:~/src/llvm$ git diff --numstat
lib/Target/PowerPC/PPCExpandISEL.cpp | 202 ++++++++++++++++++++++++++++++++++++++++++------------------------------------------------
1 file changed, 95 insertions(+), 107 deletions(-)
jtony@genoa:~/src/llvm$ git diff --numstat
Subscribe to:
Posts (Atom)