Initfile cleanup

This commit is contained in:
Henrik Lissner 2015-01-15 01:49:11 -05:00
parent f0e7f177da
commit e91258ceff
9 changed files with 91 additions and 87 deletions

View file

@ -6,7 +6,7 @@
(after "auto-complete" (add-to-list 'ac-modes 'cmake-mode))
(after "company"
(use-package company-cmake
:config (company--backend-on 'cmake-mode-hook 'company-cmake)))))
:config (company--backend-on 'cmake-mode-hook 'company-cmake 'company-yasnippet)))))
;; Shaders
(use-package glsl-mode
@ -16,22 +16,15 @@
("\\.geom\\'" . glsl-mode)))
(use-package cc-mode
:defer t
:commands (c-mode c++-mode objc-mode java-mode)
:init
(progn
(associate-minor-mode "\\.h$" 'c++-mode)
(associate-minor-mode "\\.mm$" 'objc-mode))
;; (add-hook 'c-mode-hook 'irony-mode)
;; (add-hook 'c++-mode-hook 'irony-mode)
;; (add-hook 'objc-mode-hook 'irony-mode)
;; (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
(associate-mode "\\.h$" 'c++-mode)
(associate-mode "\\.mm$" 'objc-mode))
:config
(progn
(setq-default c-basic-offset 4
c-default-style "linux"
c-tab-always-indent nil)
(setq c-basic-offset 4
c-tab-always-indent nil)
(when is-mac
(setq my--clang-includes
@ -66,26 +59,31 @@
. objc-mode))
(after "flycheck" (add-hook! 'objc-mode-hook (use-package flycheck-objc))))
(after "auto-complete"
(when is-mac (setq ac-clang-flags (my--clang-includes-flags)))
(add-hook! 'c-mode-common-hook
(use-package auto-complete-clang)
(use-package auto-complete-c-headers)
(setq ac-sources
'(ac-source-clang
ac-source-c-headers
ac-source-yasnippet
ac-source-words-in-same-mode-buffers))))
;; (use-package ycmd
;; :init (add-hook 'c++-mode-hook 'ycmd-mode)
;; :config
;; (progn
;; (setq ycmd-global-config (f-full "~/.ycm_extra_conf.py"))
;; (setq ycmd-server-command `("/usr/local/bin/python" ,(f-full "~/.emacs.d/ext/YouCompleteMe/third_party/ycmd/ycmd/")))
;; (use-package company-ycmd
;; :init (company--backend-on 'c++-mode-hook 'company-ycmd))))
;; (after "auto-complete"
;; (when is-mac (setq ac-clang-flags (my--clang-includes-flags)))
;; (add-hook! 'c-mode-common-hook
;; (use-package auto-complete-clang)
;; (use-package auto-complete-c-headers)
;; (setq ac-sources
;; '(ac-source-clang
;; ac-source-c-headers
;; ac-source-yasnippet
;; ac-source-words-in-same-mode-buffers))))
(after "company"
(use-package company-irony
:config
(progn
(use-package company-c-headers
:config (setq company-c-headers-path-system (my--clang-includes)))
(company--backend-on 'c-mode-hook 'company-clang 'company-c-headers)
(company--backend-on 'c++-mode-hook 'company-clang 'company-c-headers)
(company--backend-on 'objc-mode-hook 'company-xcode 'company-c-headers))))
;; TODO Clang is *really* slow in larger projects, maybe replace it with irony-mode or ycmd?
(company--backend-on 'c-mode-hook 'company-c-headers 'company-clang)
(company--backend-on 'c++-mode-hook 'company-c-headers 'company-clang)
(company--backend-on 'objc-mode-hook 'company-c-headers 'company-xcode))
(add-hook! 'c-mode-common-hook
(c-toggle-electric-state -1)
@ -116,46 +114,45 @@
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(add-hook 'c++-mode-hook
'(lambda()
;; We could place some regexes into `c-mode-common-hook', but
;; note that their evaluation order matters.
(font-lock-add-keywords
nil '(;; complete some fundamental keywords
("\\<\\(void\\|unsigned\\|signed\\|char\\|short\\|bool\\|int\\|long\\|float\\|double\\)\\>" . font-lock-keyword-face)
;; namespace names and tags - these are rendered as constants by cc-mode
("\\<\\(\\w+::\\)" . font-lock-function-name-face)
;; new C++11 keywords
("\\<\\(alignof\\|alignas\\|constexpr\\|decltype\\|noexcept\\|nullptr\\|static_assert\\|thread_local\\|override\\|final\\)\\>" . font-lock-keyword-face)
("\\<\\(char16_t\\|char32_t\\)\\>" . font-lock-keyword-face)
;; PREPROCESSOR_CONSTANT, PREPROCESSORCONSTANT
("\\<[A-Z]*_[A-Z_]+\\>" . font-lock-constant-face)
("\\<[A-Z]\\{3,\\}\\>" . font-lock-constant-face)
;; hexadecimal numbers
("\\<0[xX][0-9A-Fa-f]+\\>" . font-lock-constant-face)
;; integer/float/scientific numbers
("\\<[\\-+]*[0-9]*\\.?[0-9]+\\([ulUL]+\\|[eE][\\-+]?[0-9]+\\)?\\>" . font-lock-constant-face)
;; c++11 string literals
;; L"wide string"
;; L"wide string with UNICODE codepoint: \u2018"
;; u8"UTF-8 string", u"UTF-16 string", U"UTF-32 string"
("\\<\\([LuU8]+\\)\".*?\"" 1 font-lock-keyword-face)
;; R"(user-defined literal)"
;; R"( a "quot'd" string )"
;; R"delimiter(The String Data" )delimiter"
;; R"delimiter((a-z))delimiter" is equivalent to "(a-z)"
("\\(\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(\\)" 1 font-lock-keyword-face t) ; start delimiter
( "\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(\\(.*?\\))[^\\s-\\\\()]\\{0,16\\}\"" 1 font-lock-string-face t) ; actual string
( "\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(.*?\\()[^\\s-\\\\()]\\{0,16\\}\"\\)" 1 font-lock-keyword-face t) ; end delimiter
(add-hook! 'c++-mode-hook
;; We could place some regexes into `c-mode-common-hook', but
;; note that their evaluation order matters.
(font-lock-add-keywords
nil '(;; complete some fundamental keywords
("\\<\\(void\\|unsigned\\|signed\\|char\\|short\\|bool\\|int\\|long\\|float\\|double\\)\\>" . font-lock-keyword-face)
;; namespace names and tags - these are rendered as constants by cc-mode
("\\<\\(\\w+::\\)" . font-lock-function-name-face)
;; new C++11 keywords
("\\<\\(alignof\\|alignas\\|constexpr\\|decltype\\|noexcept\\|nullptr\\|static_assert\\|thread_local\\|override\\|final\\)\\>" . font-lock-keyword-face)
("\\<\\(char16_t\\|char32_t\\)\\>" . font-lock-keyword-face)
;; PREPROCESSOR_CONSTANT, PREPROCESSORCONSTANT
("\\<[A-Z]*_[A-Z_]+\\>" . font-lock-constant-face)
("\\<[A-Z]\\{3,\\}\\>" . font-lock-constant-face)
;; hexadecimal numbers
("\\<0[xX][0-9A-Fa-f]+\\>" . font-lock-constant-face)
;; integer/float/scientific numbers
("\\<[\\-+]*[0-9]*\\.?[0-9]+\\([ulUL]+\\|[eE][\\-+]?[0-9]+\\)?\\>" . font-lock-constant-face)
;; c++11 string literals
;; L"wide string"
;; L"wide string with UNICODE codepoint: \u2018"
;; u8"UTF-8 string", u"UTF-16 string", U"UTF-32 string"
("\\<\\([LuU8]+\\)\".*?\"" 1 font-lock-keyword-face)
;; R"(user-defined literal)"
;; R"( a "quot'd" string )"
;; R"delimiter(The String Data" )delimiter"
;; R"delimiter((a-z))delimiter" is equivalent to "(a-z)"
("\\(\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(\\)" 1 font-lock-keyword-face t) ; start delimiter
( "\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(\\(.*?\\))[^\\s-\\\\()]\\{0,16\\}\"" 1 font-lock-string-face t) ; actual string
( "\\<[uU8]*R\"[^\\s-\\\\()]\\{0,16\\}(.*?\\()[^\\s-\\\\()]\\{0,16\\}\"\\)" 1 font-lock-keyword-face t) ; end delimiter
;; user-defined types (rather project-specific)
("\\<[A-Za-z_]+[A-Za-z_0-9]*_\\(type\\|ptr\\)\\>" . font-lock-type-face)
("\\<\\(xstring\\|xchar\\)\\>" . font-lock-type-face)
))
) t)
;; user-defined types (rather project-specific)
("\\<[A-Za-z_]+[A-Za-z_0-9]*_\\(type\\|ptr\\)\\>" . font-lock-type-face)
("\\<\\(xstring\\|xchar\\)\\>" . font-lock-type-face)
))
t)
;; Fix enum and C++11 lambda indentation
(defadvice c-lineup-arglist (around my activate)
(defadvice c-lineup-arglist (around c-lineup-arglist-indent-fix activate)
"Improve indentation of continued C++11 lambda function opened as argument."
(setq ad-return-value
(if (and (equal major-mode 'c++-mode)

View file

@ -42,10 +42,10 @@
(add-hook hook
`(lambda()
(set (make-local-variable 'company-backends)
(append '((,@backends company-yasnippet)) company-backends)))))
(append '((,@backends)) company-backends)))))
(company--backend-on 'nxml-mode-hook 'company-nxml)
(company--backend-on 'emacs-lisp-mode-hook 'company-elisp)
(company--backend-on 'nxml-mode-hook 'company-nxml 'company-yasnippet)
(company--backend-on 'emacs-lisp-mode-hook 'company-elisp 'company-yasnippet)
;; Rewrite evil-complete to use company-dabbrev
(setq company-dabbrev-code-other-buffers t)

View file

@ -1,16 +1,15 @@
(use-package omnisharp :defer t
(use-package omnisharp
:defer t
:config
(progn
(setq omnisharp-server-executable-path "~/Dropbox/projects/lib/Omnisharp/server/OmniSharp/bin/Debug/OmniSharp.exe")
(bind 'normal omnisharp-mdoe-map
"gd" 'omnisharp-go-to-definition
"")
(bind 'normal omnisharp-mode-map
"gd" 'omnisharp-go-to-definition)
(after "company"
(company--backend-on 'csharpmode 'company-omnisharp)
(add-hook 'csharp-mode-hook 'eldoc-mode))
))
(company--backend-on 'csharp-mode-hook 'company-omnisharp)
(add-hook 'csharp-mode-hook 'turn-on-eldoc-mode))))
(use-package csharp-mode :mode "\\.cs$")
;; (use-package csharp-mode
@ -25,5 +24,6 @@
;; TODO Make more Unity-friendly
(provide 'init-csharp)
;;; init-csharp.el ends here

View file

@ -1,6 +1,7 @@
(use-package d-mode
:disabled t
:modes "\\.d$")
:mode "\\.d$")
(provide 'init-d)
;;; init-d.el ends here

View file

@ -13,10 +13,9 @@
(add-hook 'lua-mode-hook 'enable-tab-width-2)
(add-hook! 'lua-mode-hook (setq lua-indent-level tab-width))
(defun my--build-love ()
(shell-command (format "open -a love.app %s" (my--project-root))))
))
(defun love-run ()
(interactive)
(shell-command (format "open -a love.app %s" (my--project-root))))))
(provide 'init-lua)

View file

@ -6,6 +6,7 @@
(add-hook 'org-mode-hook 'enable-tab-width-2)
(add-hook 'org-mode-hook 'evil-org-mode)
(add-hook 'org-mode-hook 'turn-on-auto-fill)
(add-hook 'org-mode-hook 'org-toggle-pretty-entities)
;; Reset evil to ensure evil-org-mode's maps work
(add-hook! 'org-mode-hook (evil-mode nil) (evil-mode 1))
@ -29,6 +30,7 @@
org-hide-leading-stars t
org-hierarchical-todo-statistics t
org-checkbox-hierarchical-statistics t
org-tags-column -87
org-log-done t
org-todo-keywords
'((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
@ -50,9 +52,9 @@
(setq org-capture-templates
'(("t" "TODO" entry (file+headline "~/Dropbox/notes/todo.org" "Inbox") "* TODO %? %u\n%i")
("T" "TODO Someday" entry (file+headline "~/Dropbox/notes/todo.org" "Someday") "* TODO %? %u :someday:\n%i")
("T" "Project TODO" entry (file+headline (concat (projectile-project-root) "/TODO.org") "Unsorted") "** %u %?\n%i" :prepend t)
("c" "Changelog" entry (file+headline (concat (projectile-project-root) "/CHANGELOG.org") "Unsorted") "** %u %? :unsorted:\n%i" :prepend t)
("n" "Note" entry (file org-default-notes-file) "** %T %?\n%i" :prepend t)
("n" "Note" entry (file+headline org-default-notes-file "Unfiled") "** %T %?\n%i" :prepend t)
("j" "Journal" entry (file+datetree "~/Dropbox/notes/journal.org") "** %?%^g\nAdded: %U\n%i")
("a" "Trivia" entry (file "~/Dropbox/notes/trivia.org") "* %u %?\n%i" :prepend t)
("s" "Writing Scraps" entry (file "~/Dropbox/notes/writing.org") "* %u %?\n%i" :prepend t)
@ -199,7 +201,7 @@
(bind 'insert evil-org-mode-map
"C-e" 'org-end-of-line
"C-a" 'org-beginning-of-line)
(bind '(insert normal)
(bind '(insert normal) evil-org-mode-map
"<s-left>" 'org-beginning-of-line
"<s-right>" 'org-end-of-line
"<s-up>" 'org-up-element

View file

@ -1,5 +1,5 @@
(use-package rust-mode
:modes "\\.rs$"
:mode "\\.rs$"
:config
(after "company"
(let ((racer-dir (concat my-elisp-dir "racer/")))

View file

@ -1,3 +1,5 @@
;;; init.tmux.el - settings for interacting with tmux
(defun my--tmux-send (command)
(shell-command (format "tmux send-keys %s" command)))

View file

@ -93,6 +93,9 @@
(concat "\n" %)
(s-trim %))))
;; Trim selection; do no further processing
(defun %1 () (s-trim %))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Inter-field navigation