1
0
mirror of https://github.com/m00natic/vlfi.git synced 2025-01-18 12:05:31 +00:00

Add go to line command.

This commit is contained in:
Andrey Kotlarski 2013-04-14 02:18:06 +03:00
parent e67895afc4
commit f1ade8106c

17
vlfi.el
View File

@ -66,6 +66,7 @@
(define-key map "]" 'vlfi-end-of-file)
(define-key map "e" 'vlfi-edit-mode)
(define-key map "j" 'vlfi-jump-to-chunk)
(define-key map "l" 'vlfi-goto-line)
map)
"Keymap for `vlfi-mode'.")
@ -425,6 +426,22 @@ Search is performed chunk by chunk in `vlfi-batch-size' memory."
(or current-prefix-arg 1)))
(vlfi-re-search regexp count t))
(defun vlfi-goto-line (n)
"Go to line N."
(interactive "nGo to line: ")
(let ((start-pos vlfi-start-pos)
(end-pos vlfi-end-pos)
(pos (point))
(success nil))
(unwind-protect
(progn (vlfi-beginning-of-file)
(goto-char (point-min))
(setq success (vlfi-re-search-forward "[\n\C-m]"
(1- n))))
(unless success
(vlfi-move-to-chunk start-pos end-pos)
(goto-char pos)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; editing