Skip to content
Dar Montou edited this page Jan 4, 2019 · 1 revision

Beacon

Great way to keep track of the cursor. Really helpful during presentations.

(use-package beacon
  :init
  (beacon-mode 1)
  (setq beacon-blink-duration 0.4)
  (setq beacon-blink-when-point-moves-vertically 2)
  (setq beacon-blink-when-point-moves-horizontally 2)
  (setq beacon-size 20))

Crosshairs on Windmove and Ace Jump Mode

Makes it easier to follow the cursor around.

(use-package crosshairs
  :init
  (setq col-highlight-vline-face-flag t)
  (setq hl-line-flash-show-period 0.7)
  (setq col-highlight-period 0.7)
	:bind
	("C-c C-h" . crosshairs-mode)
  :config
  (custom-set-faces
   '(col-highlight ((t (:background "gainsboro"))))
   '(hl-line ((t (:background "gainsboro"))))))

(use-package windmove
	:ensure nil
	:commands (windmove-up crosshairs)
	:init
	(defmacro defwindmove (name fn)
		`(defun ,name ()
			 (interactive)
			 (ignore-errors
				 (,fn)
				 (crosshairs-flash))))
	(defwindmove windowmove-left windmove-left)
	(defwindmove windowmove-right windmove-right)
	(defwindmove windowmove-up windmove-up)
	(defwindmove windowmove-down windmove-down)
	:bind
	(("S-<left>"  .  windowmove-left)
	 ("S-<right>" .  windowmove-right)
	 ("S-<up>"    .  windowmove-up)
	 ("S-<down>"  .  windowmove-down)))

(use-package ace-jump-mode
	:commands (ace-jump-mode crosshairs)
	:init (add-hook 'ace-jump-mode-end-hook 'crosshairs-flash)
  :bind	("C-c SPC" . ace-jump-mode))

Magit

Git porcelain.

(use-package magit
  :defer 2
  :ensure t
  :pin melpa
  :bind
  (("C-x g" . magit-status)
   ("C-x M-d" . magit-dispatch-popup)))

Prettier

Format JavaScript on save.

(use-package prettier-js
  :init
  (defun enable-minor-mode (my-pair)
    "Enable minor mode if filename match the regexp.  MY-PAIR is a cons cell (regexp . minor-mode)."
    (if (buffer-file-name)
        (if (string-match (car my-pair) buffer-file-name)
            (funcall (cdr my-pair)))))
  (add-hook 'js-mode-hook #'(lambda ()
                              (enable-minor-mode
                               '("\\.jsx?\\'" . prettier-js-mode))))
  :config
  (setq prettier-js-command "npx")
  (setq prettier-js-args '("prettier"
                           "--use-tabs" "false"
                           "--jsx-bracket-same-line" "true"
                           "--parser" "babylon"
                           "--print-width" "80"
                           "--trailing-comma" "none"
                           "--bracket-spacing" "false")))
Clone this wiki locally