branch: elpa/nix-mode
commit 3c7afb94788df4d2da3f0791cee3b5797edbe8c2
Author: Matthew Bauer <[email protected]>
Commit: Matthew Bauer <[email protected]>
Add nix-visit-file function.
---
nix-mode.el | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/nix-mode.el b/nix-mode.el
index e805a8f56f..b61108a593 100644
--- a/nix-mode.el
+++ b/nix-mode.el
@@ -177,6 +177,15 @@ If a close brace `}' ends an antiquote, the next character
begins a string."
;; else
(t (indent-line-to (nix-indent-level)))))
+(defun nix-visit-file ()
+ "Go to file under cursor."
+ (interactive)
+ (save-excursion
+ (forward-whitespace -1)
+ (skip-chars-forward " \t")
+ (if (looking-at nix-re-file-path)
+ (find-file (match-string-no-properties 0)))))
+
(defvar nix-mode-map
(let ((map (make-sparse-keymap "Nix")))