I switched from Vim to Emacs, and I am so crazy for Emacs now.
But there is a very, very useful trick in Vim and I can't use conveniently in Emacs, that's find next/previous word at point. Those are very handy with */# in Vim.
The simplest way is to move to the beginning of the word at point and then C-s and C-w, use C-s/C-r to find next/previous word.
Then I found another trick from Mastering Emacs, but still some minor bug.
Today I find a plugin - vimpulse which simulate vim in Emacs. And I can use */# there just like Vim!!
But seems the vimpulse will automatically enables Viper.
So, are there any other methods to implement this requirement? Or, Can I automatically disable Viper if I use vimpulse?
Well, as is often the case, we can do better in Emacs. The package I use for this is highlight-symbols
Specifically, I bind a series of its commands with variations of the F3 key:
;;;;;;;;;;;;;;;;;;;;;;
;; highlight-symbol ;;
;;;;;;;;;;;;;;;;;;;;;;
(require 'highlight-symbol)
(global-set-key [f3] 'highlight-symbol-next)
(global-set-key [(shift f3)] 'highlight-symbol-prev)
(global-set-key [(control f3)] 'highlight-symbol-at-point)
(global-set-key [(control meta f3)] 'highlight-symbol-query-replace)
Next/previous symbol is nice. But I find it most helpful when reading an algorithm to highlight a few key variables.
The distinction between words and symbols is very nice for programming. I'm not sure if other editors offer this distinction.
Another related tool I find very useful for programming is iedit.
Here is how I load it:
(autoload 'iedit-mode "iedit")
(global-set-key [(control \;)] 'iedit-mode)
(define-key isearch-mode-map [(control \;)] 'iedit-mode)
To do what you want, go to a symbol and press C-;, now tab and shift tab will move amongst matching symbols.
C-' (single-quote) will show you an adhoc occur
view of the
buffer.
For a bonus refactoring tool, mark a region (maybe a class) where you want to rename the symbol (variable), and press C-; again and only matches within that region will be edited.
Try Evil: https://gitorious.org/evil/pages/Home
*/# works nice with it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With