Created
October 23, 2019 16:40
-
-
Save randomwangran/19e2caa5108792e4b3227ca8debe3fb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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