xiki 0.5.0a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +11 -0
- data/LICENSE +22 -0
- data/README.markdown +83 -0
- data/Rakefile +8 -0
- data/bin/xiki +46 -0
- data/etc/command/xiki_command.rb +203 -0
- data/etc/command/xiki_process.rb +52 -0
- data/etc/command/xiki_wrapper +2 -0
- data/etc/js/menu1.js +55 -0
- data/etc/js/xiki.js +259 -0
- data/etc/logo.png +0 -0
- data/etc/presentations/bootstrap.deck +5 -0
- data/etc/presentations/databases.deck +41 -0
- data/etc/presentations/diffs.deck +23 -0
- data/etc/presentations/documentation.deck +14 -0
- data/etc/presentations/effects.deck +5 -0
- data/etc/presentations/face.deck +297 -0
- data/etc/presentations/files.deck +79 -0
- data/etc/presentations/icons.deck +22 -0
- data/etc/presentations/images.deck +24 -0
- data/etc/presentations/key_shortcuts.deck +16 -0
- data/etc/presentations/macros.deck +18 -0
- data/etc/presentations/menu_classes.deck +44 -0
- data/etc/presentations/menu_directories.deck +30 -0
- data/etc/presentations/notes.deck +19 -0
- data/etc/presentations/other_languages.deck +55 -0
- data/etc/presentations/other_wiki_syntaxes.deck +4 -0
- data/etc/presentations/piano.deck +5 -0
- data/etc/presentations/potential/diffs.deck +38 -0
- data/etc/presentations/potential/evolution.deck +18 -0
- data/etc/presentations/potential/intro.deck +711 -0
- data/etc/presentations/potential/intro1.deck +711 -0
- data/etc/presentations/potential/intro2.deck +97 -0
- data/etc/presentations/potential/make_mysql_menu.deck +36 -0
- data/etc/presentations/potential/ruby_development.deck +17 -0
- data/etc/presentations/potential/ui_prototyping.deck +50 -0
- data/etc/presentations/potential/web_dev.deck +4 -0
- data/etc/presentations/potential/web_development.deck +10 -0
- data/etc/presentations/potential/wiki.deck +45 -0
- data/etc/presentations/presentations.deck +24 -0
- data/etc/presentations/rails_development.deck +29 -0
- data/etc/presentations/search_key_shortcuts.deck +37 -0
- data/etc/presentations/simplest_possible_ui.deck +37 -0
- data/etc/presentations/svg.deck +5 -0
- data/etc/presentations/testing.deck +28 -0
- data/etc/presentations/the_end.deck +13 -0
- data/etc/presentations/type_something_and_double_click.deck +57 -0
- data/etc/presentations/type_the_acronym.deck +144 -0
- data/etc/presentations/web_browser.deck +56 -0
- data/etc/presentations/xiki_command.deck +20 -0
- data/etc/presentations/xiki_url.deck +14 -0
- data/etc/shark.icns +0 -0
- data/etc/shark_script.icns +0 -0
- data/etc/snippets/html.notes +7 -0
- data/etc/snippets/notes.notes +20 -0
- data/etc/snippets/rb.notes +38 -0
- data/etc/templates/menu_template.menu +2 -0
- data/etc/templates/menu_template.rb +8 -0
- data/etc/templates/template.rb +5 -0
- data/etc/themes/Dark_Metal.notes +28 -0
- data/etc/themes/Orange_Path.notes +15 -0
- data/etc/themes/Shiny_Blue.notes +27 -0
- data/etc/themes/Shiny_Green.notes +27 -0
- data/etc/wrappers/wrapper.js +17 -0
- data/etc/wrappers/wrapper.py +20 -0
- data/etc/wrappers/wrapper.rb +25 -0
- data/lib/block.rb +72 -0
- data/lib/bookmarks.rb +352 -0
- data/lib/buffers.rb +170 -0
- data/lib/clipboard.rb +333 -0
- data/lib/code.rb +860 -0
- data/lib/code_tree.rb +476 -0
- data/lib/color.rb +274 -0
- data/lib/console.rb +557 -0
- data/lib/control_lock.rb +9 -0
- data/lib/control_tab.rb +176 -0
- data/lib/core_ext.rb +31 -0
- data/lib/cursor.rb +111 -0
- data/lib/deletes.rb +65 -0
- data/lib/diff_log.rb +297 -0
- data/lib/effects.rb +145 -0
- data/lib/environment.rb +5 -0
- data/lib/file_tree.rb +1875 -0
- data/lib/files.rb +334 -0
- data/lib/hide.rb +259 -0
- data/lib/history.rb +286 -0
- data/lib/image.rb +51 -0
- data/lib/incrementer.rb +15 -0
- data/lib/insert.rb +7 -0
- data/lib/irc.rb +22 -0
- data/lib/key_bindings.rb +658 -0
- data/lib/keys.rb +754 -0
- data/lib/launcher.rb +1351 -0
- data/lib/line.rb +429 -0
- data/lib/links.rb +6 -0
- data/lib/location.rb +175 -0
- data/lib/macros.rb +48 -0
- data/lib/man.rb +19 -0
- data/lib/menu.rb +708 -0
- data/lib/merb.rb +259 -0
- data/lib/message.rb +5 -0
- data/lib/meths.rb +56 -0
- data/lib/mode.rb +34 -0
- data/lib/move.rb +248 -0
- data/lib/notes.rb +1000 -0
- data/lib/numbers.rb +45 -0
- data/lib/ol.rb +203 -0
- data/lib/ol_helper.rb +44 -0
- data/lib/overlay.rb +167 -0
- data/lib/pause_means_space.rb +68 -0
- data/lib/php.rb +22 -0
- data/lib/projects.rb +21 -0
- data/lib/relinquish_exception.rb +2 -0
- data/lib/remote.rb +206 -0
- data/lib/requirer.rb +46 -0
- data/lib/rest_tree.rb +108 -0
- data/lib/ruby.rb +57 -0
- data/lib/ruby_console.rb +165 -0
- data/lib/search.rb +1572 -0
- data/lib/search_term.rb +40 -0
- data/lib/snippet.rb +68 -0
- data/lib/specs.rb +229 -0
- data/lib/styles.rb +274 -0
- data/lib/svn.rb +682 -0
- data/lib/text_util.rb +110 -0
- data/lib/tree.rb +1871 -0
- data/lib/tree_cursor.rb +87 -0
- data/lib/trouble_shooting.rb +27 -0
- data/lib/url_tree.rb +11 -0
- data/lib/view.rb +1474 -0
- data/lib/window.rb +133 -0
- data/lib/xiki.rb +404 -0
- data/menus/accounts.rb +5 -0
- data/menus/address_book.rb +21 -0
- data/menus/agenda.rb +28 -0
- data/menus/all.rb +5 -0
- data/menus/amazon.rb +16 -0
- data/menus/app.rb +16 -0
- data/menus/applescript.rb +46 -0
- data/menus/as.rb +15 -0
- data/menus/bookmarklet.rb +63 -0
- data/menus/bootstrap.rb +568 -0
- data/menus/browse.rb +13 -0
- data/menus/browser.rb +78 -0
- data/menus/cassandra_db.rb +36 -0
- data/menus/chmod.rb +27 -0
- data/menus/classes.rb +5 -0
- data/menus/coffee_script.rb +35 -0
- data/menus/computer.rb +24 -0
- data/menus/contacts.rb +5 -0
- data/menus/cookies.rb +25 -0
- data/menus/couch.rb +184 -0
- data/menus/crop.rb +45 -0
- data/menus/css.rb +55 -0
- data/menus/current.rb +5 -0
- data/menus/db.rb +12 -0
- data/menus/deck.rb +219 -0
- data/menus/dictionary.rb +9 -0
- data/menus/dir.rb +8 -0
- data/menus/disk.rb +5 -0
- data/menus/do.rb +13 -0
- data/menus/docs.rb +58 -0
- data/menus/dotsies.rb +107 -0
- data/menus/edited.rb +18 -0
- data/menus/emacs.rb +17 -0
- data/menus/enter.rb +13 -0
- data/menus/eval.rb +17 -0
- data/menus/executable.rb +16 -0
- data/menus/filter.rb +46 -0
- data/menus/firefox.rb +607 -0
- data/menus/foo.rb +30 -0
- data/menus/french.rb +7 -0
- data/menus/git.rb +185 -0
- data/menus/gito.rb +785 -0
- data/menus/google.rb +35 -0
- data/menus/google_images.rb +11 -0
- data/menus/google_patents.rb +10 -0
- data/menus/gutenberg.rb +13 -0
- data/menus/head.rb +10 -0
- data/menus/headings.rb +39 -0
- data/menus/html.rb +61 -0
- data/menus/icon.rb +40 -0
- data/menus/images.menu +2 -0
- data/menus/img.rb +15 -0
- data/menus/info.rb +9 -0
- data/menus/ip.rb +10 -0
- data/menus/iterm.rb +36 -0
- data/menus/itunes.rb +78 -0
- data/menus/javascript.rb +74 -0
- data/menus/layout.rb +18 -0
- data/menus/local_storage.rb +67 -0
- data/menus/ls.rb +19 -0
- data/menus/mac.rb +87 -0
- data/menus/maps.rb +18 -0
- data/menus/matches.rb +18 -0
- data/menus/memcache.rb +117 -0
- data/menus/mkdir.rb +23 -0
- data/menus/mongo.rb +83 -0
- data/menus/mysql.rb +294 -0
- data/menus/node.rb +88 -0
- data/menus/open.rb +19 -0
- data/menus/outline.rb +24 -0
- data/menus/piano.rb +746 -0
- data/menus/postgres.rb +34 -0
- data/menus/pre.rb +5 -0
- data/menus/python.rb +39 -0
- data/menus/rails.rb +160 -0
- data/menus/rake.rb +12 -0
- data/menus/redmine.rb +168 -0
- data/menus/riak_tree.rb +204 -0
- data/menus/rss.rb +15 -0
- data/menus/safari.rb +11 -0
- data/menus/sass.rb +15 -0
- data/menus/say.rb +6 -0
- data/menus/scale.rb +49 -0
- data/menus/serve.rb +78 -0
- data/menus/shuffle.rb +24 -0
- data/menus/spanish.rb +7 -0
- data/menus/standalone.rb +57 -0
- data/menus/tail.rb +41 -0
- data/menus/technologies.rb +19 -0
- data/menus/themes.rb +32 -0
- data/menus/thesaurus.rb +13 -0
- data/menus/to.rb +24 -0
- data/menus/twitter.rb +57 -0
- data/menus/wikipedia.rb +34 -0
- data/menus/words.rb +11 -0
- data/spec/code_tree_spec.rb +59 -0
- data/spec/diff_log_spec.rb +40 -0
- data/spec/file_tree_spec.rb +102 -0
- data/spec/keys_spec.rb +24 -0
- data/spec/line_spec.rb +68 -0
- data/spec/menu_spec.rb +50 -0
- data/spec/ol_spec.rb +98 -0
- data/spec/remote_spec.rb +43 -0
- data/spec/search_spec.rb +162 -0
- data/spec/text_util_spec.rb +119 -0
- data/spec/tree_cursor_spec.rb +91 -0
- data/spec/tree_spec.rb +955 -0
- data/tests/console_test.rb +11 -0
- data/tests/couch_db_test.rb +12 -0
- data/tests/diff_log_test.rb +43 -0
- data/tests/el_mixin.rb +16 -0
- data/tests/git_test.rb +95 -0
- data/tests/keys_test.rb +19 -0
- data/tests/line_test.rb +38 -0
- data/tests/merb_test.rb +11 -0
- data/tests/redmine_test.rb +50 -0
- data/tests/remote_test.rb +31 -0
- data/tests/rest_tree_test.rb +70 -0
- data/xiki.gemspec +37 -0
- metadata +332 -0
data/lib/history.rb
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
class History
|
|
2
|
+
|
|
3
|
+
# FILENAME = File.expand_path "~/.emacs.d/menu_log.notes"
|
|
4
|
+
# Unused
|
|
5
|
+
def self.menu
|
|
6
|
+
"
|
|
7
|
+
- menus) @log/
|
|
8
|
+
|
|
9
|
+
> Files
|
|
10
|
+
- .unsaved files/
|
|
11
|
+
- @edited/
|
|
12
|
+
- @files/history/
|
|
13
|
+
"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.prefix_times
|
|
17
|
+
prefix = Keys.prefix
|
|
18
|
+
prefix ||= 20
|
|
19
|
+
prefix = 20 if prefix == :u
|
|
20
|
+
prefix
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.open_current options={}
|
|
24
|
+
if options[:paths]
|
|
25
|
+
paths = options[:paths]
|
|
26
|
+
elsif options[:prompt_for_bookmark]
|
|
27
|
+
bm = Keys.input(:timed => true, :prompt => "Enter bookmark to show content for: ")
|
|
28
|
+
path = Bookmarks.expand(bm, :just_bookmark => true)
|
|
29
|
+
path = File.expand_path(path)
|
|
30
|
+
|
|
31
|
+
if ! options[:all] && View.files.member?(path)
|
|
32
|
+
View.open path
|
|
33
|
+
FileTree.to_outline
|
|
34
|
+
return
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
paths = [path]
|
|
38
|
+
elsif options[:outline] || options[:all]
|
|
39
|
+
paths = [$el.buffer_file_name($el.buffer_list[0])]
|
|
40
|
+
else # No options passed
|
|
41
|
+
times = Keys.prefix
|
|
42
|
+
paths = ( $el.buffer_list.map { |b| $el.buffer_file_name(b) }.select{|path| path})
|
|
43
|
+
paths = paths[0..(times-1)] if times # Limit to number if prefix passed
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
if options[:enter_here] # If entering in current file
|
|
47
|
+
path = paths.to_s
|
|
48
|
+
# If it's a dir, delegate to Open Tree
|
|
49
|
+
if path =~ /\/$/
|
|
50
|
+
FileTree.ls :here => true, :dir => path
|
|
51
|
+
return
|
|
52
|
+
end
|
|
53
|
+
View.insert "- " + FileTree.filename_to_next_line(paths.to_s)
|
|
54
|
+
$el.open_line 1
|
|
55
|
+
FileTree.enter_lines
|
|
56
|
+
|
|
57
|
+
else # If entering in new buffer
|
|
58
|
+
|
|
59
|
+
# By default happen in same view
|
|
60
|
+
View.bar if options[:bar] # If to go to bar
|
|
61
|
+
|
|
62
|
+
# If only one path, go to it's buffer if already open
|
|
63
|
+
if paths.size == 1
|
|
64
|
+
View.open paths[0]
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
View.to_buffer("*tree of current")
|
|
68
|
+
View.clear; Notes.mode
|
|
69
|
+
|
|
70
|
+
raise "Thought this wouldn't happen :(" if paths.length > 1
|
|
71
|
+
|
|
72
|
+
dir, file = paths[0].match(/(.+\/)(.+)/)[1..2]
|
|
73
|
+
View << "- #{dir}\n - #{file}\n"
|
|
74
|
+
|
|
75
|
+
View.to_top
|
|
76
|
+
Keys.clear_prefix
|
|
77
|
+
FileTree.select_next_file
|
|
78
|
+
if options[:all]
|
|
79
|
+
FileTree.enter_lines(//)
|
|
80
|
+
elsif options[:outline] || options[:prompt_for_bookmark]
|
|
81
|
+
FileTree.enter_lines
|
|
82
|
+
else
|
|
83
|
+
Tree.search :recursive => true
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def self.open_edited
|
|
90
|
+
times = self.prefix_times
|
|
91
|
+
View.to_buffer("*tree of edited")
|
|
92
|
+
View.clear; notes_mode
|
|
93
|
+
View.insert Tree.paths_to_tree($el.elvar.editedhistory_history.to_a[0..(times-1)])
|
|
94
|
+
View.to_top
|
|
95
|
+
Keys.clear_prefix
|
|
96
|
+
FileTree.select_next_file
|
|
97
|
+
Tree.search :recursive => true
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def self.open_history
|
|
101
|
+
times = self.prefix_times
|
|
102
|
+
View.to_buffer("*tree of history")
|
|
103
|
+
View.clear; notes_mode
|
|
104
|
+
|
|
105
|
+
self.insert_history times
|
|
106
|
+
View.to_top
|
|
107
|
+
Keys.clear_prefix
|
|
108
|
+
FileTree.select_next_file
|
|
109
|
+
Tree.search :recursive => true
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def self.insert_history times
|
|
113
|
+
View.insert Tree.paths_to_tree($el.elvar.recentf_list.to_a[0..(times-1)])
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def self.enter_history
|
|
117
|
+
orig = Location.new
|
|
118
|
+
self.insert_history self.prefix_times
|
|
119
|
+
right = $el.point
|
|
120
|
+
orig.go
|
|
121
|
+
Tree.search :recursive => true, :left => $el.point, :right => right
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def self.insert_viewing times
|
|
125
|
+
paths = ( $el.buffer_list.map { |b| $el.buffer_file_name(b) }.select{|path| path})
|
|
126
|
+
paths = paths[0..(times-1)] if times # Limit to number if prefix passed
|
|
127
|
+
View.insert Tree.paths_to_tree(paths)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def self.enter_viewing
|
|
131
|
+
orig = Location.new
|
|
132
|
+
self.insert_viewing self.prefix_times
|
|
133
|
+
right = $el.point
|
|
134
|
+
orig.go
|
|
135
|
+
Tree.search :recursive => true, :left => $el.point, :right => right
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def self.unsaved_files
|
|
139
|
+
|
|
140
|
+
# Narrow down to modified buffer only
|
|
141
|
+
buffers = $el.buffer_list.to_a.
|
|
142
|
+
select{|b| $el.buffer_modified_p(b)}.
|
|
143
|
+
select{|b| $el.buffer_file_name(b)}
|
|
144
|
+
|
|
145
|
+
if (buffers.size == 0)
|
|
146
|
+
return "- No files unsaved!\n"
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
txt = ""
|
|
150
|
+
|
|
151
|
+
buffers.each do |b|
|
|
152
|
+
path = $el.buffer_file_name(b)
|
|
153
|
+
$el.with(:save_excursion) do
|
|
154
|
+
$el.set_buffer b
|
|
155
|
+
|
|
156
|
+
diffs = DiffLog.save_diffs :dont_log=>1
|
|
157
|
+
|
|
158
|
+
if ! diffs
|
|
159
|
+
diffs = " | File no longer exists?\n" if ! File.exists?(path)
|
|
160
|
+
diffs ||= " | no changes\n"
|
|
161
|
+
end
|
|
162
|
+
diffs = diffs.sub(/^.+\n.+\n/, '').gsub /^ /, ''
|
|
163
|
+
|
|
164
|
+
txt << "@#{path}\n"
|
|
165
|
+
txt << diffs
|
|
166
|
+
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
txt
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def self.setup_editedhistory
|
|
174
|
+
|
|
175
|
+
return if ! $el
|
|
176
|
+
|
|
177
|
+
$el.el4r_lisp_eval %q<
|
|
178
|
+
(progn
|
|
179
|
+
; Settings
|
|
180
|
+
(setq editedhistory-log "~/.editedhistory")
|
|
181
|
+
|
|
182
|
+
; Runs upon startup. Load log file into memory if it exists. Run this manually if you edit the log file.
|
|
183
|
+
(defun editedhistory-load ()
|
|
184
|
+
(if (file-readable-p editedhistory-log)
|
|
185
|
+
; Read from file into memory
|
|
186
|
+
(with-temp-buffer
|
|
187
|
+
(insert-file-contents editedhistory-log nil nil nil t)
|
|
188
|
+
(setq editedhistory-history
|
|
189
|
+
(car (read-from-string (buffer-substring (point-min) (point-max))) )))
|
|
190
|
+
; Otherwise, initialize var
|
|
191
|
+
(set 'editedhistory-history nil)))
|
|
192
|
+
|
|
193
|
+
; Saves on exit: 'editedhistory-history' to the file 'editedhistory-log'
|
|
194
|
+
(add-hook 'kill-emacs-hook 'editedhistory-save)
|
|
195
|
+
(defun editedhistory-save () (interactive)
|
|
196
|
+
(with-temp-buffer
|
|
197
|
+
(erase-buffer)
|
|
198
|
+
(insert (pp-to-string editedhistory-history) )
|
|
199
|
+
(if (file-writable-p editedhistory-log)
|
|
200
|
+
(write-region (point-min) (point-max) editedhistory-log)
|
|
201
|
+
)
|
|
202
|
+
(kill-buffer (current-buffer)))
|
|
203
|
+
nil)
|
|
204
|
+
|
|
205
|
+
; Runs upon save: Track modified files
|
|
206
|
+
(defun editedhistory-remember-file ()
|
|
207
|
+
; Remove from list in case it's already there (we want to add to beginning)
|
|
208
|
+
(when (boundp 'editedhistory-history)
|
|
209
|
+
(setq editedhistory-history (delete buffer-file-name editedhistory-history) )
|
|
210
|
+
; Add to list
|
|
211
|
+
(add-to-list 'editedhistory-history buffer-file-name))
|
|
212
|
+
nil) ; Return nil so we won't block writing
|
|
213
|
+
(add-hook 'write-file-hooks 'editedhistory-remember-file)
|
|
214
|
+
|
|
215
|
+
; Load upon startup, to add hooks
|
|
216
|
+
(define-minor-mode editedhistory-mode
|
|
217
|
+
"Toggle editedhistory mode"
|
|
218
|
+
:global t
|
|
219
|
+
:group 'editedhistory
|
|
220
|
+
|
|
221
|
+
; Load if not yet loaded
|
|
222
|
+
(pp (boundp 'editedhistory-loaded-p))
|
|
223
|
+
(unless (boundp 'editedhistory-loaded-p)
|
|
224
|
+
(setq editedhistory-loaded-p t)
|
|
225
|
+
(pp editedhistory-loaded-p)
|
|
226
|
+
; Load log file into memory
|
|
227
|
+
(editedhistory-load)))
|
|
228
|
+
|
|
229
|
+
; Load mode
|
|
230
|
+
(editedhistory-mode t)
|
|
231
|
+
)
|
|
232
|
+
>
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def self.backup_file
|
|
236
|
+
bm = Bookmarks['$bak']
|
|
237
|
+
return View.beep "- First, set the 'bak' bookmark to a dir!" if bm == "$bak"
|
|
238
|
+
|
|
239
|
+
unless bm.any? # If no bookmark, just show error
|
|
240
|
+
View.beep
|
|
241
|
+
return View.message("Error: create a bookmark named 'bak' first, in a dir where you backups will go.")
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
path = Keys.prefix_u? ?
|
|
245
|
+
View.file :
|
|
246
|
+
FileTree.tree_path_or_this_file
|
|
247
|
+
|
|
248
|
+
name = path.sub(/.+\//, '')
|
|
249
|
+
|
|
250
|
+
# Copy file xx
|
|
251
|
+
$el.copy_file path, "#{bm}#{name}.#{Time.now.strftime('%Y-%m-%d.%H-%M')}"
|
|
252
|
+
|
|
253
|
+
message = "backed up to $bak: '#{name}'"
|
|
254
|
+
View.flash "- #{message}", :times=>3
|
|
255
|
+
View.message "Successfully #{message}"
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def self.diff_with_backup
|
|
259
|
+
|
|
260
|
+
if Keys.prefix_u
|
|
261
|
+
$el.ediff_files Dir["#{Bookmarks['$bak']}#{View.file_name}*"].last, View.file
|
|
262
|
+
return
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
backup = Dir["#{Bookmarks['$bak']}#{View.file_name}*"].last
|
|
266
|
+
|
|
267
|
+
return View.beep("- No backup exists in $bak/") if ! backup
|
|
268
|
+
|
|
269
|
+
diff = Console.run "diff -U 0 \"#{backup}\" \"#{$el.buffer_file_name}\"", :sync=>true
|
|
270
|
+
|
|
271
|
+
return Launcher.show "- No Differences!" if diff.blank?
|
|
272
|
+
|
|
273
|
+
diff = DiffLog.format diff
|
|
274
|
+
|
|
275
|
+
View.to_buffer("*diff with saved*")
|
|
276
|
+
View.clear
|
|
277
|
+
Notes.mode
|
|
278
|
+
|
|
279
|
+
$el.insert diff.count("\n") > 2 ?
|
|
280
|
+
diff :
|
|
281
|
+
"| Alert\n- ~No Differences~\n"
|
|
282
|
+
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
end
|
|
286
|
+
History.setup_editedhistory
|
data/lib/image.rb
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'ftools'
|
|
2
|
+
|
|
3
|
+
class Image
|
|
4
|
+
def self.menu_before *args
|
|
5
|
+
if args[-1] =~ /\.(png|gif|jpg)\/?$/
|
|
6
|
+
path = args.join('/')
|
|
7
|
+
Notes.enter_junior
|
|
8
|
+
Image << path
|
|
9
|
+
View.cursor = Line.right - 1
|
|
10
|
+
return false # Tell it to not continue to menu
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.menu
|
|
15
|
+
%`
|
|
16
|
+
.log/
|
|
17
|
+
docs/
|
|
18
|
+
> Show image underneath
|
|
19
|
+
@image//tmp/draw_rect.gif
|
|
20
|
+
api/
|
|
21
|
+
> Examples
|
|
22
|
+
| Insert an image:
|
|
23
|
+
@Image << "/tmp/draw_rect.gif"
|
|
24
|
+
`
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.>> file, txt=nil
|
|
28
|
+
txt ||= "@img/#{file}"
|
|
29
|
+
Move.to_end
|
|
30
|
+
self.<< file, txt, :enter_junior=>1
|
|
31
|
+
Move.backward
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def self.<< file, txt=nil, options={}
|
|
35
|
+
txt ||= "@img/#{file}"
|
|
36
|
+
|
|
37
|
+
# Copy to place with unique name, so a cached version doesn't get displayed...
|
|
38
|
+
tmp_dir = "/tmp/img_tmp/"
|
|
39
|
+
Dir.mkdir tmp_dir if ! File.directory? tmp_dir
|
|
40
|
+
|
|
41
|
+
# Copy to place with unique name, so a cached version doesn't get displayed.
|
|
42
|
+
|
|
43
|
+
unique_tmp_file = "#{tmp_dir}#{File.basename(file).sub /.+\./, "\\0#{rand(99999)}."}"
|
|
44
|
+
|
|
45
|
+
File.copy file, unique_tmp_file
|
|
46
|
+
|
|
47
|
+
Notes.enter_junior if options[:enter_junior]
|
|
48
|
+
|
|
49
|
+
$el.insert_image $el.create_image(unique_tmp_file), txt
|
|
50
|
+
end
|
|
51
|
+
end
|
data/lib/incrementer.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Helps you to insert "1", "2", "3".... Useful during macros.
|
|
2
|
+
class Incrementer
|
|
3
|
+
def self.start
|
|
4
|
+
Clipboard['n'] = (Keys.prefix_n || 0).to_s
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def self.increment
|
|
8
|
+
Clipboard['n'] = Clipboard['n'].next
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.enter
|
|
12
|
+
self.increment if Keys.prefix_u
|
|
13
|
+
View.insert Clipboard['n']
|
|
14
|
+
end
|
|
15
|
+
end
|
data/lib/insert.rb
ADDED
data/lib/irc.rb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
class Irc
|
|
2
|
+
|
|
3
|
+
def self.menu
|
|
4
|
+
"
|
|
5
|
+
- .logon
|
|
6
|
+
- room (o): /j merb
|
|
7
|
+
- identify (o): /m nickserv IDENTIFY #{self.pw}
|
|
8
|
+
"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.logon
|
|
12
|
+
View.handle_bar
|
|
13
|
+
$el.el4r_lisp_eval "(erc :server \"irc.freenode.net\" :nick \"#{@@username}\")"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.username= to; @@username = to; end
|
|
17
|
+
def self.username; @@username; end
|
|
18
|
+
|
|
19
|
+
def self.pw; @@pw; end
|
|
20
|
+
def self.pw= to; @@pw = to; end
|
|
21
|
+
|
|
22
|
+
end
|
data/lib/key_bindings.rb
ADDED
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
class KeyBindings
|
|
2
|
+
|
|
3
|
+
# Define all keys
|
|
4
|
+
def self.keys
|
|
5
|
+
Menu.init
|
|
6
|
+
|
|
7
|
+
self.as_keys
|
|
8
|
+
self.open_keys
|
|
9
|
+
self.enter_keys
|
|
10
|
+
self.to_keys
|
|
11
|
+
self.layout_keys
|
|
12
|
+
self.do_keys
|
|
13
|
+
self.isearch
|
|
14
|
+
self.misc
|
|
15
|
+
|
|
16
|
+
Keys.add_menu_items
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.as_keys
|
|
20
|
+
# A: as...
|
|
21
|
+
# Use A prefix for: remembering, saving
|
|
22
|
+
|
|
23
|
+
Keys.AA { Line.to_left } # AA - beginning of line (A's default)
|
|
24
|
+
Keys.as_bookmark { Bookmarks.save } # remember bookmark
|
|
25
|
+
Keys.as_clipboard { Clipboard.as_clipboard } #
|
|
26
|
+
# Keys.as_directory { FileTree.copy_path } # copy dir to clipboard from tree
|
|
27
|
+
Keys.as_delete { Launcher.as_delete } # copy dir to clipboard from tree
|
|
28
|
+
Keys.as_everything { Clipboard.copy_everything }
|
|
29
|
+
Keys.as_file { DiffLog.save } # save (or, with prefix, save as)
|
|
30
|
+
Keys.as_history { History.backup_file } # creates backup
|
|
31
|
+
Keys.as_indented { CodeTree.as_indented }
|
|
32
|
+
Keys.as_job { Macros.record } # start recording macro
|
|
33
|
+
Keys.as_kill { Clipboard.cut(0); Location.as_spot('killed') } # cut)
|
|
34
|
+
Keys.as_line { Clipboard.as_line }
|
|
35
|
+
Keys.as_menu { Menu.as_menu }
|
|
36
|
+
Keys.as_nav { Notes.as_nav }
|
|
37
|
+
Keys.as_open { Launcher.as_open } # copy object / symbol at point
|
|
38
|
+
Keys.as_paragraph { Clipboard.copy_paragraph } # copy paragraph
|
|
39
|
+
Keys.as_quick { Bookmarks.save :q } # like AB but uses different temporary namespace
|
|
40
|
+
Keys.as_rest { Clipboard.copy_paragraph(:rest => true) }
|
|
41
|
+
Keys.as_spot { Location.as_spot } # remember point in file
|
|
42
|
+
Keys.as_todo { Notes.as_todo }
|
|
43
|
+
Keys.as_update { Launcher.as_update }
|
|
44
|
+
# U
|
|
45
|
+
|
|
46
|
+
# TODO: make this be as_variable?
|
|
47
|
+
# like: Keys.as_name { Clipboard.copy } # copies using key (prompted for)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Keys.as_variable { Clipboard.copy } # Copy to variable
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# Think of another key for backing it up?
|
|
54
|
+
|
|
55
|
+
Keys.as_window { View.save } # remember window configuration as name
|
|
56
|
+
Keys.as_you { Clipboard.as_thing } # copy object / symbol at point
|
|
57
|
+
|
|
58
|
+
# Y
|
|
59
|
+
# Z
|
|
60
|
+
#Keys.A0 { Clipboard.copy("0") } # As 0: copy as key "0"
|
|
61
|
+
Keys.A1 { Clipboard.copy("1") } # As 1
|
|
62
|
+
Keys.A2 { Clipboard.copy("2") }; Keys.A3 { Clipboard.copy("3") }; Keys.A4 { Clipboard.copy("4") }
|
|
63
|
+
Keys.A5 { Clipboard.copy("5") }; Keys.A6 { Clipboard.copy("6") }; Keys.A7 { Clipboard.copy("7") }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.open_keys
|
|
67
|
+
# O: open...
|
|
68
|
+
# Use O prefix for: opening, jumping to files
|
|
69
|
+
|
|
70
|
+
Keys.OO { $el.open_line $el.elvar.current_prefix_arg || 1 } # OO - open line (O's default)
|
|
71
|
+
Keys.open_a_calendar { $el.calendar }
|
|
72
|
+
#Keys.OAD { Svn.jump_to_diff }
|
|
73
|
+
Keys.open_as_file { Code.open_as_file }
|
|
74
|
+
Keys.open_as_elisp { $el.find_function_at_point } # jump to definition of lisp function
|
|
75
|
+
Keys.open_as_highest { FileTree.open_as_upper }
|
|
76
|
+
Keys.open_as_lowest { FileTree.open_as_upper(:lowest) }
|
|
77
|
+
Keys.open_as_utf { $el.revert_buffer_with_coding_system('utf-8'.to_sym) }
|
|
78
|
+
Keys.open_as_2 { FileTree.open_as_upper(:second) }
|
|
79
|
+
Keys.open_as_root { Files.open_sudo }
|
|
80
|
+
Keys.open_a_shell { Console.open }
|
|
81
|
+
Keys.open_as_tail { Files.open_tail }
|
|
82
|
+
Keys.open_bookmark { Bookmarks.go }
|
|
83
|
+
Keys.open_current { Launcher.open("- current/") } # open buffer list
|
|
84
|
+
Keys.open_diffs { DiffLog.open } # shows diffs of what you've edited
|
|
85
|
+
Keys.open_edited { Files.open_edited } # show recently edited files
|
|
86
|
+
Keys.open_file { Files.open }
|
|
87
|
+
# G: leave unmapped for escape
|
|
88
|
+
Keys.open_history { Launcher.open("- files/history/") } # show recently viewed files
|
|
89
|
+
Keys.open_in_browser { Browser.open_in_browser }
|
|
90
|
+
Keys.open_in_left { View.open_in_bar }
|
|
91
|
+
Keys.open_in_os { Files.open_in_os }
|
|
92
|
+
Keys.open_in_right { View.open_in_right }
|
|
93
|
+
Keys.open_in_window { Files.open_in_window } # Expose file in OS folder
|
|
94
|
+
Keys.open_just { Files.open_just }
|
|
95
|
+
Keys.open_key { Keys.jump_to_code } # jump to ruby code of key definition
|
|
96
|
+
Keys.open_list_appointments { View.bar; Launcher.open("- Agenda.menu/") }
|
|
97
|
+
Keys.open_list_bookmarks { Launcher.open("bookmarks/list/") }
|
|
98
|
+
Keys.open_list_clipboard { Launcher.open("clipboard/log/") }
|
|
99
|
+
# Keys.open_last_error { Code.show_el4r_error }
|
|
100
|
+
Keys.open_list_faces { Styles.list_faces }
|
|
101
|
+
# Keys.open_list_flashes { Launcher.open "- view/flashes/" }
|
|
102
|
+
# Keys.open_list_faces { list_faces_display }
|
|
103
|
+
Keys.open_lisp_info { $el.info "elisp" } # Open manual
|
|
104
|
+
|
|
105
|
+
# Keys.open_log_list { Launcher.open(Keys.prefix_u ? "- last/" : "- log/") } # Show git diffs o 1 file
|
|
106
|
+
Keys.open_log_list { Git.show_log_one_file } # Show git diffs o 1 file
|
|
107
|
+
|
|
108
|
+
# Keys.open_list_styles { list_faces_display }
|
|
109
|
+
Keys.open_last_output { Ol.open_last_output } # Show git diffs for a bookmark
|
|
110
|
+
Keys.open_log_push { Gito.show_log } # Show git diffs for a bookmark
|
|
111
|
+
Keys.open_last_screenshot { Files.open_last_screenshot }
|
|
112
|
+
# Keys.open_like_text { txt = View.txt; View.to_buffer "txt"; View << txt }
|
|
113
|
+
# Keys.open_log_tree { Rails.tree_from_log }
|
|
114
|
+
Keys.open_list_databases { Launcher.open('- Couch.databases/') }
|
|
115
|
+
# Keys.open_list_models { Launcher.open("- Merb.models/") }
|
|
116
|
+
Keys.open_list_javascript { Launcher.open("- technologies/javascript/") }
|
|
117
|
+
Keys.open_list_names { Clipboard.list }
|
|
118
|
+
Keys.open_list_ruby { Launcher.open("- technologies/ruby/") }
|
|
119
|
+
Keys.open_list_technologies { Launcher.open("- technologies/") } # open first hyperlink on page
|
|
120
|
+
Keys.open_last_urls { Launcher.open "- last/urls/" }
|
|
121
|
+
Keys.open_menu { Xiki.open_menu } # Open all menus and show them
|
|
122
|
+
Keys.open_not_saved { Launcher.open("- history/unsaved files/") }
|
|
123
|
+
# O: defined above - mapped to what C-o does by default
|
|
124
|
+
Keys.open_point { Bookmarks.go(nil, :point => true) }
|
|
125
|
+
Keys.open_quick { Bookmarks.open_quick } # like OB but uses different temporary namespace
|
|
126
|
+
Keys.open_related_test { Code.open_related_rspec }
|
|
127
|
+
Keys.open_related_file { Code.open_related_file }
|
|
128
|
+
Keys.open_repository_list { Gito.show_log_one_file } # Show git diffs o 1 file
|
|
129
|
+
# S
|
|
130
|
+
Keys.open_search { Search.outline_search } # hide search via outline
|
|
131
|
+
Keys.open_tree { FileTree.tree } # draw a tree, prompting for bookmark tag
|
|
132
|
+
Keys.open_up { View.show_dir } # open enclosing dir
|
|
133
|
+
Keys.open_visualize { Code.do_list_ancestors } # show currently open files and buffers
|
|
134
|
+
Keys.open_windows { View.restore } # open window configuration by name
|
|
135
|
+
Keys.open_xiki_docs { Help.display_docs }
|
|
136
|
+
Keys.open_xiki_help { Launcher.open("- Help.menu/") } #
|
|
137
|
+
# Y
|
|
138
|
+
# Z
|
|
139
|
+
|
|
140
|
+
# Keys.O0 {} # Open 0: open bookmarked file tagged with "0"
|
|
141
|
+
|
|
142
|
+
Keys.O1 { Files.open_nth 1 }; Keys.O2 { Files.open_nth 2 }; Keys.O3 { Files.open_nth 3 }; Keys.O4 { Files.open_nth 4 }; Keys.O5 { Files.open_nth 5 }
|
|
143
|
+
Keys.O6 { Files.open_nth 6 }; Keys.O7 { Files.open_nth 7 }; Keys.O8 { Files.open_nth 8 }; Keys.O9 { Files.open_nth 9 }
|
|
144
|
+
|
|
145
|
+
Keys.O0 { View.open("$0") } # Open 0: open bookmarked file tagged with "0"
|
|
146
|
+
|
|
147
|
+
Keys.O8 { History.open_current :all => true, :prompt_for_bookmark => true } # Like do_outline, but inserts all
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def self.enter_keys
|
|
151
|
+
# E: enter...
|
|
152
|
+
# Use E prefix for: inserting
|
|
153
|
+
|
|
154
|
+
# TODO find different word?
|
|
155
|
+
# - Because "enter" can be confused with the enter key?
|
|
156
|
+
# - ideas: embed, emit, entry
|
|
157
|
+
Keys.EE { Line.to_right } # EE - end of line (E's default)
|
|
158
|
+
Keys.enter_all { Launcher.enter_all }
|
|
159
|
+
Keys.enter_bullet { Notes.bullet }
|
|
160
|
+
Keys.enter_clipboard { Clipboard.paste("0") } # paste
|
|
161
|
+
Keys.enter_docs { Line.enter_docs }
|
|
162
|
+
# E: defined above - mapped to what C-e does by default
|
|
163
|
+
Keys.enter_file_path { Files.enter_file } # Given a bookmark
|
|
164
|
+
Keys.enter_firefox_tabs { Launcher.insert('- Firefox.tabs/') } # Given a bookmark
|
|
165
|
+
Keys.enter_history { DiffLog.enter_from_difflog } # Save point and go to difflog to search
|
|
166
|
+
Keys.enter_insert_1 { Notes.enter_do_bullet } # insert date string (and time if C-u)
|
|
167
|
+
Keys.enter_insert_date { View.enter_date }
|
|
168
|
+
Keys.enter_insert_comment { Code.enter_insert_comment } # insert date string (and time if C-u)
|
|
169
|
+
Keys.enter_insert_new { DiffLog.enter_new } # Enter Old: enter newly-deleted from last save
|
|
170
|
+
Keys.enter_insert_ruby { code = Keys.input(:prompt=>"Enter ruby code to eval and insert results: "); View.insert(eval(code).to_s)}
|
|
171
|
+
Keys.enter_insert_search { Search.enter_insert_search }
|
|
172
|
+
|
|
173
|
+
Keys.enter_insert_old { DiffLog.enter_old } # Enter Old: enter newly-deleted from last save
|
|
174
|
+
|
|
175
|
+
Keys.enter_insert_words { PauseMeansSpace.go }
|
|
176
|
+
Keys.enter_junior { Notes.enter_junior }
|
|
177
|
+
Keys.enter_key { Keys.insert_code }
|
|
178
|
+
Keys.enter_last_commands {
|
|
179
|
+
bm = Keys.input(:timed => true, :prompt => "bookmark to show commands for (space for currently open): ")
|
|
180
|
+
return Launcher.insert("- Console.tree/") if bm == " "
|
|
181
|
+
Launcher.insert("- Console.history \"$#{bm}\"/")
|
|
182
|
+
}
|
|
183
|
+
Keys.enter_list_databases { Launcher.insert('- Couch.databases/') }
|
|
184
|
+
Keys.enter_like_edits { Search.enter_like_edits }
|
|
185
|
+
Keys.enter_log_javascript { Firefox.enter_log_javascript_line }
|
|
186
|
+
Keys.enter_log_stack { Code.enter_log_stack }
|
|
187
|
+
Keys.enter_log_line { Code.enter_log_line }
|
|
188
|
+
Keys.enter_log_output { Code.enter_log_output }
|
|
189
|
+
# Keys.enter_last_log { Launcher.insert(Keys.prefix_u ? "- last/" : "- log/") }
|
|
190
|
+
# Keys.enter_last_launched { Launcher.enter_last_launched }
|
|
191
|
+
Keys.enter_list_ruby { Launcher.insert("technologies/ruby/") }
|
|
192
|
+
# Keys.enter_like_test { Specs.enter_as_rspec }
|
|
193
|
+
Keys.enter_log_time { Code.enter_log_time }
|
|
194
|
+
Keys.enter_like_url { Firefox.enter_as_url }
|
|
195
|
+
Keys.enter_like_variable { insert "\#{#{Clipboard.get(0)}}" }
|
|
196
|
+
|
|
197
|
+
Keys.enter_menu { Xiki.insert_menu } # Redundant with C-enter on blank line
|
|
198
|
+
Keys.enter_note { Notes.enter_do_bullet } # Redundant with C-enter on blank line
|
|
199
|
+
Keys.enter_outline { Launcher.enter_outline } # in tree, enter methods or headings
|
|
200
|
+
|
|
201
|
+
Keys.enter_push { Gito.code_tree_diff(:enter=>true) } # Commit to repos, push, etc
|
|
202
|
+
Keys.enter_quote { FileTree.enter_quote }
|
|
203
|
+
Keys.enter_row { View.insert_line }
|
|
204
|
+
|
|
205
|
+
# Keys.enter_search { Search.enter_search }
|
|
206
|
+
Keys.enter_snippet { Snippet.insert }
|
|
207
|
+
|
|
208
|
+
#Keys.enter_spot { Location.enter_at_spot } # enter selected text at spot
|
|
209
|
+
Keys.enter_tree { FileTree.tree(:here=>true) }
|
|
210
|
+
Keys.enter_upper { View.enter_upper }
|
|
211
|
+
Keys.enter_value { Clipboard.paste }
|
|
212
|
+
# W
|
|
213
|
+
Keys.enter_whitespace { Code.enter_whitespace }
|
|
214
|
+
# X
|
|
215
|
+
# Y
|
|
216
|
+
# Z
|
|
217
|
+
#Keys.E0 { Clipboard.paste("0") } # Enter 0: paste from "0" tag
|
|
218
|
+
Keys.E1 { Clipboard.paste(1) } # Enter 1
|
|
219
|
+
Keys.E2 { Clipboard.paste(2) } # Enter 2
|
|
220
|
+
Keys.E3 { Clipboard.paste(3) }
|
|
221
|
+
Keys.E4 { Clipboard.paste(4) }; Keys.E5 { Clipboard.paste(5) }; Keys.E6 { Clipboard.paste(6) }
|
|
222
|
+
Keys.E7 { Clipboard.paste(7) }; Keys.E7 { Clipboard.paste(8) }; Keys.E7 { Clipboard.paste(9) }
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
def self.do_keys
|
|
226
|
+
# D: do...
|
|
227
|
+
# Use D prefix for: things that modify text or execute code
|
|
228
|
+
|
|
229
|
+
# Keys.D { insert "Apparently this is necessary to remap C-d" }
|
|
230
|
+
Keys.DD { $el.delete_char $el.elvar.current_prefix_arg || 1 } # DD - delete character (D's default)
|
|
231
|
+
# Keys.do_as_camelcase { Clipboard.do_as_camel_case } # change word to camel case (LikeThat)
|
|
232
|
+
Keys.do_as_execute { Console.do_as_execute } # Run shell command on tree
|
|
233
|
+
Keys.do_as_html { Firefox.do_as_html }
|
|
234
|
+
Keys.do_as_browser { Firefox.run_block }
|
|
235
|
+
Keys.do_as_javascript { Javascript.run }
|
|
236
|
+
# Keys.do_as_launched { Launcher.do_as_launched }
|
|
237
|
+
# Keys.do_as_php { Php.run }
|
|
238
|
+
Keys.do_as_menu { Menu.do_as_menu } # Grab item after '@' and run it by itself
|
|
239
|
+
Keys.do_as_python { Python.run_block }
|
|
240
|
+
# Do, take numeric prefix for before and after
|
|
241
|
+
Keys.do_add_space { Code.add_space }
|
|
242
|
+
Keys.do_as_test { Code.do_as_rspec }
|
|
243
|
+
Keys.do_as_wrap { Block.do_as_wrap }
|
|
244
|
+
Keys.do_as_quote { Notes.do_as_quote }
|
|
245
|
+
Keys.do_as_xul { Firefox.do_as_xul }
|
|
246
|
+
Keys.do_backward { $el.backward_kill_word(Keys.prefix || 1) } # delete word backward
|
|
247
|
+
Keys.do_code_align { Code.do_code_align } # Based on input character, all matches line up
|
|
248
|
+
Keys.do_click_back { Firefox.back }
|
|
249
|
+
Keys.do_create_directory { FileTree.do_create_dir }
|
|
250
|
+
# Keys.do_click_hyperlink { Firefox.click } # compare with last AV version
|
|
251
|
+
|
|
252
|
+
Keys.do_current_file { Files.delete_current_file }
|
|
253
|
+
|
|
254
|
+
Keys.do_compare_history { History.diff_with_backup } # compare with last AV version
|
|
255
|
+
|
|
256
|
+
Keys.do_code_indent { Code.indent }
|
|
257
|
+
Keys.do_count_matches { View.count_matches }
|
|
258
|
+
Keys.do_copy_next { Files.copy } # copy file to next view
|
|
259
|
+
Keys.do_colors_off { $el.font_lock_mode } # toggles
|
|
260
|
+
Keys.do_clean_quotes { Files.do_clean_quotes } # Fix special chars
|
|
261
|
+
|
|
262
|
+
Keys.do_compare_repository { Gito.diff_one_file }
|
|
263
|
+
|
|
264
|
+
Keys.do_compare_saved { DiffLog.compare_with_saved }
|
|
265
|
+
|
|
266
|
+
Keys.do_copy_to { FileTree.copy_to }
|
|
267
|
+
Keys.do_compare_with { DiffLog.do_compare_with }
|
|
268
|
+
Keys.DC1 { Clipboard.diff_1_and_2 } # Compare contents of clipboards "1" and "2"
|
|
269
|
+
# D: defined above - mapped to what C-d does by default
|
|
270
|
+
Keys.do_expand { $el.dabbrev_expand nil } # expand abbreviation
|
|
271
|
+
Keys.do_forward { $el.kill_word(Keys.prefix || 1) } # delete word forward
|
|
272
|
+
# H
|
|
273
|
+
# G: leave unmapped for escape
|
|
274
|
+
Keys.do_here { Launcher.do_last_launch :here=>1 }
|
|
275
|
+
Keys.do_indent { Code.indent_to }
|
|
276
|
+
Keys.do_job { Macros.run } # do last macro
|
|
277
|
+
Keys.do_kill_all { Effects.blink :what=>:all; View.kill_all } # kill all text in buffer
|
|
278
|
+
Keys.do_kill_indented { CodeTree.do_kill_indented } # Delete menu or file or whatever (just passes "0") prefix
|
|
279
|
+
Keys.do_kill_matching { Search.kill_filter }
|
|
280
|
+
Keys.do_kill_nonmatching { Search.kill_filter }
|
|
281
|
+
Keys.do_kill_paragraph { View.kill_paragraph } # kill all text in buffer
|
|
282
|
+
Keys.do_kill_rest { CodeTree.kill_rest } # kill adjacent lines at same indent as this one
|
|
283
|
+
Keys.do_kill_siblings { CodeTree.kill_siblings } # kill adjacent lines at same indent as this one
|
|
284
|
+
Keys.do_kill_trailing { View.gsub!(/ +$/, "") } # Deletes trailing whitespace
|
|
285
|
+
Keys.do_list_ancestors { View.beep "- Changed to: do+visibility!" } # Moved to do+visibility
|
|
286
|
+
Keys.do_load_browser { Firefox.reload }
|
|
287
|
+
Keys.do_last_command { Console.do_last_command }
|
|
288
|
+
Keys.do_line_duplicate { Line.duplicate_line }
|
|
289
|
+
Keys.do_load_file { Files.do_load_file } # U prefix will auto-update / auto-refresh to relflect changes
|
|
290
|
+
Keys.do_lines_having { # delete lines matching a regex
|
|
291
|
+
unless $el.elvar.current_prefix_arg
|
|
292
|
+
delete_matching_lines( Keys.input(:prompt => "Delete lines having: ") )
|
|
293
|
+
else
|
|
294
|
+
delete_non_matching_lines( Keys.input(:prompt => "Delete lines not having: ") )
|
|
295
|
+
end
|
|
296
|
+
}
|
|
297
|
+
Keys.do_linebreaks_linux { $el.set_buffer_file_coding_system :unix }
|
|
298
|
+
Keys.do_line_next { Line.move :next }
|
|
299
|
+
Keys.do_lines_order { Line.do_lines_sort }
|
|
300
|
+
Keys.do_line_previous { Line.move(:previous) }
|
|
301
|
+
Keys.do_lines_reverse { $el.reverse_region($el.region_beginning, $el.region_end) }
|
|
302
|
+
Keys.do_lines_shuffle { Code.randomize_lines } # Shuffle lines
|
|
303
|
+
|
|
304
|
+
Keys.do_lines_toggle { Line.do_lines_toggle } # Swap next N lines
|
|
305
|
+
|
|
306
|
+
Keys.do_lines_unique { Code.kill_duplicates } # Uniqify, delete duplicates
|
|
307
|
+
Keys.do_linebreaks_windows { $el.set_buffer_file_coding_system :dos }
|
|
308
|
+
Keys.do_move_to { FileTree.move_to }
|
|
309
|
+
Keys.do_name_buffer { Buffers.rename }
|
|
310
|
+
Keys.do_notes_colors { FileTree.apply_styles; Notes.apply_styles; FileTree.apply_styles_at_end }
|
|
311
|
+
Keys.do_number_enter { Incrementer.enter }
|
|
312
|
+
Keys.do_name_files { FileTree.rename_file }
|
|
313
|
+
Keys.do_number_increment { Incrementer.increment }
|
|
314
|
+
Keys.do_next_paragraph { Code.do_next_paragraph } # Move line to start of next paragraph
|
|
315
|
+
Keys.do_number_start { Incrementer.start }
|
|
316
|
+
Keys.do_outline { History.open_current :outline=>true, :prompt_for_bookmark=>true }
|
|
317
|
+
Keys.do_push { Gito.code_tree_diff } # Commit to repos, push, etc
|
|
318
|
+
Keys.do_query { Search.query_replace } # do query replace
|
|
319
|
+
Keys.do_run { Code.run } # run code as ruby
|
|
320
|
+
$el.define_key :global_map, $el.kbd("C-d C-s"), :cua_set_rectangle_mark # Keys.do_several
|
|
321
|
+
Keys.do_tree { FileTree.tree(:recursive=>true) } # draw filesystem tree for current dir or bookmark
|
|
322
|
+
Keys.do_upper { Launcher.do_last_launch }
|
|
323
|
+
Keys.do_viewing { Buffers.open_viewing } # Not great fit here
|
|
324
|
+
Keys.do_whitespace { Deletes.delete_whitespace } # delete blank lines
|
|
325
|
+
# X
|
|
326
|
+
Keys.do_you { $el.delete_char $el.elvar.current_prefix_arg || 1 } # Delete character
|
|
327
|
+
Keys.do_zip_next { Files.zip }
|
|
328
|
+
Keys.set("C-d C-.") { # Do .: Go to point/bookmark starting with "." and run it (like pressing C-. on that line)
|
|
329
|
+
input = Keys.input(:timed => true)
|
|
330
|
+
$el.with(:save_window_excursion) do
|
|
331
|
+
Bookmarks.go(".#{input}")
|
|
332
|
+
Launcher.launch
|
|
333
|
+
end
|
|
334
|
+
}
|
|
335
|
+
Keys.set("C-d C-/") { Code.comment }
|
|
336
|
+
|
|
337
|
+
Keys.D1 { Search.query_replace_nth "1", "2" }
|
|
338
|
+
Keys.D2 { Search.query_replace_nth "2", "1" }
|
|
339
|
+
Keys.D3 { Search.query_replace_nth "3", "4" }
|
|
340
|
+
Keys.D4 { Search.query_replace_nth "4", "3" }
|
|
341
|
+
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def self.to_keys
|
|
345
|
+
# T: to...
|
|
346
|
+
# Use T prefix for: moving cursor, jumping to specific points
|
|
347
|
+
|
|
348
|
+
$el.el4r_lisp_eval(%Q`(global-set-key (kbd "C-\'") \'repeat)`)
|
|
349
|
+
|
|
350
|
+
Keys.TT { $el.transpose_chars $el.elvar.current_prefix_arg } # TT - toggle character (T's default)
|
|
351
|
+
Keys.to_axis { Move.to_axis } # to beginning of file
|
|
352
|
+
Keys.to_backward { $el.backward_word(Keys.prefix || 1) } # move backward one word
|
|
353
|
+
Keys.to_column { Move.to_column } # to x coordinate - ie column
|
|
354
|
+
# D
|
|
355
|
+
Keys.to_end { Move.to_end } # To end of line
|
|
356
|
+
Keys.to_forward { $el.forward_word(Keys.prefix || 1) } # move forward one word
|
|
357
|
+
Keys.to_highest { View.to_highest } # to beginning of file
|
|
358
|
+
Keys.to_indent { Move.to_indent }
|
|
359
|
+
Keys.to_junior { Move.to_junior }
|
|
360
|
+
Keys.to_kind { Move.to_other_bracket } # to matching bracket, etc
|
|
361
|
+
Keys.to_lowest { View.to_bottom } # move to end
|
|
362
|
+
Keys.to_menu { Menu.to_menu } # to matching bracket, etc
|
|
363
|
+
Keys.to_next { Move.to_next_paragraph } # to next paragraph
|
|
364
|
+
Keys.to_outline { FileTree.to_outline }
|
|
365
|
+
Keys.to_previous { Move.to_previous_paragraph } # to beginning of previous paragraph
|
|
366
|
+
Keys.to_quote { Move.to_quote } # move to next ...|... quote
|
|
367
|
+
Keys.to_row { Move.to_line } # go to nth line, relative to top of window
|
|
368
|
+
Keys.to_spot { Location.to_spot }
|
|
369
|
+
# T: defined above - mapped to what C-t does by default
|
|
370
|
+
Keys.to_up { Tree.to_parent } # to parent (last line indented less)
|
|
371
|
+
Keys.to_visible { View.to_relative } # go to nth line, relative to top of window
|
|
372
|
+
Keys.to_words { Line.to_beginning } # move to start of words on line
|
|
373
|
+
# X
|
|
374
|
+
# Z
|
|
375
|
+
|
|
376
|
+
Keys.T0 { View.to_nth_paragraph 0 }
|
|
377
|
+
Keys.T1 { View.to_nth_paragraph 1 }
|
|
378
|
+
Keys.T2 { View.to_nth_paragraph 2 }
|
|
379
|
+
Keys.T3 { View.to_nth_paragraph 3 }
|
|
380
|
+
Keys.T4 { View.to_nth_paragraph 4 }
|
|
381
|
+
Keys.T5 { View.to_nth_paragraph 5 }
|
|
382
|
+
Keys.T6 { View.to_nth_paragraph 6 }
|
|
383
|
+
Keys.T7 { View.to_nth_paragraph 7 }
|
|
384
|
+
Keys.T8 { View.to_nth_paragraph 8 }
|
|
385
|
+
Keys.T9 { View.to_nth_paragraph 9 }
|
|
386
|
+
|
|
387
|
+
Keys.set("C-t C-/") { Code.to_comment }
|
|
388
|
+
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
def self.layout_keys
|
|
392
|
+
# L: layout...
|
|
393
|
+
# Use L prefix for: adjusting the layout, changing what is visible
|
|
394
|
+
|
|
395
|
+
Keys.LL { View.recenter } # LL - recenter (L's default)
|
|
396
|
+
Keys.layout_all { View.hide_others }
|
|
397
|
+
Keys.layout_balance { 3.times { View.balance } } # balance windows
|
|
398
|
+
Keys.layout_create { View.create } # open new view
|
|
399
|
+
|
|
400
|
+
Keys.layout_dimensions { Launcher.open('- window/dimensions/presets/', :bar_is_fine=>1, :first_letter=>1) }
|
|
401
|
+
|
|
402
|
+
Keys.layout_expand { View.enlarge }
|
|
403
|
+
# F
|
|
404
|
+
Keys.layout_files { View.layout_files }
|
|
405
|
+
Keys.layout_hide { View.hide } #
|
|
406
|
+
Keys.layout_indent { Hide.hide_by_indent } # only show lines indented less than x
|
|
407
|
+
Keys.layout_jump { View.shift }
|
|
408
|
+
Keys.layout_kill { View.kill }
|
|
409
|
+
# L: defined above - mapped to what C-d does by default
|
|
410
|
+
Keys.layout_marker { Color.colorize } # colorize line, etc
|
|
411
|
+
Keys.layout_next { View.next(:blink=>true) } # next view
|
|
412
|
+
Keys.layout_output { View.layout_output }
|
|
413
|
+
Keys.layout_previous { View.previous(:blink=>true) }
|
|
414
|
+
# Q
|
|
415
|
+
Keys.layout_right { View.to_upper(:blink=>true) } # Go to view to the right
|
|
416
|
+
Keys.layout_search { Keys.prefix_u? ? Search.find_in_buffers(Keys.input(:prompt=>"Search all open files for: ")) : Hide.search }
|
|
417
|
+
Keys.layout_todo { View.layout_todo } # show bar on left with the quick bookmark named "-t"
|
|
418
|
+
Keys.layout_uncover { Hide.reveal } # Reveal all hidden text
|
|
419
|
+
# V
|
|
420
|
+
Keys.layout_visibility { Launcher.open('- window/visibility/', :bar_is_fine=>1, :first_letter=>1) }
|
|
421
|
+
Keys.layout_wrap { $el.toggle_truncate_lines } # wrap lines
|
|
422
|
+
# X
|
|
423
|
+
# Y
|
|
424
|
+
Keys.layout_zoom { $el.narrow_to_region($el.region_beginning, $el.region_end) } # show selection only
|
|
425
|
+
Keys.L0 { View.recenter_top } # Layout 0: scroll so cursor is 0 lines from top af window
|
|
426
|
+
Keys.L1 { Move.to_window(1, :blink=>true) } # Layout 1
|
|
427
|
+
Keys.L2 { Move.to_window(2, :blink=>true) } # Layout 2
|
|
428
|
+
Keys.L3 { Move.to_window(3, :blink=>true) }; Keys.L4 { Move.to_window(4, :blink=>true) }
|
|
429
|
+
Keys.L5 { Move.to_window(5, :blink=>true) }; Keys.L6 { Move.to_window(6, :blink=>true) }; Keys.L7 { Move.to_window(7, :blink=>true) }; Keys.L8 { Move.to_window(8, :blink=>true) }
|
|
430
|
+
Keys.L9 { Move.to_last_window(:blink=>true) }
|
|
431
|
+
|
|
432
|
+
# Todo: if prefix passed, expand window, but leave other windows open with that much space in each
|
|
433
|
+
# Keys.LCR { Colors.highlight } # Layout Tree: show bar on left with the quick bookmark named "-t"
|
|
434
|
+
|
|
435
|
+
# Todo:
|
|
436
|
+
# - Make it recognize :n when opening
|
|
437
|
+
# - If you put it at end of path or as tree node, it should make it into path
|
|
438
|
+
# - So look at it when opening path and optionally jump
|
|
439
|
+
# - narrow block to region:
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
# Control keys during isearch
|
|
443
|
+
def self.isearch
|
|
444
|
+
Keys.search_axis { Search.to_left }
|
|
445
|
+
Keys.search_bookmark { Search.bookmark }
|
|
446
|
+
# B: leave unmapped for back
|
|
447
|
+
|
|
448
|
+
Keys.search_clipboard { Search.isearch_clipboard } # Clipboard (copy)
|
|
449
|
+
|
|
450
|
+
Keys.search_delete { Search.isearch_delete } # Delete
|
|
451
|
+
Keys.search_enter { Search.enter } # Enter: insert clipboard, replacing match
|
|
452
|
+
Keys.search_frontward { Search.go_to_end } # Forward
|
|
453
|
+
Keys.search_g { Search.cancel } # Stop searching
|
|
454
|
+
# have_...
|
|
455
|
+
$el.define_key :isearch_mode_map, $el.kbd("C-h"), nil
|
|
456
|
+
Keys.search_have_append { Search.isearch_move_to "$t", :append=>1 }
|
|
457
|
+
Keys.search_have_bullet { Search.have_label }
|
|
458
|
+
Keys.search_have_case { Search.isearch_have_case }
|
|
459
|
+
Keys.search_have_edges { Search.just_edges } # Delete everything but chars at edges of match
|
|
460
|
+
Keys.search_have_files { View.beep "- Changed to: search+have+navigation!" }
|
|
461
|
+
Keys.search_have_highest { Search.isearch_restart :top }
|
|
462
|
+
Keys.search_have_javascript { Search.isearch_have_output_javascript }
|
|
463
|
+
Keys.search_have_line { Search.have_line } # copy line back to search start
|
|
464
|
+
Keys.search_have_nav { Search.isearch_move_to "$f" }
|
|
465
|
+
|
|
466
|
+
Keys.search_have_output { Search.isearch_have_output }
|
|
467
|
+
Keys.search_have_push { Gito.search_just_push } # When search match
|
|
468
|
+
|
|
469
|
+
Keys.search_have_right { Search.have_right }
|
|
470
|
+
Keys.search_have_spot { Search.insert_at_spot }
|
|
471
|
+
Keys.search_have_todo { Search.isearch_move_to "$t" }
|
|
472
|
+
Keys.search_have_variable { Search.insert_var_at_search_start }
|
|
473
|
+
Keys.search_have_within { Search.isearch_have_within } # Grab everything except chars on edges
|
|
474
|
+
|
|
475
|
+
# AVAILABLE: search_i ? (when nothing searched for)
|
|
476
|
+
|
|
477
|
+
# I: leave unmapped - had issues using it (messes up position)
|
|
478
|
+
# just_...
|
|
479
|
+
$el.define_key :isearch_mode_map, $el.kbd("C-j"), nil
|
|
480
|
+
Keys.search_just_adjust { Search.isearch_just_adjust }
|
|
481
|
+
Keys.search_just_bookmark { Search.just_bookmark }
|
|
482
|
+
Keys.search_just_case { Search.isearch_just_case } # make match be camel case
|
|
483
|
+
Keys.search_just_difflog { Search.jump_to_difflog } # find last string in difflog
|
|
484
|
+
Keys.search_just_edits { Search.just_edits } # Search in diff of edits to this file
|
|
485
|
+
Keys.search_just_files { Search.isearch_restart "$f" } # isearch for this string in $f
|
|
486
|
+
Keys.search_just_have { Search.just_select } # select match
|
|
487
|
+
Keys.search_just_integer { Search.stop; Search.isearch "[0-9][0-9.]*", :regex=>1 }
|
|
488
|
+
|
|
489
|
+
Keys.search_just_menu { Search.just_menu }
|
|
490
|
+
# Keys.search_just_mark { Search.just_marker }
|
|
491
|
+
Keys.search_just_next { Search.isearch_restart :next }
|
|
492
|
+
Keys.search_just_output { Search.isearch_restart "$o" }
|
|
493
|
+
Keys.search_just_previous { Search.isearch_restart :previous }
|
|
494
|
+
Keys.search_just_query { Search.isearch_query_replace :match } # replace
|
|
495
|
+
Keys.search_just_right { Search.isearch_restart :right } # Search in top-right view
|
|
496
|
+
Keys.search_just_search { Search.isearch_just_search } # Add "##search" line in tree for match
|
|
497
|
+
Keys.search_just_todo { Search.isearch_restart "$t" } # isearch for this string in $t
|
|
498
|
+
|
|
499
|
+
Keys.search_just_variable { Search.isearch_just_surround_with_char '#{', '}' }
|
|
500
|
+
Keys.search_just_wrap { Ol << 'search_just_wrap'; toggle_truncate_lines } # make match be snake case
|
|
501
|
+
|
|
502
|
+
Keys.search_just_yellow { Search.just_orange }
|
|
503
|
+
Keys.search_kill { Search.cut } # cut
|
|
504
|
+
|
|
505
|
+
$el.define_key :isearch_mode_map, $el.kbd("C-l"), nil
|
|
506
|
+
|
|
507
|
+
Keys.search_like_clipboard {
|
|
508
|
+
reverse = Search.was_reverse
|
|
509
|
+
match = Search.stop
|
|
510
|
+
Search.isearch Clipboard[0], :reverse=>reverse
|
|
511
|
+
} # make match be camel case
|
|
512
|
+
Keys.search_like_delete { Search.like_delete } # Delete all lines that contain the match
|
|
513
|
+
Keys.search_like_file { Search.isearch_open }
|
|
514
|
+
Keys.search_like_menu { Launcher.search_like_menu }
|
|
515
|
+
Keys.search_like_output { Search.isearch_have_output :string=>1 }
|
|
516
|
+
Keys.search_line_pull { Search.isearch_move_line }
|
|
517
|
+
Keys.search_like_quote { Search.isearch_google :quote=>true }
|
|
518
|
+
Keys.search_like_repository { Gito.search_repository } # When not searching
|
|
519
|
+
|
|
520
|
+
Keys.search_like_synonyms { Search.search_thesaurus }
|
|
521
|
+
# Keys.search_like_timer { Search.search_like_timer }
|
|
522
|
+
|
|
523
|
+
# Keys.search_like_thesaurus { Search.search_thesaurus }
|
|
524
|
+
Keys.search_last_urls { Launcher.open("- Launcher.urls/") }
|
|
525
|
+
Keys.search_like_variable { Search.just_name }
|
|
526
|
+
Keys.search_like_web { Search.isearch_google } # make match be snake case
|
|
527
|
+
Keys.search_like_xiki { View.open "$x/#{Search.stop.strip}" }
|
|
528
|
+
|
|
529
|
+
# Use search_navigated instead
|
|
530
|
+
# Keys.search_last_launched { Search.search_last_launched }
|
|
531
|
+
# Keys.search_log { Search.search_log }
|
|
532
|
+
# M: leave unmapped for stop
|
|
533
|
+
Keys.search_next { Search.isearch_next } # Next, or navigated (if nothing searched for yet)
|
|
534
|
+
Keys.search_outline { Search.isearch_outline } # Outline
|
|
535
|
+
Keys.search_paths { Search.isearch_paths } # Just go to previous line
|
|
536
|
+
# P: leave unmapped for previous
|
|
537
|
+
# Q: leave unmapped for quoting
|
|
538
|
+
# R: leave unmapped for reverse
|
|
539
|
+
# S: leave unmapped for search
|
|
540
|
+
Keys.search_to { Search.isearch_to } # To: open file / jump to method
|
|
541
|
+
Keys.search_usurp { Search.isearch_pull_in_sexp } # usurp: pull sexp into search string
|
|
542
|
+
Keys.search_value { Search.insert_at_search_start } # Value: copy value back to search start
|
|
543
|
+
# W: leave unmapped for pulling into search
|
|
544
|
+
|
|
545
|
+
Keys.search_xiki { Search.xiki } # search+xiki+__ mapped inside this method
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
# Y: leave unmapped for yank
|
|
549
|
+
Keys.search_zap { Search.zap } # zap - delete up until search start
|
|
550
|
+
|
|
551
|
+
# Surround with characters (quotes and brackets)
|
|
552
|
+
|
|
553
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-'")) { Search.isearch_just_surround_with_char '"' }
|
|
554
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C-'")) { Search.isearch_just_surround_with_char "'" }
|
|
555
|
+
|
|
556
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C-,")) { Search.isearch_surround_with_tag }
|
|
557
|
+
|
|
558
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C-SPC")) { Search.isearch_just_surround_with_char " " }
|
|
559
|
+
|
|
560
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-`")) { Search.isearch_just_surround_with_char "~" }
|
|
561
|
+
|
|
562
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C-/")) { Search.isearch_just_comment }
|
|
563
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C-=")) { Search.just_increment }
|
|
564
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C--")) { Search.just_increment(:decrement=>true) }
|
|
565
|
+
|
|
566
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-9")) { Search.isearch_just_surround_with_char '(', ')' }
|
|
567
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C-9")) { Search.isearch_just_surround_with_char '[', ']'}
|
|
568
|
+
|
|
569
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-h C-[")) { Search.isearch_just_surround_with_char '[', ']' }
|
|
570
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C-[")) { Search.isearch_just_surround_with_char '{', '}' }
|
|
571
|
+
|
|
572
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-h C-'")) { Search.insert_quote_at_search_start }
|
|
573
|
+
|
|
574
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C-1")) { Search.enter(Clipboard[1]) } # isearch_just_1
|
|
575
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C-2")) { Search.enter(Clipboard[2]) } # isearch_just_2
|
|
576
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-j C-3")) { Search.enter(Clipboard[3]) } # isearch_just_3
|
|
577
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-h C-1")) { Search.isearch_query_replace Clipboard[1] }
|
|
578
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-h C-2")) { Search.isearch_query_replace Clipboard[2] }
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-h C-0")) { Search.isearch_query_replace Clipboard[0] }
|
|
582
|
+
|
|
583
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-1")) { Search.isearch_or_copy("1") }
|
|
584
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-2")) { Search.isearch_or_copy("2") }
|
|
585
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-3")) { Search.isearch_or_copy("3") }
|
|
586
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-4")) { Search.isearch_or_copy("4") }
|
|
587
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-5")) { Search.isearch_or_copy("5") }
|
|
588
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-6")) { Search.isearch_or_copy("6") }
|
|
589
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-7")) { Search.isearch_or_copy("7") }
|
|
590
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-8")) { Search.isearch_or_copy("8") }
|
|
591
|
+
|
|
592
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-=")) { $el.isearch_yank_char } # Add one char from isearch
|
|
593
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C--")) { Search.subtract } # Remove one char from isearch
|
|
594
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-/")) { $el.isearch_delete_char } # Remove last action from search results
|
|
595
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-,")) { Search.isearch_query_replace } # Replace all occurrences
|
|
596
|
+
|
|
597
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-\\")) { Search.hide } # Hide: hide non-matching
|
|
598
|
+
|
|
599
|
+
$el.define_key(:isearch_mode_map, $el.kbd("C-0")) { Search.isearch_pause_or_resume } # isearch_just_0
|
|
600
|
+
|
|
601
|
+
# Safe mapping of C-m to Search.isearch_m (works when el4r is down)
|
|
602
|
+
$el.el4r_lisp_eval(%`(defun isearch-m () (interactive)
|
|
603
|
+
(if (eq (process-status el4r-process) 'run) (el4r-ruby-eval "Search.isearch_m") (isearch-exit)))
|
|
604
|
+
`.unindent)
|
|
605
|
+
$el.define_key :isearch_mode_map, $el.kbd("C-m"), :isearch_m # Hide: hide non-matching
|
|
606
|
+
|
|
607
|
+
end
|
|
608
|
+
|
|
609
|
+
def self.misc
|
|
610
|
+
|
|
611
|
+
$el.define_key :global_map, $el.kbd("C-S-v"), :scroll_down
|
|
612
|
+
|
|
613
|
+
# Single character definitions
|
|
614
|
+
Keys.B { Move.backward }
|
|
615
|
+
Keys.F { Move.forward }
|
|
616
|
+
Keys.Q { Keys.timed_insert }
|
|
617
|
+
Keys.set("C-.") { Launcher.launch_or_hide(:blink=>true) }
|
|
618
|
+
|
|
619
|
+
# Alternate key for C-. (probably easier to remember)
|
|
620
|
+
Keys.set("<C-return>") { Launcher.launch_or_hide(:blink=>true) }
|
|
621
|
+
Keys.set("<M-return>") { Launcher.launch_or_hide(:blink=>true) }
|
|
622
|
+
|
|
623
|
+
if $el.locate_library "ruby-mode"
|
|
624
|
+
$el.el_require :ruby_mode
|
|
625
|
+
$el.define_key :ruby_mode_map, $el.kbd("C-\\") do
|
|
626
|
+
Hide.show
|
|
627
|
+
Hide.hide_unless /^ *(def|class|module|create_table|it|describe) /
|
|
628
|
+
$el.recenter -2
|
|
629
|
+
Hide.search
|
|
630
|
+
end
|
|
631
|
+
end
|
|
632
|
+
$el.el_require :cc_mode
|
|
633
|
+
|
|
634
|
+
# Unmap keys in modes that interfere
|
|
635
|
+
$el.el4r_lisp_eval("(require 'shell)")
|
|
636
|
+
$el.define_key :shell_mode_map, $el.kbd("C-d"), nil # shell-mode etc. special C-d shortcuts over-ride xiki
|
|
637
|
+
$el.define_key :objc_mode_map, $el.kbd("C-d"), nil
|
|
638
|
+
$el.define_key :c_mode_map, $el.kbd("C-d"), nil
|
|
639
|
+
$el.el4r_lisp_eval("(require 'dired)")
|
|
640
|
+
$el.define_key :dired_mode_map, $el.kbd("C-o"), nil
|
|
641
|
+
$el.define_key :java_mode_map, $el.kbd("C-d"), nil
|
|
642
|
+
$el.el_require :php_mode
|
|
643
|
+
$el.define_key :php_mode_map, $el.kbd("C-d"), nil
|
|
644
|
+
|
|
645
|
+
# C-l in ediff mode
|
|
646
|
+
$el.defun(:ediff_disable_C_l) { $el.define_key(:ediff_mode_map, $el.kbd("C-l"), nil) }
|
|
647
|
+
$el.add_hook :ediff_keymap_setup_hook, :ediff_disable_C_l
|
|
648
|
+
|
|
649
|
+
ControlTab.keys
|
|
650
|
+
|
|
651
|
+
Keys.set("M-0") { Styles.font_size 120 }
|
|
652
|
+
Keys.set("M-=") { Styles.zoom }
|
|
653
|
+
Keys.set("M--") { Styles.zoom :out=>1 }
|
|
654
|
+
|
|
655
|
+
View.sensible_defaults
|
|
656
|
+
end
|
|
657
|
+
|
|
658
|
+
end
|