Ask HN Emacs Users: What's in your .emacs file?
11–20 of 67 posts
Re: Ask HN Emacs Users: What's in your .emacs file?
#12 ;; don't sleep emacs accidentally
(global-set-key [(control z)] nil)
;; shortcut buffer navigation
(global-set-key [f5] 'previous-buffer)
(global-set-key [f8] 'next-buffer)
;; show columns by default
(column-number-mode)
;; stop the blinking
(blink-cursor-mode nil)
and reams of macrosRe: Ask HN Emacs Users: What's in your .emacs file?
#13 ; I type this by mistake 80% of the time
(global-unset-key (kbd "C-x C-c"))
; One of my favorite commands
(global-set-key "\C-x\C-j" 'join-line)
; I haven't seen a keyboard with "copy" and "paste" buttons since 2008
; Honestly, Emacs' defaults, WTF
(global-set-key (kbd "") 'clipboard-kill-ring-save)
(global-set-key (kbd "") 'clipboard-yank)Re: Ask HN Emacs Users: What's in your .emacs file?
#14 (setq-default show-trailing-whitespace t)
(setq longlines-show-hard-newlines t) ; displays "\" at the end of lines that wrap past the window's edge
; camel case word navigation
(when (boundp 'subword-mode)
(add-hook 'after-change-major-mode-hook '(lambda () (subword-mode 1))))
; Bindings
(defun delete-backward-indent (&optional arg)
"Erase a level of indentation, or 1 character"
(interactive "*P")
(if (= (current-column) 0)
(delete-backward-char 1)
(let ((n (mod (current-column) standard-indent)))
(if (looking-back (concat "^\s*" (make-string n 32)))
(if (= n 0)
(delete-backward-char standard-indent)
(delete-backward-char n))
(delete-backward-char 1)))))
(defun newline-maybe-indent ()
"Like newline-and-indent, but doesn't indent if the previous line is blank"
(interactive "*")
(if (= (line-beginning-position) (line-end-position))
(newline)
(newline-and-indent)))
(add-hook 'python-mode-hook
'(lambda ()
(hs-minor-mode 1) ; code folding
(define-key python-mode-map (kbd "RET") 'newline-maybe-indent)
(define-key python-mode-map (kbd "DEL") 'delete-backward-indent)
(define-key python-mode-map (kbd "M-RET") 'hs-toggle-hiding)))
; On-the-fly spell checking
(add-hook 'python-mode-hook '(lambda () (flyspell-prog-mode)))
; On-the-fly pyflakes checking
(require 'flymake-point) ; shows errors in the minibuffer when highlighted (http://bitbucket.org/[redacted]/dotfiles/src/tip/.emacs.d/plugins/flymake-point.el)
(setq python-check-command "pyflakes")
(when (load "flymake" t)
(defun flymake-pyflakes-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "pyflakes" (list local-file))))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.py\\'" flymake-pyflakes-init)))
(add-hook 'python-mode-hook '(lambda () (flymake-mode 1)))
I have a feeling there's probably a better way to do that delete-backward-indent thing. Maybe I should just switch to hungry delete mode.My entire .emacs is here: http://bitbucket.org/[redacted]/dotfiles/src/tip/.emacs
Re: Ask HN Emacs Users: What's in your .emacs file?
#15 (global-set-key (kbd "C-=") 'switch-to-previous-buffer)
(defun switch-to-previous-buffer ()
(interactive)
(switch-to-buffer (other-buffer)))
(global-set-key (kbd "C-z") 'shell)
(defun my-shell-mode-hook ()
(local-set-key (kbd "C-z") 'bury-buffer))
(add-hook 'shell-mode-hook 'my-shell-mode-hook)Re: Ask HN Emacs Users: What's in your .emacs file?
#16Re: Ask HN Emacs Users: What's in your .emacs file?
#17To mimic some of TextMate's functionality, I use:
1. autopair.el: http://www.emacswiki.org/emacs/AutoPairs.
2. yasnippet.el: http://code.google.com/p/yasnippet/
The latest version of Emacs for the MacOSX has an awesome fullscreen capability. I followed the instructions here: http://www.sanityinc.com/full-screen-support-for-cocoa-emacs...
iswitchb-mode has awesome minibuffer completion capabilities. http://www.emacswiki.org/emacs/IswitchBuffers
Re: Ask HN Emacs Users: What's in your .emacs file?
#18* Undo-tree. (http://www.emacswiki.org/emacs/UndoTree) Makes emacs undo useful.
This has been one of the most useful functions I've added to my .emacs:
(defun xsteve-ido-choose-from-recentf ()
"Use ido to select a recently opened file from the `recentf-list'"
(interactive)
(let ((home (expand-file-name (getenv "HOME"))))
(find-file
(ido-completing-read "Recentf open: "
(mapcar (lambda (path)
(replace-regexp-in-string home "~" path))
recentf-list)
nil t))))
(global-set-key [(meta f11)] 'xsteve-ido-choose-from-recentf)
From: http://www.xsteve.at/prg/emacs/power-user-tips.html, which has a bunch of good tips/key bindingsRe: Ask HN Emacs Users: What's in your .emacs file?
#19This is super useful to me:
(global-set-key [f6] 'linum-mode)
(global-set-key [f7] 'next-buffer)
(global-set-key [f8] 'previous-buffer)
I also have yasnippet, but I don't really use it at all (I should). Also, recentf http://www.emacswiki.org/cgi-bin/wiki/recentf-buffer.el for a recently opened stuff (like dired, but for recent stuff).And most importantly, I setup my font to monaco, tango color scheme and I prefer full screen emacs, so i have a bit of an involved process where I have basically this:
(global-set-key [f11] 'ds-darkroom)
(global-set-key [f12] 'menu-bar-mode)
where F11 puts me in and out of full screen mode and f12 toggles menu bar. F11 uses a small utility written in C# for windows to make this happen.clean darkroom - http://i.imgur.com/LloOY.png
with menu - http://i.imgur.com/yTeUz.png
I'm trying for years to force myself not to move my right hand to arrows and instead use C-p C-n and C-b C-f, but I can't (well sometimes I do, but not all the time).
And various tweaks here and there, I might have forgotten something though.
Re: Ask HN Emacs Users: What's in your .emacs file?
#20 ;; move along, nothing to see here :P
;; the beef is in ~/.vimrc and under ~/.vim/ ;)