Skip to content

Instantly share code, notes, and snippets.

@drdv
drdv / autojump.el
Last active November 24, 2023 14:24
autojump
(defun j (&optional show-top-candidates)
"Use autojump to navigate to a directory in dired-mode.
Optional argument SHOW-TOP-CANDIDATES, if non-nil, specifies whether to
list the top candidates (as given by `autojump --complete user-input`) in an ido menu,
otherwise directly jump to top candidate.
Tested with autojump v22.5.3."
(interactive "P")
(let* ((autojump-candidates-regex "^.*__.__\\(.*\\)")
@drdv
drdv / gist.el
Last active April 16, 2020 08:45
(defun yaml-company-backend (command &optional arg &rest ignored)
"A very simple backend for completion of anchors in YAML mode."
(interactive (list 'interactive))
(cl-case command
(interactive (company-begin-backend 'drdv-yaml-company-backend))
;; Dispatch to handle two cases:
;; - words that starts with "*" (anchor suggestions)
;; - empty space (job suggestions)
(prefix (and (eq major-mode 'yaml-mode)
(cond ((looking-back "\\*.*") (match-string 0))