Skip to content

Instantly share code, notes, and snippets.

@jacres
Created November 10, 2013 19:48
Show Gist options
  • Save jacres/7402985 to your computer and use it in GitHub Desktop.
Save jacres/7402985 to your computer and use it in GitHub Desktop.
#!/bin/sh
echo -std=c++11 -I /home/james/development/projects/renderer/external/include -I /home/james/development/projects/renderer/deferred_demo/src -I /usr/lib/gcc/x86_64-unknow
n-linux-gnu/4.8.2/../../../../include/c++/4.8.2 -I /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/../../../../include/c++/4.8.2/x86_64-unknown-linux-gnu -I /usr/lib/gcc/x86_
64-unknown-linux-gnu/4.8.2/../../../../include/c++/4.8.2/backward -I /usr/lib/gcc/x86_64-unknown-linux-gnu/4.8.2/include -I /usr/local/include -I /usr/lib/gcc/x86_64-unkn
own-linux-gnu/4.8.2/include-fixed -I /usr/include
;;; package --- Summary
(setq package-archives '(("ELPA" . "http://tromey.com/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
;;; Commentary:
;;; Code:
(package-initialize)
(add-to-list 'load-path (expand-file-name "~/.emacs.d/"))
; terminal hook
(add-hook 'term-setup-hook
'(lambda ()
(xterm-mouse-mode 1)
(define-key function-key-map "\033[1;3A" [M-up])
(define-key function-key-map "\033[1;3B" [M-down])
(define-key function-key-map "\033[1;3C" [M-right])
(define-key function-key-map "\033[1;3D" [M-left])))
;; Initial Buffers
(add-hook 'window-setup-hook 'delete-other-windows)
(require 'ido) ;; ido mode for filename completion
(ido-mode t)
(fset 'yes-or-no-p 'y-or-n-p) ; yes/no single char
; color / themes
(load-theme 'wombat t)
;; yasnippet (loaded before autocomplete so that the can work together)
(require 'yasnippet)
(setq yas/indent-line nil)
(yas-global-mode 1)
(require 'auto-complete)
(require 'auto-complete-config)
(require 'auto-complete-clang-async)
(set-default 'ac-c-sources
'(ac-source-yasnippet
ac-source-yasnippet
ac-source-words-in-buffer
ac-source-words-in-same-mode-buffers))
(defun ac-cc-mode-setup ()
(setq ac-clang-complete-executable "~/.emacs.d/clang-complete")
(setq ac-auto-start nil)
(define-key ac-mode-map (kbd "C-q") 'auto-complete)
(define-key ac-mode-map (kbd "C-^") 'ac-clang-syntax-check) ;;ctrl-6 - don't really use this since flycheck does the same thing
(setq ac-sources
(append '(ac-source-clang-async) ac-sources))
(ac-clang-launch-completion-process)
)
(defun ac-common-setup ()
())
(defun my-ac-config ()
(add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
(add-hook 'auto-complete-mode-hook 'ac-common-setup)
)
(my-ac-config)
(global-auto-complete-mode t)
;; runs a bash script to echo out clang c-flags
(defun my-clang-config ()
"Sets `ac-clang-cflags' to a shell command's output. set new cflags for ac-clang from shell command output"
(interactive)
(setq ac-clang-cflags
(split-string
(shell-command-to-string
(read-shell-command "Clang Flags Script: " "../clang_flags.sh" nil
(and buffer-file-name
(file-relative-name buffer-file-name))))))
(ac-clang-update-cmdlineargs))
; default window size
(if (window-system)
(set-frame-size (selected-frame) 160 65)
(setq linum-format (quote "%d "))) ; space after line numbers in non-window mode
; tabs/indents
(setq tab-width 2)
(setq-default indent-tabs-mode nil)
(setq indent-tabs-mode t)
(setq-default truncate-lines t) ; no line wrapping
; line numbers
(global-linum-mode 1)
(setq column-number-mode t)
; current line highlight
(global-hl-line-mode 1)
(set-face-background 'hl-line "#252525")
(set-face-foreground 'highlight nil)
(set-face-underline-p 'highlight nil)
; Change background color to darker grey
(set-face-attribute 'default nil
:inherit nil
:stipple nil
:background "#121212"
:foreground "#f6f3e8"
:inverse-video nil
:box nil
:strike-through nil
:overline nil
:underline nil
:slant 'normal
:weight 'normal
:height 90
:width 'normal
:foundry "unknown"
:family "DejaVu Sans Mono")
(global-set-key (kbd "C-x C-o") 'ff-find-other-file) ;; switch implementation/header
(global-set-key [f10] 'compile)
(global-set-key [f9] 'recompile)
;; CUA is for block selection/replace (so you can type to replace a selection like in other editors)
(setq cua-enable-cua-keys nil) ;; don't add C-x,C-c,C-v
(cua-mode t) ;; for rectangles, CUA is nice
;; auto pair brackets
(require 'autopair)
(autopair-global-mode 1)
(setq autopair-autowrap t)
; headers as C++
(setq auto-mode-alist (cons '("\\.h$" . c++-mode) auto-mode-alist))
;; create CPP implementations from .h definition files
(require 'member-function)
(setq mf--source-file-extension "cpp")
;; indent after newline
(add-hook 'c-mode-common-hook
'(lambda ()
(local-set-key (kbd "RET") 'newline-and-indent)))
;; Load GLSL syntax
(load-file "~/.emacs.d/glsl-mode.el")
(autoload 'glsl-mode "glsl-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.glsl\\'" . glsl-mode))
(add-to-list 'auto-mode-alist '("\\.vert\\'" . glsl-mode))
(add-to-list 'auto-mode-alist '("\\.frag\\'" . glsl-mode))
(add-to-list 'auto-mode-alist '("\\.geom\\'" . glsl-mode))
;; OpenCL
(setq auto-mode-alist (cons '("\.cl$" . c-mode) auto-mode-alist))
;; Smooth scrolling
;; scroll one line at a time (less "jumpy" than defaults)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
;; auto header generation
(require 'header2)
(setq header-copyright-notice "Copyright © James Acres\nhttp://www.jamesacres.com\nhttp://github.com/jacres\n@jimmyacres\n")
(setq header-author 'user-full-name)
(setq header-file-name 'buffer-file-name)
(setq header-creation-date 'current-time-string)
(setq header-modification-author 'user-full-name)
(setq make-header-hook '(
header-file-name
header-blank
header-copyright
header-blank
header-creation-date
header-modification-date
))
(add-hook 'emacs-lisp-mode-hook 'auto-make-header)
(add-hook 'c-mode-common-hook 'auto-make-header)
(add-hook 'verilog-mode-hook 'auto-make-header)
(add-hook 'python-mode-hook 'auto-make-header)
(add-hook 'cperl-mode-hook 'auto-make-header)
(add-hook 'c-mode-hook 'auto-make-header)
(add-hook 'makefile-mode-hook 'auto-make-header)
(add-hook 'sh-mode-hook 'auto-make-header)
(add-hook 'write-file-hooks 'auto-update-file-header)
(autoload 'auto-make-header "header2")
(add-hook 'emacs-lisp-mode-hook 'auto-make-header)
(add-hook 'c-mode-common-hook 'auto-make-header)
(autoload 'auto-update-file-header "header2")
(add-hook 'write-file-hooks 'auto-update-file-header)
;; emacs auto backups
(setq backup-directory-alist '(("." . "~/.emacs.d/backup"))
backup-by-copying t ; Don't delink hardlinks
version-control t ; Use version numbers on backups
delete-old-versions t ; Automatically delete excess backups
kept-new-versions 20 ; how many of the newest versions to keep
kept-old-versions 5 ; and how many of the old
)
(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.
'(flycheck-clang-include-path (quote ("./" "/home/james/development/projects/renderer/glfw_deferred_opencl/src/" "/home/james/development/projects/renderer/external/include/" "/usr/lib/clang/3.3/include" "/usr/include/c++/4.8.2" "/usr/include/c++/4.8.2/x86_64-unknown-linux-gnu")))
'(flycheck-clang-language-standard "c++11")
'(flycheck-clang-standard-library "libc++")
'(flycheck-highlighting-mode (quote symbols))
'(flycheck-idle-change-delay 10)
'(flycheck-mode-hook (quote (flycheck-color-mode-line-mode)))
'(flycheck-standard-error-navigation t)
'(global-flycheck-mode t nil (flycheck))
'(inhibit-startup-screen t)
'(show-paren-mode t))
;; flycheck
(add-hook 'after-init-hook 'global-flycheck-mode)
(require 'flycheck-tip)
(define-key c-mode-map (kbd "C-c C-n") 'flycheck-tip-cycle) ;; cycles through the errors found by flycheck and gives a popup with more info
(define-key c++-mode-map (kbd "C-c C-n") 'flycheck-tip-cycle)
;; rainbow delimeters
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
(global-rainbow-delimiters-mode)
(provide 'init)
;;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment