Skip to content

Instantly share code, notes, and snippets.

@jarcode-foss
Last active March 15, 2016 00:04
Show Gist options
  • Save jarcode-foss/bf0b0ff70740b1478282 to your computer and use it in GitHub Desktop.
Save jarcode-foss/bf0b0ff70740b1478282 to your computer and use it in GitHub Desktop.
;; Jarcode's configuration for the best editor (emacs).
;; The toolbar and menu bar is for casuals
(tool-bar-mode -1)
(menu-bar-mode -1)
;; Scrollbar is just distracting, line numbers are used to know where in the file I am
(scroll-bar-mode -1)
;; Font, enable anti-aliasing and FULL HINTING in GTK to get desired look
;; This should look extremely thin, and is quite easy on the eyes (at least
;; for me).
;; change to '20' for videos
(add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-11"))
;; Line numbers
(add-hook 'prog-mode-hook 'linum-mode)
;; Line spacing, emacs does not have enough spacing by default and it makes text
;; feel too condensed with some fonts. This helps needless double-line breaks to
;; avoid clutter
(setq-default line-spacing 3)
(add-to-list 'load-path "~/.emacs.d/lisp")
;; split window on startup
(split-window-right)
;; my packages
(setq package-list '(rainbow-delimiters iedit lua-mode php-mode web-mode))
;; melpa is sort of a requirement
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/")
t)
(package-initialize)
; fetch the list of packages available
(unless package-archive-contents
(package-refresh-contents))
; install the missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
;; Stupid black bars
(set-fringe-mode '(1 . 0))
;; emacs should be fullscreen
(add-to-list 'default-frame-alist '(fullscreen . maximized))
;; I auto-save myself so often that this feature is never used, and emacs never crashes for me.
(setq auto-save-default nil)
(setq make-backup-files nil)
;; iedit bug fix
(define-key global-map (kbd "C-c ;") 'iedit-mode)
;; kill buffer without asking, unless unsaved changes
(global-set-key (kbd "C-x k") 'kill-this-buffer)
;; emacsclient usage, I select files in pcmanfm
(server-start)
(tool-bar-mode -1)
;; tabbing setup, I always use four spaces.
;; Some people will murder over this - here's why:
;; - I want my code to look the exact same regardless of where it's viewed
;; - aligning my text with tabs is a nightmare, not all editors will display tabs correctly,
;; but all editors will display spaces the same with a fullspaced/monospaced font
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
;; XML uses some retard form of indentation, fix it
(setq nxml-child-indent 4)
(defvaralias 'c-basic-offset 'tab-width)
(setq tab-stop-list (number-sequence 4 200 4))
;; java tabbing to 4 spaces, set java tabs to 4 spaces
(add-hook 'java-mode-hook (lambda ()
(setq c-basic-offset 4
tab-width 4
indent-tabs-mode t)))
;; java annotations are broken in emacs java mode
(add-hook 'java-mode-hook
(lambda ()
"Treat Java 1.5 @-style annotations as comments."
(setq c-comment-start-regexp "(@|/(/|[*][*]?))")
(modify-syntax-entry ?@ "< b" java-mode-syntax-table)))
;; Java argument indenting. This is different from how I indent C, but it's
;; more compatible with the typical sun/google java style.
(defun my-indent-setup ()
(c-set-offset 'arglist-intro '+))
(add-hook 'java-mode-hook 'my-indent-setup)
;; the GTK emacs24 scrolling thingy is wayyy too fast, I'm setting it to 4
(setq mouse-wheel-scroll-amount '(4))
(setq mouse-wheel-progressive-speed nil)
(setq auto-window-vscroll nil)
;; scrolling in chunks is annoying
(setq redisplay-dont-pause t)
;; lua indents to 3 by default, fixing that horrific style
(setq lua-indent-level 4)
;; auto complete stuff
;; disabled because slow
;; (require 'auto-complete-config)
;; (ac-config-default)
(semantic-mode 1)
(global-semantic-idle-scheduler-mode 1)
(global-ede-mode 1)
;; hook rainbow delims
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
;; extra highlighting for c-mode
;; pointer operators/symbols
(font-lock-add-keywords 'c-mode
'(("*" . font-lock-builtin-face)))
(font-lock-add-keywords 'c-mode
'(("&" . font-lock-builtin-face)))
;; other operators
(font-lock-add-keywords 'c-mode
'(("[]~^=<>&/.,\\[\\|\\*\\+\\-]" . font-lock-builtin-face)))
;; function calls should be highlighted the same way macros are
;; ripped from SO somewhere
(setq func-process-regex '(("\\(\\w+\\)\\s-*\(" (1 font-lock-preprocessor-face))))
;; assign to C, java, and Lua
(font-lock-add-keywords 'c-mode func-process-regex t)
(font-lock-add-keywords 'java-mode func-process-regex t)
;; My theme, it relies on deeper-blue, a built-in theme and then works from it
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ansi-color-names-vector
["#2d3743" "#ff4242" "#74af68" "#dbdb95" "#34cae2" "#008b8b" "#00ede1" "#e1e1e0"])
'(blink-cursor-mode nil)
'(cua-mode t nil (cua-base))
'(custom-enabled-themes (quote (deeper-blue)))
'(inhibit-startup-screen t)
'(rainbow-delimiters-max-face-count 3)
'(show-paren-mode t)
'(tool-bar-mode nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :background "#3C3C3C" :foreground "gray80" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 111 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
'(cursor ((t (:background "SpringGreen3"))))
'(font-lock-comment-delimiter-face ((t (:foreground "sea green"))))
'(font-lock-comment-face ((t (:foreground "sea green"))))
'(font-lock-function-name-face ((t (:foreground "orchid"))))
'(font-lock-preprocessor-face ((t (:foreground "gold3"))))
'(font-lock-type-face ((t (:foreground "MediumPurple1"))))
'(fringe ((t (:background "gray21"))))
'(mode-line ((t (:background "gray25" :foreground "gray75"))))
'(mode-line-buffer-id ((t (:foreground "cornflower blue" :weight thin))))
'(mode-line-emphasis ((t nil)))
'(mode-line-inactive ((t (:background "gray30" :foreground "gray75" :box (:line-width 1 :style released-button)))))
'(rainbow-delimiters-depth-1-face ((t (:foreground "orange"))))
'(rainbow-delimiters-depth-2-face ((t (:foreground "chartreuse"))))
'(rainbow-delimiters-depth-3-face ((t (:foreground "cyan")))))
(put 'dired-find-alternate-file 'disabled nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment