Skip to content

Instantly share code, notes, and snippets.

@hamsham
Last active May 16, 2017 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamsham/2e3f4cfbd682e7404a0066d2ee234e8d to your computer and use it in GitHub Desktop.
Save hamsham/2e3f4cfbd682e7404a0066d2ee234e8d to your computer and use it in GitHub Desktop.
My Emacs Config
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(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-faces-vector
[default default default italic underline success warning error]
)
'(custom-enabled-themes (quote (tango-dark)))
'(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.
)
;; Truncate long lines, don't do any word wrapping
(setq-default truncate-lines t)
(setq trucate-partial-width-windows nil)
;; Enable line numbers
(global-linum-mode 1)
(setq linum-format "%d \u2502")
;; Allow the current column to be displayed
(setq column-number-mode t)
;; Tabs at 4 characters up to 200 columns
(setq tab-stop-list (number-sequence 4 200 4))
(setq show-parent-mode 1)
;; ONLY SPACES!!!
(setq-default
c-default-style "bsd" ; "Allman" style indentation
indent-tabs-mode nil ; Spaces for tabs
tab-width 4 ; 4 Spaces per tab
tab-always-indent nil ; Always indent on tab
c-tab-always-indent t ; C-mode, always indent on tab
c++-tab-always-indent t ; C++ mode, always indent on tab
)
(defvaralias 'c-basic-offset 'tab-width)
(defvaralias 'c-indent-level 'tab-width)
(defvaralias 'cperl-indent-level 'tab-width)
;(setq indent-line-function 'insert-tab)
; Symbols for C/C++ modes found here:
; https://www.gnu.org/software/emacs/manual/html_node/ccmode
; https://www.gnu.org/software/emacs/manual/html_node/ccmode/Syntactic-Symbols.html#Syntactic-Symbols
(defun hams-c-mode ()
(c-set-offset 'innamespace '0) ; no namespace indentations
(c-set-offset 'inextern-lang '0) ; no indentations of "extern 'C'"
(c-set-offset 'inline-open '0) ; no extra indentations of inline functions
(c-set-offset 'label '0) ; no extra label indents
(c-set-offset 'case-label '+) ; indent 'case' statements
(c-set-offset 'inclass '++) ; double-indents on class data
(c-set-offset 'access-label '-) ; single-indents on class access labels
(c-set-offset 'friend '-) ; single-indents on 'friend' expressions
(c-set-offset 'stream-op '+) ; extra indent when continuing a stream
)
(add-hook 'c-mode-hook 'hams-c-mode)
(add-hook 'c++-mode-hook 'hams-c-mode)
;; auto-refresh dired
(add-hook 'dired-mode-hook 'auto-revert-mode)
(put 'scroll-left 'disabled nil)
;; Custom Plugins
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
;; Nyan Cat
(setq nyan-wavy-trail t)
(setq nyan-animate-nyancat t)
(nyan-mode 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment