Skip to content

Instantly share code, notes, and snippets.

@randomwangran
Created October 23, 2019 16:40
Show Gist options
  • Save randomwangran/19e2caa5108792e4b3227ca8debe3fb3 to your computer and use it in GitHub Desktop.
Save randomwangran/19e2caa5108792e4b3227ca8debe3fb3 to your computer and use it in GitHub Desktop.
(defun eshell/less (&rest args)
"Invoke `view-file' on a file. "less +42 foo" will go to line 42 in
the buffer for foo."
(while args
(if (string-match "\\`\\+\\([0-9]+\\)\\'" (car args))
(let* ((line (string-to-number (match-string 1 (pop args))))
(file (pop args)))
(tyler-eshell-view-file file)
(goto-line line))
(tyler-eshell-view-file (pop args)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment