.emacs.d / site-lisp / macros.el

;; insert a footnote to the text. The footnote is in a format
;; [i] Text of the footnote...
;; It will search for the first [i] in the text body and place \footnote{...} there
(setq last-kbd-macro
   [?\C-\M-f ?\C-f ?\C-  ?\M-e ?\M-w ?\M-` ?\C-a ?\C-s ?\C-w ?\C-w ?\C-r ?\C-r ?\C-\] delete ?\M-x ?f ?n ?o ?t ?e ?\] return])

(defun fnote ()
  (interactive)
  (insert "\\footnote{")
  (yank)
  (insert "}"))

(setq last-kbd-macro
   [?\C-\M-f ?\C-f ?\C-  ?\M-e ?\M-w ?\M-` ?\C-a ?\C-s ?\C-\M-w ?\C-\M-w ?\C-r ?\C-r return ?\C-\] delete ?\M-x ?f ?n ?o ?t ?e return])

;; swap between two last used buffers
(fset 'swap-buffer-to-last-used
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([24 98 return] 0 "%d")) arg)))
(bind-key "C-x C-a" nil emacs-lisp-mode-map)
(bind-key "C-x C-a" 'swap-buffer-to-last-used)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ALIASES

(defalias 'qrr 'query-replace-regexp)
(defalias 'rs 'replace-string)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.