Skip to content

Instantly share code, notes, and snippets.

@jhlb
Created February 20, 2016 22:41
Show Gist options
  • Save jhlb/f2d47d42ac2bce60ea93 to your computer and use it in GitHub Desktop.
Save jhlb/f2d47d42ac2bce60ea93 to your computer and use it in GitHub Desktop.
;; JHL Emacs Configuration 2016-02-20
;; Remove GUI
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
;; Simplify Startup
(modify-frame-parameters nil '((wait-for-wm . nil)))
(setq inhibit-startup-message t)
;; Inconsolata.
; requires ~/.fonts/Inconsolata.otf
(set-default-font "-unknown-Inconsolata-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1")
(add-to-list 'default-frame-alist '(font . "-unknown-Inconsolata-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1"))
;; Backups in hidden folder
(setq
backup-by-copying t
backup-directory-alist
'(("." . "~/.emacs.d/saves"))
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
; ...
;; Reverse window switching
(defun select-previous-window ()
"Switch to the previous window"
(interactive)
(select-window (previous-window)))
(global-set-key (kbd "C-x p") 'select-previous-window)
;; Snake controls WASD
(eval-after-load "snake"
'(progn
(define-key snake-mode-map "w" 'snake-move-up)
(define-key snake-mode-map "a" 'snake-move-left)
(define-key snake-mode-map "s" 'snake-move-down)
(define-key snake-mode-map "d" 'snake-move-right)))
;; Format Conventions
(setq c-default-style "linux"
c-basic-offset 4)
;; Increment number at point
(defun my-increment-number-decimal (&optional arg)
"Increment the number forward from point by 'arg'."
(interactive "p*")
(save-excursion
(save-match-data
(let (inc-by field-width answer)
(setq inc-by (if arg arg 1))
(skip-chars-backward "0123456789")
(when (re-search-forward "[0-9]+" nil t)
(setq field-width (- (match-end 0) (match-beginning 0)))
(setq answer (+ (string-to-number (match-string 0) 10) inc-by))
;;(when (< answer 0)
;; (setq answer (+ (expt 01 field-width) answer)))
(replace-match (format (concat "%0" (int-to-string field-width) "d")
answer)))))))
(global-set-key (kbd "C-c +") 'my-increment-number-decimal)
(if (string= default-directory "/")
(cd "~"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment