Creating HTML faster with Emmet

A picture is worth a thousand words, so here's all you need to know about Emmet.

Emacs + Emmet = HAPPINESS

Emmet is available for a number of IDE's and editors, including Emacs. If you've ever written any CSS you'll feel right at home with how selectors and identifiers work.

Posted in: Emacs | Comments (0)


Distraction free writing with Emacs

Emacs darkroom-mode

Emacs is a great platform for many things, and in just a few steps it can be setup for distraction free writing.

You'll need a copy of darkroom-mode, which can either be downloaded from the darkroom-mode homepage, or installed using M-x package-install darkroom.

Once installed it's good to go, but I prefer slightly different settings to the default.

I use use-package to manage my configuration, but the setup is pretty much the same without it (just use the contents of the progn expression). The following will set the font to be larger and will limit the page to 80 columns wide:

(use-package darkroom-mode
  :commands darkroom-mode
  :init
  (progn
    (defvar darkroom-mode-face-foreground "Inconsolata")
    (defvar darkroom-mode-face-size 160)
    (defvar darkroom-mode-center-margin 80)
    (define-key global-map [f12] 'darkroom-mode)))

Once everything is configured, hitting <f12> will toggle darkroom mode.

To remove the title bar and go into full-screen mode, you'll need a little extra trickery:

(defun pn/full-screen-toggle ()
  "toggle full-screen mode"
  (interactive)
  (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
(global-set-key (kbd "<f11>")  'pn/full-screen-toggle)

The code above will bind <f11> to toggle window decorations and go full-screen (linux/mac only).

Posted in: Emacs | Comments (0)