Emacs
Useful commands
- Re-indent whole buffer: C-x h C-M-\
Add-ons
Emacs is the text editor. It can do everything anyway but with a few add-ons it can do even more. I think these ones are pretty cool:
My .emacs file:
;; Set up the keyboard so the delete key on both the regular keyboard
;; and the keypad delete the character under the cursor and to the right
;; under X, instead of the default, backspace behavior.
(global-set-key [delete] 'delete-char)
(global-set-key [kp-delete] 'delete-char)
;; turn on font-lock mode
(global-font-lock-mode t)
;; enable visual feedback on selections
(setq-default transient-mark-mode t)
;; always end a file with a newline
(setq require-final-newline t)
;; stop at the end of the file, not just add lines
(setq next-line-add-newlines nil)
(when window-system
;; enable wheelmouse support by default
(mwheel-install)
;; use extended compound-text coding for X clipboard
(set-selection-coding-system 'compound-text-with-extensions))
;; Path to add-on files
(add-to-list 'load-path "~/emacs")
;; Load add-ons
(require 'tramp)
(require 'crypt++)
(require 'psvn)
;; tramp stuff
(setq tramp-auto-save-directory "~/.emacs.d/tramp-auto-save")
;; crypt++ stuff
(modify-coding-system-alist 'file "\\.bz\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.bz2\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.gpg\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.gz\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.Z\\'" 'no-conversion)
(if (load "crypt++" t)
(progn
(setq crypt-encryption-type 'gpg)
(setq crypt-confirm-password t)
(crypt-rebuild-tables)))
(require 'cc-mode)
;; Set indent style
(setq c-default-style
'((java-mode . "java") (other . "stroustrup")))
;; Auto indent on new lines (maps C-j to RET)
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)
(custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(column-number-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
)
(put 'upcase-region 'disabled nil)
