Brentt <brenttnew
...@gmail.com> writes:
> Hello, I use emacs to edit latex documents.
> I would like to have some key bindings that will insert my commonly
> used codes.
> e.g. I'd like C-c C-i to enter in an
> \int_{}
> and have the cursor end up in the first bracket.
> How does one go about this? I've been searching for documentation on
> custom key bindings, but havn't found anything that spells out how to
> do this. I'm guessing it would have to do with writing an init file,
> but not sure of the code to do this.
You can write elisp as described by Peter Breitfeld. However, if
you're not completely ready for elisp yet you can write keyboard
macros. Try to type this
C-x ( \ i n t _ { } C-b C-x )
C-e
The C-e will play back your keyboard macro. Or you can bind it to a
key, like F8:
C-x C-k b F8
Then you can play back your keyboard macro using F8.
Or you can give it a name
C-x C-k n latex-int
Which you can execute with M-x latex-int
Or save using
M-x insert-kbd-macro <RET> latex-int <RET>
The above will generate:
(fset 'latex-int
(lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ("\\int_{}^B 0 "%d")) arg)))
Which you can put in your .emacs for later use.
//Petter
--
.sig removed by request.