summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-06-05 12:52:14 +0200
committerAlan Pearce2017-06-05 12:52:14 +0200
commitd0112b2cb2b8f92041cd25d2b3fa018a5527fa1f (patch)
tree9e63a4065807265d178ef85e2f0d259e072c8e8b
parent6fba65d173fd9372b7580ef3f8c213fb969a8c11 (diff)
parent7cbe8257a61d6bedb942d0fd15ad7aa018447012 (diff)
downloaddotfiles-d0112b2cb2b8f92041cd25d2b3fa018a5527fa1f.tar.lz
dotfiles-d0112b2cb2b8f92041cd25d2b3fa018a5527fa1f.tar.zst
dotfiles-d0112b2cb2b8f92041cd25d2b3fa018a5527fa1f.zip
Merge remote-tracking branch 'origin/master'
-rw-r--r--README.org2
-rw-r--r--emacs/.emacs.d/init.org197
-rw-r--r--zsh/.config/zsh/.zshenv8
3 files changed, 160 insertions, 47 deletions
diff --git a/README.org b/README.org
index 3acd8b2..6c85344 100644
--- a/README.org
+++ b/README.org
@@ -20,7 +20,7 @@ It should work on:
 
 ** Installation
 
-Clone the project anywhere, e.g. with =[[https://github.com/motemen/ghq][ghq]]=
+Clone the project anywhere, e.g. with [[https://github.com/motemen/ghq][ghq]]
 
 #+BEGIN_SRC sh :exports code
 ghq get git://git.alanpearce.eu/dotfiles
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 45b2a44..a34f148 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -18,6 +18,17 @@ Open Emacs with just a plain window.  No graphics or messages, please!
 (remove-hook 'find-file-hooks #'vc-refresh-state)
 #+END_SRC
 
+Are we running on Windows via the WSL?
+
+#+BEGIN_SRC emacs-lisp
+(when (file-exists-p "/proc/sys/kernel/osrelease")
+  (with-temp-buffer
+    (insert-file-contents-literally "/proc/sys/kernel/osrelease")
+    (decode-coding-region (point-min) (point-max) 'utf-8 t)
+    (when (string-match "Microsoft$" (buffer-string))
+      (setq system-type 'gnu/linux/windows))))
+#+END_SRC
+
 ** Compatibility
 
 #+BEGIN_SRC emacs-lisp
@@ -76,8 +87,7 @@ the buffer to be empty.
   (use-package use-package
     :commands (use-package-autoload-keymap)
     :defer 5))
-(setq use-package-verbose t
-      use-package-always-ensure t
+(setq use-package-always-ensure t
       package-enable-at-startup nil)
 #+END_SRC
 
@@ -170,10 +180,19 @@ Eziam looks nice, too
 #+BEGIN_SRC emacs-lisp
 (use-package eziam-light-theme
   :ensure eziam-theme
+  :if (or window-system
+          server-name)
   :defines (eziam-scale-headings)
   :config (progn
             (setq eziam-scale-headings nil)
-            (load-theme 'eziam-light t)))
+            (load-theme 'eziam-light t)
+            (custom-theme-set-faces 'user
+                                    '(default ((t (:background "#ffffff"))))
+                                    '(js2-function-call ((t (:underline nil))))
+                                    '(font-lock-keyword-face ((t (:weight normal))))
+                                    '(git-gutter-fr:added ((t (:foreground "#96a4ab"))))
+                                    '(git-gutter-fr:modified ((t (:foreground "#96a4ab"))))
+                                    '(git-gutter-fr:deleted ((t (:foreground "#96a4ab")))))))
 #+END_SRC
 
 Highlighting quasi-quoted expressions in lisps is quite useful, but I
@@ -221,9 +240,13 @@ because I manage those in my [[file:~/projects/dotfiles/tag-xresources/xresource
         (if (eq displays 1)
             (ap/set-fonts "Monaco" 16 "Lucida Grande" 16 t 0.2)
           (ap/set-fonts "Monoid" 12 "Helvetica Neue" 12 t 0.1))))
-     ((eq window-system 'x)
+     ((and (eq window-system 'x)
+           (not (eq system-type 'gnu/linux/windows)))
       (set-fontset-font "fontset-default" 'unicode (font-spec :name "Iosevka" :size 14))
-      (ap/set-fonts "Iosevka" 16 "Noto Sans" 14 nil))))
+      (ap/set-fonts "Iosevka" 16 "Noto Sans" 14 nil))
+     ((and (eq window-system 'x)
+           (eq system-type 'gnu/linux/windows))
+      (ap/set-fonts "Noto Mono" 12 "Sans" 12 nil))))
 
   (ap/set-fonts-according-to-system))
 #+END_SRC
@@ -288,19 +311,17 @@ Sometimes I like to hide clutter.  Other times, it's useful.
 
 (defun hide-clutter ()
   (interactive)
-  (fringe-mode '(4 . 8))
   (hide-mode-line))
 
 (defun show-clutter ()
   (interactive)
-  (fringe-mode '(8 . 8))
   (show-mode-line))
-(hide-clutter)
 
 (when mode-line-default-hidden
   (call-interactively #'hide-mode-line))
 
-(setq-default indicate-buffer-boundaries 'left)
+(setq-default indicate-buffer-boundaries nil)
+(fringe-mode '(4 . 4))
 
 (defun hide-mode-line-if-default-hidden ()
   (if mode-line-default-hidden
@@ -309,11 +330,11 @@ Sometimes I like to hide clutter.  Other times, it's useful.
 
 (add-to-list 'default-frame-alist '(border-width . 0))
 (add-to-list 'default-frame-alist '(internal-border-width . 0))
-(when (eq window-system 'x)
+(when (or (eq window-system 'x)
+          (eq window-system 'mac))
   (setq window-divider-default-bottom-width 1
         window-divider-default-right-width 1
         window-divider-default-places t)
-  (setq mode-line-default-hidden t)
   (window-divider-mode +1))
 
 (add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden)
@@ -382,10 +403,16 @@ read them automatically any more.  So, let’s use the
 [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]] package to set up ~exec-path~ and similar
 variables from whatever my shell configuration is.
 
+On Windows, I like to run Emacs from the system tray menu of VcXsrv.
+It starts up without an environment in this case as well.
+
 #+BEGIN_SRC emacs-lisp
 (use-package exec-path-from-shell
-  :if (eq system-type 'darwin)
-  :config (exec-path-from-shell-initialize))
+  :if (or (eq system-type 'darwin)
+          (eq system-type 'gnu/linux/windows))
+  :config (progn
+            (setq exec-path-from-shell-arguments '("-l"))
+            (exec-path-from-shell-initialize)))
 #+END_SRC
 
 * Keybindings
@@ -510,7 +537,7 @@ based upon some folder conventions I use.
   :demand t
   :diminish projectile-mode
   :config (progn
-            (projectile-global-mode)
+            (projectile-mode 1)
             (add-to-list 'projectile-globally-ignored-directories ".stversions")
 
             (defun yarn-install (&optional arg)
@@ -545,7 +572,9 @@ based upon some folder conventions I use.
                   projectile-completion-system 'ivy)))
 
 (use-package counsel-projectile
-  :config (counsel-projectile-on))
+  :config (progn
+            (counsel-projectile-on)
+            (define-key projectile-mode-map [remap counsel-projectile-ag] #'counsel-projectile-rg)))
 #+END_SRC
 
 ** vc
@@ -571,12 +600,24 @@ changed.  This package colours the fringe.  I have it set to the right
 fringe so it doesn’t interfere with flycheck.
 
 #+BEGIN_SRC emacs-lisp
+(eval-when-compile (require 'fringe-helper))
 (use-package git-gutter-fringe
   :defer 2
   :diminish git-gutter-mode
   :config (progn
             (global-git-gutter-mode 1)
-            (set-face-foreground 'git-gutter:modified "grey")
+            ;; places the git gutter outside the margins.
+            (setq-default fringes-outside-margins t)
+            ;; thin fringe bitmaps
+            (fringe-helper-define 'git-gutter-fr:added '(center repeated)
+              ".XXX....")
+            (fringe-helper-define 'git-gutter-fr:modified '(center repeated)
+              ".XXX....")
+            (fringe-helper-define 'git-gutter-fr:deleted 'bottom
+              ".......X"
+              "......XX"
+              ".....XXX"
+              "....XXXX")
             (setq git-gutter-fr:side 'right-fringe)))
 #+END_SRC
 
@@ -597,6 +638,17 @@ time.  Make sure to set it up with a nice =completing-read-function=
   :init (add-hook 'magit-mode-hook #'magit-load-config-extensions))
 #+END_SRC
 
+** git-messenger
+
+Popup the last commit that changed the line at point.
+
+#+BEGIN_SRC emacs-lisp
+(use-package git-messenger
+  :bind* (("C-x v p" . git-messenger:popup-message))
+  :config (progn
+            (setq git-messenger:use-magit-popup t)))
+#+END_SRC
+
 ** git-timemachine
 
 This package allow me to go through a file’s history with just a few
@@ -988,6 +1040,17 @@ Directional window movement
          ("S-<up>"    . windmove-up)
          ("S-<down>"  . windmove-down)))
 #+END_SRC
+* Blogging
+
+I have a [[https://alanpearce.uk][blog]] that I publish with hugo.
+
+#+BEGIN_SRC emacs-lisp
+(use-package easy-hugo
+  :config (setq easy-hugo-basedir (car (split-string (shell-command-to-string "ghq list --full-path alanpearce.uk")))
+                easy-hugo-url "https://alanpearce.uk"
+                easy-hugo-default-ext ".md"))
+#+END_SRC
+
 * Completion
 
 Make built-in completion a bit more intelligent, by adding substring
@@ -1035,6 +1098,7 @@ seems to work perfectly well for me.
 
 #+BEGIN_SRC emacs-lisp
 (use-package company-nixos-options
+  :defer 30
   :config (progn
             (add-to-list 'company-backends 'company-nixos-options)))
 #+END_SRC
@@ -1153,6 +1217,17 @@ Expand subfolders like a tree inside the parent
             (bind-key "i" #'dired-subtree-toggle dired-mode-map))))
 #+END_SRC
 
+** Disk usage
+
+Combine dired and du (disk usage).
+
+#+BEGIN_SRC emacs-lisp
+(use-package dired-du
+  :after dired
+  :config (progn
+            (setq dired-du-size-format t)))
+#+END_SRC
+
 ** Dired-narrow
 One can already use dired with wildcards to browse a filtered
 directory listing, but it opens a new buffer.  Dired-narrow is a
@@ -1262,7 +1337,7 @@ workplace, so I keep it in a host-specific, GPG-encrypted file.
                   send-mail-function #'smtpmail-send-it
                   message-send-mail-function #'smtpmail-send-it)))
 
-(with-eval-after-load 'gnus-mime
+(with-eval-after-load "gnus-mime"
   (define-key gnus-mime-button-map " " #'gnus-mime-view-part-externally))
 
 (with-eval-after-load "mailcap"
@@ -1282,7 +1357,7 @@ information here as well.
 #+BEGIN_SRC emacs-lisp
 (use-package bbdb
   :config (progn
-            (bbdb-initialize 'gnus 'mail 'message 'pgp)
+            (bbdb-initialize 'gnus 'message 'pgp)
             (bbdb-mua-auto-update-init 'gnus 'message)
             (setq bbdb-send-mail-style 'gnus
                   bbdb-complete-mail-allow-cycling t
@@ -1584,13 +1659,15 @@ works really nicely.
             (ledger-report "Budget (Cumulative)" nil)))
   :config (progn
             (setq ledger-use-iso-dates t
-                  ledger-post-use-completion-engine :built-in
+                  ledger-post-use-completion-engine :ido
                   ledger-reconcile-default-commodity "€"
                   ledger-clear-whole-transactions t
                   ledger-narrow-on-reconcile t
-                  ledger-default-date-format "%Y-%m-%d"
-                  ledger-reports '(("Monthly Expenses" "ledger -f %(ledger-file) reg -M Expenses --real -l \"payee != 'Opening Balances'\"")
-                                   ("Expenses:This Month" "ledger -f %(ledger-file) bal \\^Expenses -p \"this month\"")
+                  ledger-reports `(("Monthly Expenses" "ledger -f %(ledger-file) reg -M \\^Flex --real -X EUR -l \"payee != 'Opening Balances'\"")
+                                   ("Average Monthly Expenses (Past 12 Months)" ,(concat "ledger -f %(ledger-file) -b "
+                                                                                    (format-time-string "%Y-%m" (time-add (current-time) (days-to-time -365)))
+                                                                                    " --monthly --average balance ^Flex"))
+                                   ("Expenses:This Month" "ledger -f %(ledger-file) bal \\^Flex -p \"this month\"")
                                    ("On-budget Balances" "ledger -f %(ledger-file) bal --current -R :Budget: Assets:Receivable Liabilities:Personal")
                                    ("All Account Balances" "ledger -f %(ledger-file) bal --current -R \\^Assets \\^Liabilities")
                                    ("Budget Values (Current Month)" "ledger -f %(ledger-file) bal -p \"this month\" --limit \"payee=~/budget/\" \\^Funds")
@@ -1667,6 +1744,12 @@ Org is wünderbar.
             (set-register ?o `(file . ,(expand-file-name "organiser.org" org-directory)))
             (add-hook 'org-mode-hook #'turn-on-auto-fill)
             (org-load-modules-maybe t)))
+
+(use-package org-src
+  :ensure nil
+  :after org
+  :config (progn
+            (bind-key "C-x C-s" #'org-edit-src-exit org-src-mode-map)))
 #+END_SRC
 
 **** org-babel
@@ -1717,15 +1800,32 @@ On-the-fly error checking in programming modes?  Yes please.
   :defer 5
   :config (progn
             (global-flycheck-mode)
-            (setq flycheck-check-syntax-automatically '(save new-line mode-enabled))
+            (setq flycheck-check-syntax-automatically '(save mode-enabled))
+            (setq flycheck-indication-mode 'left-fringe)
+            (with-eval-after-load 'git-gutter-fringe
+              (fringe-helper-define 'flycheck-fringe-bitmap-double-arrow '(center repeated)
+                ".XXX...."))
             (if (executable-find "eslint_d")
                 (setq flycheck-javascript-eslint-executable "eslint_d"))))
 #+END_SRC
 
+*** flycheck-pos-tip
+
+Show flycheck errors in a little popup, so I don't lose my place
+
+#+BEGIN_SRC emacs-lisp
+(use-package flycheck-pos-tip
+  :after flycheck
+  :config (progn
+            (setq flycheck-display-errors-delay 0.5)
+            (flycheck-pos-tip-mode 1)))
+#+END_SRC
+
 *** flycheck-flow
 
 #+BEGIN_SRC emacs-lisp
 (use-package flycheck-flow
+  :after js2-mode
   :config (progn
             (flycheck-add-next-checker 'javascript-eslint 'javascript-flow)))
 #+END_SRC
@@ -1790,6 +1890,15 @@ guess a definition.
   :config (setq dumb-jump-selector 'ivy))
 #+END_SRC
 
+** imenu-anywhere
+
+This is like imenu, but shows functions (or similar top-level
+entities) across buffers in the same project.  Neat!
+
+#+BEGIN_SRC emacs-lisp
+(use-package imenu-anywhere
+  :bind ("C-x C-." . ivy-imenu-anywhere))
+#+END_SRC
 ** Lisps
 
 *** All
@@ -2036,6 +2145,15 @@ the project.  This will allows emacs to find their executables.
             (add-hook 'js2-mode-hook #'add-node-modules-path)))
 #+END_SRC
 
+**** Flow
+
+#+BEGIN_SRC emacs-lisp
+(use-package flow-minor-mode
+  :after js2-mode
+  :config (progn
+            (add-hook 'js2-mode-hook #'flow-minor-enable-automatically)))
+#+END_SRC
+
 **** Indium
 
 Javascript with an inferior node.js process and a debugger?  Awesome.
@@ -2264,6 +2382,18 @@ Sometimes I might want to show off my emacs usage.
             (add-hook 'prog-mode-hook #'flyspell-prog-mode)))
 #+END_SRC
 
+** Style checking
+
+[[https://github.com/ValeLint/vale][Vale]] is a linter, but for prose.  Neat idea!  Salesman is a bad term.
+
+#+BEGIN_SRC emacs-lisp
+(use-package flycheck-vale
+  :if (executable-find "vale")
+  :config (progn
+            (add-to-list 'flycheck-vale-modes 'org-mode)
+            (flycheck-vale-setup)))
+#+END_SRC
+
 * Scripting
 
 Make a shell-script buffer executable after saving it, if it has a shebang.
@@ -2293,6 +2423,8 @@ nice, when I remember to use it.
 #+BEGIN_SRC emacs-lisp
 (use-package eshell
   :bind ("C-c s" .  eshell)
+  :defer 10
+  :functions (eshell/pwd)
   :config (progn
             (setq eshell-directory-name "~/.emacs.d/eshell"
                   eshell-prompt-function (lambda ()
@@ -2353,6 +2485,7 @@ Emacs has an editor within.
 (put 'downcase-region 'disabled nil)
 (setq sentence-end-double-space t
       line-move-visual nil)
+(setq-default truncate-lines t)
 #+END_SRC
 
 ** align
@@ -2376,7 +2509,7 @@ The most important one for me is JSON property alignment.
 I like to use the clipboard more than the primary selection in X11.
 
 #+BEGIN_SRC emacs-lisp
-(setq x-select-enable-clipboard t
+(setq select-enable-clipboard t
       save-interprogram-paste-before-kill t)
 (if (functionp 'x-cut-buffer-or-selection-value)
     (setq interprogram-paste-function 'x-cut-buffer-or-selection-value))
@@ -2384,22 +2517,6 @@ I like to use the clipboard more than the primary selection in X11.
   (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
 #+END_SRC
 
-*** Copy formatted code
-
-#+BEGIN_SRC emacs-lisp
-(bind-key* "C-c w" (define-prefix-command 'copy-as-map))
-(use-package copy-as-format
-  :bind (("C-c C-w" . copy-as-format)
-         :map copy-as-map
-         ("b" . copy-as-format-bitbucket)
-         ("g" . copy-as-format-github)
-         ("h" . copy-as-format-hipchat)
-         ("w" . copy-as-format-html)
-         ("j" . copy-as-format-jira)
-         ("m" . copy-as-format-markdown)
-         ("s" . copy-as-format-slack)))
-#+END_SRC
-
 ** Selection
 
 I’m quite used to deleting text by selecting it and typing.  Emacs has
diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv
index 87276bd..87dda38 100644
--- a/zsh/.config/zsh/.zshenv
+++ b/zsh/.config/zsh/.zshenv
@@ -40,7 +40,8 @@ then
     read osrelease < /proc/sys/kernel/osrelease
     if [[ $osrelease =~ Microsoft$ ]]
     then
-      windows=1
+      export windows=1
+      umask 002
     fi
   fi
 
@@ -53,11 +54,6 @@ then
       ;;
   esac
 
-  if [[ ${path[(I)$HOME/bin ]} ]]
-  then
-    path+=($HOME/bin)
-  fi
-
   if [[ ${path[(I)$HOME/.local/bin ]} ]]
   then
     path+=($HOME/.local/bin)