-
-
Save lpirir/77e156f89067b61b636a1701b74b0501 to your computer and use it in GitHub Desktop.
Emacs Configuration for Windows
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
;; Package | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(package-initialize) | |
(package-refresh-contents) | |
;; Install required/optional packages for lean-mode | |
(defvar lean-mode-required-packages | |
'(company dash dash-functional flycheck whitespace-cleanup-mode | |
fill-column-indicator s f lua-mode mmm-mode unicode-fonts | |
;; The follows are not required but useful packages to have: | |
magit git-gutter subatomic-theme ido-ubiquitous projectile)) | |
(dolist (p lean-mode-required-packages) | |
(when (not (package-installed-p p)) | |
(package-install p))) | |
;; Basic Emacs Setup | |
(column-number-mode 1) | |
(defalias 'yes-or-no-p 'y-or-n-p) | |
(display-time-mode t) | |
(ido-mode) | |
(ido-ubiquitous-mode 1) | |
(load-theme 'subatomic t) | |
(menu-bar-mode -1) | |
(scroll-bar-mode -1) | |
(setq visible-bell t) | |
(setq-default indent-tabs-mode nil) | |
(tool-bar-mode -1) | |
(custom-set-variables | |
'(c-basic-offset 4) | |
'(global-font-lock-mode t nil (font-lock)) | |
'(show-paren-mode t nil (paren)) | |
'(transient-mark-mode t)) | |
;; Projectile Mode | |
(projectile-global-mode t) | |
(setq projectile-indexing-method 'git) | |
(setq projectile-enable-caching t) | |
;; C++ Coding Style | |
(setq auto-mode-alist (cons '("\\.h$" . c++-mode) auto-mode-alist)) | |
(defconst my-cc-style | |
'("cc-mode" | |
(c-offsets-alist . ((innamespace . [0]))))) | |
(c-add-style "my-cc-mode" my-cc-style) | |
(add-hook 'c++-mode-hook '(lambda () | |
(c-set-style "my-cc-mode") | |
(gtags-mode 1) | |
)) | |
;; C++ 11 new keywords | |
(font-lock-add-keywords 'c++-mode | |
'(("\\<\\(thread_local\\)\\>" . font-lock-warning-face) | |
("\\<\\(constexpr\\)\\>" . font-lock-keyword-face) | |
)) | |
;; Set up lean-root path | |
(setq lean-rootdir "c:/lean") | |
(setq-local lean-emacs-path | |
(concat (file-name-as-directory lean-rootdir) | |
(file-name-as-directory "src") | |
"emacs")) | |
(add-to-list 'load-path (expand-file-name lean-emacs-path)) | |
(require 'lean-mode) | |
;; Git | |
(require 'magit) | |
(add-to-list 'exec-path "C:/Program Files (x86)/Git/bin") | |
(global-set-key "\C-xg" 'magit-status) | |
(setq vc-display-status nil) | |
(global-git-gutter-mode t) | |
;; full screen magit-status | |
(defadvice magit-status (around magit-fullscreen activate) | |
(window-configuration-to-register :magit-fullscreen) | |
ad-do-it | |
(delete-other-windows)) | |
(defun magit-quit-session () | |
"Restores the previous window configuration and kills the magit buffer" | |
(interactive) | |
(kill-buffer) | |
(jump-to-register :magit-fullscreen)) | |
(define-key magit-status-mode-map (kbd "q") 'magit-quit-session) | |
(define-key magit-mode-map "c" 'magit-commit) | |
(setq magit-git-executable "c:/Program Files (x86)/Git/bin/git.exe") | |
;; Fonta | |
(unicode-fonts-setup) | |
(when (member "Inconsolata" (font-family-list)) | |
(set-face-attribute 'default nil :font "Inconsolata-13")) | |
(setq inhibit-splash-screen t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment