Using Emacs is like an adventure.
I found two very powerful extensions recently in Github. Yes, I’ve shared some powerful features/extensions last year by this post, but those two are not only powerful, but also handy, compared with align-regex, occur, anything, etc.
I’ve used Eclipse, which has a good support for refactoring, but I want complain: Dialogs suck!
So, when I need to rename one variable or a function which occurs many times in a file, what am I supposed to do?
replace-string? It could, but it’s not good enough, since I am lazy, I don’t want to type the whole name, I use replace-regexp.
I mean, before I saw the magic of mark-multiple.el.
With it, I only need to mark the whole name, by two key stroke,
C-space M-f, then use
C-. to match all occurrences afterwards, and edit, all occurrences are being changed at the same time.
Download it from here, and my configuration:
(add-to-list 'load-path "~/Dropbox/Emacs/emacs.d/mark-multiple")
Imagine how frequently you copy or move some words a day?
I do it like always. Copy one word is easy,
C-space M-f, one line is also easy,
C-a M-k, but check code samples below, how can I mark
point-min when my cursor is after “m”,
C-f C-f M-b M-b?
Seems too many key strokes.
Do we mark things like these:
to-char (po from
I never do that. If cursor is after “m” of
point-min, what I might want to mark are
(goto-char (point-min)), those are meaningful.
They are semantic units.
What expand-region does is to mark the semantic units one by one, inside out by each expand.
Move cursor character by character is boring, and hurts finger, so, no more cursor move, just expand.
Download it from here.
;; Convert a buffer from dos ^M end of lines to unix end of lines
Some more things, maybe not very powerful, but interesting.
Tired of control and meta keys? Try KeyChord, by this extension, we can bind commands to two keys pressed simultaneous or a single key quickly pressed twice. For example,
hj might never appears in one word, so I bind
hj, whenever I want to open another file, type
j at the same time, quick and easy.
I began to write python code, when a function is long, I feel it's hard to track which scope I am in by indentation, if block of indentation is highlighted by some color, it might be better. HighLightIndentation makes my life easier.
I think it's cool to have a grey dotted line in editor on column 80. I don't want to argue whether it's reasonable to restrict one line to less than 80 characters, I just believe if "keep it simple, stupid!", 80 characters is really enough, and I love to split windows horizontally.