Last active
April 22, 2016 21:33
-
-
Save Arc0re/49381ee10c42e5233603 to your computer and use it in GitHub Desktop.
Basic .emacs (should be multiplatform). Put it in $HOME (on mswin define $HOME as a user env variable)
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
;; Loading plugins and shit | |
(add-to-list 'load-path "~/elisp") | |
(add-to-list 'custom-theme-load-path "~/elisp/themes/") | |
(require 'php-mode) | |
;; MELPA repo | |
(require 'package) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) | |
(package-initialize) | |
(setq temporary-file-directory "~/tmp") | |
;; Common lisp SLIME | |
;;(setq inferior-lisp-program "clisp.exe") | |
;;(load "C:\\quicklisp\\slime-helper.el") | |
;; Reopen files on startup (session) | |
(desktop-save-mode 1) | |
;; Theme | |
;;(load-theme 'borland-blue t) | |
;; Font | |
(set-frame-font "Courier New-10") | |
;;(set-frame-font "Consolas-10"); | |
;; Clock | |
(display-time) | |
;; Line numbers | |
;;(global-linum-mode) | |
;; Highlight current line | |
;;(global-hl-line-mode) | |
;; C-c to copy, C-v to paste, C-x to cut, C-z to cancel, IBM's Common User Access, for Muggles | |
(cua-mode t) | |
;; Menus | |
(menu-bar-mode -1) | |
(tool-bar-mode -1) | |
(scroll-bar-mode -1) | |
;; Shut the fuck up fucking bell | |
(setq ring-bell-function 'ignore) | |
; Prevent Emacs from making backup files | |
(setq make-backup-files nil) | |
;; C/C++ stuff | |
(setq-default c-basic-offset 4 tab-width 4 indent-tab-mode t) ; Global 4 spaces indentation | |
(setq c-default-style "k&r" c-basic-offset 4) ; switches from GNU style and sets it to 4 spaces | |
;; Custom functions | |
(defun load-config () | |
"Loads .emacs" | |
(interactive) | |
(load-file "~/.emacs")) | |
(defun edit-config () | |
"Loads .emacs for edition" | |
(interactive) | |
(find-file "~/.emacs") | |
(emacs-lisp-mode)) | |
;; Keyboard Shortcuts | |
(global-set-key (kbd "C-c k") 'delete-window) ; Kill split, i.e | |
(global-set-key (kbd "s-s") 'save-buffer) ; Mac style C-s, cmd = super | |
(global-set-key (kbd "C-c w") 'other-window) ; easier than C-x o | |
(global-set-key (kbd "C-c <right>") ' windmove-right) ; Switch to right window | |
(global-set-key (kbd "C-c <left>") ' windmove-left) ; Switch to left window | |
(global-set-key (kbd "C-c <up>") ' windmove-up) ; Switch to top window | |
(global-set-key (kbd "C-c <down>") ' windmove-down) ; Switch to bottom window | |
(global-set-key (kbd "C-c f") 'toggle-frame-maximized) ; C-c f to fullscreen | |
(global-set-key (kbd "C-c n") 'global-linum-mode) ; Toggle line numbers | |
(global-set-key (kbd "C-c d") 'dired) ; Opens file manager | |
(global-set-key (kbd "C-c m") 'buffer-menu) ; Lists buffers | |
(global-set-key (kbd "C-c v") 'split-window-right) ; vsplit | |
(global-set-key (kbd "C-c h") 'split-window-below) ; hsplit | |
(global-set-key (kbd "C-c l") 'load-config) ; Quickload | |
(global-set-key (kbd "C-c e") 'edit-config) ; Quickedit | |
(global-set-key (kbd "<f5>") 'compile) ; Only the first time to setup the build system (script, make...) | |
(global-set-key (kbd "<f8>") 'recompile) ; 'compile without prompt asking for setup | |
;; Hardcoded color scheme, 'list-colors-display' | |
(defun load-custom-colors () | |
"Loads the hardcoded theme" | |
(set-background-color "black") | |
(set-face-attribute 'font-lock-builtin-face nil :foreground "blue violet") ; builtin functions | |
(set-face-attribute 'font-lock-comment-face nil :foreground "dark slate grey") | |
(set-face-attribute 'font-lock-constant-face nil :foreground "SteelBlue") ; NULL, ... | |
(set-face-attribute 'font-lock-function-name-face nil :foreground "SlateBlue") | |
(set-face-attribute 'font-lock-keyword-face nil :foreground "royal blue") ; if, while... | |
(set-face-attribute 'font-lock-string-face nil :foreground "RoyalBlue4") | |
(set-face-attribute 'font-lock-type-face nil :foreground "steel blue") ; user defined datatypes | |
(set-face-attribute 'font-lock-variable-name-face nil :foreground "dodger blue")) | |
;;(load-custom-colors) | |
;; Hardcoded color scheme inspired by Sean 'Nothings' Barrett | |
(defun load-barrett-colors () | |
"Loads the barrett hardcoded theme" | |
(add-to-list 'default-frame-alist '(foreground-color . "#000000")) | |
(add-to-list 'default-frame-alist '(background-color . "#FFFFFF")) | |
(set-face-attribute 'font-lock-builtin-face nil :foreground "#000000") ; builtin functions | |
(set-face-attribute 'font-lock-comment-face nil :foreground "green4") | |
(set-face-attribute 'font-lock-constant-face nil :foreground "black") ; NULL, ... | |
(set-face-attribute 'font-lock-function-name-face nil :foreground "black") | |
(set-face-attribute 'font-lock-keyword-face nil :foreground "black") ; if, while... | |
(set-face-attribute 'font-lock-string-face nil :foreground "black") | |
(set-face-attribute 'font-lock-type-face nil :foreground "black") ; user defined datatypes | |
(set-face-attribute 'region nil :background "black") ;; selections... | |
(set-face-attribute 'region nil :foreground "#FFFFFF") | |
(set-face-attribute 'font-lock-variable-name-face nil :foreground "black")) | |
(load-barrett-colors) | |
;; ************************************************************************************** | |
;; To launch Emacs with another .emacs than the $HOME one : | |
;; emacs -q(--no-init-file) -l .emacs_to_load | |
;; Equivalent of emacs -mm on Windows : (w32-send-sys-command 61488) ou | |
;; (toggle-frame-maximized) on line 1 of the file. | |
;; ABOUT KEYBOARD SHORTCUTS | |
;; The EmacsManual says that the combination of C-c | |
;; followed by a plain letter, and the function keys f5 through f9 are reserved for users. | |
;; Emacs stuff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment