Walt Mankowski on 29 Jun 2004 14:34:02 -0000 |
On Tue, Jun 29, 2004 at 09:43:36AM -0400, Jon Nelson wrote: > I am looking for a command that will recursively search the current buffer > for a word and insert it at the current cursor position. For example, > when writing code and trying to remember the exact spelling/case of > identifiers I would use this command to save me from typos. In vi I could > do this with ^P or ^N (C-P or C-N). I get around this problem with the command dabbrev-expand (mapped by default to M-/). This is sort of like tab-completion for variables (except it doesn't use tab :). Here's how it works. Say you've declared a long variable name: int a_very_long_variable_name; Then down below you want to use it: for (a_very_long_variable_name = 0; a_very_long_variable_name < 10; a_very_long_variable_name++) printf("a_very_long_variable_name = %d\n", a_very_long_variable_name); What you do is start typing the name, then hit M-/:: a _ v M-/ and emacs expands the rest of the variable for you. If you have more than one variable that matches, hitting M-/ repeatedly will cycle through them. Walt Attachment:
signature.asc
|
|