ver 2010.02 → 2010.08
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.yardopts +1 -1
- data/AUTHORS +2 -2
- data/CHANGELOG +1160 -0
- data/MANIFEST +212 -62
- data/README.textile +68 -9
- data/Rakefile +2 -2
- data/bin/ver +33 -8
- data/config/commands/ANTLR.rb +11 -0
- data/config/commands/ActionScript.rb +102 -0
- data/config/commands/Active4D.rb +30 -0
- data/config/commands/Ada.rb +11 -0
- data/config/commands/Ant.rb +90 -0
- data/config/commands/Apache.rb +98 -0
- data/config/commands/AppleScript.rb +169 -0
- data/config/commands/Blogging.rb +72 -0
- data/config/commands/Bulletin Board.rb +10 -0
- data/config/commands/Bundle Development.rb +83 -0
- data/config/commands/C++ Qt.rb +158 -0
- data/config/commands/C.rb +82 -0
- data/config/commands/CMake.rb +32 -0
- data/config/commands/CSS.rb +76 -0
- data/config/commands/CTags.rb +29 -0
- data/config/commands/CVS.rb +114 -0
- data/config/commands/CoffeeScript.rb +58 -0
- data/config/commands/Context Free.rb +20 -0
- data/config/commands/Cucumber.rb +94 -0
- data/config/commands/D.rb +47 -0
- data/config/commands/Darcs.rb +72 -0
- data/config/commands/Diff.rb +76 -0
- data/config/commands/Doxygen.rb +9 -0
- data/config/commands/Experimental Wiki.rb +9 -0
- data/config/commands/Experimental.rb +172 -0
- data/config/commands/F-Script.rb +13 -0
- data/config/commands/FXScript.rb +11 -0
- data/config/commands/FileMerge.rb +42 -0
- data/config/commands/Fortran.rb +58 -0
- data/config/commands/GTD2.rb +134 -0
- data/config/commands/GTDAlt.rb +225 -0
- data/config/commands/GetBundle.rb +41 -0
- data/config/commands/Go.rb +29 -0
- data/config/commands/Graphviz.rb +11 -0
- data/config/commands/Greasemonkey.rb +158 -0
- data/config/commands/Gri.rb +11 -0
- data/config/commands/Groovy Grails.rb +174 -0
- data/config/commands/Groovy.rb +66 -0
- data/config/commands/HTML.rb +206 -0
- data/config/commands/Haskell.rb +48 -0
- data/config/commands/Hotkey.rb +50 -0
- data/config/commands/Hyperlink Helper.rb +81 -0
- data/config/commands/ImageBrowser.rb +10 -0
- data/config/commands/Io.rb +11 -0
- data/config/commands/JSFL.rb +29 -0
- data/config/commands/JSON.rb +11 -0
- data/config/commands/Java.rb +45 -0
- data/config/commands/JavaDoc.rb +12 -0
- data/config/commands/JavaScript Prototype & Script.aculo.us.rb +51 -0
- data/config/commands/JavaScript YUI.rb +12 -0
- data/config/commands/JavaScript jQuery.rb +12 -0
- data/config/commands/JavaScript.rb +50 -0
- data/config/commands/LaTeX.rb +423 -0
- data/config/commands/Lisp.rb +20 -0
- data/config/commands/Logo.rb +10 -0
- data/config/commands/Logtalk.rb +34 -0
- data/config/commands/Lua.rb +29 -0
- data/config/commands/MEL.rb +20 -0
- data/config/commands/Mail.rb +73 -0
- data/config/commands/Make.rb +20 -0
- data/config/commands/Man Pages.rb +20 -0
- data/config/commands/Markdown.rb +194 -0
- data/config/commands/Math.rb +79 -0
- data/config/commands/Matlab.rb +188 -0
- data/config/commands/Maven.rb +162 -0
- data/config/commands/Mediawiki.rb +12 -0
- data/config/commands/Mercurial.rb +185 -0
- data/config/commands/MoinMoin.rb +74 -0
- data/config/commands/Movable Type.rb +68 -0
- data/config/commands/Nemerle.rb +29 -0
- data/config/commands/OCaml Experimental Completions.rb +22 -0
- data/config/commands/OCaml.rb +99 -0
- data/config/commands/Objective-C.rb +181 -0
- data/config/commands/Outlines.rb +54 -0
- data/config/commands/PHP Smarty.rb +10 -0
- data/config/commands/Pascal.rb +11 -0
- data/config/commands/Perforce.rb +102 -0
- data/config/commands/Perl.rb +78 -0
- data/config/commands/Processing.rb +11 -0
- data/config/commands/Prolog.rb +11 -0
- data/config/commands/Property List.rb +38 -0
- data/config/commands/Python Django.rb +11 -0
- data/config/commands/Python.rb +131 -0
- data/config/commands/R Console (R.app).rb +80 -0
- data/config/commands/R Console (Rdaemon).rb +414 -0
- data/config/commands/R.rb +337 -0
- data/config/commands/Ragel.rb +10 -0
- data/config/commands/Regular Expressions.rb +18 -0
- data/config/commands/Remind.rb +44 -0
- data/config/commands/Ruby RSpec.rb +40 -0
- data/config/commands/Ruby on Rails.rb +331 -0
- data/config/commands/Ruby.rb +220 -0
- data/config/commands/S5 Slide Show.rb +37 -0
- data/config/commands/SCons.rb +24 -0
- data/config/commands/SQL.rb +60 -0
- data/config/commands/SVK.rb +83 -0
- data/config/commands/SWeave.rb +63 -0
- data/config/commands/Scheme.rb +30 -0
- data/config/commands/Scilab.rb +28 -0
- data/config/commands/Setext.rb +20 -0
- data/config/commands/Shell Script.rb +59 -0
- data/config/commands/Slate.rb +9 -0
- data/config/commands/Source.rb +84 -0
- data/config/commands/Standard ML.rb +38 -0
- data/config/commands/Subversion.rb +181 -0
- data/config/commands/TODO.rb +32 -0
- data/config/commands/Tcl.rb +21 -0
- data/config/commands/TerminalMate.rb +30 -0
- data/config/commands/Text.rb +137 -0
- data/config/commands/TextMate.rb +100 -0
- data/config/commands/Textile.rb +58 -0
- data/config/commands/Thrift.rb +20 -0
- data/config/commands/Transmit.rb +34 -0
- data/config/commands/Txt2tags.rb +213 -0
- data/config/commands/Vectorscript.rb +19 -0
- data/config/commands/Widget Creator.rb +23 -0
- data/config/commands/XML.rb +29 -0
- data/config/commands/Xcode.rb +106 -0
- data/config/commands/YAML.rb +39 -0
- data/config/commands/YARD.rb +12 -0
- data/config/commands/iTerm.rb +26 -0
- data/config/commands/reStructuredText.rb +126 -0
- data/config/detect.rb +13 -1
- data/config/keymap/diakonos.rb +113 -115
- data/config/keymap/emacs.rb +6 -2
- data/config/keymap/nano.rb +104 -112
- data/config/keymap/vim.rb +329 -258
- data/config/plugin/autosave.rb +3 -6
- data/config/plugin/git.rb +18 -12
- data/config/plugin/soma.rb +1 -1
- data/config/preferences/Apache.rb +17 -17
- data/config/preferences/AppleScript.rb +5 -5
- data/config/preferences/Bundle Development.rb +10 -10
- data/config/preferences/C.rb +38 -30
- data/config/preferences/CoffeeScript.rb +28 -0
- data/config/preferences/ColdFusion.rb +6 -6
- data/config/preferences/Cucumber.rb +40 -0
- data/config/preferences/Diff.rb +4 -4
- data/config/preferences/Eiffel.rb +6 -6
- data/config/preferences/Erlang.rb +16 -16
- data/config/preferences/F-Script.rb +12 -12
- data/config/preferences/FXScript.rb +5 -5
- data/config/preferences/Fortran.rb +17 -17
- data/config/preferences/Go.rb +23 -0
- data/config/preferences/Groovy.rb +29 -0
- data/config/preferences/HTML.rb +44 -44
- data/config/preferences/Haskell.rb +14 -14
- data/config/preferences/Io.rb +11 -11
- data/config/preferences/Java.rb +8 -8
- data/config/preferences/LaTeX.rb +24 -24
- data/config/preferences/Logo.rb +6 -6
- data/config/preferences/Logtalk.rb +5 -5
- data/config/preferences/Markdown.rb +43 -0
- data/config/preferences/Maven.rb +42 -42
- data/config/preferences/Mediawiki.rb +8 -8
- data/config/preferences/Movable Type.rb +14 -14
- data/config/preferences/OCaml.rb +15 -15
- data/config/preferences/Objective-C.rb +5 -5
- data/config/preferences/PHP.rb +2564 -0
- data/config/preferences/Property List.rb +8 -8
- data/config/preferences/R.rb +5 -5
- data/config/preferences/Ruby.rb +24 -24
- data/config/preferences/Source.rb +13 -13
- data/config/preferences/Standard ML.rb +9 -9
- data/config/preferences/Tcl.rb +5 -5
- data/config/preferences/Text.rb +14 -14
- data/config/preferences/TextMate.rb +5 -5
- data/config/preferences/Textile.rb +8 -8
- data/config/preferences/YARD.rb +9 -0
- data/config/preferences/iTerm.rb +9 -9
- data/config/rc.rb +5 -2
- data/config/snippets/ASP vb.NET.rb +203 -54
- data/config/snippets/ASP.rb +51 -36
- data/config/snippets/ActionScript.rb +332 -205
- data/config/snippets/Active4D.rb +325 -256
- data/config/snippets/Ada.rb +106 -60
- data/config/snippets/Ant.rb +7 -5
- data/config/snippets/Apache.rb +24 -20
- data/config/snippets/AppleScript.rb +213 -82
- data/config/snippets/Blogging.rb +41 -18
- data/config/snippets/Bulletin Board.rb +56 -21
- data/config/snippets/Bundle Development.rb +108 -63
- data/config/snippets/C++ Qt.rb +72 -57
- data/config/snippets/C.rb +128 -100
- data/config/snippets/CMake.rb +42 -32
- data/config/snippets/CSS.rb +515 -115
- data/config/snippets/CoffeeScript.rb +85 -0
- data/config/snippets/ColdFusion.rb +2228 -1547
- data/config/snippets/Context Free.rb +35 -28
- data/config/snippets/Cucumber.rb +55 -0
- data/config/snippets/D.rb +164 -111
- data/config/snippets/DokuWiki.rb +103 -54
- data/config/snippets/Doxygen.rb +87 -40
- data/config/snippets/Eiffel.rb +121 -18
- data/config/snippets/Erlang.rb +109 -68
- data/config/snippets/F-Script.rb +30 -24
- data/config/snippets/FXScript.rb +364 -210
- data/config/snippets/Fortran.rb +462 -280
- data/config/snippets/GTDAlt.rb +10 -4
- data/config/snippets/Gettext.rb +10 -8
- data/config/snippets/Go.rb +52 -0
- data/config/snippets/Greasemonkey.rb +52 -42
- data/config/snippets/Gri.rb +12 -10
- data/config/snippets/Groovy Grails.rb +313 -0
- data/config/snippets/Groovy.rb +685 -0
- data/config/snippets/HTML.rb +325 -126
- data/config/snippets/Haskell.rb +32 -24
- data/config/snippets/Io.rb +53 -42
- data/config/snippets/Java.rb +204 -92
- data/config/snippets/JavaDoc.rb +105 -56
- data/config/snippets/JavaScript MooTools.rb +208 -13
- data/config/snippets/JavaScript Objective-J.rb +18 -15
- data/config/snippets/JavaScript Prototype & Script.aculo.us.rb +362 -107
- data/config/snippets/JavaScript YUI.rb +1245 -186
- data/config/snippets/JavaScript jQuery.rb +693 -375
- data/config/snippets/JavaScript.rb +71 -53
- data/config/snippets/LaTeX.rb +188 -0
- data/config/snippets/Lisp.rb +59 -40
- data/config/snippets/Logo.rb +12 -6
- data/config/snippets/Logtalk.rb +131 -60
- data/config/snippets/Lua.rb +43 -33
- data/config/snippets/MIPS Assembler.rb +7 -5
- data/config/snippets/Mail.rb +10 -1
- data/config/snippets/Markdown.rb +7 -0
- data/config/snippets/Matlab.rb +232 -178
- data/config/snippets/Maven.rb +6 -5
- data/config/snippets/Mediawiki.rb +43 -12
- data/config/snippets/MoinMoin.rb +50 -10
- data/config/snippets/Movable Type.rb +368 -53
- data/config/snippets/Nemerle.rb +127 -79
- data/config/snippets/OCaml Code Completion Misc.rb +1716 -72
- data/config/snippets/OCaml Code Completion Unix.rb +2128 -203
- data/config/snippets/OCaml.rb +107 -73
- data/config/snippets/ODCompletion.rb +169 -118
- data/config/snippets/Objective-C.rb +281 -193
- data/config/snippets/PHP Smarty.rb +149 -79
- data/config/snippets/PHP.rb +186 -0
- data/config/snippets/Pascal.rb +47 -33
- data/config/snippets/Perl HTML-Template.rb +33 -0
- data/config/snippets/Perl Mason.rb +50 -30
- data/config/snippets/Perl Template Toolkit.rb +25 -20
- data/config/snippets/Perl.rb +91 -72
- data/config/snippets/Processing.rb +55 -33
- data/config/snippets/Propel.rb +36 -30
- data/config/snippets/Property List.rb +57 -24
- data/config/snippets/Python Django Templates.rb +381 -95
- data/config/snippets/Python Django.rb +159 -132
- data/config/snippets/Python.rb +88 -0
- data/config/snippets/R Console (Rdaemon).rb +11 -9
- data/config/snippets/R.rb +96 -77
- data/config/snippets/Remind.rb +18 -15
- data/config/snippets/Ruby RSpec.rb +343 -238
- data/config/snippets/Ruby on Rails.rb +1116 -765
- data/config/snippets/Ruby.rb +770 -545
- data/config/snippets/S5 Slide Show.rb +32 -24
- data/config/snippets/SSH Config.rb +21 -17
- data/config/snippets/SWIG.rb +30 -18
- data/config/snippets/Scilab.rb +98 -79
- data/config/snippets/Setext.rb +10 -8
- data/config/snippets/Shell Script.rb +52 -42
- data/config/snippets/Slate.rb +62 -48
- data/config/snippets/Source.rb +24 -1
- data/config/snippets/Standard ML.rb +37 -27
- data/config/snippets/Tcl.rb +32 -26
- data/config/snippets/Text.rb +28 -15
- data/config/snippets/Textile.rb +130 -45
- data/config/snippets/Thrift.rb +22 -18
- data/config/snippets/Twiki.rb +158 -105
- data/config/snippets/Txt2tags.rb +166 -79
- data/config/snippets/Vectorscript.rb +47 -38
- data/config/snippets/Widget Creator.rb +5 -5
- data/config/snippets/XML.rb +30 -18
- data/config/snippets/YAML.rb +5 -4
- data/config/snippets/YARD.rb +93 -0
- data/config/snippets/reStructuredText.rb +25 -20
- data/config/syntax/ANTLR.rb +17 -15
- data/config/syntax/ASP vb.NET.rb +27 -24
- data/config/syntax/ASP.rb +21 -19
- data/config/syntax/ActionScript.rb +16 -16
- data/config/syntax/Active4D Config.rb +5 -5
- data/config/syntax/Active4D Library.rb +2 -2
- data/config/syntax/Active4D.rb +32 -30
- data/config/syntax/Ada.rb +13 -10
- data/config/syntax/Ant.rb +9 -7
- data/config/syntax/Apache.rb +22 -18
- data/config/syntax/AppleScript.rb +486 -192
- data/config/syntax/AsciiDoc.rb +21 -0
- data/config/syntax/BibTeX.rb +7 -7
- data/config/syntax/Blog - HTML.rb +7 -7
- data/config/syntax/Blog - Markdown.rb +6 -6
- data/config/syntax/Blog - Text.rb +2 -2
- data/config/syntax/Blog - Textile.rb +2 -2
- data/config/syntax/Bulletin Board.rb +33 -32
- data/config/syntax/C++ Qt.rb +7 -6
- data/config/syntax/C++.rb +31 -28
- data/config/syntax/C.rb +55 -51
- data/config/syntax/CMake Listfile.rb +12 -11
- data/config/syntax/CSS.rb +24 -23
- data/config/syntax/CSV.rb +3 -3
- data/config/syntax/CoffeeScript.rb +161 -0
- data/config/syntax/ColdFusion.rb +8 -8
- data/config/syntax/Context Free.rb +18 -16
- data/config/syntax/Cucumber Steps.rb +108 -0
- data/config/syntax/D.rb +70 -69
- data/config/syntax/Diff.rb +13 -10
- data/config/syntax/DokuWiki.rb +22 -18
- data/config/syntax/Doxygen.rb +1 -1
- data/config/syntax/Dylan.rb +8 -8
- data/config/syntax/Eiffel.rb +12 -12
- data/config/syntax/Erlang.rb +96 -89
- data/config/syntax/F-Script.rb +11 -9
- data/config/syntax/FXScript.rb +16 -14
- data/config/syntax/Fortran - Modern.rb +25 -24
- data/config/syntax/Fortran - Punchcard.rb +43 -40
- data/config/syntax/GTD.rb +1 -1
- data/config/syntax/GTDalt.rb +14 -11
- data/config/syntax/Gettext.rb +10 -9
- data/config/syntax/Gherkin.rb +65 -0
- data/config/syntax/Go.rb +256 -0
- data/config/syntax/Grails Server Page.rb +108 -0
- data/config/syntax/Graphviz (DOT).rb +6 -6
- data/config/syntax/Greasemonkey.rb +3 -3
- data/config/syntax/Gri.rb +12 -12
- data/config/syntax/Groovy.rb +502 -0
- data/config/syntax/HTML (ASP).rb +3 -3
- data/config/syntax/HTML (ASP.net).rb +31 -31
- data/config/syntax/HTML (Active4D).rb +19 -19
- data/config/syntax/HTML (Django).rb +6 -6
- data/config/syntax/HTML (Erlang).rb +4 -4
- data/config/syntax/HTML (Mason).rb +13 -13
- data/config/syntax/HTML (Rails).rb +5 -5
- data/config/syntax/HTML (Tcl).rb +3 -3
- data/config/syntax/HTML (Template Toolkit).rb +9 -9
- data/config/syntax/HTML.rb +27 -27
- data/config/syntax/Haskell.rb +31 -28
- data/config/syntax/Inform.rb +5 -5
- data/config/syntax/Ini.rb +4 -4
- data/config/syntax/Installer Distribution Script.rb +19 -18
- data/config/syntax/Io.rb +17 -15
- data/config/syntax/JSFL.rb +7 -6
- data/config/syntax/Java Properties.rb +3 -3
- data/config/syntax/Java Server Page (JSP).rb +5 -4
- data/config/syntax/Java.rb +40 -33
- data/config/syntax/JavaDoc.rb +24 -22
- data/config/syntax/JavaScript (Rails).rb +1 -1
- data/config/syntax/JavaScript.rb +41 -34
- data/config/syntax/Javascript YUI.rb +109 -101
- data/config/syntax/LaTeX Beamer.rb +3 -3
- data/config/syntax/LaTeX Log.rb +3 -3
- data/config/syntax/LaTeX Memoir.rb +7 -5
- data/config/syntax/LaTeX Rdaemon.rb +1 -1
- data/config/syntax/LaTeX.rb +52 -47
- data/config/syntax/Language Grammar.rb +58 -55
- data/config/syntax/Lex-Flex.rb +13 -13
- data/config/syntax/Lighttpd.rb +7 -7
- data/config/syntax/Lisp.rb +6 -5
- data/config/syntax/Literate Haskell.rb +2 -2
- data/config/syntax/Logo.rb +4 -4
- data/config/syntax/Logtalk.rb +64 -49
- data/config/syntax/Lua.rb +12 -12
- data/config/syntax/MATLAB.rb +71 -70
- data/config/syntax/MEL.rb +16 -15
- data/config/syntax/MIPS Assembler.rb +11 -11
- data/config/syntax/MacPorts Portfile.rb +16 -15
- data/config/syntax/Mail.rb +5 -4
- data/config/syntax/Makefile.rb +3 -3
- data/config/syntax/Man.rb +2 -2
- data/config/syntax/Markdown.rb +440 -0
- data/config/syntax/Maven POM.rb +17 -16
- data/config/syntax/Mediawiki.rb +46 -46
- data/config/syntax/Modula-3.rb +7 -6
- data/config/syntax/MoinMoin.rb +16 -16
- data/config/syntax/MooTools.rb +75 -65
- data/config/syntax/Movable Type (MT only).rb +18 -18
- data/config/syntax/Movable Type.rb +20 -20
- data/config/syntax/MultiMarkdown.rb +35 -0
- data/config/syntax/Nemerle.rb +12 -12
- data/config/syntax/OCaml.rb +79 -71
- data/config/syntax/OCamllex.rb +14 -14
- data/config/syntax/OCamlyacc.rb +14 -12
- data/config/syntax/Objective-C++.rb +2 -2
- data/config/syntax/Objective-C.rb +76 -70
- data/config/syntax/Objective-J.rb +30 -29
- data/config/syntax/Octave.rb +27 -27
- data/config/syntax/OpenGL.rb +4 -4
- data/config/syntax/PHP.rb +1154 -0
- data/config/syntax/Pascal.rb +8 -8
- data/config/syntax/Perl HTML-Template.rb +5 -5
- data/config/syntax/Perl.rb +80 -76
- data/config/syntax/Plain Text.rb +5 -5
- data/config/syntax/Postscript.rb +6 -6
- data/config/syntax/Processing.rb +20 -20
- data/config/syntax/Prolog.rb +2 -2
- data/config/syntax/Property List.rb +50 -47
- data/config/syntax/Prototype & Script.aculo.us (JavaScript) Bracketed.rb +15 -13
- data/config/syntax/Prototype & Script.aculo.us (JavaScript).rb +9 -8
- data/config/syntax/Python Django.rb +6 -6
- data/config/syntax/Python.rb +94 -87
- data/config/syntax/Quake Style .cfg.rb +4 -4
- data/config/syntax/R Console (Rdaemon) Plain.rb +2 -2
- data/config/syntax/R Console (Rdaemon).rb +2 -2
- data/config/syntax/R.rb +21 -20
- data/config/syntax/RSpec.rb +15 -15
- data/config/syntax/Ragel.rb +14 -13
- data/config/syntax/Rd (R Documentation).rb +4 -4
- data/config/syntax/Regular Expressions (Oniguruma).rb +11 -10
- data/config/syntax/Regular Expressions (Python).rb +9 -9
- data/config/syntax/Release Notes.rb +7 -6
- data/config/syntax/Remind.rb +19 -17
- data/config/syntax/Rez.rb +10 -9
- data/config/syntax/Ruby Haml.rb +11 -11
- data/config/syntax/Ruby on Rails.rb +26 -24
- data/config/syntax/Ruby.rb +73 -71
- data/config/syntax/S5 Slide Show.rb +9 -9
- data/config/syntax/SQL.rb +29 -27
- data/config/syntax/SSH Config.rb +4 -4
- data/config/syntax/SWIG.rb +12 -11
- data/config/syntax/SWeave.rb +8 -7
- data/config/syntax/Scheme.rb +56 -54
- data/config/syntax/Scilab.rb +7 -6
- data/config/syntax/Setext.rb +14 -13
- data/config/syntax/Shell Script (Bash).rb +42 -42
- data/config/syntax/Slate.rb +24 -19
- data/config/syntax/Smarty.rb +11 -10
- data/config/syntax/Standard ML - CM.rb +2 -2
- data/config/syntax/Standard ML.rb +26 -23
- data/config/syntax/Strings File.rb +6 -6
- data/config/syntax/TSV.rb +2 -2
- data/config/syntax/Tcl.rb +10 -9
- data/config/syntax/TeX Math.rb +7 -6
- data/config/syntax/TeX.rb +7 -7
- data/config/syntax/Textile.rb +33 -27
- data/config/syntax/Thrift.rb +37 -29
- data/config/syntax/Twiki.rb +19 -18
- data/config/syntax/Txt2tags.rb +26 -23
- data/config/syntax/Vectorscript.rb +9 -7
- data/config/syntax/XML strict.rb +6 -4
- data/config/syntax/XML.rb +55 -30
- data/config/syntax/XSL.rb +5 -5
- data/config/syntax/YAML.rb +14 -12
- data/config/syntax/camlp4.rb +5 -5
- data/config/syntax/iCalendar.rb +3 -3
- data/config/syntax/jQuery (JavaScript).rb +9 -9
- data/config/syntax/mod_perl.rb +6 -6
- data/config/syntax/qmake Project file.rb +16 -15
- data/config/syntax/reStructuredText.rb +23 -21
- data/config/syntax/svn-commit.tmp.rb +5 -5
- data/lib/ver.rb +169 -85
- data/lib/ver/action.rb +39 -30
- data/lib/ver/buffer.rb +962 -144
- data/lib/ver/buffer/frame.rb +23 -0
- data/lib/ver/buffer/invalid_trailing_whitespace.rb +17 -0
- data/lib/ver/buffer/markup_underline_link.rb +30 -0
- data/lib/ver/buffer/matching_brace.rb +22 -0
- data/lib/ver/buffer/term.rb +1 -1
- data/lib/ver/clipboard.rb +107 -0
- data/lib/ver/digraphs.rb +1373 -0
- data/lib/ver/entry.rb +54 -43
- data/lib/ver/event.rb +335 -0
- data/lib/ver/exception_view.rb +3 -1
- data/lib/ver/executor.rb +7 -7
- data/lib/ver/executor/buffer.rb +4 -4
- data/lib/ver/executor/encoding.rb +19 -0
- data/lib/ver/executor/entry.rb +9 -9
- data/lib/ver/executor/fuzzy_file_finder.rb +1 -1
- data/lib/ver/executor/label.rb +2 -0
- data/lib/ver/executor/method.rb +2 -3
- data/lib/ver/help/describe_key.rb +44 -44
- data/lib/ver/hover_completion.rb +11 -6
- data/lib/ver/keymap.rb +68 -39
- data/lib/ver/layout/paned.rb +56 -44
- data/lib/ver/layout/toplevel.rb +68 -0
- data/lib/ver/layout/vim.rb +919 -0
- data/lib/ver/major_mode.rb +49 -49
- data/lib/ver/methods.rb +22 -25
- data/lib/ver/methods/basic.rb +49 -20
- data/lib/ver/methods/bookmark.rb +33 -33
- data/lib/ver/methods/clipboard.rb +186 -49
- data/lib/ver/methods/completion.rb +5 -5
- data/lib/ver/methods/control.rb +47 -66
- data/lib/ver/methods/delete.rb +5 -122
- data/lib/ver/methods/help.rb +2 -2
- data/lib/ver/methods/insert.rb +101 -29
- data/lib/ver/methods/layout.rb +62 -64
- data/lib/ver/methods/macro.rb +45 -0
- data/lib/ver/methods/move.rb +63 -349
- data/lib/ver/methods/nano.rb +99 -71
- data/lib/ver/methods/open.rb +8 -7
- data/lib/ver/methods/preview.rb +34 -14
- data/lib/ver/methods/save.rb +194 -163
- data/lib/ver/methods/search.rb +169 -81
- data/lib/ver/methods/search_and_replace.rb +62 -49
- data/lib/ver/methods/selection.rb +26 -54
- data/lib/ver/methods/snippet.rb +79 -54
- data/lib/ver/methods/undo.rb +12 -16
- data/lib/ver/minibuffer.rb +283 -134
- data/lib/ver/minor_mode.rb +36 -47
- data/lib/ver/mode_resolving.rb +71 -0
- data/lib/ver/platform.rb +41 -0
- data/lib/ver/plist.rb +16 -4
- data/lib/ver/register.rb +86 -0
- data/lib/ver/status.rb +44 -6
- data/lib/ver/status/battery.rb +1 -1
- data/lib/ver/status/buffer_position.rb +2 -2
- data/lib/ver/status/diakonos_position.rb +3 -3
- data/lib/ver/status/encoding.rb +1 -1
- data/lib/ver/status/filename.rb +1 -1
- data/lib/ver/status/label.rb +20 -20
- data/lib/ver/status/mode.rb +1 -1
- data/lib/ver/status/nano_help.rb +3 -14
- data/lib/ver/status/nano_position.rb +6 -6
- data/lib/ver/status/percent.rb +2 -2
- data/lib/ver/status/position.rb +2 -2
- data/lib/ver/status/short_filename.rb +1 -1
- data/lib/ver/status/syntax.rb +1 -1
- data/lib/ver/struct.rb +28 -0
- data/lib/ver/syntax/processor.rb +2 -1
- data/lib/ver/text.rb +48 -520
- data/lib/ver/text/end.rb +14 -0
- data/lib/ver/text/index.rb +16 -101
- data/lib/ver/text/insert.rb +138 -0
- data/lib/ver/text/mark.rb +559 -0
- data/lib/ver/text/position.rb +240 -0
- data/lib/ver/text/range.rb +74 -0
- data/lib/ver/text/selection.rb +402 -0
- data/lib/ver/text/selection/block.rb +69 -0
- data/lib/ver/text/selection/char.rb +93 -0
- data/lib/ver/text/selection/line.rb +64 -0
- data/lib/ver/text/tag.rb +322 -0
- data/lib/ver/undo.rb +109 -34
- data/lib/ver/vendor/eval_completer.rb +184 -0
- data/lib/ver/vendor/json_store.rb +23 -0
- data/lib/ver/vendor/open3.rb +729 -0
- data/lib/ver/vendor/pathname.rb +73 -0
- data/lib/ver/vendor/textpow.rb +1 -1
- data/lib/ver/version.rb +1 -1
- data/lib/ver/widget_event.rb +9 -5
- data/lib/ver/widget_major_mode.rb +69 -23
- data/spec/helper.rb +124 -8
- data/spec/ver/action.rb +160 -46
- data/spec/ver/buffer.rb +23 -0
- data/spec/ver/clipboard.rb +92 -0
- data/spec/ver/keymap.rb +63 -61
- data/spec/ver/keymap/diakonos.rb +88 -0
- data/spec/ver/keymap/emacs.rb +65 -0
- data/spec/ver/keymap/general.rb +98 -0
- data/spec/ver/keymap/nano.rb +84 -0
- data/spec/ver/keymap/vim.rb +205 -0
- data/spec/ver/keymap/vim/changing_text.rb +489 -0
- data/spec/ver/keymap/vim/complex_changes.rb +53 -0
- data/spec/ver/keymap/vim/copying_and_moving_text.rb +258 -0
- data/spec/ver/keymap/vim/deleting_text.rb +188 -0
- data/spec/ver/keymap/vim/digraphs.rb +52 -0
- data/spec/ver/keymap/vim/external_commands.rb +21 -0
- data/spec/ver/keymap/vim/inserting_mode_keys.rb +115 -0
- data/spec/ver/keymap/vim/inserting_mode_special.rb +168 -0
- data/spec/ver/keymap/vim/inserting_text.rb +108 -0
- data/spec/ver/keymap/vim/left_right_motion.rb +120 -0
- data/spec/ver/keymap/vim/mark_motion.rb +73 -0
- data/spec/ver/keymap/vim/repeating_commands.rb +64 -0
- data/spec/ver/keymap/vim/text_object_motion.rb +137 -0
- data/spec/ver/keymap/vim/text_objects.rb +101 -0
- data/spec/ver/keymap/vim/undo_redo.rb +21 -0
- data/spec/ver/keymap/vim/up_down_motion.rb +94 -0
- data/spec/ver/keymap/vim/various_motion.rb +33 -0
- data/spec/ver/keysyms.rb +13 -0
- data/spec/ver/major_mode.rb +37 -37
- data/spec/ver/minor_mode.rb +21 -20
- data/spec/ver/plugin/smart_autoindent.rb +2 -2
- data/spec/ver/text/index.rb +122 -0
- data/spec/ver/text/insert.rb +299 -0
- data/spec/ver/text/mark.rb +94 -0
- data/spec/ver/text/range.rb +71 -0
- data/spec/ver/text/selection.rb +315 -0
- data/spec/ver/text/tag.rb +93 -0
- data/spec/ver/undo.rb +133 -0
- data/spec/ver/undo/record_sanitize.rb +85 -0
- data/spec/ver/vendor/eval_completer.rb +91 -0
- data/spec/ver/widget_major_mode.rb +4 -3
- data/ver.gemspec +8 -8
- metadata +234 -72
- data/.todo +0 -102
- data/ROADMAP.textile +0 -187
- data/config/snippets/ANTLR.rb +0 -3
- data/config/snippets/Bison.rb +0 -3
- data/config/snippets/CTags.rb +0 -3
- data/config/snippets/CVS.rb +0 -3
- data/config/snippets/Darcs.rb +0 -3
- data/config/snippets/Diff.rb +0 -3
- data/config/snippets/Dylan.rb +0 -3
- data/config/snippets/Experimental Wiki.rb +0 -3
- data/config/snippets/Experimental.rb +0 -3
- data/config/snippets/FileMerge.rb +0 -3
- data/config/snippets/GTD2.rb +0 -3
- data/config/snippets/GetBundle.rb +0 -3
- data/config/snippets/Graphviz.rb +0 -3
- data/config/snippets/Hotkey.rb +0 -3
- data/config/snippets/Hyperlink Helper.rb +0 -3
- data/config/snippets/ImageBrowser.rb +0 -3
- data/config/snippets/Inform.rb +0 -3
- data/config/snippets/Ini.rb +0 -3
- data/config/snippets/Installer.rb +0 -3
- data/config/snippets/JSFL.rb +0 -3
- data/config/snippets/JSON.rb +0 -3
- data/config/snippets/Lex-Flex.rb +0 -3
- data/config/snippets/Lighttpd.rb +0 -3
- data/config/snippets/MEL.rb +0 -3
- data/config/snippets/MacPorts.rb +0 -3
- data/config/snippets/Make.rb +0 -3
- data/config/snippets/Man Pages.rb +0 -3
- data/config/snippets/Math.rb +0 -3
- data/config/snippets/Mercurial.rb +0 -3
- data/config/snippets/Modula.rb +0 -3
- data/config/snippets/Navigation.rb +0 -3
- data/config/snippets/OCaml Experimental Completions.rb +0 -3
- data/config/snippets/OpenGL.rb +0 -3
- data/config/snippets/Outlines.rb +0 -3
- data/config/snippets/Perforce.rb +0 -3
- data/config/snippets/Perl HTML::Template.rb +0 -27
- data/config/snippets/Postscript.rb +0 -3
- data/config/snippets/Prolog.rb +0 -3
- data/config/snippets/Quake.rb +0 -3
- data/config/snippets/R Console (R.app).rb +0 -3
- data/config/snippets/Ragel.rb +0 -3
- data/config/snippets/Regular Expressions.rb +0 -3
- data/config/snippets/Rez.rb +0 -3
- data/config/snippets/Ruby Haml.rb +0 -3
- data/config/snippets/SCons.rb +0 -3
- data/config/snippets/SQL.rb +0 -3
- data/config/snippets/SVK.rb +0 -3
- data/config/snippets/SWeave.rb +0 -3
- data/config/snippets/Scheme.rb +0 -3
- data/config/snippets/Subversion.rb +0 -3
- data/config/snippets/TODO.rb +0 -3
- data/config/snippets/Tabular.rb +0 -3
- data/config/snippets/TerminalMate.rb +0 -3
- data/config/snippets/TextMate.rb +0 -3
- data/config/snippets/Transmit.rb +0 -3
- data/config/snippets/Xcode.rb +0 -3
- data/config/snippets/iCalendar.rb +0 -3
- data/config/snippets/iTerm.rb +0 -3
- data/lib/ver/keysyms.rb +0 -104
- data/spec/ver/methods/move.rb +0 -150
@@ -3,31 +3,35 @@ module VER
|
|
3
3
|
module Selection
|
4
4
|
module_function
|
5
5
|
|
6
|
-
def
|
7
|
-
|
8
|
-
text.store(self, :start, text.index(:insert))
|
9
|
-
end
|
10
|
-
|
11
|
-
text.store(self, :mode, new_mode)
|
12
|
-
text.store(self, :refresh, true)
|
13
|
-
Undo.separator(text)
|
14
|
-
refresh(text)
|
15
|
-
end
|
16
|
-
|
17
|
-
def leave(text, old_mode, new_mode)
|
18
|
-
return if new_mode.name =~ /^select/
|
19
|
-
|
20
|
-
text.store(self, :mode, new_mode)
|
21
|
-
text.store(self, :refresh, false)
|
22
|
-
Undo.separator(text)
|
23
|
-
clear(text)
|
24
|
-
end
|
6
|
+
def pipe(buffer)
|
7
|
+
paths = ENV['PATH'].split(':').map{|path| Pathname(path).expand_path }
|
25
8
|
|
26
|
-
|
27
|
-
|
28
|
-
|
9
|
+
buffer.ask 'Pipe command: ' do |answer, action|
|
10
|
+
case action
|
11
|
+
when :complete
|
12
|
+
current = answer.split.last
|
13
|
+
paths.map{|path|
|
14
|
+
(path/"*#{current}*").glob.select{|file|
|
15
|
+
begin
|
16
|
+
file = File.readlink(file) if File.symlink?(file)
|
17
|
+
stat = File.stat(file)
|
18
|
+
stat.file? && stat.executable?
|
19
|
+
rescue Errno::ENOENT
|
20
|
+
end
|
21
|
+
}
|
22
|
+
}.flatten.compact
|
23
|
+
when :attempt
|
24
|
+
buffer.at_sel.pipe!(answer)
|
25
|
+
buffer.at_sel.finish
|
26
|
+
:abort
|
27
|
+
end
|
29
28
|
end
|
30
29
|
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
__END__
|
31
35
|
|
32
36
|
def refresh(text)
|
33
37
|
return unless text.store(self, :refresh)
|
@@ -187,30 +191,6 @@ module VER
|
|
187
191
|
finish(text)
|
188
192
|
end
|
189
193
|
|
190
|
-
def pipe(text)
|
191
|
-
paths = ENV['PATH'].split(':').map{|path| Pathname(path).expand_path }
|
192
|
-
|
193
|
-
text.ask 'Pipe command: ' do |answer, action|
|
194
|
-
case action
|
195
|
-
when :complete
|
196
|
-
current = answer.split.last
|
197
|
-
paths.map{|path|
|
198
|
-
(path/"*#{current}*").glob.select{|file|
|
199
|
-
begin
|
200
|
-
file = File.readlink(file) if File.symlink?(file)
|
201
|
-
stat = File.stat(file)
|
202
|
-
stat.file? && stat.executable?
|
203
|
-
rescue Errno::ENOENT
|
204
|
-
end
|
205
|
-
}
|
206
|
-
}.flatten.compact
|
207
|
-
when :attempt
|
208
|
-
pipe_execute(text, answer)
|
209
|
-
finish(text)
|
210
|
-
:abort
|
211
|
-
end
|
212
|
-
end
|
213
|
-
end
|
214
194
|
|
215
195
|
def comment(text)
|
216
196
|
comment = "#{text.options.comment_line} "
|
@@ -413,14 +393,6 @@ module VER
|
|
413
393
|
|
414
394
|
from_y, to_y = [ly, ry].sort
|
415
395
|
from_x, to_x = [lx, rx].sort
|
416
|
-
|
417
|
-
code = [%(set win "#{text.tk_pathname}")]
|
418
|
-
|
419
|
-
from_y.upto to_y do |y|
|
420
|
-
code << "$win tag add sel #{y}.#{from_x} #{y}.#{to_x + 1}"
|
421
|
-
end
|
422
|
-
|
423
|
-
Tk.execute_only(Tk::TclString.new(code.join("\n")))
|
424
396
|
end
|
425
397
|
|
426
398
|
def refresh_char(text, start)
|
data/lib/ver/methods/snippet.rb
CHANGED
@@ -5,109 +5,134 @@ module VER
|
|
5
5
|
module Snippet
|
6
6
|
module_function
|
7
7
|
|
8
|
-
def dwim(
|
9
|
-
jump(
|
8
|
+
def dwim(buffer)
|
9
|
+
jump(buffer) or complete(buffer) && jump(buffer)
|
10
10
|
end
|
11
11
|
|
12
|
-
def jump(
|
13
|
-
jump_marks_and_tags(
|
12
|
+
def jump(buffer)
|
13
|
+
jump_marks_and_tags(buffer) || jump_home(buffer)
|
14
14
|
end
|
15
15
|
|
16
|
-
def jump_home(
|
17
|
-
if
|
18
|
-
|
19
|
-
|
16
|
+
def jump_home(buffer)
|
17
|
+
if buffer.mark_names.include?(:ver_snippet_0)
|
18
|
+
buffer.mark_set(:insert, :ver_snippet_0)
|
19
|
+
buffer.mark_unset(:ver_snippet_0)
|
20
20
|
true
|
21
21
|
else
|
22
|
-
cancel(
|
22
|
+
cancel(buffer)
|
23
23
|
false
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def jump_marks_and_tags(
|
28
|
-
(marks(
|
27
|
+
def jump_marks_and_tags(buffer)
|
28
|
+
(marks(buffer) + tags(buffer)).
|
29
29
|
sort_by{|_, name, _|
|
30
30
|
name =~ /_0$/ ? 'zero' : name
|
31
31
|
}.each do |idx, name, type|
|
32
|
+
|
32
33
|
case type
|
33
34
|
when :tag
|
34
|
-
return jump_tag(
|
35
|
+
return jump_tag(buffer, name)
|
35
36
|
when :mark
|
36
|
-
return jump_mark(
|
37
|
+
return jump_mark(buffer, name)
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
41
|
false
|
41
42
|
end
|
42
43
|
|
43
|
-
def marks(
|
44
|
-
|
44
|
+
def marks(buffer)
|
45
|
+
buffer.mark_names.map{|mark|
|
45
46
|
next unless mark =~ /^ver_snippet_(\d+)$/
|
46
47
|
[$1.to_i, mark, :mark]
|
47
48
|
}.compact
|
48
49
|
end
|
49
50
|
|
50
|
-
def tags(
|
51
|
-
|
51
|
+
def tags(buffer)
|
52
|
+
buffer.tag_names.map{|tag|
|
52
53
|
next unless tag =~ /^ver\.snippet\.(\d+)$/
|
53
54
|
[$1.to_i, tag, :tag]
|
54
55
|
}.compact
|
55
56
|
end
|
56
57
|
|
57
|
-
def jump_tag(
|
58
|
-
|
59
|
-
from, to =
|
58
|
+
def jump_tag(buffer, name)
|
59
|
+
buffer.minor_mode(:insert, :snippet)
|
60
|
+
from, to = *buffer.tag_ranges(name).first
|
60
61
|
return unless from
|
61
62
|
|
62
|
-
|
63
|
+
buffer.mark_set(:insert, from)
|
63
64
|
true
|
64
65
|
end
|
65
66
|
|
66
|
-
def jump_mark(
|
67
|
-
|
67
|
+
def jump_mark(buffer, name)
|
68
|
+
buffer.mark_set('insert', name)
|
68
69
|
if name =~ /_0$/
|
69
|
-
cancel(
|
70
|
+
cancel(buffer, :insert)
|
70
71
|
else
|
71
|
-
|
72
|
+
buffer.mark_unset(name)
|
72
73
|
end
|
73
74
|
|
74
75
|
true
|
75
76
|
end
|
76
77
|
|
77
|
-
def cancel(
|
78
|
-
marks(
|
79
|
-
tags(
|
80
|
-
|
78
|
+
def cancel(buffer, into_mode = :control)
|
79
|
+
marks(buffer).each{|_, mark, _| buffer.mark_unset(mark) }
|
80
|
+
tags(buffer).each{|_, tag, _| buffer.tag_delete(tag) }
|
81
|
+
buffer.minor_mode(:snippet, into_mode) if buffer.minor_mode?(:snippet)
|
81
82
|
end
|
82
83
|
|
83
|
-
def
|
84
|
-
tag =
|
84
|
+
def on_insert(buffer, string = buffer.event.unicode)
|
85
|
+
tag = buffer.tag_names(:insert).find{|name| name =~ /^ver\.snippet\.(\d+)$/ }
|
85
86
|
|
86
87
|
if tag
|
87
|
-
from, to =
|
88
|
-
|
89
|
-
|
88
|
+
from, to = *buffer.tag_ranges(tag).first
|
89
|
+
buffer.tag_delete(tag, from, to)
|
90
|
+
buffer.replace(from, to, string)
|
90
91
|
else
|
91
|
-
|
92
|
+
buffer.insert(:insert, string)
|
92
93
|
end
|
93
94
|
end
|
94
95
|
|
95
|
-
|
96
|
-
|
96
|
+
class Scope < Struct.new(:tags)
|
97
|
+
def include?(scope)
|
98
|
+
tags.include?(scope)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def complete(buffer)
|
103
|
+
sofar = buffer.get('insert linestart', 'insert')
|
104
|
+
l sofar: sofar
|
105
|
+
|
106
|
+
scope = Scope.new(buffer.tag_names(:insert))
|
107
|
+
|
108
|
+
buffer.snippets.each do |snippet|
|
109
|
+
next unless tab_trigger = snippet[:tabTrigger]
|
110
|
+
next unless sofar.end_with?(tab_trigger)
|
111
|
+
next unless scope.include?(snippet[:scope])
|
112
|
+
from = buffer.index("insert - #{tab_trigger.size} displaychars")
|
113
|
+
to = buffer.at_insert
|
114
|
+
return insert(buffer, from, to, snippet)
|
115
|
+
end
|
116
|
+
|
117
|
+
return
|
118
|
+
|
119
|
+
head = buffer.get('insert linestart', 'insert')
|
97
120
|
name = head[/\S+$/]
|
98
|
-
from =
|
99
|
-
to =
|
121
|
+
from = buffer.index("insert - #{name.size} chars")
|
122
|
+
to = buffer.index("insert")
|
123
|
+
|
124
|
+
l buffer.snippets
|
100
125
|
|
101
|
-
return unless snippet =
|
102
|
-
insert(
|
126
|
+
return unless snippet = buffer.snippets[name]
|
127
|
+
insert(buffer, from, to, snippet)
|
103
128
|
true
|
104
129
|
end
|
105
130
|
|
106
|
-
def insert(
|
107
|
-
|
108
|
-
|
131
|
+
def insert(buffer, from, to, snippet_source)
|
132
|
+
buffer.delete(from, to)
|
133
|
+
buffer.mark_set(:insert, from)
|
109
134
|
snippet = VER::Snippet.new(snippet_source[:content])
|
110
|
-
snippet.apply_on(
|
135
|
+
snippet.apply_on(buffer)
|
111
136
|
end
|
112
137
|
end # Snippet
|
113
138
|
end # Methods
|
@@ -147,9 +172,9 @@ module VER
|
|
147
172
|
out
|
148
173
|
end
|
149
174
|
|
150
|
-
def apply_on(
|
175
|
+
def apply_on(buffer)
|
151
176
|
parse(@snippet, out = [])
|
152
|
-
apply_out_on(
|
177
|
+
apply_out_on(buffer, out)
|
153
178
|
end
|
154
179
|
|
155
180
|
private
|
@@ -215,11 +240,11 @@ module VER
|
|
215
240
|
out
|
216
241
|
end
|
217
242
|
|
218
|
-
def apply_out_on(
|
219
|
-
indent = ' ' *
|
220
|
-
initial_indent =
|
243
|
+
def apply_out_on(buffer, out)
|
244
|
+
indent = ' ' * buffer.options.shiftwidth
|
245
|
+
initial_indent = buffer.get('insert linestart', 'insert lineend')[/^\s+/]
|
221
246
|
|
222
|
-
|
247
|
+
buffer.undo_record do |record|
|
223
248
|
out.each do |atom|
|
224
249
|
case atom
|
225
250
|
when String
|
@@ -229,12 +254,12 @@ module VER
|
|
229
254
|
record.insert(:insert, atom)
|
230
255
|
when Numeric
|
231
256
|
mark = "ver_snippet_#{atom}"
|
232
|
-
|
233
|
-
|
257
|
+
buffer.mark_set(mark, 'insert')
|
258
|
+
buffer.mark_gravity(mark, 'left')
|
234
259
|
when Array
|
235
260
|
number, content = atom
|
236
261
|
tag = "ver.snippet.#{number}"
|
237
|
-
|
262
|
+
buffer.tag_configure(tag, underline: true)
|
238
263
|
record.insert(:insert, content, tag)
|
239
264
|
end
|
240
265
|
end
|
data/lib/ver/methods/undo.rb
CHANGED
@@ -6,19 +6,17 @@ module VER
|
|
6
6
|
module Undo
|
7
7
|
module_function
|
8
8
|
|
9
|
-
# Redo +count+ changes made in the given +
|
10
|
-
def redo(
|
11
|
-
count.times{
|
12
|
-
text.pristine = false
|
9
|
+
# Redo +count+ changes made in the given +buffer+.
|
10
|
+
def redo(buffer, count = buffer.prefix_count)
|
11
|
+
count.times{ buffer.redo }
|
13
12
|
end
|
14
13
|
|
15
|
-
# Undo +count+ changes made in the given +
|
16
|
-
def undo(
|
17
|
-
count.times{
|
18
|
-
text.pristine = false
|
14
|
+
# Undo +count+ changes made in the given +buffer+
|
15
|
+
def undo(buffer, count = buffer.prefix_count)
|
16
|
+
count.times{ buffer.undo }
|
19
17
|
end
|
20
18
|
|
21
|
-
# Wrapper to record multiple changes to given +
|
19
|
+
# Wrapper to record multiple changes to given +buffer+ as one change, so
|
22
20
|
# they can be undone and redone together.
|
23
21
|
# A user usually expects one command to correspond to one undo record,
|
24
22
|
# except for things like replacement or input.
|
@@ -27,17 +25,15 @@ module VER
|
|
27
25
|
#
|
28
26
|
# @yieldparam [VER::Undo::AutoSeparator]
|
29
27
|
# proxy for delete/insert/replace methods
|
30
|
-
def record(
|
31
|
-
|
32
|
-
text.undoer.record_multi(&block)
|
33
|
-
text.pristine = false
|
28
|
+
def record(buffer, &block)
|
29
|
+
buffer.undo_record(&block)
|
34
30
|
end
|
35
31
|
|
36
32
|
# Insert a separator into the undo history, undo/redo apply always up to
|
37
33
|
# the next separator.
|
38
|
-
# Operates on the undoer of the given +
|
39
|
-
def separator(
|
40
|
-
|
34
|
+
# Operates on the undoer of the given +buffer+.
|
35
|
+
def separator(buffer)
|
36
|
+
buffer.undoer.separate!
|
41
37
|
end
|
42
38
|
end # Undo
|
43
39
|
end # Methods
|
data/lib/ver/minibuffer.rb
CHANGED
@@ -1,217 +1,352 @@
|
|
1
1
|
module VER
|
2
|
-
class MiniBuffer <
|
2
|
+
class MiniBuffer < Text
|
3
|
+
HISTORY = Hash.new{|h,k| h[k] = SizedArray.new(50) }
|
4
|
+
|
5
|
+
# NOTE:
|
6
|
+
# {Text#dump} on a peer text widget causes segfault, I've reported the
|
7
|
+
# issue to the tk maintainers and they are working on it.
|
8
|
+
# All tcl/tk versions are affected AFAIK, take care.
|
9
|
+
class Peer < MiniBuffer
|
10
|
+
attr_reader :buffer
|
11
|
+
|
12
|
+
def initialize(text, parent, buffer, options = {})
|
13
|
+
@tk_parent = parent
|
14
|
+
@buffer = buffer
|
15
|
+
@tk_pathname = Tk.register_object(parent, self)
|
16
|
+
Tk.execute(text.tk_pathname, 'peer', 'create', @tk_pathname, options)
|
17
|
+
setup_common
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.answer_from(text)
|
22
|
+
line = text.get('current linestart', 'current lineend')
|
23
|
+
minibuf = VER.minibuf
|
24
|
+
minibuf.answer = line
|
25
|
+
minibuf.complete_small
|
26
|
+
end
|
27
|
+
|
3
28
|
include Keymapped
|
4
29
|
|
5
|
-
attr_accessor :messages_expire, :
|
30
|
+
attr_accessor :messages_expire, :char_width, :ask_stack,
|
31
|
+
:at_insert, :completion_buffer
|
32
|
+
attr_reader :asking, :messages, :messages_pending, :buffer
|
6
33
|
|
7
34
|
def initialize(*args)
|
8
35
|
super
|
36
|
+
setup
|
37
|
+
end
|
38
|
+
|
39
|
+
def peer_create(parent, buffer, *args)
|
40
|
+
Peer.new(self, parent, buffer, *args)
|
41
|
+
end
|
42
|
+
|
43
|
+
def setup
|
44
|
+
setup_common
|
9
45
|
|
10
|
-
|
46
|
+
@info.configure(foreground: '#fff')
|
47
|
+
@warn.configure(foreground: '#f00')
|
48
|
+
@highlight.configure(background: '#330')
|
49
|
+
|
50
|
+
# Now to the difficult part.
|
51
|
+
# When i talk about "tag", i mean the prompt and answer tags.
|
52
|
+
#
|
53
|
+
# If the "tag" contents are deleted, we will get errors in all places
|
54
|
+
# where it's used.
|
55
|
+
# To avoid that, we add extra tags called "tag"_keeper.
|
56
|
+
# These are elided and contain only one character, their priority is
|
57
|
+
# higher than "tag" to sure they never show.
|
58
|
+
# The character within is also tagged with "tag".
|
59
|
+
# When doing modifications, we just have to make sure that the
|
60
|
+
# "tag"_keeper tag stays around.
|
61
|
+
# To simplify referencing, we add a mark called "tag" with left gravity.
|
62
|
+
# When getting contents of "tag", get only non-elided part.
|
63
|
+
|
64
|
+
@prompt_keeper = tag(:prompt_keeper)
|
65
|
+
insert('1.0', 'p', @prompt_keeper)
|
66
|
+
@prompt_mark = mark(:prompt, '1.1', :left)
|
67
|
+
@prompt_tag = tag(:prompt, '1.0', '1.1')
|
68
|
+
@prompt_keeper.configure(elide: true)
|
69
|
+
tag_lower(@prompt_tag, @prompt_keeper)
|
70
|
+
|
71
|
+
@answer_keeper = tag(:answer_keeper)
|
72
|
+
insert('1.1', 'a', :answer_keeper)
|
73
|
+
@answer_mark = mark(:answer, '1.2', :left)
|
74
|
+
@answer_tag = tag(:answer, '1.1', '1.2')
|
75
|
+
@answer_keeper.configure(elide: true)
|
76
|
+
tag_lower(@answer_tag, @answer_keeper)
|
77
|
+
|
78
|
+
bind('<Configure>'){ pack_forget }
|
79
|
+
end
|
80
|
+
|
81
|
+
def setup_common
|
11
82
|
configure(
|
12
|
-
|
13
|
-
|
14
|
-
|
83
|
+
autoseparators: true,
|
84
|
+
background: '#000',
|
85
|
+
blockcursor: false,
|
15
86
|
borderwidth: 0,
|
16
87
|
exportselection: true,
|
88
|
+
font: VER.options.font,
|
89
|
+
foreground: '#fff',
|
90
|
+
highlightbackground: '#000', # this specifies the colors
|
91
|
+
highlightcolor: '#fff', # that are used when the widget
|
92
|
+
highlightthickness: 1, # has input focus.
|
93
|
+
insertbackground: '#fff',
|
17
94
|
insertofftime: 0,
|
18
95
|
setgrid: false, # wtf?
|
19
|
-
|
20
|
-
|
21
|
-
background: '#000',
|
22
|
-
foreground: '#fff',
|
23
|
-
insertbackground: '#fff'
|
96
|
+
undo: true,
|
97
|
+
wrap: :word
|
24
98
|
)
|
25
99
|
|
26
100
|
self.major_mode = :MiniBuffer
|
27
101
|
self.messages_expire = false
|
28
|
-
|
29
|
-
|
102
|
+
@messages_pending = Hash.new(0)
|
103
|
+
@messages = SizedArray.new(10)
|
104
|
+
self.char_width = VER.options.font.measure('0')
|
105
|
+
self.ask_stack = []
|
106
|
+
self.at_insert = mark(:insert)
|
107
|
+
self.completion_buffer = Tk::Text.new(tk_parent)
|
108
|
+
@old_grid_info = nil
|
109
|
+
|
110
|
+
[ :info, :warn, :highlight, :prompt, :answer ].each do |name|
|
111
|
+
instance_variable_set("@#{name}", tag(name))
|
112
|
+
end
|
30
113
|
|
31
|
-
|
32
|
-
|
33
|
-
|
114
|
+
bind('<Configure>', &method(:adjust_size))
|
115
|
+
bind('<Destroy>', &method(:on_destroy))
|
116
|
+
end
|
34
117
|
|
35
|
-
|
118
|
+
def on_destroy(event)
|
119
|
+
@lock = true
|
36
120
|
end
|
37
121
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
122
|
+
def type(string)
|
123
|
+
major_mode.fake(string)
|
124
|
+
end
|
125
|
+
|
126
|
+
def history
|
127
|
+
HISTORY[@prompt.get]
|
128
|
+
end
|
129
|
+
|
130
|
+
def adjust_size(event = nil)
|
131
|
+
if get_displaychars('1.0', 'end').strip.empty?
|
132
|
+
if (info = grid_info) && !info.empty?
|
133
|
+
@old_grid_info = info
|
134
|
+
grid_forget
|
135
|
+
end
|
136
|
+
else
|
137
|
+
height = count('1.0', 'end', 'displaylines') || 1
|
138
|
+
grid_configure(@old_grid_info) if @old_grid_info
|
139
|
+
configure(height: height)
|
140
|
+
end
|
141
|
+
|
142
|
+
# a generous 25ms to make sure the display is updated.
|
143
|
+
# Might need longer, lemme know if that's the case.
|
144
|
+
Tk::After.ms(25){ buffer.see(:insert) } if buffer
|
145
|
+
rescue => ex
|
146
|
+
VER.error(ex)
|
43
147
|
end
|
44
148
|
|
45
|
-
def prompt=(
|
46
|
-
replace
|
47
|
-
rescue
|
48
|
-
insert '1.0 linestart', prompt, 'prompt'
|
149
|
+
def prompt=(value)
|
150
|
+
replace('prompt', 'prompt.last', value, 'prompt')
|
49
151
|
end
|
50
152
|
|
51
153
|
def prompt
|
52
|
-
|
53
|
-
rescue
|
54
|
-
''
|
154
|
+
get_displaychars('prompt', 'prompt.last')
|
55
155
|
end
|
56
156
|
|
57
|
-
def answer=(
|
58
|
-
replace
|
59
|
-
rescue
|
60
|
-
insert 'prompt.last', answer, 'answer'
|
61
|
-
rescue
|
62
|
-
insert 'end', answer, 'answer'
|
157
|
+
def answer=(value)
|
158
|
+
replace('answer', 'answer.last', value, 'answer')
|
63
159
|
end
|
64
160
|
|
65
161
|
def answer
|
66
|
-
|
67
|
-
|
68
|
-
|
162
|
+
get_displaychars('answer', 'answer.last')
|
163
|
+
end
|
164
|
+
|
165
|
+
def warn(object)
|
166
|
+
case object
|
167
|
+
when Exception
|
168
|
+
message("#{object.class}: #{object}", 'warn')
|
169
|
+
when Symbol, String
|
170
|
+
message(object.to_s, 'warn')
|
171
|
+
else
|
172
|
+
message(object.to_str, 'warn')
|
173
|
+
end
|
69
174
|
end
|
70
175
|
|
71
176
|
def message(string, tag = 'info')
|
72
|
-
|
73
|
-
insert = index('insert')
|
177
|
+
insert = at_insert.index
|
74
178
|
|
179
|
+
begin
|
180
|
+
replace("#{tag}.first", "#{tag}.last", " #{string}", tag)
|
181
|
+
# mark(tag, "#{tag}.first", :left)
|
182
|
+
rescue
|
75
183
|
begin
|
76
|
-
|
184
|
+
insert(tag, " #{string}", tag)
|
77
185
|
rescue
|
78
|
-
insert
|
186
|
+
insert('1.0 lineend', " #{string}", tag)
|
79
187
|
end
|
188
|
+
end
|
80
189
|
|
81
|
-
|
82
|
-
|
83
|
-
|
190
|
+
if string.to_s.strip != ''
|
191
|
+
messages << string
|
84
192
|
message_expire(tag) # if messages_expire
|
85
|
-
message_notify(tag)
|
86
|
-
message_buffer_insert(string, tag)
|
193
|
+
# message_notify(tag)
|
87
194
|
end
|
88
|
-
|
195
|
+
adjust_size
|
89
196
|
|
90
|
-
|
91
|
-
|
92
|
-
buffer = Buffer[:Messages]
|
93
|
-
buffer.text.execute(:insert, :end, string, tag)
|
94
|
-
|
95
|
-
last_focus = Tk::Focus.focus # for some reason
|
96
|
-
buffer.text.see(:end) # this changes focus to the text
|
97
|
-
Tk::Focus.focus(last_focus) # so we restore it here
|
197
|
+
self.insert = insert
|
198
|
+
see "#{tag}.first"
|
98
199
|
end
|
99
200
|
|
100
201
|
def message_notify(tag, timeout = 500)
|
101
202
|
tag_add('highlight', "#{tag}.first", "#{tag}.last")
|
102
203
|
|
103
204
|
Tk::After.ms timeout.to_int do
|
104
|
-
|
205
|
+
begin
|
206
|
+
tag_remove('highlight', "#{tag}.first", "#{tag}.last")
|
207
|
+
rescue
|
208
|
+
end
|
105
209
|
end
|
106
210
|
end
|
107
211
|
|
108
|
-
def message_expire(tag, timeout =
|
109
|
-
self.messages_pending += 1
|
212
|
+
def message_expire(tag, timeout = 5000)
|
213
|
+
self.messages_pending[tag] += 1
|
110
214
|
|
111
215
|
Tk::After.ms timeout.to_int do
|
112
|
-
self.messages_pending -= 1
|
113
|
-
if messages_pending == 0
|
216
|
+
self.messages_pending[tag] -= 1
|
217
|
+
if messages_pending[tag] == 0
|
114
218
|
delete("#{tag}.first", "#{tag}.last") rescue nil
|
219
|
+
adjust_size
|
115
220
|
end
|
116
221
|
end
|
117
222
|
end
|
118
223
|
|
119
|
-
def
|
120
|
-
|
121
|
-
|
122
|
-
message("#{object.class}: #{object}", 'warn')
|
123
|
-
when Symbol, String
|
124
|
-
message(object.to_s, 'warn')
|
125
|
-
else
|
126
|
-
message(object.to_str, 'warn')
|
127
|
-
end
|
224
|
+
def claim_focus
|
225
|
+
bind('<FocusOut>'){ focus; Tk.callback_break }
|
226
|
+
focus
|
128
227
|
end
|
129
228
|
|
130
|
-
def
|
131
|
-
|
132
|
-
|
229
|
+
def release_focus
|
230
|
+
bind('<FocusOut>'){ }
|
231
|
+
end
|
133
232
|
|
134
|
-
|
135
|
-
|
233
|
+
def ask(prompt, options = {}, action = nil, &block)
|
234
|
+
action ||= block
|
136
235
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
236
|
+
if @asking
|
237
|
+
ask_stack << [prompt, options, action]
|
238
|
+
else
|
239
|
+
@asking = true
|
240
|
+
@action = action || options[:action]
|
241
|
+
@caller = options.fetch(:caller)
|
242
|
+
|
243
|
+
self.prompt = prompt
|
244
|
+
self.answer = options[:value]
|
245
|
+
self.insert = 'answer.last'
|
246
|
+
|
247
|
+
message ''
|
248
|
+
warn ''
|
249
|
+
self.messages_expire = true
|
250
|
+
|
251
|
+
# Make sure display is ready.
|
252
|
+
Tk.update
|
253
|
+
focus
|
254
|
+
end
|
142
255
|
end
|
143
256
|
|
144
257
|
def abort(event = nil)
|
145
|
-
self.answer = ''
|
146
258
|
self.prompt = ''
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
259
|
+
self.answer = ''
|
260
|
+
completion_buffer.place_forget rescue nil
|
261
|
+
@asking = false
|
262
|
+
|
263
|
+
if ask_stack.empty?
|
264
|
+
self.messages_expire = false
|
265
|
+
@caller.focus
|
266
|
+
else
|
267
|
+
ask(*ask_stack.shift)
|
268
|
+
end
|
151
269
|
end
|
152
270
|
|
153
271
|
def attempt(event = nil)
|
272
|
+
HISTORY[@prompt.get] << answer
|
154
273
|
invoke(:attempt)
|
155
274
|
end
|
156
275
|
|
157
|
-
def self.answer_from(text)
|
158
|
-
line = text.get('current linestart', 'current lineend')
|
159
|
-
minibuf = VER.minibuf
|
160
|
-
minibuf.answer = line
|
161
|
-
minibuf.complete_small
|
162
|
-
end
|
163
|
-
|
164
276
|
def show_completions(completions)
|
165
|
-
buffer =
|
166
|
-
|
167
|
-
text.delete('1.0', 'end')
|
277
|
+
buffer = completion_buffer
|
278
|
+
buffer.delete('1.0', 'end')
|
168
279
|
completions.each do |completion|
|
169
|
-
|
170
|
-
|
280
|
+
buffer.insert('end', completion, 'ver.minibuf.completion')
|
281
|
+
buffer.insert('end', "\n")
|
171
282
|
end
|
172
|
-
buffer.
|
283
|
+
buffer.place relx: 0.0, rely: 0.9, anchor: :sw, relheight: 0.9
|
173
284
|
end
|
174
285
|
|
175
286
|
def complete_small(event = nil)
|
176
287
|
if choices = invoke(:complete)
|
177
|
-
|
288
|
+
case choices.size
|
289
|
+
when 0
|
290
|
+
when 1
|
178
291
|
self.answer = choices.first
|
292
|
+
else
|
293
|
+
self.answer = common_subchoice(choices)
|
179
294
|
end
|
180
295
|
end
|
181
296
|
end
|
182
297
|
|
183
298
|
def complete_large(event = nil)
|
184
299
|
if choices = invoke(:complete)
|
185
|
-
|
300
|
+
case choices.size
|
301
|
+
when 0
|
302
|
+
when 1
|
186
303
|
self.answer = choices.first
|
187
|
-
|
304
|
+
else
|
305
|
+
self.answer = common_subchoice(choices)
|
188
306
|
show_completions(choices)
|
189
307
|
end
|
190
308
|
end
|
191
309
|
end
|
192
310
|
|
311
|
+
def common_subchoice(choices)
|
312
|
+
longest = choices.max_by{|choice| choice.size }
|
313
|
+
common = ''
|
314
|
+
|
315
|
+
longest.each_char do |char|
|
316
|
+
current = common + char
|
317
|
+
|
318
|
+
if choices.all?{|choice| choice.start_with?(current) }
|
319
|
+
common << char
|
320
|
+
else
|
321
|
+
break
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
common
|
326
|
+
end
|
327
|
+
|
193
328
|
def invoke(action, *args)
|
194
329
|
Tk::Event.generate(self, "<<#{action.capitalize}>>")
|
195
|
-
|
196
|
-
|
197
|
-
abort
|
198
|
-
else
|
199
|
-
result
|
200
|
-
end
|
330
|
+
result = @action.call(answer, action, *args)
|
331
|
+
result == :abort ? abort : result
|
201
332
|
end
|
202
333
|
|
203
|
-
def
|
204
|
-
|
205
|
-
|
334
|
+
def events
|
335
|
+
major_mode.event_history
|
336
|
+
end
|
337
|
+
|
338
|
+
def insert_string
|
339
|
+
case string = events.last.unicode
|
340
|
+
when /^[^\n\r[:cntrl:]]+$/
|
206
341
|
insert(:insert, string, 'answer')
|
207
342
|
invoke(:modified)
|
208
343
|
else
|
209
|
-
|
344
|
+
l insert_string: string
|
210
345
|
end
|
211
346
|
end
|
212
347
|
|
213
348
|
def insert_selection(event = nil)
|
214
|
-
insert(:insert, Tk::Selection.get, 'answer')
|
349
|
+
insert(:insert, Tk::Selection.get(type: 'UTF8_STRING'), 'answer')
|
215
350
|
invoke(:modified)
|
216
351
|
end
|
217
352
|
|
@@ -221,73 +356,87 @@ module VER
|
|
221
356
|
end
|
222
357
|
|
223
358
|
def end_of_line(event = nil)
|
224
|
-
return if tag_ranges('answer').empty?
|
225
359
|
mark_set('insert', 'answer.last')
|
226
360
|
invoke(:movement)
|
227
361
|
end
|
228
362
|
|
229
363
|
def kill_end_of_line(event = nil)
|
230
|
-
|
364
|
+
content = get_displaychars('insert', 'answer.last')
|
365
|
+
copy(content) if content =~ /\S/
|
231
366
|
delete('insert', 'answer.last')
|
232
367
|
invoke(:modified)
|
233
368
|
end
|
234
369
|
|
235
|
-
def
|
236
|
-
return
|
237
|
-
delete('insert')
|
370
|
+
def delete_next_char(event = nil)
|
371
|
+
return unless line = get_displaychars('insert', 'answer.last')
|
372
|
+
delete('insert') unless line == ''
|
238
373
|
invoke(:modified)
|
239
374
|
end
|
240
375
|
|
241
|
-
def
|
242
|
-
|
243
|
-
line = get('insert', 'answer.last')
|
376
|
+
def delete_next_word(event = nil)
|
377
|
+
line = get_displaychars('insert', 'answer.last')
|
244
378
|
return unless word = line[/^\s*(?:\w+|[^\w\s]+)\s*/]
|
245
379
|
delete('insert', "insert + #{word.size} chars")
|
246
380
|
invoke(:modified)
|
247
381
|
end
|
248
382
|
|
249
|
-
def
|
250
|
-
return
|
251
|
-
delete('insert - 1 chars')
|
383
|
+
def delete_prev_char(event = nil)
|
384
|
+
return unless compare('insert', '>', 'answer')
|
385
|
+
delete('insert - 1 display chars')
|
252
386
|
invoke(:modified)
|
253
387
|
end
|
254
388
|
|
255
|
-
def
|
256
|
-
|
257
|
-
line = get('answer.first', 'insert').reverse
|
389
|
+
def delete_prev_word(event = nil)
|
390
|
+
line = get_displaychars('answer', 'insert').reverse
|
258
391
|
return unless word = line[/^\s*(?:\w+|[^\w\s]+)\s*/]
|
259
|
-
delete("insert - #{word.size} chars", 'insert')
|
392
|
+
delete("insert - #{word.size} display chars", 'insert')
|
260
393
|
invoke(:modified)
|
261
394
|
end
|
262
395
|
|
263
396
|
def next_char(event = nil)
|
264
|
-
return if tag_ranges('answer').empty?
|
265
397
|
return if compare('insert', '>=', 'answer.last')
|
266
398
|
mark_set('insert', 'insert + 1 chars')
|
267
399
|
invoke(:movement)
|
268
400
|
end
|
269
401
|
|
270
402
|
def prev_char(event = nil)
|
271
|
-
return if
|
272
|
-
return if compare('insert', '<=', 'answer.first')
|
403
|
+
return if compare('insert', '<=', 'answer')
|
273
404
|
mark_set('insert', 'insert - 1 chars')
|
274
405
|
invoke(:movement)
|
275
406
|
end
|
276
407
|
|
277
408
|
def start_of_line(event = nil)
|
278
|
-
|
279
|
-
mark_set('insert', 'answer.first')
|
409
|
+
mark_set('insert', 'answer')
|
280
410
|
invoke(:movement)
|
281
411
|
end
|
282
412
|
|
283
413
|
def transpose_chars(event = nil)
|
284
|
-
return if tag_ranges('answer').empty?
|
285
414
|
insert = index('insert')
|
286
|
-
line =
|
415
|
+
line = get_displaychars('insert', 'answer.last')
|
287
416
|
line[0, 2] = line[0, 2].reverse
|
288
417
|
replace('insert', 'answer.last', line, 'answer')
|
289
418
|
mark_set('insert', insert)
|
290
419
|
invoke(:modified)
|
291
420
|
end
|
421
|
+
|
422
|
+
def copy(string)
|
423
|
+
Clipboard.dwim = string
|
424
|
+
end
|
425
|
+
|
426
|
+
def paste(event = nil)
|
427
|
+
return unless content = Clipboard.dwim
|
428
|
+
insert(:insert, content, 'answer')
|
429
|
+
invoke(:modified)
|
430
|
+
end
|
431
|
+
|
432
|
+
def prev_history
|
433
|
+
history = HISTORY[@prompt.get]
|
434
|
+
l prev_history: history
|
435
|
+
end
|
436
|
+
|
437
|
+
def next_history
|
438
|
+
history = HISTORY[@prompt.get]
|
439
|
+
l next_history: history
|
440
|
+
end
|
292
441
|
end
|
293
442
|
end
|