Created
March 8, 2018 15:55
-
-
Save jhlb/38b014372dc7163cfd4a0b6107158f99 to your computer and use it in GitHub Desktop.
init.el march 8, 2018
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; JHL Emacs Configuration 2018-03-08 | |
;; confirm before exit | |
(setq confirm-kill-emacs 'y-or-n-p) | |
;; 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-*-20-*-*-*-m-0-iso10646-1") | |
(add-to-list 'default-frame-alist '(font . "-unknown-Inconsolata-normal-normal-normal-*-20-*-*-*-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 "~")) | |
;; arduino files open in c++ mode | |
(add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode)) | |
;; add melpa | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.org/packages/") t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment