Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

js2r: Toggle between test and source.

 oo: open other - opens in other window
 jo: jump to other - opens in this window
  • Loading branch information...
commit e6cdaf3fdb57278c8a7d9e277cbcc5bd3d05f10d 1 parent e430e0f
@magnars authored
Showing with 15 additions and 0 deletions.
  1. +13 −0 defuns/js2r-defuns.el
  2. +2 −0  setup-js2-mode.el
13 defuns/js2r-defuns.el
@@ -32,6 +32,19 @@
(make-variable-buffer-local 'js2r-path-to-sources)
(make-variable-buffer-local 'js2r-test-suffix)
+;; Toggle between source and test
+(defun jump-between-source-and-test-files (arg)
+ (interactive "P")
+ (if (looks-like-test-file-name (buffer-file-name))
+ (jump-to-source-file arg)
+ (jump-to-test-file arg)))
+(defun jump-between-source-and-test-files-other-window (arg)
+ (interactive "P")
+ (if (looks-like-test-file-name (buffer-file-name))
+ (jump-to-source-file-other-window arg)
+ (jump-to-test-file-other-window arg)))
;; Jump to source-file
(defun jump-to-source-file (arg)
2  setup-js2-mode.el
@@ -18,6 +18,8 @@
(define-key js2-mode-map (kbd "C-c RET ot") 'jump-to-test-file-other-window)
(define-key js2-mode-map (kbd "C-c RET js") 'jump-to-source-file)
(define-key js2-mode-map (kbd "C-c RET os") 'jump-to-source-file-other-window)
+(define-key js2-mode-map (kbd "C-c RET jo") 'jump-between-source-and-test-files)
+(define-key js2-mode-map (kbd "C-c RET oo") 'jump-between-source-and-test-files-other-window)
(defun js2-hide-test-functions ()
Please sign in to comment.
Something went wrong with that request. Please try again.