Update '.emacs.d/init.org"

This commit is contained in:
2019-02-19 17:22:40 +00:00
parent c4cba4277a
commit dbbf804726

View File

@@ -28,7 +28,6 @@ configuration that isn't in described this file.
Configure some startup parameters. Configure some startup parameters.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(set-background-color "#000000")
(line-number-mode t) (line-number-mode t)
(column-number-mode t) (column-number-mode t)
(setq inhibit-splash-screen t) (setq inhibit-splash-screen t)
@@ -49,7 +48,22 @@ Winner-mode keeps a history of window configurations. Handy when magit
decides to blow away, or I hit the wrong key and blow away my windows. decides to blow away, or I hit the wrong key and blow away my windows.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(winner-mode t) (use-package winner
:init
(winner-mode))
#+END_SRC
Add Purpose for binding a "purpose" to a window, such as "terminal" or
"edit", so only buffers with that purpose may end up in that
window. This helps keep things organized without too much manual
tweaking. You can also save and load window layouts and purposes.
#+BEGIN_SRC emacs-lisp
(use-package window-purpose
:bind (("C-c p s" . purpose-set-window-purpose))
:init (purpose-mode t)
;(purpose-x-kill-setup) ;; This seems to cause slowness in helm
(purpose-x-magit-multi-on))
#+END_SRC #+END_SRC
By default, if you a region selected and hit "backspace" it does not By default, if you a region selected and hit "backspace" it does not
@@ -80,7 +94,9 @@ Install magit, and explicitly call out with-editor as well, even
though its a requirement for magit. though its a requirement for magit.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package magit) (use-package magit
:config (setq magit-bury-buffer-function 'magit-mode-quit-window))
(use-package with-editor) (use-package with-editor)
#+END_SRC #+END_SRC
@@ -114,14 +130,6 @@ Multi-term is useful for having multiple terminal buffers.
(add-to-list 'term-bind-key-alist bind))))) (add-to-list 'term-bind-key-alist bind)))))
#+END_SRC #+END_SRC
Eyebrowse is a package for managing multiple simultaneous window
configurations.
#+BEGIN_SRC emacs-lisp
(use-package eyebrowse
:config (eyebrowse-mode t))
#+END_SRC
Install helm, a completion framework, and install its functions over Install helm, a completion framework, and install its functions over
some of the usual emacs keybinds. some of the usual emacs keybinds.
@@ -129,10 +137,10 @@ some of the usual emacs keybinds.
(use-package helm (use-package helm
:config (helm-mode) :config (helm-mode)
:bind (("M-x" . helm-M-x) :bind (("M-x" . helm-M-x)
("C-c b" . helm-mini) ("C-x b" . helm-mini)
("C-x C-b" . helm-buffers-list) ("C-x C-b" . helm-buffers-list)
("C-x b" . helm-buffers-list) ("M-y" . helm-show-kill-ring))
("M-y" . helm-show-kill-ring))) :init (setq helm-split-window-inside-p t))
#+END_SRC #+END_SRC
Install projectile for managing buffers within projects. Install projectile for managing buffers within projects.
@@ -164,6 +172,11 @@ Add helm-swoop for searching across multiple buffers.
(use-package helm-swoop) (use-package helm-swoop)
#+END_SRC #+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package helm-purpose
:bind (("C-c b" . helm-purpose-switch-buffer-with-purpose)))
#+END_SRC
Use ws-butler to automatically clean up any trailing whitespace I Use ws-butler to automatically clean up any trailing whitespace I
leave behind. Other lines are left untouched. leave behind. Other lines are left untouched.
@@ -180,10 +193,10 @@ bottom of the window.
:config (smooth-scrolling-mode t)) :config (smooth-scrolling-mode t))
#+END_SRC #+END_SRC
Tango dark is my standard of the last few years. Monokai theme is my theme of choice.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(load-theme 'tango-dark) (use-package monokai-theme)
#+END_SRC #+END_SRC
Don't use the arrow keys, try to stay on the home row. Don't use the arrow keys, try to stay on the home row.
@@ -192,31 +205,49 @@ Don't use the arrow keys, try to stay on the home row.
(mapc 'global-unset-key '([left] [right] [up] [down] [C-down] [C-up] [C-right] [C-left])) (mapc 'global-unset-key '([left] [right] [up] [down] [C-down] [C-up] [C-right] [C-left]))
#+END_SRC #+END_SRC
Disable the mouse too. I don't really need it. Use zoom-window to enable full-screening a single window, briefly.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package disable-mouse (use-package zoom-window
:config (global-disable-mouse-mode)) :bind* ("C-c z z" . zoom-window-zoom))
#+END_SRC #+END_SRC
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package ace-window (use-package ace-window
:bind* ("C-x o" . ace-window) :bind* ("C-x o" . ace-window)
:init (progn :init (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)) (setq aw-scope 'frame))
(setq aw-scope 'frame)))
#+END_SRC #+END_SRC
C-mode configurations. Set tab width to 4, since that's what I'm used C-mode configurations. Set tab width to 4, since that's what I'm used
to. to.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq c-default-style "linux" c-basic-offset 4) (defun my-c-common-hook()
(setq-default c-basic-offset 4 (setq c-hungry-delete-key t)
tab-width 4 (adaptive-wrap-prefix-mode t)
indent-tabs-mode nil) (toggle-word-wrap t))
(add-hook 'c-mode-hook (lambda ()
(setq c-hungry-delete-key t))) (add-hook 'c-mode-common-hook 'my-c-common-hook)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(setq-default c-basic-offset 4
tab-width 4
indent-tabs-mode nil)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(defconst my-cc-style
'("linux"
(c-offsets-alist . ((innamespace . [0])))))
(c-add-style "my-cc-style" my-cc-style)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package highlight-doxygen
:init (highlight-doxygen-global-mode))
#+END_SRC #+END_SRC
Add the ability to toggle a buffer as dedicated to its window, to Add the ability to toggle a buffer as dedicated to its window, to
@@ -266,7 +297,7 @@ Boring buffers can still be found via helm/ibuffer.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun buffer-is-boring (buffer) (defun buffer-is-boring (buffer)
(or (or
(string-match-p "^\*" (buffer-name buffer)) (and (string-match-p "^\*" (buffer-name buffer)))
(string-match-p "^magit" (buffer-name buffer)))) (string-match-p "^magit" (buffer-name buffer))))
(defun buffer-iterate (iter-fun) (defun buffer-iterate (iter-fun)
@@ -312,9 +343,51 @@ Boring buffers can still be found via helm/ibuffer.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package clang-format (use-package clang-format
:commands clang-format clang-format-buffer clang-format-region :commands clang-format clang-format-buffer clang-format-region)
#+END_SRC #+END_SRC
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode)) (add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode))
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package yaml-mode)
(use-package markdown-mode)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package adaptive-wrap)
#+END_SRC
Add cquery for completions. This requires.
1. The cquery is checked out into ~/software/cquery/ and built.
2. The project has a .cquery file at its root, which specifies all of the includes paths.
#+BEGIN_SRC emacs-lisp
(defun cquery//enable ()
(condition-case nil
(lsp)
(user-error nil)))
(use-package cquery
:commands lsp
:after (:any c-mode c++-mode objc-mode)
:config (setq cquery-executable "~/software/cquery/build/release/bin/cquery")
(add-hook 'c-mode-hook #'cquery//enable)
(add-hook 'c++-mode-hook #'cquery//enable)
;; Do not use projectile for root-matching, since we have multiple git projects that are compiled together
(setq cquery-project-root-matchers '(cquery-project-roots-matcher "compile_commands.json" ".cquery" "build/compile_commands.json"))
(push 'company-lsp company-backends)
)
(use-package company
:init (add-hook 'c-mode-hook company-mode)
(add-hook 'c++-mode-hook company-mode)
)
(use-package company-lsp
:init (push 'company-lsp company-backends))
#+END_SRC #+END_SRC