ace_vimtura-rails 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c71628703677b559ac619646bef72aabbb018e15
4
- data.tar.gz: 92dcdb470f466159254c21a18152b1c442dcfa98
3
+ metadata.gz: cb80492b1f9659e15ae344bafe36fb65eb6d3e09
4
+ data.tar.gz: 17fc6630d6fbaa639f6258f40fc95ba4bc36cb44
5
5
  SHA512:
6
- metadata.gz: 0eb0759d1356ded1d263656e84f7b6b790bca9e2482173648ab139c91817b5d2adea66240d5a39e2f70b3864e776c3863c423fc316f5b2d02c7c4e2888945c60
7
- data.tar.gz: 2a5d681c821f6b359edce87f429f80bde2654d4c29baa27ea9b2536be6cdcd3513e603c70d416d803eef7554710d34fa02e6a9a43b368c03f6d8583c2257cc55
6
+ metadata.gz: d8a42bdcb6ba6c7c844c746c82dadefdf88611ade5b9d75cf383c6995d843c6d161f5041727f4b06978a90ea5f5a44aa66ead09131e9a8cf56fe7b33fc07fe8c
7
+ data.tar.gz: 65e720ff86a38399b6b90342a37bfc9571a83156f4a2d7703bb9cb9c222813c1b59010c15d5e562b4fd1b5992bb6f745216b370bf3f339ff6c3f819505e77228
@@ -21,7 +21,10 @@ define(['ace', 'ace/keyboard/vim', 'style'], function() {
21
21
  };
22
22
  AceVimtura.Renderers = {};
23
23
  AceVimtura.Renderers.Vendor = {};
24
- AceVimtura.Views = {};
24
+ AceVimtura.Views = {
25
+ Help: '<h2>Ace Vimtura</h2><h3>Index</h3><h3>Mappings</h3><p>Type in <code>:map</code> to see mappings.<h3>Commands</h3><p><code>:help</code> show this text </p><p><code>:pre</code> toggle preview mode</p><p><code>:map</code> see key mappings</p><p><code>:w</code> or <code>:write</code> save current text to your browser</p><p><code>:q</code> or <code>:quit</code> close preview and also disable rendering</p><p><code>:set</code> or <code>:se</code> sets variable if value given, shows current value otherwise<h3>Variables</h3><p>theme</p><p>renderer<small>renderer only</small></p><p>filetype <small>changes both renderer and syntax hightlighter</small></p>',
26
+ Mappings: '<h2>Supported key bindings</h2><h3>Motion:</h3><p>h, j, k, l</p><p> gj, gk </p><p> e, E, w, W, b, B, ge, gE </p><p>f&lt;character&gt;, F&lt;character&gt;, t&lt;character&gt;, T&lt;character&gt; </p><p> $, ^, 0, -, +, _ </p><p> gg, G </p><p> % </p><p> \'&lt;character&gt;, `&lt;character&gt; </p><h3>Operator:</h3><p> d, y, c </p><p> dd, yy, cc </p><p> g~, g~g~ </p><p> &gt;, &lt;, &gt;&gt;, &lt;&lt; </p><h3> Operator-Motion: </h3><p> x, X, D, Y, C, ~ </p><h3> Action: </h3><p> a, i, s, A, I, S, o, O </p><p> zz, z., z&lt;CR&gt;, zt, zb, z- </p><p> J </p><p> u, Ctrl-r </p><p> m&lt;character&gt; </p><p> r&lt;character&gt; </p><h3> Modes: </h3><p> ESC - leave insert mode, visual mode, and clear input state. </p><p> Ctrl-[, Ctrl-c - same as ESC.</p>'
27
+ };
25
28
  AceVimtura.Utils = {};
26
29
  AceVimtura.init = function(id, options) {
27
30
  var div, i, key, len;
@@ -41,11 +44,10 @@ define(['ace', 'ace/keyboard/vim', 'style'], function() {
41
44
  this.ace.dom = div;
42
45
  this.ace.setKeyboardHandler('ace/keyboard/vim');
43
46
  this.vimapi = ace.require('ace/keyboard/vim').CodeMirror.Vim;
44
- this.setFiletype('markdown');
45
47
  this._initPreview();
46
48
  this.setTheme(AceVimtura.options.theme);
47
49
  this._defineCommands();
48
- this.load() || this.showHelp();
50
+ this.load() || this.showHelp() && this.setFiletype('markdown');
49
51
  if (options.autoFocus) {
50
52
  return this.ace.focus();
51
53
  }
@@ -96,14 +98,22 @@ define(['ace', 'ace/keyboard/vim', 'style'], function() {
96
98
  return this.filetypeName;
97
99
  };
98
100
  AceVimtura.goSplit = function() {
99
- this.ace.dom.classList.remove('fullscreen');
100
- this.preview.enable();
101
- return this.isSplit = true;
101
+ return require(['preview'], (function(_this) {
102
+ return function() {
103
+ _this.ace.dom.classList.remove('fullscreen');
104
+ _this.preview.enable();
105
+ return _this.isSplit = true;
106
+ };
107
+ })(this));
102
108
  };
103
109
  AceVimtura.goFullscreen = function() {
104
- this.ace.dom.classList.add('fullscreen');
105
- this.preview.disable();
106
- return this.isSplit = false;
110
+ return require(['preview'], (function(_this) {
111
+ return function() {
112
+ _this.ace.dom.classList.add('fullscreen');
113
+ _this.preview.disable();
114
+ return _this.isSplit = false;
115
+ };
116
+ })(this));
107
117
  };
108
118
  AceVimtura.toggleSplit = function() {
109
119
  if (this.isSplit) {
@@ -112,29 +122,45 @@ define(['ace', 'ace/keyboard/vim', 'style'], function() {
112
122
  return this.goSplit();
113
123
  }
114
124
  };
115
- AceVimtura.save = function() {
125
+ AceVimtura.save = function(filename) {
116
126
  var ls;
127
+ if (filename == null) {
128
+ filename = null;
129
+ }
117
130
  ls = window.localStorage;
118
- return ls.ace_vimtura_file = this.ace.getValue();
119
- };
120
- AceVimtura.load = function() {
121
- var data, ls;
131
+ filename || (filename = this.filename || 'noname');
132
+ ls.ace_vimtura_value = this.ace.getValue();
133
+ return ls.ace_vimtura_filetype = this.getFiletype();
134
+ };
135
+ AceVimtura.load = function(filename) {
136
+ var ls, val;
137
+ if (filename == null) {
138
+ filename = null;
139
+ }
122
140
  ls = window.localStorage;
123
- if (data = ls.ace_vimtura_file) {
124
- return this.ace.setValue(data);
125
- } else {
141
+ if (!(ls && (val = ls.ace_vimtura_value))) {
126
142
  return false;
127
143
  }
144
+ this.ace.setValue(val);
145
+ this.setFiletype(ls.ace_vimtura_filetype);
146
+ return true;
128
147
  };
129
148
  AceVimtura.showHelp = function() {
130
- this.save();
131
- this.goSplit();
132
- return this.preview.html(this.Views.Help);
149
+ return require(['preview'], (function(_this) {
150
+ return function() {
151
+ _this.goSplit();
152
+ return _this.preview.html(_this.Views.Help);
153
+ };
154
+ })(this));
133
155
  };
134
156
  AceVimtura.showMappings = function() {
135
- this.save();
136
- this.goSplit();
137
- return this.preview.html(this.Views.Mappings);
157
+ return require(['preview'], (function(_this) {
158
+ return function() {
159
+ _this.save();
160
+ _this.goSplit();
161
+ return _this.preview.html(_this.Views.Mappings);
162
+ };
163
+ })(this));
138
164
  };
139
165
  AceVimtura.setVariable = function(variable, value) {
140
166
  var methBase;
@@ -1,5 +1,5 @@
1
1
  module AceVimtura
2
2
  module Rails
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ace_vimtura-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - d-theus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-14 00:00:00.000000000 Z
11
+ date: 2015-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler