Created
April 9, 2016 23:37
-
-
Save jarcode-foss/2e57b048f66420520f0ca332f3dbfaf5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
;; Jarcode's configuration for the best editor (emacs). | |
;; I now use EXWM, so emacs is my window manager. | |
;; Enter the debugger if emacs quits a frame without handling the quit signal | |
;; EXWM is somewhat unstable, so I'm using this feature to report issues when I | |
;; need to force emacs out of an operation | |
(setq debug-on-quit t) | |
;; 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")) | |
;; Some frontends for emacs won't properly use the default face for | |
;; the background color, this fixes that. | |
(add-to-list 'default-frame-alist '(background-color . "#3B3B3B")) | |
;; Line numbers | |
(add-hook 'prog-mode-hook 'linum-mode) | |
;; Disable cursor in other buffers | |
(setq-default cursor-in-non-selected-windows nil) | |
;; 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 | |
;; default should be 0, for non-programming buffers | |
(setq-default line-spacing 0) | |
;; set spacing to 2 pixels for prog-mode | |
(add-hook 'prog-mode-hook (lambda () | |
(setq line-spacing 3))) | |
(add-to-list 'load-path "~/.emacs.d/lisp") | |
;; split window on startup | |
(split-window-right) | |
;; my packages | |
;; | |
;; The first package is EXWM, because I actually use emacs as my window manager | |
(setq package-list '(exwm rainbow-delimiters iedit lua-mode php-mode web-mode rust-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 . 1)) | |
;; 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) | |
(require 'exwm-config) | |
(exwm-config-default) | |
;; Some fullscreen applications refuse to run in true fullscreen, and it can cause | |
;; EXWM to put borders around the fullscreen application, offsetting the whole X | |
;; window by the border width. I'm disabling borders entirely to fix this. | |
(setq exwm-floating-border-width 0) | |
;; One workspace, makes life easier. | |
(setq exwm-workspace-number 1) | |
;; for exiting fullscreen applications (games, browser, etc) | |
;; fullscreen mode is great for games and chrome if I'm not multitasking | |
(defun my-state-reset () | |
(interactive) | |
(message "EXWM state reset") | |
(exwm-reset)) | |
(global-unset-key (kbd "s-q")) | |
(exwm-input-set-key (kbd "s-q") #'my-state-reset) | |
;; emacs launch bar! | |
(global-unset-key (kbd "s-o")) | |
(exwm-input-set-key (kbd "s-o") (lambda (command) | |
(interactive (list (read-shell-command "$ "))) | |
(start-process-shell-command command nil command))) | |
;; System tray | |
(require 'exwm-systemtray) | |
(exwm-systemtray-enable) | |
;; Default browser | |
(setq browse-url-generic-program | |
(executable-find (getenv "BROWSER")) | |
browse-url-browser-function 'browse-url-generic) | |
;; 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))) | |
;; ignore iheader syntax | |
(add-hook 'c-initialization-hook | |
(lambda () (modify-syntax-entry ?@ "-" c-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 | |
(font-lock-add-keywords 'c-mode func-process-regex t) | |
(font-lock-add-keywords 'java-mode func-process-regex t) | |
;; enable exwm | |
(exwm-enable) | |
;; 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 "PfEd" :family "DejaVu Sans Mono")))) | |
'(bg:erc-color-face4 ((t (:background "brown")))) | |
'(bg:erc-color-face5 ((t (:background "dark red")))) | |
'(cursor ((t (:background "IndianRed1")))) | |
'(erc-current-nick-face ((t (:foreground "gold")))) | |
'(erc-input-face ((t (:foreground "dim gray")))) | |
'(erc-keyword-face ((t (:foreground "chartreuse")))) | |
'(erc-my-nick-face ((t (:foreground "orange")))) | |
'(erc-my-nick-prefix-face ((t nil))) | |
'(erc-nick-default-face ((t nil))) | |
'(erc-nick-msg-face ((t (:foreground "orange" :weight bold)))) | |
'(erc-nick-prefix-face ((t nil))) | |
'(erc-notice-face ((t (:foreground "slate gray")))) | |
'(erc-pal-face ((t (:foreground "orchid")))) | |
'(erc-prompt-face ((t (:foreground "orange")))) | |
'(erc-timestamp-face ((t (:foreground "dim gray")))) | |
'(error ((t (:foreground "orange red")))) | |
'(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 (:inherit default :background "#3C3C3C")))) | |
'(header-line ((t (:background "grey16" :foreground "gray" :box (:line-width 2 :color "grey18"))))) | |
'(hi-blue-b ((t (:foreground "dodger blue" :weight bold)))) | |
'(hi-red-b ((t (:foreground "orange red" :weight bold)))) | |
'(highlight ((t (:background "gray17")))) | |
'(highlight-changes ((t (:foreground "lime green")))) | |
'(highlight-changes-delete ((t (:foreground "firebrick3" :underline t)))) | |
'(linum ((t (:inherit (shadow default) :foreground "dim gray")))) | |
'(mode-line ((t (:background "grey14" :foreground "gray75" :box (:line-width 2 :color "gray20"))))) | |
'(mode-line-buffer-id ((t (:foreground "indian red" :box (:line-width 2 :color "gray20") :weight thin)))) | |
'(mode-line-emphasis ((t nil))) | |
'(mode-line-highlight ((t nil))) | |
'(mode-line-inactive ((t (:background "gray14" :foreground "gray26" :box (:line-width 2 :color "gray20"))))) | |
'(powerline-inactive1 ((t (:inherit mode-line-inactive :background "grey18")))) | |
'(rainbow-delimiters-depth-1-face ((t (:foreground "orange")))) | |
'(rainbow-delimiters-depth-2-face ((t (:foreground "chartreuse")))) | |
'(rainbow-delimiters-depth-3-face ((t (:foreground "cyan")))) | |
'(region ((t (:background "gray17")))) | |
'(term ((t (:inherit default :background "#3C3C3C" :foreground "gray75")))) | |
'(term-color-black ((t (:background "gray17" :foreground "gray75")))) | |
'(term-color-blue ((t (:background "slate blue" :foreground "dodger blue")))) | |
'(term-color-cyan ((t (:background "dark cyan" :foreground "dark turquoise")))) | |
'(term-color-green ((t (:background "sea green" :foreground "medium sea green")))) | |
'(term-color-magenta ((t (:background "MediumPurple" :foreground "orchid")))) | |
'(term-color-red ((t (:background "IndianRed4" :foreground "IndianRed1")))) | |
'(term-color-white ((t (:background "gray32" :foreground "gray75")))) | |
'(term-color-yellow ((t (:background "gray40" :foreground "orange1")))) | |
'(vertical-border ((t (:inherit mode-line-inactive :foreground "dim gray")))) | |
'(window-divider-last-pixel ((t (:foreground "gray40"))))) | |
(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