jquery-ace-rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +36 -0
- data/lib/jquery-ace-rails.rb +5 -0
- data/lib/jquery-ace-rails/engine.rb +4 -0
- data/lib/jquery-ace-rails/version.rb +3 -0
- data/vendor/assets/javascripts/jquery-ace/jquery-ace.coffee +126 -0
- data/vendor/assets/javascripts/jquery-ace/jquery-ace.js +195 -0
- data/vendor/assets/javascripts/jquery-ace/jquery-ace.min.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/ace.js +11 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/ext-static_highlight.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/ext-textarea.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/keybinding-emacs.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/keybinding-vim.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-abap.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-asciidoc.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-c9search.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-c_cpp.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-clojure.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-coffee.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-coldfusion.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-csharp.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-css.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-dart.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-diff.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-dot.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-glsl.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-golang.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-groovy.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-haml.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-haxe.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-html.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-jade.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-java.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-javascript.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-json.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-jsp.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-jsx.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-latex.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-less.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-liquid.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-lisp.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-lua.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-luapage.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-lucene.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-makefile.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-markdown.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-objectivec.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-ocaml.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-perl.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-pgsql.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-php.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-powershell.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-python.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-r.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-rdoc.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-rhtml.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-ruby.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-scad.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-scala.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-scss.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-sh.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-sql.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-stylus.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-svg.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-tcl.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-tex.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-text.js +0 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-textile.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-typescript.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-xml.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-xquery.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/mode-yaml.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-ambiance.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-chaos.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-chrome.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-clouds.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-clouds_midnight.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-cobalt.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-crimson_editor.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-dawn.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-dreamweaver.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-eclipse.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-github.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-idle_fingers.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-kr.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-merbivore.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-merbivore_soft.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-mono_industrial.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-monokai.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-pastel_on_dark.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-solarized_dark.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-solarized_light.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-textmate.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-tomorrow.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-tomorrow_night.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-tomorrow_night_blue.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-tomorrow_night_bright.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-tomorrow_night_eighties.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-twilight.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-vibrant_ink.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/theme-xcode.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/worker-coffee.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/worker-css.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/worker-javascript.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/worker-json.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src-min-noconflict/worker-xquery.js +1 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/ace.js +14262 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/ext-static_highlight.js +96 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/ext-textarea.js +591 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/keybinding-emacs.js +364 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/keybinding-vim.js +1646 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-abap.js +259 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-asciidoc.js +372 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-c9search.js +187 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-c_cpp.js +765 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-clojure.js +325 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-coffee.js +520 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-coldfusion.js +1725 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-csharp.js +605 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-css.js +680 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-dart.js +279 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-diff.js +163 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-dot.js +348 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-glsl.js +838 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-golang.js +660 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-groovy.js +1082 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-haml.js +440 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-haxe.js +610 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-html.js +1850 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-jade.js +2035 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-java.js +1041 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-javascript.js +921 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-json.js +574 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-jsp.js +1371 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-jsx.js +635 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-latex.js +217 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-less.js +394 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-liquid.js +921 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-lisp.js +142 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-lua.js +609 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-luapage.js +2463 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-lucene.js +64 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-makefile.js +314 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-markdown.js +2228 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-objectivec.js +655 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-ocaml.js +448 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-perl.js +319 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-pgsql.js +928 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-php.js +2299 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-powershell.js +611 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-python.js +290 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-r.js +410 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-rdoc.js +189 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-rhtml.js +2138 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-ruby.js +410 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-scad.js +698 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-scala.js +1070 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-scss.js +416 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-sh.js +232 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-sql.js +145 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-stylus.js +474 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-svg.js +1490 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-tcl.js +342 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-tex.js +171 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-text.js +0 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-textile.js +175 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-typescript.js +1011 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-xml.js +792 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-xquery.js +676 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/mode-yaml.js +298 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-ambiance.js +202 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-chaos.js +167 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-chrome.js +161 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-clouds.js +135 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-clouds_midnight.js +136 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-cobalt.js +150 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-crimson_editor.js +154 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-dawn.js +146 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-dreamweaver.js +173 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-eclipse.js +122 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-github.js +136 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-idle_fingers.js +136 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-kr.js +143 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-merbivore.js +135 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-merbivore_soft.js +136 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-mono_industrial.js +148 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-monokai.js +140 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-pastel_on_dark.js +148 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-solarized_dark.js +128 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-solarized_light.js +131 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-textmate.js +163 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-tomorrow.js +147 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-tomorrow_night.js +147 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-tomorrow_night_blue.js +145 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-tomorrow_night_bright.js +147 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-tomorrow_night_eighties.js +144 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-twilight.js +147 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-vibrant_ink.js +131 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/theme-xcode.js +125 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/worker-coffee.js +6985 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/worker-css.js +7741 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/worker-javascript.js +6387 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/worker-json.js +2228 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/ace-build/src/worker-xquery.js +21719 -0
- data/vendor/assets/javascripts/jquery-ace/vendor/jquery-1.8.3.min.js +2 -0
- metadata +249 -0
@@ -0,0 +1,364 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Distributed under the BSD license:
|
3
|
+
*
|
4
|
+
* Copyright (c) 2010, Ajax.org B.V.
|
5
|
+
* All rights reserved.
|
6
|
+
*
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
8
|
+
* modification, are permitted provided that the following conditions are met:
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
11
|
+
* * Redistributions in binary form must reproduce the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
14
|
+
* * Neither the name of Ajax.org B.V. nor the
|
15
|
+
* names of its contributors may be used to endorse or promote products
|
16
|
+
* derived from this software without specific prior written permission.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
22
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
25
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
*
|
29
|
+
* ***** END LICENSE BLOCK ***** */
|
30
|
+
|
31
|
+
define('ace/keyboard/emacs', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/keyboard/hash_handler', 'ace/lib/keys'], function(require, exports, module) {
|
32
|
+
|
33
|
+
|
34
|
+
var dom = require("../lib/dom");
|
35
|
+
|
36
|
+
var screenToTextBlockCoordinates = function(pageX, pageY) {
|
37
|
+
var canvasPos = this.scroller.getBoundingClientRect();
|
38
|
+
|
39
|
+
var col = Math.floor(
|
40
|
+
(pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft()) / this.characterWidth
|
41
|
+
);
|
42
|
+
var row = Math.floor(
|
43
|
+
(pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop()) / this.lineHeight
|
44
|
+
);
|
45
|
+
|
46
|
+
return this.session.screenToDocumentPosition(row, col);
|
47
|
+
};
|
48
|
+
|
49
|
+
var HashHandler = require("./hash_handler").HashHandler;
|
50
|
+
exports.handler = new HashHandler();
|
51
|
+
|
52
|
+
var initialized = false;
|
53
|
+
exports.handler.attach = function(editor) {
|
54
|
+
if (!initialized) {
|
55
|
+
initialized = true;
|
56
|
+
dom.importCssString('\
|
57
|
+
.emacs-mode .ace_cursor{\
|
58
|
+
border: 2px rgba(50,250,50,0.8) solid!important;\
|
59
|
+
-moz-box-sizing: border-box!important;\
|
60
|
+
-webkit-box-sizing: border-box!important;\
|
61
|
+
box-sizing: border-box!important;\
|
62
|
+
background-color: rgba(0,250,0,0.9);\
|
63
|
+
opacity: 0.5;\
|
64
|
+
}\
|
65
|
+
.emacs-mode .ace_cursor.ace_hidden{\
|
66
|
+
opacity: 1;\
|
67
|
+
background-color: transparent;\
|
68
|
+
}\
|
69
|
+
.emacs-mode .ace_overwrite-cursors .ace_cursor {\
|
70
|
+
opacity: 1;\
|
71
|
+
background-color: transparent;\
|
72
|
+
border-width: 0 0 2px 2px !important;\
|
73
|
+
}\
|
74
|
+
.emacs-mode .ace_text-layer {\
|
75
|
+
z-index: 4\
|
76
|
+
}\
|
77
|
+
.emacs-mode .ace_cursor-layer {\
|
78
|
+
z-index: 2\
|
79
|
+
}', 'emacsMode'
|
80
|
+
);
|
81
|
+
}
|
82
|
+
|
83
|
+
editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
|
84
|
+
editor.setStyle("emacs-mode");
|
85
|
+
};
|
86
|
+
|
87
|
+
exports.handler.detach = function(editor) {
|
88
|
+
delete editor.renderer.screenToTextCoordinates;
|
89
|
+
editor.unsetStyle("emacs-mode");
|
90
|
+
};
|
91
|
+
|
92
|
+
|
93
|
+
var keys = require("../lib/keys").KEY_MODS;
|
94
|
+
var eMods = {
|
95
|
+
C: "ctrl", S: "shift", M: "alt"
|
96
|
+
};
|
97
|
+
["S-C-M", "S-C", "S-M", "C-M", "S", "C", "M"].forEach(function(c) {
|
98
|
+
var hashId = 0;
|
99
|
+
c.split("-").forEach(function(c){
|
100
|
+
hashId = hashId | keys[eMods[c]];
|
101
|
+
});
|
102
|
+
eMods[hashId] = c.toLowerCase() + "-";
|
103
|
+
});
|
104
|
+
|
105
|
+
exports.handler.bindKey = function(key, command) {
|
106
|
+
if (!key)
|
107
|
+
return;
|
108
|
+
|
109
|
+
var ckb = this.commmandKeyBinding;
|
110
|
+
key.split("|").forEach(function(keyPart) {
|
111
|
+
keyPart = keyPart.toLowerCase();
|
112
|
+
ckb[keyPart] = command;
|
113
|
+
keyPart = keyPart.split(" ")[0];
|
114
|
+
if (!ckb[keyPart])
|
115
|
+
ckb[keyPart] = "null";
|
116
|
+
}, this);
|
117
|
+
};
|
118
|
+
|
119
|
+
|
120
|
+
exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
|
121
|
+
if (hashId == -1) {
|
122
|
+
if (data.count) {
|
123
|
+
var str = Array(data.count + 1).join(key);
|
124
|
+
data.count = null;
|
125
|
+
return {command: "insertstring", args: str};
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
if (key == "\x00")
|
130
|
+
return;
|
131
|
+
|
132
|
+
var modifier = eMods[hashId];
|
133
|
+
if (modifier == "c-" || data.universalArgument) {
|
134
|
+
var count = parseInt(key[key.length - 1]);
|
135
|
+
if (count) {
|
136
|
+
data.count = count;
|
137
|
+
return {command: "null"};
|
138
|
+
}
|
139
|
+
}
|
140
|
+
data.universalArgument = false;
|
141
|
+
|
142
|
+
if (modifier)
|
143
|
+
key = modifier + key;
|
144
|
+
|
145
|
+
if (data.keyChain)
|
146
|
+
key = data.keyChain += " " + key;
|
147
|
+
|
148
|
+
var command = this.commmandKeyBinding[key];
|
149
|
+
data.keyChain = command == "null" ? key : "";
|
150
|
+
|
151
|
+
if (!command)
|
152
|
+
return;
|
153
|
+
|
154
|
+
if (command == "null")
|
155
|
+
return {command: "null"};
|
156
|
+
|
157
|
+
if (command == "universalArgument") {
|
158
|
+
data.universalArgument = true;
|
159
|
+
return {command: "null"};
|
160
|
+
}
|
161
|
+
|
162
|
+
if (typeof command != "string") {
|
163
|
+
var args = command.args;
|
164
|
+
command = command.command;
|
165
|
+
}
|
166
|
+
|
167
|
+
if (typeof command == "string") {
|
168
|
+
command = this.commands[command] || data.editor.commands.commands[command];
|
169
|
+
}
|
170
|
+
|
171
|
+
if (!command.readonly && !command.isYank)
|
172
|
+
data.lastCommand = null;
|
173
|
+
|
174
|
+
if (data.count) {
|
175
|
+
var count = data.count;
|
176
|
+
data.count = 0;
|
177
|
+
return {
|
178
|
+
args: args,
|
179
|
+
command: {
|
180
|
+
exec: function(editor, args) {
|
181
|
+
for (var i = 0; i < count; i++)
|
182
|
+
command.exec(editor, args);
|
183
|
+
}
|
184
|
+
}
|
185
|
+
};
|
186
|
+
}
|
187
|
+
|
188
|
+
return {command: command, args: args};
|
189
|
+
};
|
190
|
+
|
191
|
+
exports.emacsKeys = {
|
192
|
+
"Up|C-p" : "golineup",
|
193
|
+
"Down|C-n" : "golinedown",
|
194
|
+
"Left|C-b" : "gotoleft",
|
195
|
+
"Right|C-f" : "gotoright",
|
196
|
+
"C-Left|M-b" : "gotowordleft",
|
197
|
+
"C-Right|M-f" : "gotowordright",
|
198
|
+
"Home|C-a" : "gotolinestart",
|
199
|
+
"End|C-e" : "gotolineend",
|
200
|
+
"C-Home|S-M-,": "gotostart",
|
201
|
+
"C-End|S-M-." : "gotoend",
|
202
|
+
"S-Up|S-C-p" : "selectup",
|
203
|
+
"S-Down|S-C-n" : "selectdown",
|
204
|
+
"S-Left|S-C-b" : "selectleft",
|
205
|
+
"S-Right|S-C-f" : "selectright",
|
206
|
+
"S-C-Left|S-M-b" : "selectwordleft",
|
207
|
+
"S-C-Right|S-M-f" : "selectwordright",
|
208
|
+
"S-Home|S-C-a" : "selecttolinestart",
|
209
|
+
"S-End|S-C-e" : "selecttolineend",
|
210
|
+
"S-C-Home" : "selecttostart",
|
211
|
+
"S-C-End" : "selecttoend",
|
212
|
+
|
213
|
+
"C-l" : "recenterTopBottom",
|
214
|
+
"M-s" : "centerselection",
|
215
|
+
"M-g": "gotoline",
|
216
|
+
"C-x C-p": "selectall",
|
217
|
+
"C-Down": "gotopagedown",
|
218
|
+
"C-Up": "gotopageup",
|
219
|
+
"PageDown|C-v": "gotopagedown",
|
220
|
+
"PageUp|M-v": "gotopageup",
|
221
|
+
"S-C-Down": "selectpagedown",
|
222
|
+
"S-C-Up": "selectpageup",
|
223
|
+
"C-s": "findnext",
|
224
|
+
"C-r": "findprevious",
|
225
|
+
"M-C-s": "findnext",
|
226
|
+
"M-C-r": "findprevious",
|
227
|
+
"S-M-5": "replace",
|
228
|
+
"Backspace": "backspace",
|
229
|
+
"Delete|C-d": "del",
|
230
|
+
"Return|C-m": {command: "insertstring", args: "\n"}, // "newline"
|
231
|
+
"C-o": "splitline",
|
232
|
+
|
233
|
+
"M-d|C-Delete": {command: "killWord", args: "right"},
|
234
|
+
"C-Backspace|M-Backspace|M-Delete": {command: "killWord", args: "left"},
|
235
|
+
"C-k": "killLine",
|
236
|
+
|
237
|
+
"C-y|S-Delete": "yank",
|
238
|
+
"M-y": "yankRotate",
|
239
|
+
"C-g": "keyboardQuit",
|
240
|
+
|
241
|
+
"C-w": "killRegion",
|
242
|
+
"M-w": "killRingSave",
|
243
|
+
|
244
|
+
"C-Space": "setMark",
|
245
|
+
"C-x C-x": "exchangePointAndMark",
|
246
|
+
|
247
|
+
"C-t": "transposeletters",
|
248
|
+
|
249
|
+
"M-u": "touppercase",
|
250
|
+
"M-l": "tolowercase",
|
251
|
+
"M-/": "autocomplete",
|
252
|
+
"C-u": "universalArgument",
|
253
|
+
"M-;": "togglecomment",
|
254
|
+
|
255
|
+
"C-/|C-x u|S-C--|C-z": "undo",
|
256
|
+
"S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo?
|
257
|
+
"C-x r": "selectRectangularRegion"
|
258
|
+
};
|
259
|
+
|
260
|
+
|
261
|
+
exports.handler.bindKeys(exports.emacsKeys);
|
262
|
+
|
263
|
+
exports.handler.addCommands({
|
264
|
+
recenterTopBottom: function(editor) {
|
265
|
+
var renderer = editor.renderer;
|
266
|
+
var pos = renderer.$cursorLayer.getPixelPosition();
|
267
|
+
var h = renderer.$size.scrollerHeight - renderer.lineHeight;
|
268
|
+
var scrollTop = renderer.scrollTop;
|
269
|
+
if (Math.abs(pos.top - scrollTop) < 2) {
|
270
|
+
scrollTop = pos.top - h;
|
271
|
+
} else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) {
|
272
|
+
scrollTop = pos.top;
|
273
|
+
} else {
|
274
|
+
scrollTop = pos.top - h * 0.5;
|
275
|
+
}
|
276
|
+
editor.session.setScrollTop(scrollTop);
|
277
|
+
},
|
278
|
+
selectRectangularRegion: function(editor) {
|
279
|
+
editor.multiSelect.toggleBlockSelection();
|
280
|
+
},
|
281
|
+
setMark: function() {
|
282
|
+
},
|
283
|
+
exchangePointAndMark: {
|
284
|
+
exec: function(editor) {
|
285
|
+
var range = editor.selection.getRange();
|
286
|
+
editor.selection.setSelectionRange(range, !editor.selection.isBackwards());
|
287
|
+
},
|
288
|
+
readonly: true,
|
289
|
+
multiselectAction: "forEach"
|
290
|
+
},
|
291
|
+
killWord: {
|
292
|
+
exec: function(editor, dir) {
|
293
|
+
editor.clearSelection();
|
294
|
+
if (dir == "left")
|
295
|
+
editor.selection.selectWordLeft();
|
296
|
+
else
|
297
|
+
editor.selection.selectWordRight();
|
298
|
+
|
299
|
+
var range = editor.getSelectionRange();
|
300
|
+
var text = editor.session.getTextRange(range);
|
301
|
+
exports.killRing.add(text);
|
302
|
+
|
303
|
+
editor.session.remove(range);
|
304
|
+
editor.clearSelection();
|
305
|
+
},
|
306
|
+
multiselectAction: "forEach"
|
307
|
+
},
|
308
|
+
killLine: function(editor) {
|
309
|
+
editor.selection.selectLine();
|
310
|
+
var range = editor.getSelectionRange();
|
311
|
+
var text = editor.session.getTextRange(range);
|
312
|
+
exports.killRing.add(text);
|
313
|
+
|
314
|
+
editor.session.remove(range);
|
315
|
+
editor.clearSelection();
|
316
|
+
},
|
317
|
+
yank: function(editor) {
|
318
|
+
editor.onPaste(exports.killRing.get());
|
319
|
+
editor.keyBinding.$data.lastCommand = "yank";
|
320
|
+
},
|
321
|
+
yankRotate: function(editor) {
|
322
|
+
if (editor.keyBinding.$data.lastCommand != "yank")
|
323
|
+
return;
|
324
|
+
|
325
|
+
editor.undo();
|
326
|
+
editor.onPaste(exports.killRing.rotate());
|
327
|
+
editor.keyBinding.$data.lastCommand = "yank";
|
328
|
+
},
|
329
|
+
killRegion: function(editor) {
|
330
|
+
exports.killRing.add(editor.getCopyText());
|
331
|
+
editor.commands.byName.cut.exec(editor);
|
332
|
+
},
|
333
|
+
killRingSave: function(editor) {
|
334
|
+
exports.killRing.add(editor.getCopyText());
|
335
|
+
}
|
336
|
+
});
|
337
|
+
|
338
|
+
var commands = exports.handler.commands;
|
339
|
+
commands.yank.isYank = true;
|
340
|
+
commands.yankRotate.isYank = true;
|
341
|
+
|
342
|
+
exports.killRing = {
|
343
|
+
$data: [],
|
344
|
+
add: function(str) {
|
345
|
+
str && this.$data.push(str);
|
346
|
+
if (this.$data.length > 30)
|
347
|
+
this.$data.shift();
|
348
|
+
},
|
349
|
+
get: function() {
|
350
|
+
return this.$data[this.$data.length - 1] || "";
|
351
|
+
},
|
352
|
+
pop: function() {
|
353
|
+
if (this.$data.length > 1)
|
354
|
+
this.$data.pop();
|
355
|
+
return this.get();
|
356
|
+
},
|
357
|
+
rotate: function() {
|
358
|
+
this.$data.unshift(this.$data.pop());
|
359
|
+
return this.get();
|
360
|
+
}
|
361
|
+
};
|
362
|
+
|
363
|
+
|
364
|
+
});
|
@@ -0,0 +1,1646 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Distributed under the BSD license:
|
3
|
+
*
|
4
|
+
* Copyright (c) 2010, Ajax.org B.V.
|
5
|
+
* All rights reserved.
|
6
|
+
*
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
8
|
+
* modification, are permitted provided that the following conditions are met:
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
11
|
+
* * Redistributions in binary form must reproduce the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
14
|
+
* * Neither the name of Ajax.org B.V. nor the
|
15
|
+
* names of its contributors may be used to endorse or promote products
|
16
|
+
* derived from this software without specific prior written permission.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
22
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
25
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
*
|
29
|
+
* ***** END LICENSE BLOCK ***** */
|
30
|
+
|
31
|
+
define('ace/keyboard/vim', ['require', 'exports', 'module' , 'ace/keyboard/vim/commands', 'ace/keyboard/vim/maps/util', 'ace/lib/useragent'], function(require, exports, module) {
|
32
|
+
|
33
|
+
|
34
|
+
var cmds = require("./vim/commands");
|
35
|
+
var coreCommands = cmds.coreCommands;
|
36
|
+
var util = require("./vim/maps/util");
|
37
|
+
var useragent = require("../lib/useragent");
|
38
|
+
|
39
|
+
var startCommands = {
|
40
|
+
"i": {
|
41
|
+
command: coreCommands.start
|
42
|
+
},
|
43
|
+
"I": {
|
44
|
+
command: coreCommands.startBeginning
|
45
|
+
},
|
46
|
+
"a": {
|
47
|
+
command: coreCommands.append
|
48
|
+
},
|
49
|
+
"A": {
|
50
|
+
command: coreCommands.appendEnd
|
51
|
+
},
|
52
|
+
"ctrl-f": {
|
53
|
+
command: "gotopagedown"
|
54
|
+
},
|
55
|
+
"ctrl-b": {
|
56
|
+
command: "gotopageup"
|
57
|
+
}
|
58
|
+
};
|
59
|
+
|
60
|
+
exports.handler = {
|
61
|
+
handleMacRepeat: function(data, hashId, key) {
|
62
|
+
if (hashId == -1) {
|
63
|
+
data.inputChar = key;
|
64
|
+
data.lastEvent = "input";
|
65
|
+
} else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {
|
66
|
+
if (data.lastEvent == "input") {
|
67
|
+
data.lastEvent = "input1";
|
68
|
+
} else if (data.lastEvent == "input1") {
|
69
|
+
return true;
|
70
|
+
}
|
71
|
+
} else {
|
72
|
+
data.$lastHash = hashId;
|
73
|
+
data.$lastKey = key;
|
74
|
+
data.lastEvent = "keypress";
|
75
|
+
}
|
76
|
+
},
|
77
|
+
|
78
|
+
handleKeyboard: function(data, hashId, key, keyCode, e) {
|
79
|
+
if (hashId != 0 && (key == "" || key == "\x00"))
|
80
|
+
return null;
|
81
|
+
|
82
|
+
if (hashId == 1)
|
83
|
+
key = "ctrl-" + key;
|
84
|
+
|
85
|
+
if ((key == "esc" && hashId == 0) || key == "ctrl-[") {
|
86
|
+
return {command: coreCommands.stop};
|
87
|
+
} else if (data.state == "start") {
|
88
|
+
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
|
89
|
+
hashId = -1;
|
90
|
+
key = data.inputChar;
|
91
|
+
}
|
92
|
+
|
93
|
+
if (hashId == -1 || hashId == 1 || hashId == 0 && key.length > 1) {
|
94
|
+
if (cmds.inputBuffer.idle && startCommands[key])
|
95
|
+
return startCommands[key];
|
96
|
+
return {
|
97
|
+
command: {
|
98
|
+
exec: function(editor) {
|
99
|
+
return cmds.inputBuffer.push(editor, key);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
};
|
103
|
+
} // if no modifier || shift: wait for input.
|
104
|
+
else if (key.length == 1 && (hashId == 0 || hashId == 4)) {
|
105
|
+
return {command: "null", passEvent: true};
|
106
|
+
} else if (key == "esc" && hashId == 0) {
|
107
|
+
return {command: coreCommands.stop};
|
108
|
+
}
|
109
|
+
} else {
|
110
|
+
if (key == "ctrl-w") {
|
111
|
+
return {command: "removewordleft"};
|
112
|
+
}
|
113
|
+
}
|
114
|
+
},
|
115
|
+
|
116
|
+
attach: function(editor) {
|
117
|
+
editor.on("click", exports.onCursorMove);
|
118
|
+
if (util.currentMode !== "insert")
|
119
|
+
cmds.coreCommands.stop.exec(editor);
|
120
|
+
editor.$vimModeHandler = this;
|
121
|
+
},
|
122
|
+
|
123
|
+
detach: function(editor) {
|
124
|
+
editor.removeListener("click", exports.onCursorMove);
|
125
|
+
util.noMode(editor);
|
126
|
+
util.currentMode = "normal";
|
127
|
+
},
|
128
|
+
|
129
|
+
actions: cmds.actions,
|
130
|
+
getStatusText: function() {
|
131
|
+
if (util.currentMode == "insert")
|
132
|
+
return "INSERT";
|
133
|
+
if (util.onVisualMode)
|
134
|
+
return (util.onVisualLineMode ? "VISUAL LINE " : "VISUAL ") + cmds.inputBuffer.status;
|
135
|
+
return cmds.inputBuffer.status;
|
136
|
+
}
|
137
|
+
};
|
138
|
+
|
139
|
+
|
140
|
+
exports.onCursorMove = function(e) {
|
141
|
+
cmds.onCursorMove(e.editor, e);
|
142
|
+
exports.onCursorMove.scheduled = false;
|
143
|
+
};
|
144
|
+
|
145
|
+
});
|
146
|
+
|
147
|
+
define('ace/keyboard/vim/commands', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/maps/motions', 'ace/keyboard/vim/maps/operators', 'ace/keyboard/vim/maps/aliases', 'ace/keyboard/vim/registers'], function(require, exports, module) {
|
148
|
+
|
149
|
+
"never use strict";
|
150
|
+
|
151
|
+
var util = require("./maps/util");
|
152
|
+
var motions = require("./maps/motions");
|
153
|
+
var operators = require("./maps/operators");
|
154
|
+
var alias = require("./maps/aliases");
|
155
|
+
var registers = require("./registers");
|
156
|
+
|
157
|
+
var NUMBER = 1;
|
158
|
+
var OPERATOR = 2;
|
159
|
+
var MOTION = 3;
|
160
|
+
var ACTION = 4;
|
161
|
+
var HMARGIN = 8; // Minimum amount of line separation between margins;
|
162
|
+
|
163
|
+
var repeat = function repeat(fn, count, args) {
|
164
|
+
while (0 < count--)
|
165
|
+
fn.apply(this, args);
|
166
|
+
};
|
167
|
+
|
168
|
+
var ensureScrollMargin = function(editor) {
|
169
|
+
var renderer = editor.renderer;
|
170
|
+
var pos = renderer.$cursorLayer.getPixelPosition();
|
171
|
+
|
172
|
+
var top = pos.top;
|
173
|
+
|
174
|
+
var margin = HMARGIN * renderer.layerConfig.lineHeight;
|
175
|
+
if (2 * margin > renderer.$size.scrollerHeight)
|
176
|
+
margin = renderer.$size.scrollerHeight / 2;
|
177
|
+
|
178
|
+
if (renderer.scrollTop > top - margin) {
|
179
|
+
renderer.session.setScrollTop(top - margin);
|
180
|
+
}
|
181
|
+
|
182
|
+
if (renderer.scrollTop + renderer.$size.scrollerHeight < top + margin + renderer.lineHeight) {
|
183
|
+
renderer.session.setScrollTop(top + margin + renderer.lineHeight - renderer.$size.scrollerHeight);
|
184
|
+
}
|
185
|
+
};
|
186
|
+
|
187
|
+
var actions = exports.actions = {
|
188
|
+
"z": {
|
189
|
+
param: true,
|
190
|
+
fn: function(editor, range, count, param) {
|
191
|
+
switch (param) {
|
192
|
+
case "z":
|
193
|
+
editor.renderer.alignCursor(null, 0.5);
|
194
|
+
break;
|
195
|
+
case "t":
|
196
|
+
editor.renderer.alignCursor(null, 0);
|
197
|
+
break;
|
198
|
+
case "b":
|
199
|
+
editor.renderer.alignCursor(null, 1);
|
200
|
+
break;
|
201
|
+
}
|
202
|
+
}
|
203
|
+
},
|
204
|
+
"r": {
|
205
|
+
param: true,
|
206
|
+
fn: function(editor, range, count, param) {
|
207
|
+
if (param && param.length) {
|
208
|
+
repeat(function() { editor.insert(param); }, count || 1);
|
209
|
+
editor.navigateLeft();
|
210
|
+
}
|
211
|
+
}
|
212
|
+
},
|
213
|
+
"R": {
|
214
|
+
fn: function(editor, range, count, param) {
|
215
|
+
util.insertMode(editor);
|
216
|
+
editor.setOverwrite(true);
|
217
|
+
}
|
218
|
+
},
|
219
|
+
"~": {
|
220
|
+
fn: function(editor, range, count) {
|
221
|
+
repeat(function() {
|
222
|
+
var range = editor.selection.getRange();
|
223
|
+
if (range.isEmpty())
|
224
|
+
range.end.column++;
|
225
|
+
var text = editor.session.getTextRange(range);
|
226
|
+
var toggled = text.toUpperCase();
|
227
|
+
if (toggled == text)
|
228
|
+
editor.navigateRight();
|
229
|
+
else
|
230
|
+
editor.session.replace(range, toggled);
|
231
|
+
}, count || 1);
|
232
|
+
}
|
233
|
+
},
|
234
|
+
"*": {
|
235
|
+
fn: function(editor, range, count, param) {
|
236
|
+
editor.selection.selectWord();
|
237
|
+
editor.findNext();
|
238
|
+
ensureScrollMargin(editor);
|
239
|
+
var r = editor.selection.getRange();
|
240
|
+
editor.selection.setSelectionRange(r, true);
|
241
|
+
}
|
242
|
+
},
|
243
|
+
"#": {
|
244
|
+
fn: function(editor, range, count, param) {
|
245
|
+
editor.selection.selectWord();
|
246
|
+
editor.findPrevious();
|
247
|
+
ensureScrollMargin(editor);
|
248
|
+
var r = editor.selection.getRange();
|
249
|
+
editor.selection.setSelectionRange(r, true);
|
250
|
+
}
|
251
|
+
},
|
252
|
+
"m": {
|
253
|
+
param: true,
|
254
|
+
fn: function(editor, range, count, param) {
|
255
|
+
var s = editor.session;
|
256
|
+
var markers = s.vimMarkers || (s.vimMarkers = {});
|
257
|
+
var c = editor.getCursorPosition();
|
258
|
+
if (!markers[param]) {
|
259
|
+
markers[param] = editor.session.doc.createAnchor(c);
|
260
|
+
}
|
261
|
+
markers[param].setPosition(c.row, c.column, true);
|
262
|
+
}
|
263
|
+
},
|
264
|
+
"n": {
|
265
|
+
fn: function(editor, range, count, param) {
|
266
|
+
var options = editor.getLastSearchOptions();
|
267
|
+
options.backwards = false;
|
268
|
+
|
269
|
+
editor.selection.moveCursorRight();
|
270
|
+
editor.selection.clearSelection();
|
271
|
+
editor.findNext(options);
|
272
|
+
|
273
|
+
ensureScrollMargin(editor);
|
274
|
+
var r = editor.selection.getRange();
|
275
|
+
r.end.row = r.start.row;
|
276
|
+
r.end.column = r.start.column;
|
277
|
+
editor.selection.setSelectionRange(r, true);
|
278
|
+
}
|
279
|
+
},
|
280
|
+
"N": {
|
281
|
+
fn: function(editor, range, count, param) {
|
282
|
+
var options = editor.getLastSearchOptions();
|
283
|
+
options.backwards = true;
|
284
|
+
|
285
|
+
editor.findPrevious(options);
|
286
|
+
ensureScrollMargin(editor);
|
287
|
+
var r = editor.selection.getRange();
|
288
|
+
r.end.row = r.start.row;
|
289
|
+
r.end.column = r.start.column;
|
290
|
+
editor.selection.setSelectionRange(r, true);
|
291
|
+
}
|
292
|
+
},
|
293
|
+
"v": {
|
294
|
+
fn: function(editor, range, count, param) {
|
295
|
+
editor.selection.selectRight();
|
296
|
+
util.visualMode(editor, false);
|
297
|
+
},
|
298
|
+
acceptsMotion: true
|
299
|
+
},
|
300
|
+
"V": {
|
301
|
+
fn: function(editor, range, count, param) {
|
302
|
+
var row = editor.getCursorPosition().row;
|
303
|
+
editor.selection.clearSelection();
|
304
|
+
editor.selection.moveCursorTo(row, 0);
|
305
|
+
editor.selection.selectLineEnd();
|
306
|
+
editor.selection.visualLineStart = row;
|
307
|
+
|
308
|
+
util.visualMode(editor, true);
|
309
|
+
},
|
310
|
+
acceptsMotion: true
|
311
|
+
},
|
312
|
+
"Y": {
|
313
|
+
fn: function(editor, range, count, param) {
|
314
|
+
util.copyLine(editor);
|
315
|
+
}
|
316
|
+
},
|
317
|
+
"p": {
|
318
|
+
fn: function(editor, range, count, param) {
|
319
|
+
var defaultReg = registers._default;
|
320
|
+
|
321
|
+
editor.setOverwrite(false);
|
322
|
+
if (defaultReg.isLine) {
|
323
|
+
var pos = editor.getCursorPosition();
|
324
|
+
var lines = defaultReg.text.split("\n");
|
325
|
+
editor.session.getDocument().insertLines(pos.row + 1, lines);
|
326
|
+
editor.moveCursorTo(pos.row + 1, 0);
|
327
|
+
}
|
328
|
+
else {
|
329
|
+
editor.navigateRight();
|
330
|
+
editor.insert(defaultReg.text);
|
331
|
+
editor.navigateLeft();
|
332
|
+
}
|
333
|
+
editor.setOverwrite(true);
|
334
|
+
editor.selection.clearSelection();
|
335
|
+
}
|
336
|
+
},
|
337
|
+
"P": {
|
338
|
+
fn: function(editor, range, count, param) {
|
339
|
+
var defaultReg = registers._default;
|
340
|
+
editor.setOverwrite(false);
|
341
|
+
|
342
|
+
if (defaultReg.isLine) {
|
343
|
+
var pos = editor.getCursorPosition();
|
344
|
+
var lines = defaultReg.text.split("\n");
|
345
|
+
editor.session.getDocument().insertLines(pos.row, lines);
|
346
|
+
editor.moveCursorTo(pos.row, 0);
|
347
|
+
}
|
348
|
+
else {
|
349
|
+
editor.insert(defaultReg.text);
|
350
|
+
}
|
351
|
+
editor.setOverwrite(true);
|
352
|
+
editor.selection.clearSelection();
|
353
|
+
}
|
354
|
+
},
|
355
|
+
"J": {
|
356
|
+
fn: function(editor, range, count, param) {
|
357
|
+
var session = editor.session;
|
358
|
+
range = editor.getSelectionRange();
|
359
|
+
var pos = {row: range.start.row, column: range.start.column};
|
360
|
+
count = count || range.end.row - range.start.row;
|
361
|
+
var maxRow = Math.min(pos.row + (count || 1), session.getLength() - 1);
|
362
|
+
|
363
|
+
range.start.column = session.getLine(pos.row).length;
|
364
|
+
range.end.column = session.getLine(maxRow).length;
|
365
|
+
range.end.row = maxRow;
|
366
|
+
|
367
|
+
var text = "";
|
368
|
+
for (var i = pos.row; i < maxRow; i++) {
|
369
|
+
var nextLine = session.getLine(i + 1);
|
370
|
+
text += " " + /^\s*(.*)$/.exec(nextLine)[1] || "";
|
371
|
+
}
|
372
|
+
|
373
|
+
session.replace(range, text);
|
374
|
+
editor.moveCursorTo(pos.row, pos.column);
|
375
|
+
}
|
376
|
+
},
|
377
|
+
"u": {
|
378
|
+
fn: function(editor, range, count, param) {
|
379
|
+
count = parseInt(count || 1, 10);
|
380
|
+
for (var i = 0; i < count; i++) {
|
381
|
+
editor.undo();
|
382
|
+
}
|
383
|
+
editor.selection.clearSelection();
|
384
|
+
}
|
385
|
+
},
|
386
|
+
"ctrl-r": {
|
387
|
+
fn: function(editor, range, count, param) {
|
388
|
+
count = parseInt(count || 1, 10);
|
389
|
+
for (var i = 0; i < count; i++) {
|
390
|
+
editor.redo();
|
391
|
+
}
|
392
|
+
editor.selection.clearSelection();
|
393
|
+
}
|
394
|
+
},
|
395
|
+
":": {
|
396
|
+
fn: function(editor, range, count, param) {
|
397
|
+
}
|
398
|
+
},
|
399
|
+
"/": {
|
400
|
+
fn: function(editor, range, count, param) {
|
401
|
+
}
|
402
|
+
},
|
403
|
+
"?": {
|
404
|
+
fn: function(editor, range, count, param) {
|
405
|
+
}
|
406
|
+
},
|
407
|
+
".": {
|
408
|
+
fn: function(editor, range, count, param) {
|
409
|
+
util.onInsertReplaySequence = inputBuffer.lastInsertCommands;
|
410
|
+
var previous = inputBuffer.previous;
|
411
|
+
if (previous) // If there is a previous action
|
412
|
+
inputBuffer.exec(editor, previous.action, previous.param);
|
413
|
+
}
|
414
|
+
},
|
415
|
+
"ctrl-x": {
|
416
|
+
fn: function(editor, range, count, param) {
|
417
|
+
editor.modifyNumber(-(count || 1));
|
418
|
+
}
|
419
|
+
},
|
420
|
+
"ctrl-a": {
|
421
|
+
fn: function(editor, range, count, param) {
|
422
|
+
editor.modifyNumber(count || 1);
|
423
|
+
}
|
424
|
+
},
|
425
|
+
};
|
426
|
+
|
427
|
+
var inputBuffer = exports.inputBuffer = {
|
428
|
+
accepting: [NUMBER, OPERATOR, MOTION, ACTION],
|
429
|
+
currentCmd: null,
|
430
|
+
currentCount: "",
|
431
|
+
status: "",
|
432
|
+
operator: null,
|
433
|
+
motion: null,
|
434
|
+
|
435
|
+
lastInsertCommands: [],
|
436
|
+
|
437
|
+
push: function(editor, ch, keyId) {
|
438
|
+
var isKeyHandled = true;
|
439
|
+
this.idle = false;
|
440
|
+
var wObj = this.waitingForParam;
|
441
|
+
if (wObj) {
|
442
|
+
this.exec(editor, wObj, ch);
|
443
|
+
}
|
444
|
+
else if (!(ch === "0" && !this.currentCount.length) &&
|
445
|
+
(ch.match(/^\d+$/) && this.isAccepting(NUMBER))) {
|
446
|
+
this.currentCount += ch;
|
447
|
+
this.currentCmd = NUMBER;
|
448
|
+
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
|
449
|
+
}
|
450
|
+
else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) {
|
451
|
+
this.operator = {
|
452
|
+
ch: ch,
|
453
|
+
count: this.getCount()
|
454
|
+
};
|
455
|
+
this.currentCmd = OPERATOR;
|
456
|
+
this.accepting = [NUMBER, MOTION, ACTION];
|
457
|
+
this.exec(editor, { operator: this.operator });
|
458
|
+
}
|
459
|
+
else if (motions[ch] && this.isAccepting(MOTION)) {
|
460
|
+
this.currentCmd = MOTION;
|
461
|
+
|
462
|
+
var ctx = {
|
463
|
+
operator: this.operator,
|
464
|
+
motion: {
|
465
|
+
ch: ch,
|
466
|
+
count: this.getCount()
|
467
|
+
}
|
468
|
+
};
|
469
|
+
|
470
|
+
if (motions[ch].param)
|
471
|
+
this.waitForParam(ctx);
|
472
|
+
else
|
473
|
+
this.exec(editor, ctx);
|
474
|
+
}
|
475
|
+
else if (alias[ch] && this.isAccepting(MOTION)) {
|
476
|
+
alias[ch].operator.count = this.getCount();
|
477
|
+
this.exec(editor, alias[ch]);
|
478
|
+
}
|
479
|
+
else if (actions[ch] && this.isAccepting(ACTION)) {
|
480
|
+
var actionObj = {
|
481
|
+
action: {
|
482
|
+
fn: actions[ch].fn,
|
483
|
+
count: this.getCount()
|
484
|
+
}
|
485
|
+
};
|
486
|
+
|
487
|
+
if (actions[ch].param) {
|
488
|
+
this.waitForParam(actionObj);
|
489
|
+
}
|
490
|
+
else {
|
491
|
+
this.exec(editor, actionObj);
|
492
|
+
}
|
493
|
+
|
494
|
+
if (actions[ch].acceptsMotion)
|
495
|
+
this.idle = false;
|
496
|
+
}
|
497
|
+
else if (this.operator) {
|
498
|
+
this.exec(editor, { operator: this.operator }, ch);
|
499
|
+
}
|
500
|
+
else {
|
501
|
+
isKeyHandled = ch.length == 1;
|
502
|
+
this.reset();
|
503
|
+
}
|
504
|
+
|
505
|
+
if (this.waitingForParam || this.motion || this.operator) {
|
506
|
+
this.status += ch;
|
507
|
+
} else if (this.currentCount) {
|
508
|
+
this.status = this.currentCount;
|
509
|
+
} else if (this.status) {
|
510
|
+
this.status = "";
|
511
|
+
} else {
|
512
|
+
return isKeyHandled;
|
513
|
+
}
|
514
|
+
editor._emit("changeStatus");
|
515
|
+
return isKeyHandled;
|
516
|
+
},
|
517
|
+
|
518
|
+
waitForParam: function(cmd) {
|
519
|
+
this.waitingForParam = cmd;
|
520
|
+
},
|
521
|
+
|
522
|
+
getCount: function() {
|
523
|
+
var count = this.currentCount;
|
524
|
+
this.currentCount = "";
|
525
|
+
return count && parseInt(count, 10);
|
526
|
+
},
|
527
|
+
|
528
|
+
exec: function(editor, action, param) {
|
529
|
+
var m = action.motion;
|
530
|
+
var o = action.operator;
|
531
|
+
var a = action.action;
|
532
|
+
|
533
|
+
if (!param)
|
534
|
+
param = action.param;
|
535
|
+
|
536
|
+
if (o) {
|
537
|
+
this.previous = {
|
538
|
+
action: action,
|
539
|
+
param: param
|
540
|
+
};
|
541
|
+
}
|
542
|
+
|
543
|
+
if (o && !editor.selection.isEmpty()) {
|
544
|
+
if (operators[o.ch].selFn) {
|
545
|
+
operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param);
|
546
|
+
this.reset();
|
547
|
+
}
|
548
|
+
return;
|
549
|
+
}
|
550
|
+
else if (!m && !a && o && param) {
|
551
|
+
operators[o.ch].fn(editor, null, o.count, param);
|
552
|
+
this.reset();
|
553
|
+
}
|
554
|
+
else if (m) {
|
555
|
+
var run = function(fn) {
|
556
|
+
if (fn && typeof fn === "function") { // There should always be a motion
|
557
|
+
if (m.count && !motionObj.handlesCount)
|
558
|
+
repeat(fn, m.count, [editor, null, m.count, param]);
|
559
|
+
else
|
560
|
+
fn(editor, null, m.count, param);
|
561
|
+
}
|
562
|
+
};
|
563
|
+
|
564
|
+
var motionObj = motions[m.ch];
|
565
|
+
var selectable = motionObj.sel;
|
566
|
+
|
567
|
+
if (!o) {
|
568
|
+
if ((util.onVisualMode || util.onVisualLineMode) && selectable)
|
569
|
+
run(motionObj.sel);
|
570
|
+
else
|
571
|
+
run(motionObj.nav);
|
572
|
+
}
|
573
|
+
else if (selectable) {
|
574
|
+
repeat(function() {
|
575
|
+
run(motionObj.sel);
|
576
|
+
operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
|
577
|
+
}, o.count || 1);
|
578
|
+
}
|
579
|
+
this.reset();
|
580
|
+
}
|
581
|
+
else if (a) {
|
582
|
+
a.fn(editor, editor.getSelectionRange(), a.count, param);
|
583
|
+
this.reset();
|
584
|
+
}
|
585
|
+
handleCursorMove(editor);
|
586
|
+
},
|
587
|
+
|
588
|
+
isAccepting: function(type) {
|
589
|
+
return this.accepting.indexOf(type) !== -1;
|
590
|
+
},
|
591
|
+
|
592
|
+
reset: function() {
|
593
|
+
this.operator = null;
|
594
|
+
this.motion = null;
|
595
|
+
this.currentCount = "";
|
596
|
+
this.status = "";
|
597
|
+
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
|
598
|
+
this.idle = true;
|
599
|
+
this.waitingForParam = null;
|
600
|
+
}
|
601
|
+
};
|
602
|
+
|
603
|
+
function setPreviousCommand(fn) {
|
604
|
+
inputBuffer.previous = { action: { action: { fn: fn } } };
|
605
|
+
}
|
606
|
+
|
607
|
+
exports.coreCommands = {
|
608
|
+
start: {
|
609
|
+
exec: function start(editor) {
|
610
|
+
util.insertMode(editor);
|
611
|
+
setPreviousCommand(start);
|
612
|
+
}
|
613
|
+
},
|
614
|
+
startBeginning: {
|
615
|
+
exec: function startBeginning(editor) {
|
616
|
+
editor.navigateLineStart();
|
617
|
+
util.insertMode(editor);
|
618
|
+
setPreviousCommand(startBeginning);
|
619
|
+
}
|
620
|
+
},
|
621
|
+
stop: {
|
622
|
+
exec: function stop(editor) {
|
623
|
+
inputBuffer.reset();
|
624
|
+
util.onVisualMode = false;
|
625
|
+
util.onVisualLineMode = false;
|
626
|
+
inputBuffer.lastInsertCommands = util.normalMode(editor);
|
627
|
+
}
|
628
|
+
},
|
629
|
+
append: {
|
630
|
+
exec: function append(editor) {
|
631
|
+
var pos = editor.getCursorPosition();
|
632
|
+
var lineLen = editor.session.getLine(pos.row).length;
|
633
|
+
if (lineLen)
|
634
|
+
editor.navigateRight();
|
635
|
+
util.insertMode(editor);
|
636
|
+
setPreviousCommand(append);
|
637
|
+
}
|
638
|
+
},
|
639
|
+
appendEnd: {
|
640
|
+
exec: function appendEnd(editor) {
|
641
|
+
editor.navigateLineEnd();
|
642
|
+
util.insertMode(editor);
|
643
|
+
setPreviousCommand(appendEnd);
|
644
|
+
}
|
645
|
+
}
|
646
|
+
};
|
647
|
+
|
648
|
+
var handleCursorMove = exports.onCursorMove = function(editor, e) {
|
649
|
+
if (util.currentMode === 'insert' || handleCursorMove.running)
|
650
|
+
return;
|
651
|
+
else if(!editor.selection.isEmpty()) {
|
652
|
+
handleCursorMove.running = true;
|
653
|
+
if (util.onVisualLineMode) {
|
654
|
+
var originRow = editor.selection.visualLineStart;
|
655
|
+
var cursorRow = editor.getCursorPosition().row;
|
656
|
+
if(originRow <= cursorRow) {
|
657
|
+
var endLine = editor.session.getLine(cursorRow);
|
658
|
+
editor.selection.clearSelection();
|
659
|
+
editor.selection.moveCursorTo(originRow, 0);
|
660
|
+
editor.selection.selectTo(cursorRow, endLine.length);
|
661
|
+
} else {
|
662
|
+
var endLine = editor.session.getLine(originRow);
|
663
|
+
editor.selection.clearSelection();
|
664
|
+
editor.selection.moveCursorTo(originRow, endLine.length);
|
665
|
+
editor.selection.selectTo(cursorRow, 0);
|
666
|
+
}
|
667
|
+
}
|
668
|
+
handleCursorMove.running = false;
|
669
|
+
return;
|
670
|
+
}
|
671
|
+
else {
|
672
|
+
if (e && (util.onVisualLineMode || util.onVisualMode)) {
|
673
|
+
editor.selection.clearSelection();
|
674
|
+
util.normalMode(editor);
|
675
|
+
}
|
676
|
+
|
677
|
+
handleCursorMove.running = true;
|
678
|
+
var pos = editor.getCursorPosition();
|
679
|
+
var lineLen = editor.session.getLine(pos.row).length;
|
680
|
+
|
681
|
+
if (lineLen && pos.column === lineLen)
|
682
|
+
editor.navigateLeft();
|
683
|
+
handleCursorMove.running = false;
|
684
|
+
}
|
685
|
+
};
|
686
|
+
});
|
687
|
+
define('ace/keyboard/vim/maps/util', ['require', 'exports', 'module' , 'ace/keyboard/vim/registers', 'ace/lib/dom'], function(require, exports, module) {
|
688
|
+
var registers = require("../registers");
|
689
|
+
|
690
|
+
var dom = require("../../../lib/dom");
|
691
|
+
dom.importCssString('.insert-mode .ace_cursor{\
|
692
|
+
border-left: 2px solid #333333;\
|
693
|
+
}\
|
694
|
+
.ace_dark.insert-mode .ace_cursor{\
|
695
|
+
border-left: 2px solid #eeeeee;\
|
696
|
+
}\
|
697
|
+
.normal-mode .ace_cursor{\
|
698
|
+
border: 0!important;\
|
699
|
+
background-color: red;\
|
700
|
+
opacity: 0.5;\
|
701
|
+
}', 'vimMode');
|
702
|
+
|
703
|
+
module.exports = {
|
704
|
+
onVisualMode: false,
|
705
|
+
onVisualLineMode: false,
|
706
|
+
currentMode: 'normal',
|
707
|
+
noMode: function(editor) {
|
708
|
+
editor.unsetStyle('insert-mode');
|
709
|
+
editor.unsetStyle('normal-mode');
|
710
|
+
if (editor.commands.recording)
|
711
|
+
editor.commands.toggleRecording(editor);
|
712
|
+
editor.setOverwrite(false);
|
713
|
+
},
|
714
|
+
insertMode: function(editor) {
|
715
|
+
this.currentMode = 'insert';
|
716
|
+
editor.setStyle('insert-mode');
|
717
|
+
editor.unsetStyle('normal-mode');
|
718
|
+
|
719
|
+
editor.setOverwrite(false);
|
720
|
+
editor.keyBinding.$data.buffer = "";
|
721
|
+
editor.keyBinding.$data.state = "insertMode";
|
722
|
+
this.onVisualMode = false;
|
723
|
+
this.onVisualLineMode = false;
|
724
|
+
if(this.onInsertReplaySequence) {
|
725
|
+
editor.commands.macro = this.onInsertReplaySequence;
|
726
|
+
editor.commands.replay(editor);
|
727
|
+
this.onInsertReplaySequence = null;
|
728
|
+
this.normalMode(editor);
|
729
|
+
} else {
|
730
|
+
editor._emit("changeStatus");
|
731
|
+
if(!editor.commands.recording)
|
732
|
+
editor.commands.toggleRecording(editor);
|
733
|
+
}
|
734
|
+
},
|
735
|
+
normalMode: function(editor) {
|
736
|
+
this.currentMode = 'normal';
|
737
|
+
|
738
|
+
editor.unsetStyle('insert-mode');
|
739
|
+
editor.setStyle('normal-mode');
|
740
|
+
editor.clearSelection();
|
741
|
+
|
742
|
+
var pos;
|
743
|
+
if (!editor.getOverwrite()) {
|
744
|
+
pos = editor.getCursorPosition();
|
745
|
+
if (pos.column > 0)
|
746
|
+
editor.navigateLeft();
|
747
|
+
}
|
748
|
+
|
749
|
+
editor.setOverwrite(true);
|
750
|
+
editor.keyBinding.$data.buffer = "";
|
751
|
+
editor.keyBinding.$data.state = "start";
|
752
|
+
this.onVisualMode = false;
|
753
|
+
this.onVisualLineMode = false;
|
754
|
+
editor._emit("changeStatus");
|
755
|
+
if (editor.commands.recording) {
|
756
|
+
editor.commands.toggleRecording(editor);
|
757
|
+
return editor.commands.macro;
|
758
|
+
}
|
759
|
+
else {
|
760
|
+
return [];
|
761
|
+
}
|
762
|
+
},
|
763
|
+
visualMode: function(editor, lineMode) {
|
764
|
+
if (
|
765
|
+
(this.onVisualLineMode && lineMode)
|
766
|
+
|| (this.onVisualMode && !lineMode)
|
767
|
+
) {
|
768
|
+
this.normalMode(editor);
|
769
|
+
return;
|
770
|
+
}
|
771
|
+
|
772
|
+
editor.setStyle('insert-mode');
|
773
|
+
editor.unsetStyle('normal-mode');
|
774
|
+
|
775
|
+
editor._emit("changeStatus");
|
776
|
+
if (lineMode) {
|
777
|
+
this.onVisualLineMode = true;
|
778
|
+
} else {
|
779
|
+
this.onVisualMode = true;
|
780
|
+
this.onVisualLineMode = false;
|
781
|
+
}
|
782
|
+
},
|
783
|
+
getRightNthChar: function(editor, cursor, ch, n) {
|
784
|
+
var line = editor.getSession().getLine(cursor.row);
|
785
|
+
var matches = line.substr(cursor.column + 1).split(ch);
|
786
|
+
|
787
|
+
return n < matches.length ? matches.slice(0, n).join(ch).length : null;
|
788
|
+
},
|
789
|
+
getLeftNthChar: function(editor, cursor, ch, n) {
|
790
|
+
var line = editor.getSession().getLine(cursor.row);
|
791
|
+
var matches = line.substr(0, cursor.column).split(ch);
|
792
|
+
|
793
|
+
return n < matches.length ? matches.slice(-1 * n).join(ch).length : null;
|
794
|
+
},
|
795
|
+
toRealChar: function(ch) {
|
796
|
+
if (ch.length === 1)
|
797
|
+
return ch;
|
798
|
+
|
799
|
+
if (/^shift-./.test(ch))
|
800
|
+
return ch[ch.length - 1].toUpperCase();
|
801
|
+
else
|
802
|
+
return "";
|
803
|
+
},
|
804
|
+
copyLine: function(editor) {
|
805
|
+
var pos = editor.getCursorPosition();
|
806
|
+
editor.selection.clearSelection();
|
807
|
+
editor.moveCursorTo(pos.row, pos.column);
|
808
|
+
editor.selection.selectLine();
|
809
|
+
registers._default.isLine = true;
|
810
|
+
registers._default.text = editor.getCopyText().replace(/\n$/, "");
|
811
|
+
editor.selection.clearSelection();
|
812
|
+
editor.moveCursorTo(pos.row, pos.column);
|
813
|
+
}
|
814
|
+
};
|
815
|
+
});
|
816
|
+
|
817
|
+
define('ace/keyboard/vim/registers', ['require', 'exports', 'module' ], function(require, exports, module) {
|
818
|
+
|
819
|
+
"never use strict";
|
820
|
+
|
821
|
+
module.exports = {
|
822
|
+
_default: {
|
823
|
+
text: "",
|
824
|
+
isLine: false
|
825
|
+
}
|
826
|
+
};
|
827
|
+
|
828
|
+
});
|
829
|
+
|
830
|
+
|
831
|
+
define('ace/keyboard/vim/maps/motions', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/search', 'ace/range'], function(require, exports, module) {
|
832
|
+
|
833
|
+
|
834
|
+
var util = require("./util");
|
835
|
+
|
836
|
+
var keepScrollPosition = function(editor, fn) {
|
837
|
+
var scrollTopRow = editor.renderer.getScrollTopRow();
|
838
|
+
var initialRow = editor.getCursorPosition().row;
|
839
|
+
var diff = initialRow - scrollTopRow;
|
840
|
+
fn && fn.call(editor);
|
841
|
+
editor.renderer.scrollToRow(editor.getCursorPosition().row - diff);
|
842
|
+
};
|
843
|
+
|
844
|
+
function Motion(m) {
|
845
|
+
if (typeof m == "function") {
|
846
|
+
var getPos = m;
|
847
|
+
m = this;
|
848
|
+
} else {
|
849
|
+
var getPos = m.getPos;
|
850
|
+
}
|
851
|
+
m.nav = function(editor, range, count, param) {
|
852
|
+
var a = getPos(editor, range, count, param, false);
|
853
|
+
if (!a)
|
854
|
+
return;
|
855
|
+
editor.clearSelection();
|
856
|
+
editor.moveCursorTo(a.row, a.column);
|
857
|
+
};
|
858
|
+
m.sel = function(editor, range, count, param) {
|
859
|
+
var a = getPos(editor, range, count, param, true);
|
860
|
+
if (!a)
|
861
|
+
return;
|
862
|
+
editor.selection.selectTo(a.row, a.column);
|
863
|
+
};
|
864
|
+
return m;
|
865
|
+
}
|
866
|
+
|
867
|
+
var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
|
868
|
+
var wordSeparatorRe = /[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
|
869
|
+
var whiteRe = /\s/;
|
870
|
+
var StringStream = function(editor, cursor) {
|
871
|
+
var sel = editor.selection;
|
872
|
+
this.range = sel.getRange();
|
873
|
+
cursor = cursor || sel.selectionLead;
|
874
|
+
this.row = cursor.row;
|
875
|
+
this.col = cursor.column;
|
876
|
+
var line = editor.session.getLine(this.row);
|
877
|
+
var maxRow = editor.session.getLength();
|
878
|
+
this.ch = line[this.col] || '\n';
|
879
|
+
this.skippedLines = 0;
|
880
|
+
|
881
|
+
this.next = function() {
|
882
|
+
this.ch = line[++this.col] || this.handleNewLine(1);
|
883
|
+
return this.ch;
|
884
|
+
};
|
885
|
+
this.prev = function() {
|
886
|
+
this.ch = line[--this.col] || this.handleNewLine(-1);
|
887
|
+
return this.ch;
|
888
|
+
};
|
889
|
+
this.peek = function(dir) {
|
890
|
+
var ch = line[this.col + dir];
|
891
|
+
if (ch)
|
892
|
+
return ch;
|
893
|
+
if (dir == -1)
|
894
|
+
return '\n';
|
895
|
+
if (this.col == line.length - 1)
|
896
|
+
return '\n';
|
897
|
+
return editor.session.getLine(this.row + 1)[0] || '\n';
|
898
|
+
};
|
899
|
+
|
900
|
+
this.handleNewLine = function(dir) {
|
901
|
+
if (dir == 1){
|
902
|
+
if (this.col == line.length)
|
903
|
+
return '\n';
|
904
|
+
if (this.row == maxRow - 1)
|
905
|
+
return '';
|
906
|
+
this.col = 0;
|
907
|
+
this.row ++;
|
908
|
+
line = editor.session.getLine(this.row);
|
909
|
+
this.skippedLines++;
|
910
|
+
return line[0] || '\n';
|
911
|
+
}
|
912
|
+
if (dir == -1) {
|
913
|
+
if (this.row === 0)
|
914
|
+
return '';
|
915
|
+
this.row --;
|
916
|
+
line = editor.session.getLine(this.row);
|
917
|
+
this.col = line.length;
|
918
|
+
this.skippedLines--;
|
919
|
+
return '\n';
|
920
|
+
}
|
921
|
+
};
|
922
|
+
this.debug = function() {
|
923
|
+
console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
|
924
|
+
};
|
925
|
+
};
|
926
|
+
|
927
|
+
var Search = require("../../../search").Search;
|
928
|
+
var search = new Search();
|
929
|
+
|
930
|
+
function find(editor, needle, dir) {
|
931
|
+
search.$options.needle = needle;
|
932
|
+
search.$options.backwards = dir == -1;
|
933
|
+
return search.find(editor.session);
|
934
|
+
}
|
935
|
+
|
936
|
+
var Range = require("../../../range").Range;
|
937
|
+
|
938
|
+
module.exports = {
|
939
|
+
"w": new Motion(function(editor) {
|
940
|
+
var str = new StringStream(editor);
|
941
|
+
|
942
|
+
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
943
|
+
while (str.ch && wordSeparatorRe.test(str.ch))
|
944
|
+
str.next();
|
945
|
+
} else {
|
946
|
+
while (str.ch && !nonWordRe.test(str.ch))
|
947
|
+
str.next();
|
948
|
+
}
|
949
|
+
while (str.ch && whiteRe.test(str.ch) && str.skippedLines < 2)
|
950
|
+
str.next();
|
951
|
+
|
952
|
+
str.skippedLines == 2 && str.prev();
|
953
|
+
return {column: str.col, row: str.row};
|
954
|
+
}),
|
955
|
+
"W": new Motion(function(editor) {
|
956
|
+
var str = new StringStream(editor);
|
957
|
+
while(str.ch && !(whiteRe.test(str.ch) && !whiteRe.test(str.peek(1))) && str.skippedLines < 2)
|
958
|
+
str.next();
|
959
|
+
if (str.skippedLines == 2)
|
960
|
+
str.prev();
|
961
|
+
else
|
962
|
+
str.next();
|
963
|
+
|
964
|
+
return {column: str.col, row: str.row};
|
965
|
+
}),
|
966
|
+
"b": new Motion(function(editor) {
|
967
|
+
var str = new StringStream(editor);
|
968
|
+
|
969
|
+
str.prev();
|
970
|
+
while (str.ch && whiteRe.test(str.ch) && str.skippedLines > -2)
|
971
|
+
str.prev();
|
972
|
+
|
973
|
+
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
974
|
+
while (str.ch && wordSeparatorRe.test(str.ch))
|
975
|
+
str.prev();
|
976
|
+
} else {
|
977
|
+
while (str.ch && !nonWordRe.test(str.ch))
|
978
|
+
str.prev();
|
979
|
+
}
|
980
|
+
str.ch && str.next();
|
981
|
+
return {column: str.col, row: str.row};
|
982
|
+
}),
|
983
|
+
"B": new Motion(function(editor) {
|
984
|
+
var str = new StringStream(editor);
|
985
|
+
str.prev();
|
986
|
+
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
|
987
|
+
str.prev();
|
988
|
+
|
989
|
+
if (str.skippedLines == -2)
|
990
|
+
str.next();
|
991
|
+
|
992
|
+
return {column: str.col, row: str.row};
|
993
|
+
}),
|
994
|
+
"e": new Motion(function(editor) {
|
995
|
+
var str = new StringStream(editor);
|
996
|
+
|
997
|
+
str.next();
|
998
|
+
while (str.ch && whiteRe.test(str.ch))
|
999
|
+
str.next();
|
1000
|
+
|
1001
|
+
if (str.ch && wordSeparatorRe.test(str.ch)) {
|
1002
|
+
while (str.ch && wordSeparatorRe.test(str.ch))
|
1003
|
+
str.next();
|
1004
|
+
} else {
|
1005
|
+
while (str.ch && !nonWordRe.test(str.ch))
|
1006
|
+
str.next();
|
1007
|
+
}
|
1008
|
+
str.ch && str.prev();
|
1009
|
+
return {column: str.col, row: str.row};
|
1010
|
+
}),
|
1011
|
+
"E": new Motion(function(editor) {
|
1012
|
+
var str = new StringStream(editor);
|
1013
|
+
str.next();
|
1014
|
+
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(1))))
|
1015
|
+
str.next();
|
1016
|
+
|
1017
|
+
return {column: str.col, row: str.row};
|
1018
|
+
}),
|
1019
|
+
|
1020
|
+
"l": {
|
1021
|
+
nav: function(editor) {
|
1022
|
+
var pos = editor.getCursorPosition();
|
1023
|
+
var col = pos.column;
|
1024
|
+
var lineLen = editor.session.getLine(pos.row).length;
|
1025
|
+
if (lineLen && col !== lineLen)
|
1026
|
+
editor.navigateRight();
|
1027
|
+
},
|
1028
|
+
sel: function(editor) {
|
1029
|
+
var pos = editor.getCursorPosition();
|
1030
|
+
var col = pos.column;
|
1031
|
+
var lineLen = editor.session.getLine(pos.row).length;
|
1032
|
+
if (lineLen && col !== lineLen) //In selection mode you can select the newline
|
1033
|
+
editor.selection.selectRight();
|
1034
|
+
}
|
1035
|
+
},
|
1036
|
+
"h": {
|
1037
|
+
nav: function(editor) {
|
1038
|
+
var pos = editor.getCursorPosition();
|
1039
|
+
if (pos.column > 0)
|
1040
|
+
editor.navigateLeft();
|
1041
|
+
},
|
1042
|
+
sel: function(editor) {
|
1043
|
+
var pos = editor.getCursorPosition();
|
1044
|
+
if (pos.column > 0)
|
1045
|
+
editor.selection.selectLeft();
|
1046
|
+
}
|
1047
|
+
},
|
1048
|
+
"H": {
|
1049
|
+
nav: function(editor) {
|
1050
|
+
var row = editor.renderer.getScrollTopRow();
|
1051
|
+
editor.moveCursorTo(row);
|
1052
|
+
},
|
1053
|
+
sel: function(editor) {
|
1054
|
+
var row = editor.renderer.getScrollTopRow();
|
1055
|
+
editor.selection.selectTo(row);
|
1056
|
+
}
|
1057
|
+
},
|
1058
|
+
"M": {
|
1059
|
+
nav: function(editor) {
|
1060
|
+
var topRow = editor.renderer.getScrollTopRow();
|
1061
|
+
var bottomRow = editor.renderer.getScrollBottomRow();
|
1062
|
+
var row = topRow + ((bottomRow - topRow) / 2);
|
1063
|
+
editor.moveCursorTo(row);
|
1064
|
+
},
|
1065
|
+
sel: function(editor) {
|
1066
|
+
var topRow = editor.renderer.getScrollTopRow();
|
1067
|
+
var bottomRow = editor.renderer.getScrollBottomRow();
|
1068
|
+
var row = topRow + ((bottomRow - topRow) / 2);
|
1069
|
+
editor.selection.selectTo(row);
|
1070
|
+
}
|
1071
|
+
},
|
1072
|
+
"L": {
|
1073
|
+
nav: function(editor) {
|
1074
|
+
var row = editor.renderer.getScrollBottomRow();
|
1075
|
+
editor.moveCursorTo(row);
|
1076
|
+
},
|
1077
|
+
sel: function(editor) {
|
1078
|
+
var row = editor.renderer.getScrollBottomRow();
|
1079
|
+
editor.selection.selectTo(row);
|
1080
|
+
}
|
1081
|
+
},
|
1082
|
+
"k": {
|
1083
|
+
nav: function(editor) {
|
1084
|
+
editor.navigateUp();
|
1085
|
+
},
|
1086
|
+
sel: function(editor) {
|
1087
|
+
editor.selection.selectUp();
|
1088
|
+
}
|
1089
|
+
},
|
1090
|
+
"j": {
|
1091
|
+
nav: function(editor) {
|
1092
|
+
editor.navigateDown();
|
1093
|
+
},
|
1094
|
+
sel: function(editor) {
|
1095
|
+
editor.selection.selectDown();
|
1096
|
+
}
|
1097
|
+
},
|
1098
|
+
|
1099
|
+
"i": {
|
1100
|
+
param: true,
|
1101
|
+
sel: function(editor, range, count, param) {
|
1102
|
+
switch (param) {
|
1103
|
+
case "w":
|
1104
|
+
editor.selection.selectWord();
|
1105
|
+
break;
|
1106
|
+
case "W":
|
1107
|
+
editor.selection.selectAWord();
|
1108
|
+
break;
|
1109
|
+
case "(":
|
1110
|
+
case "{":
|
1111
|
+
case "[":
|
1112
|
+
var cursor = editor.getCursorPosition();
|
1113
|
+
var end = editor.session.$findClosingBracket(param, cursor, /paren/);
|
1114
|
+
if (!end)
|
1115
|
+
return;
|
1116
|
+
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
|
1117
|
+
if (!start)
|
1118
|
+
return;
|
1119
|
+
start.column ++;
|
1120
|
+
editor.selection.setSelectionRange(Range.fromPoints(start, end));
|
1121
|
+
break;
|
1122
|
+
case "'":
|
1123
|
+
case '"':
|
1124
|
+
case "/":
|
1125
|
+
var end = find(editor, param, 1);
|
1126
|
+
if (!end)
|
1127
|
+
return;
|
1128
|
+
var start = find(editor, param, -1);
|
1129
|
+
if (!start)
|
1130
|
+
return;
|
1131
|
+
editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start));
|
1132
|
+
break;
|
1133
|
+
}
|
1134
|
+
}
|
1135
|
+
},
|
1136
|
+
"a": {
|
1137
|
+
param: true,
|
1138
|
+
sel: function(editor, range, count, param) {
|
1139
|
+
switch (param) {
|
1140
|
+
case "w":
|
1141
|
+
editor.selection.selectAWord();
|
1142
|
+
break;
|
1143
|
+
case "W":
|
1144
|
+
editor.selection.selectAWord();
|
1145
|
+
break;
|
1146
|
+
case "(":
|
1147
|
+
case "{":
|
1148
|
+
case "[":
|
1149
|
+
var cursor = editor.getCursorPosition();
|
1150
|
+
var end = editor.session.$findClosingBracket(param, cursor, /paren/);
|
1151
|
+
if (!end)
|
1152
|
+
return;
|
1153
|
+
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
|
1154
|
+
if (!start)
|
1155
|
+
return;
|
1156
|
+
end.column ++;
|
1157
|
+
editor.selection.setSelectionRange(Range.fromPoints(start, end));
|
1158
|
+
break;
|
1159
|
+
case "'":
|
1160
|
+
case "\"":
|
1161
|
+
case "/":
|
1162
|
+
var end = find(editor, param, 1);
|
1163
|
+
if (!end)
|
1164
|
+
return;
|
1165
|
+
var start = find(editor, param, -1);
|
1166
|
+
if (!start)
|
1167
|
+
return;
|
1168
|
+
end.column ++;
|
1169
|
+
editor.selection.setSelectionRange(Range.fromPoints(start.start, end.end));
|
1170
|
+
break;
|
1171
|
+
}
|
1172
|
+
}
|
1173
|
+
},
|
1174
|
+
|
1175
|
+
"f": new Motion({
|
1176
|
+
param: true,
|
1177
|
+
handlesCount: true,
|
1178
|
+
getPos: function(editor, range, count, param, isSel) {
|
1179
|
+
var cursor = editor.getCursorPosition();
|
1180
|
+
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
1181
|
+
|
1182
|
+
if (typeof column === "number") {
|
1183
|
+
cursor.column += column + (isSel ? 2 : 1);
|
1184
|
+
return cursor;
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
}),
|
1188
|
+
"F": new Motion({
|
1189
|
+
param: true,
|
1190
|
+
handlesCount: true,
|
1191
|
+
getPos: function(editor, range, count, param, isSel) {
|
1192
|
+
var cursor = editor.getCursorPosition();
|
1193
|
+
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
|
1194
|
+
|
1195
|
+
if (typeof column === "number") {
|
1196
|
+
cursor.column -= column + 1;
|
1197
|
+
return cursor;
|
1198
|
+
}
|
1199
|
+
}
|
1200
|
+
}),
|
1201
|
+
"t": new Motion({
|
1202
|
+
param: true,
|
1203
|
+
handlesCount: true,
|
1204
|
+
getPos: function(editor, range, count, param, isSel) {
|
1205
|
+
var cursor = editor.getCursorPosition();
|
1206
|
+
var column = util.getRightNthChar(editor, cursor, param, count || 1);
|
1207
|
+
|
1208
|
+
if (typeof column === "number") {
|
1209
|
+
cursor.column += column + (isSel ? 1 : 0);
|
1210
|
+
return cursor;
|
1211
|
+
}
|
1212
|
+
}
|
1213
|
+
}),
|
1214
|
+
"T": new Motion({
|
1215
|
+
param: true,
|
1216
|
+
handlesCount: true,
|
1217
|
+
getPos: function(editor, range, count, param, isSel) {
|
1218
|
+
var cursor = editor.getCursorPosition();
|
1219
|
+
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
|
1220
|
+
|
1221
|
+
if (typeof column === "number") {
|
1222
|
+
cursor.column -= column;
|
1223
|
+
return cursor;
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
}),
|
1227
|
+
|
1228
|
+
"^": {
|
1229
|
+
nav: function(editor) {
|
1230
|
+
editor.navigateLineStart();
|
1231
|
+
},
|
1232
|
+
sel: function(editor) {
|
1233
|
+
editor.selection.selectLineStart();
|
1234
|
+
}
|
1235
|
+
},
|
1236
|
+
"$": {
|
1237
|
+
nav: function(editor) {
|
1238
|
+
editor.navigateLineEnd();
|
1239
|
+
},
|
1240
|
+
sel: function(editor) {
|
1241
|
+
editor.selection.selectLineEnd();
|
1242
|
+
}
|
1243
|
+
},
|
1244
|
+
"0": new Motion(function(ed) {
|
1245
|
+
return {row: ed.selection.lead.row, column: 0};
|
1246
|
+
}),
|
1247
|
+
"G": {
|
1248
|
+
nav: function(editor, range, count, param) {
|
1249
|
+
if (!count && count !== 0) { // Stupid JS
|
1250
|
+
count = editor.session.getLength();
|
1251
|
+
}
|
1252
|
+
editor.gotoLine(count);
|
1253
|
+
},
|
1254
|
+
sel: function(editor, range, count, param) {
|
1255
|
+
if (!count && count !== 0) { // Stupid JS
|
1256
|
+
count = editor.session.getLength();
|
1257
|
+
}
|
1258
|
+
editor.selection.selectTo(count, 0);
|
1259
|
+
}
|
1260
|
+
},
|
1261
|
+
"g": {
|
1262
|
+
param: true,
|
1263
|
+
nav: function(editor, range, count, param) {
|
1264
|
+
switch(param) {
|
1265
|
+
case "m":
|
1266
|
+
console.log("Middle line");
|
1267
|
+
break;
|
1268
|
+
case "e":
|
1269
|
+
console.log("End of prev word");
|
1270
|
+
break;
|
1271
|
+
case "g":
|
1272
|
+
editor.gotoLine(count || 0);
|
1273
|
+
case "u":
|
1274
|
+
editor.gotoLine(count || 0);
|
1275
|
+
case "U":
|
1276
|
+
editor.gotoLine(count || 0);
|
1277
|
+
}
|
1278
|
+
},
|
1279
|
+
sel: function(editor, range, count, param) {
|
1280
|
+
switch(param) {
|
1281
|
+
case "m":
|
1282
|
+
console.log("Middle line");
|
1283
|
+
break;
|
1284
|
+
case "e":
|
1285
|
+
console.log("End of prev word");
|
1286
|
+
break;
|
1287
|
+
case "g":
|
1288
|
+
editor.selection.selectTo(count || 0, 0);
|
1289
|
+
}
|
1290
|
+
}
|
1291
|
+
},
|
1292
|
+
"o": {
|
1293
|
+
nav: function(editor, range, count, param) {
|
1294
|
+
count = count || 1;
|
1295
|
+
var content = "";
|
1296
|
+
while (0 < count--)
|
1297
|
+
content += "\n";
|
1298
|
+
|
1299
|
+
if (content.length) {
|
1300
|
+
editor.navigateLineEnd()
|
1301
|
+
editor.insert(content);
|
1302
|
+
util.insertMode(editor);
|
1303
|
+
}
|
1304
|
+
}
|
1305
|
+
},
|
1306
|
+
"O": {
|
1307
|
+
nav: function(editor, range, count, param) {
|
1308
|
+
var row = editor.getCursorPosition().row;
|
1309
|
+
count = count || 1;
|
1310
|
+
var content = "";
|
1311
|
+
while (0 < count--)
|
1312
|
+
content += "\n";
|
1313
|
+
|
1314
|
+
if (content.length) {
|
1315
|
+
if(row > 0) {
|
1316
|
+
editor.navigateUp();
|
1317
|
+
editor.navigateLineEnd()
|
1318
|
+
editor.insert(content);
|
1319
|
+
} else {
|
1320
|
+
editor.session.insert({row: 0, column: 0}, content);
|
1321
|
+
editor.navigateUp();
|
1322
|
+
}
|
1323
|
+
util.insertMode(editor);
|
1324
|
+
}
|
1325
|
+
}
|
1326
|
+
},
|
1327
|
+
"%": new Motion(function(editor){
|
1328
|
+
var brRe = /[\[\]{}()]/g;
|
1329
|
+
var cursor = editor.getCursorPosition();
|
1330
|
+
var ch = editor.session.getLine(cursor.row)[cursor.column];
|
1331
|
+
if (!brRe.test(ch)) {
|
1332
|
+
var range = find(editor, brRe);
|
1333
|
+
if (!range)
|
1334
|
+
return;
|
1335
|
+
cursor = range.start;
|
1336
|
+
}
|
1337
|
+
var match = editor.session.findMatchingBracket({
|
1338
|
+
row: cursor.row,
|
1339
|
+
column: cursor.column + 1
|
1340
|
+
});
|
1341
|
+
|
1342
|
+
return match;
|
1343
|
+
}),
|
1344
|
+
"{": new Motion(function(ed) {
|
1345
|
+
var session = ed.session;
|
1346
|
+
var row = session.selection.lead.row;
|
1347
|
+
while(row > 0 && !/\S/.test(session.getLine(row)))
|
1348
|
+
row--;
|
1349
|
+
while(/\S/.test(session.getLine(row)))
|
1350
|
+
row--;
|
1351
|
+
return {column: 0, row: row};
|
1352
|
+
}),
|
1353
|
+
"}": new Motion(function(ed) {
|
1354
|
+
var session = ed.session;
|
1355
|
+
var l = session.getLength();
|
1356
|
+
var row = session.selection.lead.row;
|
1357
|
+
while(row < l && !/\S/.test(session.getLine(row)))
|
1358
|
+
row++;
|
1359
|
+
while(/\S/.test(session.getLine(row)))
|
1360
|
+
row++;
|
1361
|
+
return {column: 0, row: row};
|
1362
|
+
}),
|
1363
|
+
"ctrl-d": {
|
1364
|
+
nav: function(editor, range, count, param) {
|
1365
|
+
editor.selection.clearSelection();
|
1366
|
+
keepScrollPosition(editor, editor.gotoPageDown);
|
1367
|
+
},
|
1368
|
+
sel: function(editor, range, count, param) {
|
1369
|
+
keepScrollPosition(editor, editor.selectPageDown);
|
1370
|
+
}
|
1371
|
+
},
|
1372
|
+
"ctrl-u": {
|
1373
|
+
nav: function(editor, range, count, param) {
|
1374
|
+
editor.selection.clearSelection();
|
1375
|
+
keepScrollPosition(editor, editor.gotoPageUp);
|
1376
|
+
},
|
1377
|
+
sel: function(editor, range, count, param) {
|
1378
|
+
keepScrollPosition(editor, editor.selectPageUp);
|
1379
|
+
}
|
1380
|
+
},
|
1381
|
+
"`": new Motion({
|
1382
|
+
param: true,
|
1383
|
+
handlesCount: true,
|
1384
|
+
getPos: function(editor, range, count, param, isSel) {
|
1385
|
+
var s = editor.session;
|
1386
|
+
var marker = s.vimMarkers && s.vimMarkers[param];
|
1387
|
+
if (marker) {
|
1388
|
+
return marker.getPosition();
|
1389
|
+
}
|
1390
|
+
}
|
1391
|
+
}),
|
1392
|
+
"'": new Motion({
|
1393
|
+
param: true,
|
1394
|
+
handlesCount: true,
|
1395
|
+
getPos: function(editor, range, count, param, isSel) {
|
1396
|
+
var s = editor.session;
|
1397
|
+
var marker = s.vimMarkers && s.vimMarkers[param];
|
1398
|
+
if (marker) {
|
1399
|
+
var pos = marker.getPosition();
|
1400
|
+
var line = editor.session.getLine(pos.row);
|
1401
|
+
pos.column = line.search(/\S/);
|
1402
|
+
if (pos.column == -1)
|
1403
|
+
pos.column = line.length;
|
1404
|
+
return pos;
|
1405
|
+
}
|
1406
|
+
}
|
1407
|
+
}),
|
1408
|
+
};
|
1409
|
+
|
1410
|
+
module.exports.backspace = module.exports.left = module.exports.h;
|
1411
|
+
module.exports.right = module.exports.l;
|
1412
|
+
module.exports.up = module.exports.k;
|
1413
|
+
module.exports.down = module.exports.j;
|
1414
|
+
module.exports.pagedown = module.exports["ctrl-d"];
|
1415
|
+
module.exports.pageup = module.exports["ctrl-u"];
|
1416
|
+
|
1417
|
+
});
|
1418
|
+
|
1419
|
+
define('ace/keyboard/vim/maps/operators', ['require', 'exports', 'module' , 'ace/keyboard/vim/maps/util', 'ace/keyboard/vim/registers'], function(require, exports, module) {
|
1420
|
+
|
1421
|
+
"never use strict";
|
1422
|
+
|
1423
|
+
var util = require("./util");
|
1424
|
+
var registers = require("../registers");
|
1425
|
+
|
1426
|
+
module.exports = {
|
1427
|
+
"d": {
|
1428
|
+
selFn: function(editor, range, count, param) {
|
1429
|
+
registers._default.text = editor.getCopyText();
|
1430
|
+
registers._default.isLine = util.onVisualLineMode;
|
1431
|
+
if(util.onVisualLineMode)
|
1432
|
+
editor.removeLines();
|
1433
|
+
else
|
1434
|
+
editor.session.remove(range);
|
1435
|
+
util.normalMode(editor);
|
1436
|
+
},
|
1437
|
+
fn: function(editor, range, count, param) {
|
1438
|
+
count = count || 1;
|
1439
|
+
switch (param) {
|
1440
|
+
case "d":
|
1441
|
+
registers._default.text = "";
|
1442
|
+
registers._default.isLine = true;
|
1443
|
+
for (var i = 0; i < count; i++) {
|
1444
|
+
editor.selection.selectLine();
|
1445
|
+
registers._default.text += editor.getCopyText();
|
1446
|
+
var selRange = editor.getSelectionRange();
|
1447
|
+
if (!selRange.isMultiLine()) {
|
1448
|
+
lastLineReached = true
|
1449
|
+
var row = selRange.start.row - 1;
|
1450
|
+
var col = editor.session.getLine(row).length
|
1451
|
+
selRange.setStart(row, col);
|
1452
|
+
editor.session.remove(selRange);
|
1453
|
+
editor.selection.clearSelection();
|
1454
|
+
break;
|
1455
|
+
}
|
1456
|
+
editor.session.remove(selRange);
|
1457
|
+
editor.selection.clearSelection();
|
1458
|
+
}
|
1459
|
+
registers._default.text = registers._default.text.replace(/\n$/, "");
|
1460
|
+
break;
|
1461
|
+
default:
|
1462
|
+
if (range) {
|
1463
|
+
editor.selection.setSelectionRange(range);
|
1464
|
+
registers._default.text = editor.getCopyText();
|
1465
|
+
registers._default.isLine = false;
|
1466
|
+
editor.session.remove(range);
|
1467
|
+
editor.selection.clearSelection();
|
1468
|
+
}
|
1469
|
+
}
|
1470
|
+
}
|
1471
|
+
},
|
1472
|
+
"c": {
|
1473
|
+
selFn: function(editor, range, count, param) {
|
1474
|
+
editor.session.remove(range);
|
1475
|
+
util.insertMode(editor);
|
1476
|
+
},
|
1477
|
+
fn: function(editor, range, count, param) {
|
1478
|
+
count = count || 1;
|
1479
|
+
switch (param) {
|
1480
|
+
case "c":
|
1481
|
+
for (var i = 0; i < count; i++) {
|
1482
|
+
editor.removeLines();
|
1483
|
+
util.insertMode(editor);
|
1484
|
+
}
|
1485
|
+
|
1486
|
+
break;
|
1487
|
+
default:
|
1488
|
+
if (range) {
|
1489
|
+
editor.session.remove(range);
|
1490
|
+
util.insertMode(editor);
|
1491
|
+
}
|
1492
|
+
}
|
1493
|
+
}
|
1494
|
+
},
|
1495
|
+
"y": {
|
1496
|
+
selFn: function(editor, range, count, param) {
|
1497
|
+
registers._default.text = editor.getCopyText();
|
1498
|
+
registers._default.isLine = util.onVisualLineMode;
|
1499
|
+
editor.selection.clearSelection();
|
1500
|
+
util.normalMode(editor);
|
1501
|
+
},
|
1502
|
+
fn: function(editor, range, count, param) {
|
1503
|
+
count = count || 1;
|
1504
|
+
switch (param) {
|
1505
|
+
case "y":
|
1506
|
+
var pos = editor.getCursorPosition();
|
1507
|
+
editor.selection.selectLine();
|
1508
|
+
for (var i = 0; i < count - 1; i++) {
|
1509
|
+
editor.selection.moveCursorDown();
|
1510
|
+
}
|
1511
|
+
registers._default.text = editor.getCopyText().replace(/\n$/, "");
|
1512
|
+
editor.selection.clearSelection();
|
1513
|
+
registers._default.isLine = true;
|
1514
|
+
editor.moveCursorToPosition(pos);
|
1515
|
+
break;
|
1516
|
+
default:
|
1517
|
+
if (range) {
|
1518
|
+
var pos = editor.getCursorPosition();
|
1519
|
+
editor.selection.setSelectionRange(range);
|
1520
|
+
registers._default.text = editor.getCopyText();
|
1521
|
+
registers._default.isLine = false;
|
1522
|
+
editor.selection.clearSelection();
|
1523
|
+
editor.moveCursorTo(pos.row, pos.column);
|
1524
|
+
}
|
1525
|
+
}
|
1526
|
+
}
|
1527
|
+
},
|
1528
|
+
">": {
|
1529
|
+
selFn: function(editor, range, count, param) {
|
1530
|
+
count = count || 1;
|
1531
|
+
for (var i = 0; i < count; i++) {
|
1532
|
+
editor.indent();
|
1533
|
+
}
|
1534
|
+
util.normalMode(editor);
|
1535
|
+
},
|
1536
|
+
fn: function(editor, range, count, param) {
|
1537
|
+
count = parseInt(count || 1, 10);
|
1538
|
+
switch (param) {
|
1539
|
+
case ">":
|
1540
|
+
var pos = editor.getCursorPosition();
|
1541
|
+
editor.selection.selectLine();
|
1542
|
+
for (var i = 0; i < count - 1; i++) {
|
1543
|
+
editor.selection.moveCursorDown();
|
1544
|
+
}
|
1545
|
+
editor.indent();
|
1546
|
+
editor.selection.clearSelection();
|
1547
|
+
editor.moveCursorToPosition(pos);
|
1548
|
+
editor.navigateLineEnd();
|
1549
|
+
editor.navigateLineStart();
|
1550
|
+
break;
|
1551
|
+
}
|
1552
|
+
}
|
1553
|
+
},
|
1554
|
+
"<": {
|
1555
|
+
selFn: function(editor, range, count, param) {
|
1556
|
+
count = count || 1;
|
1557
|
+
for (var i = 0; i < count; i++) {
|
1558
|
+
editor.blockOutdent();
|
1559
|
+
}
|
1560
|
+
util.normalMode(editor);
|
1561
|
+
},
|
1562
|
+
fn: function(editor, range, count, param) {
|
1563
|
+
count = count || 1;
|
1564
|
+
switch (param) {
|
1565
|
+
case "<":
|
1566
|
+
var pos = editor.getCursorPosition();
|
1567
|
+
editor.selection.selectLine();
|
1568
|
+
for (var i = 0; i < count - 1; i++) {
|
1569
|
+
editor.selection.moveCursorDown();
|
1570
|
+
}
|
1571
|
+
editor.blockOutdent();
|
1572
|
+
editor.selection.clearSelection();
|
1573
|
+
editor.moveCursorToPosition(pos);
|
1574
|
+
editor.navigateLineEnd();
|
1575
|
+
editor.navigateLineStart();
|
1576
|
+
break;
|
1577
|
+
}
|
1578
|
+
}
|
1579
|
+
}
|
1580
|
+
};
|
1581
|
+
});
|
1582
|
+
|
1583
|
+
"use strict"
|
1584
|
+
|
1585
|
+
define('ace/keyboard/vim/maps/aliases', ['require', 'exports', 'module' ], function(require, exports, module) {
|
1586
|
+
module.exports = {
|
1587
|
+
"x": {
|
1588
|
+
operator: {
|
1589
|
+
ch: "d",
|
1590
|
+
count: 1
|
1591
|
+
},
|
1592
|
+
motion: {
|
1593
|
+
ch: "l",
|
1594
|
+
count: 1
|
1595
|
+
}
|
1596
|
+
},
|
1597
|
+
"X": {
|
1598
|
+
operator: {
|
1599
|
+
ch: "d",
|
1600
|
+
count: 1
|
1601
|
+
},
|
1602
|
+
motion: {
|
1603
|
+
ch: "h",
|
1604
|
+
count: 1
|
1605
|
+
}
|
1606
|
+
},
|
1607
|
+
"D": {
|
1608
|
+
operator: {
|
1609
|
+
ch: "d",
|
1610
|
+
count: 1
|
1611
|
+
},
|
1612
|
+
motion: {
|
1613
|
+
ch: "$",
|
1614
|
+
count: 1
|
1615
|
+
}
|
1616
|
+
},
|
1617
|
+
"C": {
|
1618
|
+
operator: {
|
1619
|
+
ch: "c",
|
1620
|
+
count: 1
|
1621
|
+
},
|
1622
|
+
motion: {
|
1623
|
+
ch: "$",
|
1624
|
+
count: 1
|
1625
|
+
}
|
1626
|
+
},
|
1627
|
+
"s": {
|
1628
|
+
operator: {
|
1629
|
+
ch: "c",
|
1630
|
+
count: 1
|
1631
|
+
},
|
1632
|
+
motion: {
|
1633
|
+
ch: "l",
|
1634
|
+
count: 1
|
1635
|
+
}
|
1636
|
+
},
|
1637
|
+
"S": {
|
1638
|
+
operator: {
|
1639
|
+
ch: "c",
|
1640
|
+
count: 1
|
1641
|
+
},
|
1642
|
+
param: "c"
|
1643
|
+
}
|
1644
|
+
};
|
1645
|
+
});
|
1646
|
+
|