Created
June 2, 2016 17:51
-
-
Save acadien/c8aadbc68d708c67f8b19b477333f491 to your computer and use it in GitHub Desktop.
Emacs config file
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
(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. | |
'(custom-safe-themes (quote ("8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" "a8245b7cc985a0610d71f9852e9f2767ad1b852c2bdea6f4aadc12cce9c4d6d0" default))) | |
'(inhibit-startup-screen t)) | |
(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. | |
) | |
(require 'package) | |
(package-initialize) | |
(add-to-list 'package-archives | |
'("melpa-stable" . "http://stable.melpa.org/packages/") t) | |
(load-theme 'solarized-dark t) | |
;; show column number | |
(setq line-number-mode t) | |
(setq column-number-mode t) | |
;; No tabs while writing file. | |
(setq-default indent-tabs-mode nil) | |
;; No tabs upon save of file. | |
;;(add-hook 'write-file-hooks (lambda () (untabify (point-min) (point-max)))) | |
;; Set fixed window width | |
(if (display-graphic-p) | |
(progn | |
;; if running in x-window, set fixed size window with vertical split. | |
(add-to-list 'default-frame-alist '(width . 203)) | |
(add-to-list 'default-frame-alist '(height . 90)) | |
(split-window-right)) | |
;; else: running in terminal | |
) | |
(defun set-narrow-single-window () | |
"Set this frame to be 81 columns wide" | |
(interactive) | |
(if (not (one-window-p)) | |
(other-window 1)) | |
(if (not (one-window-p)) | |
(delete-window)) | |
(set-frame-width (selected-frame) 81 t)) | |
(defun set-wide-single-window () | |
"Set this frame to be 101 columns wide" | |
(interactive) | |
(if (not (one-window-p)) | |
(other-window 1)) | |
(if (not (one-window-p)) | |
(delete-window)) | |
(set-frame-width (selected-frame) 101 t)) | |
(defun set-narrow-window () | |
"Set this frame to be 163 columns wide" | |
(interactive) | |
(set-frame-width (selected-frame) 163 t)) | |
(defun set-wide-window () | |
"Set this window to be 203 columns wide" | |
(interactive) | |
(set-frame-width (selected-frame) 203 t)) | |
(global-set-key (kbd "C-<") 'set-narrow-single-window) | |
(global-set-key (kbd "C->") 'set-wide-single-window) | |
(global-set-key (kbd "C-,") 'set-narrow-window) | |
(global-set-key (kbd "C-.") 'set-wide-window) | |
;; Move that cursor with ease | |
(global-set-key (kbd "s-<right>") 'move-end-of-line) | |
(global-set-key (kbd "s-<left>") 'move-beginning-of-line) | |
(global-set-key (kbd "s-<down>") 'scroll-up-command) | |
(global-set-key (kbd "s-<up>") 'scroll-down-command) | |
;; Switch buffers with mouse wheel | |
(global-set-key (kbd "S-<wheel-right>") 'next-buffer) | |
(global-set-key (kbd "S-<wheel-left>") 'previous-buffer) | |
(global-set-key (kbd "<mouse-8>") 'previous-buffer) | |
(global-set-key (kbd "<drag-mouse-8>") 'previous-buffer) | |
(global-set-key (kbd "<mouse-6>") 'previous-buffer) | |
(global-set-key (kbd "<drag-mouse-6>") 'previous-buffer) | |
(global-set-key (kbd "<mouse-7>") 'next-buffer) | |
(global-set-key (kbd "<drag-mouse-7>") 'next-buffer) | |
(global-set-key (kbd "<mouse-9>") 'next-buffer) | |
(global-set-key (kbd "<drag-mouse-9>") 'next-buffer) | |
;; Delete line backwards | |
(defun backward-kill-line (arg) | |
"Kill ARG lines backward." | |
(interactive "p") | |
(kill-line (- 1 arg))) | |
(global-set-key (kbd "C-S-k") 'backward-kill-line) | |
;; Delete trailing white space when saving | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
;; Auto CLANG linting | |
(load "/usr/share/emacs/site-lisp/clang-format-3.9/clang-format.el") | |
(global-set-key (kbd "C-u") 'clang-format-buffer) | |
;; Font size. | |
(add-to-list 'default-frame-alist | |
'(font . "Ubuntu Mono-10:bold")) | |
;; Hide scrollbar. | |
(scroll-bar-mode -1) | |
;; Comment region | |
(global-set-key "\C-cc" 'comment-region) | |
(global-set-key "\C-cu" 'uncomment-region) | |
;; feature for revert split pane config. | |
;; Call winner-undo [Ctrl+c ←] and winner-redo [Ctrl+c →] | |
(winner-mode 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment