My personal dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1076 lines
35 KiB

* About
# -*- mode: org; -*-
#+TITLE: Wolfe's Literate Emacs Config
#+AUTHOR: Josh Wolfe
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href=""/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href=""/>
#+HTML_HEAD: <script src=""></script>
#+HTML_HEAD: <script src=""></script>
#+HTML_HEAD: <script type="text/javascript" src=""></script>
#+HTML_HEAD: <script type="text/javascript" src=""></script>
#+LATEX_HEADER: \usepackage[margin=0.7in]{geometry}
#+HTML: <a href=""><img src="" alt="Build Status"/></a><br><br>
This literate config is best read [[][here]] or in emacs.
This page is generated and kept up to date using a combination of
[[][travis ci]] and [[][ReadTheOrg]]. If you want to see the script that travis
uses [[][here]] is the bash script it runs and [[][this]] is the =.el= file that
it runs through emacs to generate the html page (this was mostly stolen
from IvanMalison).
Included in this section is also my export headers. These are responsible
for including the ReadTheOrg theme as well as some metadata and options
like title, author, table of contents etc. If you wish to see the headers
I'm using, [[][this]] is the raw org file.
* Startup
Runs a different function on startup depending on display mode.
#+BEGIN_SRC emacs-lisp :tangle yes
(setq custom-theme-directory "~/.emacs.d/themes")
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/term-setup ()
(use-package base16-theme
(load-theme 'base16-default-dark t))
(setq nlinum-format "%d ")
;;(global-hl-line-mode 1)
;;(add-to-list 'default-frame-alist '(background-color . "color-16"))
'(line-number ((t (:background "color-18" :foreground "brightblack"))))
'(ivy-current-match ((t (:background "color-18" :foreground "color-16"))))
'(linum ((t (:background "color-18"))))
'(region ((t :background "color-19")))
'(mode-line ((t (:background "color-19" :foreground "brightblue" :box nil))))
((t (:background "color-18" :foreground "color-244"))))))
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/gui-setup ()
(use-package base16-theme
(load-theme 'base16-default-dark t)
(defvar my/base16-colors base16-default-dark-colors)
(setq evil-emacs-state-cursor `(,(plist-get my/base16-colors :base0D) box)
evil-insert-state-cursor `(,(plist-get my/base16-colors :base0D) bar)
evil-motion-state-cursor `(,(plist-get my/base16-colors :base0E) box)
evil-normal-state-cursor `(,(plist-get my/base16-colors :base07) box)
evil-replace-state-cursor `(,(plist-get my/base16-colors :base08) bar)
evil-visual-state-cursor `(,(plist-get my/base16-colors :base09) box))
(set-face-attribute 'fringe nil :background nil))
'(region ((t (:background "gray19"))))
'(org-block ((t (:foreground "#d8d8d8"))))
'(org-done ((t (:box (:line-width 1) :weight bold))))
'(org-level-1 ((t (:inherit outline-1 :height 1.3))))
'(org-todo ((t (:box (:line-width 1) :weight bold))))))
#+BEGIN_SRC emacs-lisp :tangle yes
5 years ago
;; Not a function but it needs to be after the 2 setup functions
(if (display-graphic-p)
* General Settings
Basic settings I can't really live without.
#+BEGIN_SRC emacs-lisp :tangle yes
(setq inhibit-splash-screen t
inhibit-startup-message t
inhibit-startup-echo-area-message "wolfe")
(tool-bar-mode -1) ; No toolbar
(scroll-bar-mode -1) ; Hide scrollbars
(menu-bar-mode -1) ; No menubar
(show-paren-mode t) ; Highlights matching parens
(setq initial-scratch-message "") ; No scratch text
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
(setq-default indent-tabs-mode nil)
(column-number-mode t)
(delete-selection-mode 1) ; Replace selection on insert
(setq vc-follow-symlinks t) ; Always follow symlinks
(when (member "Inconsolata" (font-family-list)) ; Set default font
(add-to-list 'default-frame-alist '(font . "Inconsolata-15" ))
(set-face-attribute 'default t :font "Inconsolata-15"))
(setq custom-file "~/.emacs.d/custom.el") ; Set custom file & don't load it
(setq tags-revert-without-query t) ; Don't ask to reload TAGS file
(setq scroll-margin 10
scroll-step 1
scroll-conservatively 10000
scroll-preserve-screen-position 1)
(setq-default truncate-lines t)
(load-file "~/.emacs.d/lisp/column-marker.el")
(add-hook 'prog-mode-hook (lambda () (interactive) (column-marker-1 81)))
'(column-marker-1 ((t (:background "dim gray")))))
(setq explicit-shell-file-name
(if (file-readable-p "/usr/bin/zsh") "/usr/bin/zsh" "/bin/bash"))
(setq source-directory "~/Projects/emacs/")
(when (eq system-type 'windows-nt)
(setq explicit-shell-file-name "cmdproxy.exe"))
* Mode Line
#+BEGIN_SRC emacs-lisp :tangle yes
(if (display-graphic-p)
(use-package powerline
(defadvice powerline-major-mode (around delight-powerline-major-mode activate)
(let ((inhibit-mode-name-delight nil))
(setq powerline-arrow-shape 'curve
powerline-display-buffer-size nil
powerline-display-mule-info nil)
(remove-hook 'focus-out-hook 'powerline-unset-selected-window)
(setq powerline-height 24))
(setq-default mode-line-format
" "
;; is this buffer read-only?
'(:eval (when buffer-read-only
(propertize "RO"
'face 'font-lock-type-face
'help-echo "Buffer is read-only")))
;; was this buffer modified since the last save?
'(:eval (when (buffer-modified-p)
(propertize "M"
'face 'font-lock-warning-face
'help-echo "Buffer has been modified")))
" "
;; the buffer name; the file name as a tool tip
'(:eval (propertize "%b " 'face 'font-lock-keyword-face
'help-echo (buffer-file-name)))
;; the current major mode for the buffer.
'(:eval (propertize (format-mode-line mode-name) 'face '(:family "Arial")
'help-echo buffer-file-coding-system))
'(:eval (propertize (format-mode-line minor-mode-alist)
'face '(:family "Arial")))
"] "
;; line and column
"(" ;; '%02' to set to 2 chars at least; prevents flickering
(propertize "%02l" 'face 'font-lock-type-face) ","
(propertize "%02c" 'face 'font-lock-type-face)
") "
;; relative position, size of file
(propertize "%p" 'face 'font-lock-constant-face) ;; % above top
(propertize "%I" 'face 'font-lock-constant-face) ;; size
"] "
;; add the time, with the date and the emacs uptime in the tooltip
'(:eval (propertize (format-time-string "%H:%M")
(concat (format-time-string "%c; ")
(emacs-uptime "Uptime:%hh"))))
* Functions
** Face Under Point
Returns the font lock face that's under the cursor.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun what-face (pos)
(interactive "d")
(let ((face (or (get-char-property (point) 'read-face-name)
(get-char-property (point) 'face))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))
** Compile Project
Compiles the project without a prompt.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/compile-no-prompt ()
(let ((compilation-read-command nil))
(compile (eval compile-command))))
** Compile Dotfiles
Compiles all el files in the =~/.emacs.d= directory.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/compile-dot-emacs ()
"Byte-compile dotfiles."
(byte-recompile-directory user-emacs-directory 0))
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/clear-all-elc ()
(shell-command "find ~/.emacs.d/ -name \"*.elc\" -type f -delete"))
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/remove-elc-on-save ()
"If you're saving an emacs-lisp file, likely the .elc is no longer valid."
(add-hook 'after-save-hook
(lambda ()
(if (file-exists-p (concat buffer-file-name "c"))
(delete-file (concat buffer-file-name "c"))))
nil t))
(add-hook 'emacs-lisp-mode-hook 'wolfe/remove-elc-on-save)
** Find Tags
Looks up tag under point.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/find-tag ()
"Jump to the tag at point without prompting"
(find-tag (find-tag-default)))
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/create-tags ()
"Create the tags table"
(save-window-excursion (shell-command "etags -R -o ETAGS *")))
#+BEGIN_SRC emacs-lisp :tangle yes
(defadvice xref-find-definitions (around refresh-etags activate)
"Rerun etags and reload tags if tag not found and redo find-tag.
If buffer is modified, ask about save before running etags."
(condition-case err
(error (and (buffer-modified-p) (not (ding))
(save-window-excursion (shell-command "etags -R *"))
** Terminal Suspend
Fixes =C-z= in terminal.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/controlz ()
(when (eq (display-graphic-p) nil)
** Dropbox
Utility functions for finding Dropbox directories/files.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/org-open (name)
"Opens the file in the dropbox path"
(when (eq system-type 'gnu/linux)
(evil-buffer-new nil (concat "~/Dropbox/org/" name ".org")))
(when (eq system-type 'windows-nt)
(evil-buffer-new nil (concat "C:\\Users\\Josh\\Dropbox\\org\\"
name ".org"))))
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/org-dropbox-path ()
"Returns the dropbox path"
((eq system-type 'gnu/linux)
((eq system-type 'windows-nt)
(else "")))
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/dropbox-start ()
(if (eq nil (file-exists-p "/virtual/wolfejos/dropbox/.dropbox-dist"))
(call-process-shell-command "(python ~/.emacs.d/ start -i&)")
(call-process-shell-command "(python ~/.emacs.d/ start&)")))
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/dropbox-stop ()
(call-process-shell-command "python ~/.emacs.d/ stop&"))
** Reload
For reloading =init.el= file without restarting.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/load-init ()
"Reloads init file"
(load-file "~/.emacs.d/init.el"))
** Narrowing
Better narrowing.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun narrow-or-widen-dwim (p)
"Widen if buffer is narrowed, narrow-dwim otherwise.
Dwim means: region, org-src-block, org-subtree, or
defun, whichever applies first. Narrowing to
org-src-block actually calls `org-edit-src-code'.
With prefix P, don't widen, just narrow even if buffer
is already narrowed."
(interactive "P")
(declare (interactive-only))
(cond ((and (buffer-narrowed-p) (not p)) (widen))
(narrow-to-region (region-beginning)
((derived-mode-p 'org-mode)
;; `org-edit-src-code' is not a real narrowing
;; command. Remove this first conditional if
;; you don't want it.
(cond ((ignore-errors (org-edit-src-code) t)
((ignore-errors (org-narrow-to-block) t))
(t (org-narrow-to-subtree))))
((derived-mode-p 'latex-mode)
(t (narrow-to-defun))))
(defun wolfe/man ()
(if (executable-find "man")
(man (word-at-point))
** Projects Folder
This function returns the path to my projects folder depending on OS.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/project-path ()
((eq system-type 'gnu/linux)
((eq system-type 'windows-nt)
(else nil)))
** Open C# Project File
This function prompts for a file. It then opens that file and looks for a src/
directory above it. The dir can be any number of levels higher. In that folder
it looks for a C# .sln file and starts the an omnisharp server for that project.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/csharp-project ()
(setq path (read-file-name "File: " (wolfe/project-path)))
(setq split-path (split-string path "/"))
(if (member "src" split-path)
(catch 'loop
(dolist (item (reverse split-path))
(if (string-equal item "src")
(throw 'loop nil)
(delete item split-path)))
(message "src/ directory not found")))
(if (or (equal '("c:") split-path) (equal '() split-path))
(message "Could not find src directory for specified project")
(omnisharp-start-omnisharp-server (mapconcat 'identity split-path "/"))
(find-file path))))
** Hot Expand
Is used in one of my [[Hydra][hydras]] =wolfe/hydra-org-expand=. For inserting org-templates.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun hot-expand (str)
"Expand org template."
(insert str)
** Ag Project If In Project
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/ag-try-project ()
(if (projectile-project-p)
(call-interactively 'projectile-ag)
(call-interactively 'ag)))
** Projectile Invalidate From List
Select project from list of projectile projects to invalidate.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/projectile-invalidate-list ()
(projectile-invalidate-cache t))
* Org Mode
** General
Setup some basic quality of life org settings.
#+BEGIN_SRC emacs-lisp :tangle yes
(setq org-pretty-entities t
org-src-fontify-natively t
org-src-tab-acts-natively t
org-src-window-setup 'current-window
org-fontify-whole-heading-line t
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t
org-log-done 'time
org-agenda-use-time-grid nil
org-agenda-skip-deadline-if-done t
org-agenda-skip-scheduled-if-done t
org-ellipsis "⤵")
(global-set-key "\C-cl" 'org-store-link)
;; ispell ignores SRC blocks
(add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_SRC" . "#\\+END_SRC"))
(add-to-list 'ispell-skip-region-alist '("#\\+BEGIN_LATEX" . "#\\+END_LATEX"))
(add-hook 'org-mode-hook
'(lambda ()
(setq org-file-apps
(append '(("\\.pdf\\'" . "zathura \"%s\"")) org-file-apps ))))
** Bullets
Replaces the asterisks with nice UTF-8 bullets.
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package org-bullets
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
** Agenda
Setup org agenda for managing my life.
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package org-agenda
:ensure nil
:bind (("C-c a" . org-agenda)
:map org-agenda-mode-map
("j" . org-agenda-next-item)
("k" . org-agenda-previous-item))
;; Formats the agenda into nice columns
(setq org-agenda-prefix-format
'((agenda . " %i %-12t% s %-12(car (last (org-get-outline-path)))")
(timeline . " % s")
(todo . " %i %-12:c")
(tags . " %i %-12:c")
(search . " %i %-12:c")))
;; Sets location of org files
(setq org-agenda-files '("~/Dropbox/org/"))
(setq browse-url-browser-function 'browse-url-chromium))
** Export
Setup html for syntax highlighting on export and add the apppropriate
minted package for PDF export.
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package htmlize)
(require 'ox-latex)
(add-to-list 'org-latex-packages-alist '("" "minted"))
(setq org-latex-listings 'minted)
(setq org-latex-pdf-process
'("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
"pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
* Hydra
Customizable popup menus.
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package hydra)
#+BEGIN_SRC emacs-lisp :tangle yes
(setq wolfe/hydra-projectile
(defhydra hydra-projectile (:color blue :columns 4)
("f" counsel-projectile-find-file "Find File")
("s" counsel-projectile-switch-project "Switch Project")
("k" projectile-kill-buffers "Kill Buffers")
("c" projectile-invalidate-cache "Clear Cache")
("d" counsel-projectile-find-dir "Find Directory")
("o" projectile-multi-occur "Multi Occur")
("P" projectile-clear-known-projects "Clear Projects")
("C" wolfe/projectile-invalidate-list "Clear A Cache")
(setq wolfe/hydra-jira
(defhydra hydra-jira (:color blue :columns 4)
("p" org-jira-get-projects "Get Projects")
("b" org-jira-browse-issue "Browse Issue")
("g" org-jira-get-issues "Get Issues")
("u" org-jira-update-issue "Update Issue")
("p" org-jira-progress-issue "Update Issue Progress")
("a" org-jira-assign-issue "Assign Issue")
("r" org-jira-refresh-issue "Refresh Issue")
("R" org-jira-refresh-issues-in-buffer "Refresh Issues in Buffer")
("c" org-jira-create-issue "Create Issue")
("y" org-jira-copy-current-issue-key "Copy Current Issue Key")
("s" org-jira-create-subtask "Create Subtask")
("G" org-jira-get-subtasks "Get Subtasks")
("U" org-jira-update-comment "Update Comment")
("t" org-jira-todo-to-jira "Todo to Jira")
("O" (funcall wolfe/hydra-org-expand) "Org Hydra")))
(setq wolfe/hydra-csharp
(defhydra hydra-csharp (:color blue)
("d" omnisharp-go-to-definition "Goto definition")
("D" omnisharp-go-to-definition-other-window "Pop-open definition")
("u" omnisharp-find-usages "Find usages")
("r" omnisharp-rename "Rename symbol")
("R" omnisharp-reload-solution "Reload solution")
("i" omnisharp-code-format-region "Indent region")
("I" omnisharp-code-format-entire-file "Indent entire file")
(setq wolfe/hydra-org-expand
(defhydra hydra-org-template (:color blue :hint nil)
_c_enter _q_uote _L_aTeX:
_l_atex _e_xample _i_ndex:
_a_scii _v_erse _I_NCLUDE:
_s_rc ^ ^ _H_TML:
_h_tml ^ ^ _A_SCII:
("s" (hot-expand "<s"))
("e" (hot-expand "<e"))
("q" (hot-expand "<q"))
("v" (hot-expand "<v"))
("c" (hot-expand "<c"))
("l" (hot-expand "<l"))
("h" (hot-expand "<h"))
("a" (hot-expand "<a"))
("L" (hot-expand "<L"))
("i" (hot-expand "<i"))
("I" (hot-expand "<I"))
("H" (hot-expand "<H"))
("A" (hot-expand "<A"))))
(setq wolfe/hydra-org
(defhydra hydra-org (:color blue)
"Org Mode"
("t" (funcall wolfe/hydra-org-expand) "Expand template")))
(setq wolfe/hydra-default
(defhydra hydra-default (:color blue)
("o" (funcall wolfe/hydra-org) "Org Mode")
("#" (funcall wolfe/hydra-csharp) "C# Mode")))
#+BEGIN_SRC emacs-lisp :tangle yes
(defun wolfe/hydra-selector ()
((derived-mode-p 'csharp-mode) wolfe/hydra-csharp)
((bound-and-true-p org-jira-mode) wolfe/hydra-jira)
((derived-mode-p 'org-mode) wolfe/hydra-org)
(:else wolfe/hydra-default)))
* Evil & General
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package general)
(use-package evil
(setq evil-want-C-u-scroll t) ; Unbind <C-u> for evil mode's use
(setq evil-want-C-i-jump nil)
(evil-mode t)
(setq evil-split-window-below t)
(setq evil-vsplit-window-right t)
(setq-default evil-symbol-word-search t)
(setq evil-lookup-func #'wolfe/man)
(evil-ex-define-cmd "re[load]" 'wolfe/load-init) ; Custom reload command
(evil-ex-define-cmd "Q" 'save-buffers-kill-terminal) ; For typos
(define-key evil-ex-map "e " 'counsel-find-file) ; Trigger file completion :e
(global-unset-key (kbd "M-SPC")) ; Unbind secondary leader
(general-create-definer wolfe/bind-leader
:keymaps 'global
:states '(normal insert visual emacs)
:prefix "SPC"
:non-normal-prefix "M-SPC")
(:states 'motion
"k" 'evil-previous-visual-line
"j" 'evil-next-visual-line)
(:states 'operator
"k" 'evil-previous-line
"j" 'evil-next-line)
(:states 'visual
"<" (lambda ()
(evil-shift-left (region-beginning) (region-end))
">" (lambda ()
(evil-shift-right (region-beginning) (region-end))
(:states 'normal
"C-z" 'wolfe/controlz)
"w" 'save-buffer
"S" 'eval-buffer
"s" 'eval-defun
"b" 'mode-line-other-buffer
"k" 'kill-buffer
"m" 'ivy-switch-buffer
"t" 'wolfe/find-tag
"e" 'iedit-mode
"c" 'wolfe/compile-no-prompt
"n" 'narrow-or-widen-dwim
"a" 'org-agenda
"g" 'magit-status
"f" 'wolfe/ag-try-project
"''" 'org-edit-src-exit
"#" 'wolfe/csharp-project
"p" (lambda() (interactive) (funcall wolfe/hydra-projectile))
";" (lambda() (interactive) (save-excursion (end-of-line) (insert-char ?\;)))
"id" (lambda() (interactive) (indent-region (point-min) (point-max)))
"o" (lambda() (interactive) (wolfe/org-open "everything"))
"SPC" (lambda() (interactive) (funcall (wolfe/hydra-selector)))
"init" (lambda() (interactive) (evil-buffer-new nil "~/.emacs.d/"))
;; Tpope's surround
(use-package evil-surround
(global-evil-surround-mode 1))
(use-package evil-magit)
(use-package evil-matchit
(global-evil-matchit-mode 1))
* Ivy, Counsel and Swiper
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package ivy
:bind (("M-x" . counsel-M-x)
("C-x C-f" . counsel-find-file)
:map ivy-minibuffer-map
("TAB" . ivy-next-line)
("RET" . ivy-alt-done))
(use-package smex)
(use-package counsel)
(setq ivy-re-builders-alist
'((t . ivy--regex-ignore-order)))
(setq ivy-wrap t)
(ivy-mode 1)
(eval-after-load "hydra" (use-package ivy-hydra)))
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package swiper
:bind (("C-s" . swiper)))
* Ag
Emacs interface for ag
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package ag)
* Projectile
5 years ago
Project management
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package projectile
(use-package counsel-projectile
(setq projectile-enable-caching t)
(setq projectile-indexing-method 'alien)
(setq projectile-globally-ignored-file-suffixes '(".dll" ".exe"))
* Magit
5 years ago
Magic git interface from within emacs
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package magit
(global-set-key "\C-x\g" 'magit-status))
* Nlinum
5 years ago
Vim-like relative line numbering
#+BEGIN_SRC emacs-lisp :tangle yes
(if (fboundp 'display-line-numbers-mode)
(setq display-line-numbers 'relative)
(add-hook 'prog-mode-hook 'display-line-numbers-mode))
(use-package nlinum-relative
(setq nlinum-relative-redisplay-delay 0.25)
(setq nlinum-relative-current-symbol "")
(add-hook 'prog-mode-hook 'nlinum-relative-mode))))
* Iedit
5 years ago
Edit all instances of a string
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package iedit
(setq iedit-toggle-key-default nil))
* Flycheck
5 years ago
On the fly syntax checking
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package flycheck
(with-eval-after-load 'flycheck
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))))
5 years ago
* Restclient
5 years ago
Postman inside of emacs.
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package restclient)
5 years ago
* Delight
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package delight
(delight '((emacs-lisp-mode "ξ" :major)
(lisp-interaction-mode "λ" :major)
(python-mode "π" :major)
(org-mode "Ø" :major)
(company-mode " C" company)
(ivy-mode " ι" ivy)
(projectile-mode " ρ" projectile)
(eldoc-mode " ε" eldoc)
(flycheck-mode " ƒ" flycheck)
(undo-tree-mode "" undo-tree)
(auto-revert-mode "" autorevert))))
* Web
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package web-mode
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode))
(setq web-mode-enable-auto-closing t)
(setq web-mode-enable-auto-opening t)
(setq web-mode-enable-auto-indentation t))
(use-package json-mode)
* Latex
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package latex-preview-pane
:ensure f)
* Company
Autocomplete engine
#+BEGIN_SRC emacs-lisp :tangle yes
(use-package company
:bind (:map company-active-map
("C-n" . company-select-next)
("C-p" . company-select-previous))
(setq company-idle-delay 0) ; Delay to complete
(setq company-minimum-prefix-length 1)
(setq company-selection-wrap-around t) ; Loops around suggestions
(if (display-graphic-p)
(define-key company-active-map [tab] 'company-select-next)
(define-key company-active-map (kbd "C-i") 'company-select-next))
;; C / C++
(setq company-clang-insert-arguments nil)
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(use-package company-irony
(eval-after-load 'company
'(add-to-list 'company-backends 'company-irony)))
;; C#
(use-package omnisharp
(setq omnisharp-server-executable-path "C:/emacs/omnisharp/Omnisharp.exe")
(add-hook 'csharp-mode-hook 'omnisharp-mode)
(add-to-list 'company-backends 'company-omnisharp))
(use-package company-jedi
(add-to-list 'company-backends 'company-jedi))
;; Javascript
(use-package company-tern
(add-to-list 'company-backends 'company-tern)
(add-hook 'web-mode-hook 'tern-mode))
5 years ago
;; Restclient
(use-package company-restclient
(add-to-list 'company-backends 'company-restclient))
(require 'color)
(let ((bg (face-attribute 'default :background)))
`(company-tooltip ((t (:inherit default :background ,(color-lighten-name bg 2)))))
`(company-scrollbar-bg ((t (:background ,(color-lighten-name bg 10)))))
`(company-scrollbar-fg ((t (:background ,(color-lighten-name bg 5)))))
`(company-tooltip-selection ((t (:inherit font-lock-function-name-face))))
`(company-tooltip-common ((t (:inherit font-lock-constant-face))))))))
* Email
#+BEGIN_SRC emacs-lisp :tangle yes
(when (require 'mu4e nil 'noerror)
(setq mu4e-msg2pdf "/usr/bin/msg2pdf")
;; set mu4e as default mail client
mail-user-agent 'mu4e-user-agent
;; root mail directory - can't be switched
;; with context, can only be set once
mu4e-maildir "~/.mail"
mu4e-attachments-dir "~/Downloads/Attachments"
;; update command
mu4e-get-mail-command "mbsync -q -a"
;; update database every seven minutes
mu4e-update-interval (* 60 7)
;; use smtpmail (bundled with emacs) for sending
message-send-mail-function 'smtpmail-send-it
;; optionally log smtp output to a buffer
smtpmail-debug-info t
;; close sent message buffers
message-kill-buffer-on-exit t
;; customize list columns
mu4e-headers-fields '((:flags . 4)