diff --git a/Rakefile b/Rakefile index cfb20cc..54015a8 100644 --- a/Rakefile +++ b/Rakefile @@ -38,7 +38,9 @@ task :release => [:bundle, :package, 'doc:archive'] do sh "googlecode_upload.py -s \"YASnippet Document #{$version}\"" + " -p yasnippet -l \"Featured,Type-Docs,OpSys-All\"" + " pkg/yasnippet-doc-#{$version}.tar.bz2" - + FileUtils.cp "yasnippet-bundle.el", "pkg/yasnippet-bundle-#{$version}.el" + sh "echo for ELPA | mutt -a pkg/yasnippet-bundle-#{$version}.el -s " + + "'YASnippet bundle v#{$version}' elpa@tromey.com" end rule '.html' => '.rst' do |t| diff --git a/doc/changelog.html b/doc/changelog.html new file mode 100644 index 0000000..ab1b98b --- /dev/null +++ b/doc/changelog.html @@ -0,0 +1,295 @@ + + + + + + +ChangeLog + + + + + +
+
+
+
+ +
+
+
+
+
+

0.5.10 / 2009-02-11

+
    +
  • Added grouping support so that the snippets in the menu can be +groupped together.
  • +
  • Make the bundle ELPA +compatible.
  • +
+
+
+

0.5.9 / 2009-01-21

+
    +
  • Fixed the bug of disabling the auto-indenting of cc-mode.
  • +
+
+
+

0.5.8 / 2009-01-15

+
    +
  • Added a key property in snippet definition for snippet names +that are not valid path name.
  • +
  • Fixed some bugs of indenting (Issue 44, Issue +46).
  • +
  • Fixed Issue 45 by +providing a proper default value for yas/buffer-local-condition.
  • +
  • Added helper function yas/substr for convenient mirror +transformation.
  • +
  • Make variable yas/registered-snippet properly initialized.
  • +
  • Fixed the overlay error when overlay becomes empty (Issue 49 and +Issue 48). This +bug has occurred and been fixed earlier, and should not have +happened if we have proper regression test.
  • +
  • Added a workaround for c-electric- serial commands (Issue 27).
  • +
+
+
+

0.5.7 / 2008-12-03

+
    +
  • Fixed Issue 28 of +properly clean up snippet (by joaotavora).
  • +
  • Added a new section "Field-level undo functionality" to correct +Issue 33 +(by joaotavora).
  • +
  • Added some snippets from users for sql, erlang, scala, html, xml, latex, etc.
  • +
  • Fixed Issue 16 by adding +$> support. Here's the doc for $> indenting.
  • +
+
+
+

0.5.6 / 2008-08-07

+
    +
  • Added a buffer local variable yas/dont-activate to turn off +yas/minor-mode in some major modes. See Issue 29.
  • +
  • Make the environment of elisp evaluation more friendly to +(current-column).
  • +
  • Fixed the regular expression bug in python-mode snippets.
  • +
  • Use filename or full key extension for snippet name if no name +property is defined.
  • +
+
+
+

0.5.5 / 2008-05-29

+
    +
  • Tweak yas/extra-mode-hooks so that it can be more easily +customized.
  • +
  • Add an entry in FAQ about why TAB key doesn't work in some +modes.
  • +
+
+
+

0.5.4 / 2008-05-15

+
    +
  • Added ox-mode-hook and python-mode-hook to +yas/extra-mode-hooks to fix the problem YASnippet is not enabled +in those modes.
  • +
+
+
+

0.5.3 / 2008-05-07

+
    +
  • Fix indent of python-mode snippets.
  • +
  • Fix a bug of dropdown-list: conflicts with color-theme (Issue 23). Thanks +Mike.
  • +
  • Fix a bug of condition system.
  • +
+
+
+

0.5.2 / 2008-04-20

+
    +
  • Fix a bug for comparing string to symbol using string= (which +will fire an error).
  • +
+
+
+

0.5.1 / 2008-04-14

+
    +
  • Use a beautiful css style in the document.
  • +
+
+
+

0.5.0 / 2008-04-10

+
    +
  • Integrate with hippie-expand. Just add yas/hippie-try-expand to +hippie-expand-try-functions-list.
  • +
  • If you set yas/fall-back-behavior to 'return-nil, YASnippet +will return nil when it can't find a snippet to expand.
  • +
  • Defect fix: the condition of a snippet was evaluated twice in +earlier version.
  • +
  • Deleting snippet (using C-w or C-k) won't cause serious +problem now.
  • +
  • Several complex snippet for python-mode from Yasser included in the +distribution.
  • +
+
+
+

0.4.5 / 2008-04-07

+
    +
  • Merge the latest dropdown-list.el.
  • +
  • Add snippets for f90-mode from Li Zhu.
  • +
  • Bug fix: l-safe-expr-p: Lisp nesting exceeds max-lisp-eval-depth +error when several (more than two) snippets overlaps. Thanks +sunwaybupt@newsmth for reporting this bug.
  • +
+
+
+

0.4.4 / 2008-03-24

+
    +
  • Bug fix: dropdown-list.el doesn't recognize [return] properly.
  • +
+
+
+

0.4.3 / 2008-03-23

+
    +
  • Bug fix: failed to recognize user customized yas/trigger-key.
  • +
+
+
+

0.4.2 / 2008-03-22

+
    +
  • Make a separate document package for release. Also make document +available online.
  • +
+
+
+

0.4.1 / 2008-03-21

+
    +
  • Make sure yas/minor-mode's key bindings always take priority to +other minor modes.
  • +
+
+
+

0.4.0 / 2008-03-20

+
    +
  • Document refinement and released with YASnippet. Most of the Online +wiki document will be deprecated soon.
  • +
  • Powerful condition system added to yasnippet!
  • +
  • Incorporate dropdown-list.el and make it default way for +selecting multiple candidates. Thanks to Jaeyoun Chung.
  • +
  • yas/before-expand-snippet-hook
  • +
+
+
+

0.3.2 / 2008-03-19

+
    +
  • Enhancement: A better way to define minor-mode. Thanks to Kentaro +Kuribayashi. See this thread +for more details.
  • +
+
+
+

0.3.1 / 2008-03-17

+
    +
  • Bug fix: Emacs get confused when a field is deleted. See issue 10.
  • +
+
+
+

0.3.0 / 2008-03-16

+
    +
  • Add a yas/after-exit-snippet-hook so that you can do something like +indent-region or fill-region after finish the snippet.
  • +
  • Use minor-mode instead of global-set-key to bind the trigger +key. Now the trigger key and fall-back behavior can be more +flexible. Not constrained to <tab>. Thanks to Trey Jackson. See +this thread +for more details.
  • +
  • Now user can customize the popup function for selecting multiple +candidate for the same snippet key.
  • +
  • Support dropdown-list.el to be a better way to select multiple +candidate when in text mode.
  • +
+
+
+

0.2.3 / 2008-03-15

+
    +
  • Bug in non-window (-nw) mode when there's multiple candidate to +expand. See issue 7.
  • +
  • Allow expanding another snippet as long as not currently inside a +field.
  • +
+
+
+

0.2.2 / 2008-03-13

+
    +
  • Added customized face for fields and mirrors. Better in dark +background. And users can customize it.
  • +
+
+
+

0.2.1 / 2008-03-10

+
    +
  • Fix the insert-behind problem under both Emacs 22 and Emacs 23.
  • +
+
+
+

0.2.0 / 2008-03-10

+
    +
  • Use big keymap overlay to detect insert-behind event manually to +avoid sometimes missed hook calls. See issue 3 for more +details.
  • +
  • Support parent snippet table. Now you can set (for example) +cc-mode as common mode for c++-mode, c-mode and +java-mode. They'll share snippets defined for cc-mode.
  • +
+
+
+

0.1.1 / 2008-03-08

+
    +
  • Add a rake task to upload to google code.
  • +
  • Use elisp compile-bundle function instead of python scrip
  • +
+
+
+

0.1.0 / 2008-03-07

+
    +
  • Embedded elisp support.
  • +
  • Fields navigation support.
  • +
  • Mirror of fields support.
  • +
  • Menu-bar support.
  • +
  • Multiple snippets with same name support.
  • +
  • Popup menu for multiple snippet with same name support.
  • +
  • Transformation of fields support.
  • +
  • Load directory support.
  • +
  • Compile bundle support.
  • +
+
+
+
+
+
+
+
+
+ + diff --git a/doc/changelog.rst b/doc/changelog.rst index 4efc94f..3e956c8 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -6,9 +6,52 @@ ChangeLog :Contact: pluskid@gmail.com :Date: 2008-03-22 -0.5.7 / -================= +0.5.10 / 2009-02-11 +=================== +* Added *grouping* support so that the snippets in the menu can be + groupped together. +* Make the bundle `ELPA `_ + compatible. + +0.5.9 / 2009-01-21 +================== + +* Fixed the bug of disabling the auto-indenting of ``cc-mode``. + +0.5.8 / 2009-01-15 +================== + +* Added a ``key`` property in snippet definition for snippet names + that are not valid path name. +* Fixed some bugs of indenting (`Issue 44 + `_, `Issue + 46 `_). +* Fixed `Issue 45 + `_ by + providing a proper default value for ``yas/buffer-local-condition``. +* Added helper function ``yas/substr`` for convenient mirror + transformation. +* Make variable ``yas/registered-snippet`` properly initialized. +* Fixed the overlay error when overlay becomes empty (`Issue 49 + `_ and + `Issue 48 + `_). This + bug has occurred and been fixed earlier, and should not have + happened if we have proper regression test. +* Added a workaround for ``c-electric-`` serial commands (`Issue 27 + `_). + +0.5.7 / 2008-12-03 +================== + +* Fixed `Issue 28 + `_ of + properly clean up snippet (by joaotavora). +* Added a new section "Field-level undo functionality" to correct + `Issue 33 `_ + (by joaotavora). +* Added some snippets from users for sql, erlang, scala, html, xml, latex, etc. * Fixed `Issue 16 `_ by adding ``$>`` support. Here's the `doc for $> indenting diff --git a/doc/define_snippet.html b/doc/define_snippet.html new file mode 100644 index 0000000..64db46b --- /dev/null +++ b/doc/define_snippet.html @@ -0,0 +1,760 @@ + + + + + + +How to define a snippet ? + + + + + +
+
+
+
+ +
+
+
+
+ +

The most convenient way to define snippets for YASnippet is to put +them in a directory arranged by the mode and use +yas/load-directory to load them.

+

However, this might slow down the Emacs startup speed if you have many +snippets. You can use yas/define-snippets to define a bunch of +snippets for a perticular mode. But this is hard to maintain! So, +there's a better way: define your snippets in directory and use +yas/compile-bundle to compile it into a bundle file when you +modified your snippets.

+

The release bundle of YASnippet is produced by +yas/compile-bundle. The bundle use yas/define-snippets to +define snippets. This avoid the IO and parsing overhead when loading +snippets.

+

Finally, you can use yas/define to define a single snippet at your +convenience. I ofthen use this to do some testing.

+
+

Define snippets in files

+
+

Directory hierarchy

+

Here's the directory hierarchy of the snippets directory comes +with YASnippet:

+
snippets
+`-- text-mode/
+    |-- cc-mode/
+    |   |-- c++-mode/
+    |   |   |-- beginend
+    |   |   |-- class
+    |   |   `-- using
+    |   |-- c-mode/
+    |   |   `-- fopen
+    |   |-- do
+    |   |-- for
+    |   |-- if
+    |   |-- inc
+    |   |-- inc.1
+    |   |-- main
+    |   |-- once
+    |   `-- struct
+    |-- css-mode/
+    |   |-- background
+    |   |-- background.1
+    |   `-- border
+    |-- email
+    |-- html-mode/
+    |   |-- div
+    |   |-- doctype
+    |   |-- doctype.xhml1
+    |   |-- doctype.xhtml1_1
+    |   |-- doctype.xhtml1_strict
+    |   `-- doctype.xhtml1_transitional
+    |-- objc-mode/
+    |   `-- prop
+    |-- perl-mode/
+    |   |-- cperl-mode/
+    |   |-- eval
+    |   |-- for
+    |   |-- fore
+    |   |-- if
+    |   |-- ife
+    |   |-- ifee
+    |   |-- sub
+    |   |-- unless
+    |   |-- while
+    |   |-- xfore
+    |   |-- xif
+    |   |-- xunless
+    |   `-- xwhile
+    |-- python-mode/
+    |   |-- __
+    |   |-- class
+    |   |-- def
+    |   |-- for
+    |   |-- ifmain
+    |   `-- while
+    |-- rst-mode/
+    |   |-- chapter
+    |   |-- section
+    |   `-- title
+    |-- ruby-mode/
+    |   |-- #
+    |   |-- =b
+    |   |-- Comp
+    |   |-- all
+    |   |-- am
+    |   |-- any
+    |   |-- app
+    |   |-- bm
+    |   |-- case
+    |   |-- cla
+    |   |-- classify
+    |   |-- cls
+    |   |-- collect
+    |   |-- dee
+    |   |-- deli
+    |   |-- det
+    |   |-- ea
+    |   |-- eac
+    |   |-- eai
+    |   |-- eav
+    |   |-- eawi
+    |   |-- forin
+    |   |-- if
+    |   |-- ife
+    |   |-- inject
+    |   |-- mm
+    |   |-- r
+    |   |-- rb
+    |   |-- reject
+    |   |-- req
+    |   |-- rreq
+    |   |-- rw
+    |   |-- select
+    |   |-- w
+    |   |-- y
+    |   `-- zip
+    `-- time
+
+

Snippet definitions are put in plain text files. They are arranged by +subdirectories. For example, snippets for c-mode are put in the +c-mode directory.

+

The parent directory acts as the parent mode. This is the way of +YASnippet to share snippet definitions among different modes. As you +can see above, c-mode and c++-mode share the same parents +cc-mode, while all modes are derived from text-mode. This can +be also used to as an alias -- cperl-mode is an empty directory +whose parent is perl-mode.

+

File names act as the snippet trigger key. Note files starting with a +dot (.) are ignored.

+
+
+

File content

+

A file defining a snippet may just contain the template for the +snippet. Optionally it can also contains some meta data for the +snippet as well as comments.

+

Generally speaking, if the file contains a line of # --, then all +contents above that line are considered as meta data and comments; +below are template. Or else the whole file content is considered as +the template.

+

Here's a typical example:

+
#contributor : pluskid <pluskid@gmail.com>
+#name : __...__
+# --
+__${init}__
+
+

Meta data are specified in the syntax of

+
#data-name : data value
+
+

Any other text above # -- is considered as comment and +ignored. Here's a list of currently supported meta data:

+images/group.png +
    +
  • name: The name of the snippet. This is a one-line description of +the snippet. It will be displayed in the menu. So it's a good idea +to select a descriptive name fo a snippet -- especially +distinguishable among similar snippets.
  • +
  • contributor: The contributor of the snippet.
  • +
  • condition: The condition of the snippet. This is a piece of +elisp code. If a snippet has a condition, then it will only be +expanded when the condition code evaluate to some non-nil value.
  • +
  • key: The key to expand the snippet. Sometimes the key of a +snippet is non-ASCII or not valid filename (e.g. contains +/). One can then define the key property which will +overwrite the filename as the key to expand the snippet.
  • +
  • group: The snippets for a mode can be grouped. Grouped snippets +will be grouped in sub-menu. This is useful if one has too many +snippets for a mode which will make the menu too long. group +property only affect menu construction (See The Menu). Refer to +the snippets for ruby-mode for examples. Group can also be +nested, e.g. control structure.loops tells that the snippet is +under the loops group which is under the control structure +group.
  • +
+
+
+

Define snippets using elisp code

+

As I mentioned above, you can define snippets directly by writing +elisp code.

+
+

yas/define-snippets

+

The basic syntax of yas/define-snippets is

+
(yas/define-snippets MODE SNIPPETS &optional PARENT)
+
+

The parameters are self-descriptive. If you specify a PARENT, then +the snippets of the parents may be shared by MODE. Note if you use +this function several times, the later specified PARENT will +overwrite the original one. However, not specifying a PARENT won't +erase the original parent.

+

The SNIPPETS parameter is a list of snippet definitions. Each +element should have the following form:

+
(KEY TEMPLATE NAME CONDITION GROUP)
+
+

The NAME, CONDITION and GROUP can be omitted if you don't +want to provide one. Here's an example:

+
(yas/define-snippets 'c++-mode
+'(
+  ("using" "using namespace ${std};
+$0" "using namespace ... " nil)
+  ("class" "class ${1:Name}
+{
+public:
+    $1($2);
+    virtual ~$1();
+};" "class ... { ... }" nil)
+  ("beginend" "${1:v}.begin(), $1.end" "v.begin(), v.end()" nil)
+  )
+'cc-mode)
+
+

The example above is auto-generated code by yas/compile-bundle.

+
+
+

yas/compile-bundle

+

yas/compile-bundle can be used to parse the snippets from a +directory hierarchy and translate them into the elisp form. The +translated code is faster to load. Further more, the generated bundle +is a stand-alone file not depending on yasnippet.el. The released +bundles of YASnippet are all generated this way.

+

The basic syntax of yas/compile-bundle is

+
(yas/compile-bundle &optional yasnippet yasnippet-bundle snippet-roots code)
+
+

As you can see, all the parameters are optional. The default values +for those parameters are convenient for me to produce the default +release bundle:

+
(yas/compile-bundle "yasnippet.el"
+                    "./yasnippet-bundle.el"
+                    '("snippets")
+                    "(yas/initialize)")
+
+

The snippet-roots can be a list of root directories. This is +useful when you have multiple snippet directories (maybe from other +users). The code parameter can be used to specify your own +customization code instead of the default (yas/initialize). For +example, you can set yas/trigger-key to (kbd "SPC") here if +you like.

+
+
+

yas/define

+

The basic syntax for yas/define is

+
(yas/define mode key template &optional name condition group)
+
+

This is only a syntax sugar for

+
(yas/define-snippets mode
+                     (list (list key template name condition group)))
+
+
+
+
+
+

The strategy to select a snippet

+

When user press the yas/trigger-key, YASnippet try to find a +proper snippet to expand. The strategy to find such a snippet is +explained here.

+
+

Finding the key

+

YASnippet search from current point backward trying to find the +snippet to be expanded. The default searching strategy is quite +powerful. For example, in c-mode, "bar", "foo_bar", +"#foo_bar" can all be recognized as a template key. Further more, +the searching is in that order. In other words, if "bar" is found +to be a key to some valid snippet, then "foo_bar" and +"#foobar" won't be searched.

+

However, this strategy can also be customized easily from the +yas/key-syntaxes variable. It is a list of syntax rules, the +default value is ("w" "w_" "w_." "^ "). Which means search the +following thing until found one:

+
    +
  • a word.
  • +
  • a symbol. In lisp, - and ? can all be part of a symbol.
  • +
  • a sequence of characters of either word, symbol or punctuation.
  • +
  • a sequence of characters of non-whitespace characters.
  • +
+

But you'd better keep the default value unless you understand what +Emacs's syntax rule mean.

+
+
+

The condition system

+

I write forked snippet.el to make the smart-snippet.el. I call it +smart-snippet because a condition can be attached to a snippet. This +is really a good idea. However, writing condition for a snippet +usually needs good elisp and Emacs knowledge, so it is strange to many +user.

+

Later I write YASnippet and persuade people to use it instead of +smart-snippet.el. However, some user still love smart-snippet because +it is smart. So I make YASnippet smart. Even smarter than +smart-snippet.el. :p

+

Consider this scenario: you are an old Emacs hacker. You like the +abbrev-way and set yas/trigger-key to (kbd "SPC"). However, +you don't want if to be expanded as a snippet when you are typing +in a comment block or a string (e.g. in python-mode).

+

It's OK, just specify the condition for if to be (not +(python-in-string/comment)). But how about while, for, +etc. ? Writing the same condition for all the snippets is just +boring. So YASnippet introduce a buffer local variable +yas/buffer-local-condition. You can set this variable to (not +(python-in-string/comment)) in python-mode-hook. There's no way +to do this in smart-snippet.el!

+

Then, what if you really want some snippet even in comment? This is +also possible! But let's stop telling the story and look at the rules:

+
    +
  • If yas/buffer-local-condition evaluate to nil, snippet won't be +expanded.
  • +
  • If it evaluate to the a cons cell where the car is the symbol +require-snippet-condition and the cdr is a symbol (let's +call it requirement):
      +
    • If the snippet has no condition, then it won't be expanded.
    • +
    • If the snippet has a condition but evaluate to nil or error +occured during evaluation, it won't be expanded.
    • +
    • If the snippet has a condition that evaluate to non-nil (let's +call it result):
        +
      • If requirement is t, the snippet is ready to be +expanded.
      • +
      • If requirement is eq to result, the snippet is ready +to be expanded.
      • +
      • Otherwise the snippet won't be expanded.
      • +
      +
    • +
    +
  • +
  • If it evaluate to other non-nil value:
      +
    • If the snippet has no condition, or has a condition that evaluate +to non-nil, it is ready to be expanded.
    • +
    • Otherwise, it won't be expanded.
    • +
    +
  • +
+

So set yas/buffer-local-condition like this

+
(add-hook 'python-mode-hook
+          '(lambda ()
+             (setq yas/buffer-local-condition
+                   '(if (python-in-string/comment)
+                        '(require-snippet-condition . force-in-comment)
+                      t))))
+
+

And specify the condition for a snippet that you're going to expand in +comment to be evaluated to the symbol force-in-comment. Then it +can be expanded as you expected, while other snippets like if +still can't expanded in comment.

+
+
+

Multiple snippet with the same key

+

There can be multiple snippet bind to the same key. If you define a +snippet with a key that is already used, you'll overwrite the original +snippet definition. However, you can add a different postfix to the +key.

+

In general, the extension (consider a file name) is ignored when +defining a snippet. So def, def.1 and def.mine will all be +valid candidates when the key is def.

+

When there are multiple candidates, YASnippet will let you select +one. The UI for selecting multiple candidate can be +customized. There're two variable related:

+
    +
  • yas/window-system-popup-function: the function used when you +have a window system.
  • +
  • yas/text-popup-function: the function used when you don't have a +window system, i.e. when you are working in a terminal.
  • +
+
+Currently there're three solution come with YASnippet.
+images/popup-menu.png + +
+

Just select the first one

+

This one is originally used in terminal mode. It doesn't let you to +choose anything, it just select the first one on behalf of you. So I +bet you never want to use this. :p

+
+
+

Use a dropdown-menu.el

+images/dropdown-menu.png +

Originally, only the above two function is available in +YASnippet. They are difficult to use -- especially in a +terminal. Until later Jaeyoun Chung show me his dropdown-menu.el, +I say wow! It's wonderful!

+
    +
  • It works in both window system and terminal.
  • +
  • It is customizable, you can use C-n, C-p to navigate, q +to quite and even press 6 as a shortcut to select the 6th +candidate.
  • +
+

So I added yas/dropdown-list-popup-for-template to support +dropdown-list.el. And upload dropdown-list.el to YASnippet +hompage for an optional download (since Jaeyoun didn't provide a URL).

+

Then finally, in 0.4.0, I included a copy of the content of +dropdown-list.el [1] in yasnippet.el and made it the default +way for selecting multiple candidates.

+

However, the original functions are still there, you can still use this

+
(setq yas/window-system-popup-function
+      'yas/x-popup-menu-for-template)
+
+

if you prefer a modern UI. :)

+
+
+
+

The Trigger Key

+

YASnippet is implemented as a minor-mode (yas/minor-mode). The +trigger key yas/trigger-key is defined in yas/minor-mode-map +to call yas/expand to try to expand a snippet.

+
+

The Minor Mode

+images/minor-mode-indicator.png +

When yas/minor-mode is enabled, the trigger key will take +effect. The default key is (kbd "TAB"), however, you can freely +set it to some other key. By default, YASnippet add a hook to +after-change-major-mode-hook to enable yas/minor-mode [2] in +every buffer. This works fine for most modes, however, some mode +doesn't follow the Emacs convention and doens't call this hook. You +can either explicitly hook for those mode or just add it to +yas/extra-mode-hooks to let YASnippet do it for you:

+
(require 'yasnippet)
+(add-to-list 'yas/extra-mode-hooks
+             'ruby-mode-hook)
+(yas/initialize)
+
+

Note that should be put after (require 'yasnippet) and before +(yas/initialize). Further more, you may report it to me, I'll add +that to the default value.

+
+
+

The Fallback

+

If yas/expand failed to find any suitable snippet to expand, it +will disable the minor mode temporarily and find if there's any other +command bind the yas/trigger-key. If found, the command will be +called. Usually this works very well -- when there's a snippet, expand +it, otherwise, call whatever command originally bind to the trigger +key.

+

However, you can change this behavior by customizing the +yas/fallback-behavior variable. If you set this variable to +'return-nil, it will return nil instead of trying to call the +original command when no snippet is found. This is useful when you +would like YASnippet to work with other extensions, +e.g. hippie-expand. I'm also glad to tell you that integration +with hippie-expand is already included in YASnippet.

+
+
+

Integration with hippie-expand

+

To integrate with hippie-expand, just put +yas/hippie-try-expand in +hippie-expand-try-functions-list. Personally I would like to put +in front of the list, but it can be put anywhere you prefer.

+
+
+
+

Other way to select a snippet

+

When you use the trigger key (so yas/expand) to expand a snippet, +the key for the snippet is deleted before the template for the snippet +is inserted.

+

However, there're other ways to insert a snippet.

+
+

The Menu

+

YASnippet will setup a menu just after the Buffers Menu in the +menubar. The snippets for all real modes are listed there under the +menu. You can select a snippet from the menu to expand it. Since you +select manually from the menu, you can expand any snippet. For +example, you can expand a snippet defined for python-mode in a +c-mode buffer by selecting it from the menu:

+images/menubar.png +
    +
  • Condition system is ignored since you select to expand it +explicitly.
  • +
  • There will be no muliple candidates since they are listed in the +menu as different items.
  • +
+

This can be convenient sometimes. However, if you don't like the +menubar of Emacs and never use it. You can tell YASnippet don't boring +to build a menu by setting yas/use-menu to nil.

+

Another thing to note is that only real modes are listed under the +menu. As you know, common snippets can be shared by making up a +virtual parent mode. It's too bad if the menu is floored by those +virtual modes. So YASnippet only show menus for those real +modes. But the snippets fo the virtual modes can still be accessed +through the parent submenu of some real mode.

+

YASnippet use a simple way to check whether a mode is real or +virtual: (fboundp mode). For example, the symbol c-mode is +bound to a function while cc-mode is not. But this is not enough, +some modes aren't part of Emacs, and maybe when initializing +YASnippet, those modes haven't been initialized. So YASnippet also +maintain a list of known modes (yas/known-modes). You can add item +to that list if you need.

+
+
+

Expanding From Elisp Code

+

Sometimes you might want to expand a snippet directly by calling a +functin from elisp code. You should call yas/expand-snippet +instead of yas/expand in this case.

+

As with expanding from the menubar, condition system and multiple +candidates won't exists here. In fact, expanding from menubar has the +same effect of evaluating the follow code:

+
(yas/expand-snippet (point) (point) template)
+
+

Where template is the template of a snippet. It is never required +to belong to any snippet -- you can even make up it on the fly. The +1st and 2nd parameter defines the region to be deleted after YASnippet +inserted the template. It is used by yas/expand to indicate the +region of the key. There's usually no need to delete any region when +we are expanding a snippet from elisp code, so passing two (point) +is fine. Note only (point) will be fine because the 1st parameter +also indicate where to insert and expand the template.

+
+
+
+
+

The Syntax of the Template

+

The syntax of the snippet template is simple but powerful, very +similar to TextMate's.

+
+

Plain Text

+

Arbitrary text can be included as the content of a template. They are +usually interpreted as plain text, except $ and `. You need to +use \ to escape them: \$ and \`. The \ itself may also +needed to be escaped as \\ sometimes.

+
+
+

Embedded elisp code

+

Elisp code can be embedded inside the template. They are written +inside back-quotes (`):

+

They are evaluated when the snippet is being expanded. The evaluation +is done in the same buffer as the snippet being expanded. Here's an +example for c-mode to calculate the header file guard dynamically:

+
#ifndef ${1:_`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H_}
+#define $1
+
+$0
+
+#endif /* $1 */
+
+
+
+

Tab Stops

+

Tab stops are fields that you can navigate back and forth by TAB +and S-TAB [3]. They are written by $ followed with a +number. $0 has the special meaning of the exit point of a +snippet. That is the last place to go when you've traveled all the +fields. Here's a typical example:

+
<div$1>
+    $0
+</div>
+
+
+
+

Placeholders

+

Tab stops can have default values -- a.k.a placeholders. The syntax is +like this:

+
${N:default value}
+
+

They acts as the default value for a tab stop. But when you firstly +type at a tab stop, the default value will be replaced by your +typing. The number can be omitted if you don't want to create +mirrors or transformations for this field.

+
+
+

Mirrors

+

We refer the tab stops with placeholders as a field. A field can have +mirrors. Its mirrors will get updated when you change the text of a +field. Here's an example:

+
\begin{${1:enumerate}}
+    $0
+\end{$1}
+
+

When you type "document" at ${1:enumerate}, the word +"document" will also be inserted at \end{$1}. The best +explanation is to see the screencast(YouTube or avi video).

+

The tab stops with the same number to the field act as its mirrors. If +none of the tab stops has an initial value, the first one is selected +as the field and others mirrors.

+
+
+

Transformations

+

If the default value of a field starts with $, then it is interpreted +as the transformation code instead of default value. A transformation +is some arbitrary elisp code that will get evaluated in an environment +when the variable text is bind to the inputted text of the +field. Here's an example for Objective-C:

+
- (${1:id})${2:foo}
+{
+    return $2;
+}
+
+- (void)set${2:$(capitalize text)}:($1)aValue
+{
+    [$2 autorelease];
+    $2 = [aValue retain];
+}
+$0
+
+

Look at ${2:$(capitalize text)}, it is a transformation instead of +a placeholder. The actual placeholder is at the first line: +${2:foo}. When you type text in ${2:foo}, the transformation +will be evaluated and the result will be placed there as the +transformated text. So in this example, if you type baz in the field, +the transformed text will be Baz. This example is also available in +the screencast.

+

Another example is for rst-mode. In reStructuredText, the document +title can be some text surrounded by "===" below and above. The "===" +should be at least as long as the text. So

+
=====
+Title
+=====
+
+

is a valid title but

+
===
+Title
+===
+
+

is not. Here's an snippet for rst title:

+
${1:$(make-string (string-width text) ?\=)}
+${1:Title}
+${1:$(make-string (string-width text) ?\=)}
+
+$0
+
+ + + + + +
[1]With some minor change, mainly for fixing some trivial bugs.
+ + + + + +
[2]This is done when you call yas/initialize.
+ + + + + +
[3]Of course, this can be customized.
+
+
+

Indenting

+

Many people miss the indenting feature of smart-snippet: when you +place a $> in your snippet, an (indent-according-to-mode) will +be executed there to indent the line. So you'll not need to hard-code +the indenting in the snippet template, and it will be very convenient +when you need to work with several different project where coding +styles are different.

+

The reason why this feature wasn't added to YASnippet until after +0.5.6 is that it doesn't work well for all modes. In some cases +(e.g. python-mode), calling indent-according-to-mode will break +the overlays created by YASnippet.

+

However, since many people asked for this feature, I finally added +this to YASnippet. Here's an example of the usage:

+
for (${int i = 0}; ${i < 10}; ${++i})
+{$>
+$0$>
+}$>
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/doc/define_snippet.rst b/doc/define_snippet.rst index d81a58f..dbd9baa 100644 --- a/doc/define_snippet.rst +++ b/doc/define_snippet.rst @@ -178,6 +178,9 @@ Meta data are specified in the syntax of Any other text above ``# --`` is considered as comment and ignored. Here's a list of currently supported meta data: +.. image:: images/group.png + :align: right + * ``name``: The name of the snippet. This is a one-line description of the snippet. It will be displayed in the menu. So it's a good idea to select a descriptive name fo a snippet -- especially @@ -186,6 +189,18 @@ ignored. Here's a list of currently supported meta data: * ``condition``: The condition of the snippet. This is a piece of elisp code. If a snippet has a condition, then it will only be expanded when the condition code evaluate to some non-nil value. +* ``key``: The key to expand the snippet. Sometimes the key of a + snippet is non-ASCII or not valid filename (e.g. contains + ``/``). One can then define the ``key`` property which will + overwrite the filename as the key to expand the snippet. +* ``group``: The snippets for a mode can be grouped. Grouped snippets + will be grouped in sub-menu. This is useful if one has too many + snippets for a mode which will make the menu too long. ``group`` + property only affect menu construction (See `The Menu`_). Refer to + the snippets for ``ruby-mode`` for examples. Group can also be + nested, e.g. ``control structure.loops`` tells that the snippet is + under the ``loops`` group which is under the ``control structure`` + group. @@ -215,10 +230,10 @@ element should have the following form: .. sourcecode:: common-lisp - (KEY TEMPLATE NAME CONDITION) + (KEY TEMPLATE NAME CONDITION GROUP) -The ``NAME`` and ``CONDITION`` can be omitted if you don't want to -provide one. Here's an example: +The ``NAME``, ``CONDITION`` and ``GROUP`` can be omitted if you don't +want to provide one. Here's an example: .. sourcecode:: common-lisp @@ -278,14 +293,14 @@ The basic syntax for ``yas/define`` is .. sourcecode:: common-lisp - (yas/define mode key template &optional name condition) + (yas/define mode key template &optional name condition group) This is only a syntax sugar for .. sourcecode:: common-lisp (yas/define-snippets mode - (list (list key template name condition))) + (list (list key template name condition group))) The strategy to select a snippet ================================ diff --git a/doc/faq.html b/doc/faq.html new file mode 100644 index 0000000..f9a40e0 --- /dev/null +++ b/doc/faq.html @@ -0,0 +1,107 @@ + + + + + + +How to define a snippet ? + + + + + +
+
+
+
+ +
+
+
+
+
+

Why there's an extra newline?

+

If you have a newline at the end of the snippet definition file, then +YASnippet will add a newline when you expanding a snippet. Please +don't add a newline at the end if you don't want it when you saving +the snippet file.

+

Note some editors will automatically add a newline for you. In Emacs, +if you set require-final-newline to t, it will add the final +newline for you automatically.

+
+
+

Why TAB key doesn't expand a snippet?

+

First check the mode line to see if there's yas. If no, then try +M-x yas/minor-mode-on to manually turn on yas/minor-mode and +try to expand the snippet again. If it works, then, you can add the +following code to your .emacs before loading YASnippet:

+
(setq yas/extra-mode-hooks '(the-major-mode))
+
+

where the-major-mode is the major mode in which yas/minor-mode +isn't enabled by default.

+

If yas/minor-mode is on but the snippet still not expanded. Then +try to see what command is bound to the TAB key: press C-h k +and then press TAB. Emacs will show you the result.

+

You'll see a buffer prompted by Emacs saying that TAB runs the +command .... Alternatively, you might see <tab> runs the command +..., note the difference between TAB and <tab> where the +latter has priority. If you see <tab> bound to a command other +than yas/expand, (e.g. in org-mode) you can try the following +code to work around:

+
(add-hook 'org-mode-hook
+          '(lambda ()
+             (make-variable-buffer-local 'yas/trigger-key)
+             (setq yas/trigger-key [tab])))
+
+

replace org-mode-hook with the major mode hook you are dealing +with (C-h m to see what major mode you are in).

+

If it says TAB but YASnippet still doesn't work, check your +configuration and you may also ask for help on the discussion group. Don't forget to +attach the information on what command is bound to TAB as well as the +mode information (Can be obtained by C-h m).

+
+
+

How to define snippets with named by characters not supported by the filesystem?

+

For example, you want to define a snippet by the key < which is not a +valid character for filename on Windows. In this case, you may use +yas/define to define the snippet. If you want to enjoy defining +snippets in a file, you can use the key property to specify the key of +the defined snippet explicitly.

+

Just name your snippet with an arbitrary valid filename, lt for +example. and specify < for the key property:

+
#key: <
+#name: <...></...>
+# --
+<${1:div}>$0</$1>
+
+
+
+
+
+
+
+
+
+ + diff --git a/doc/faq.rst b/doc/faq.rst index f5b18e3..abc7b58 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -59,3 +59,22 @@ configuration and you may also ask for help on the `discussion group `_. Don't forget to attach the information on what command is bound to TAB as well as the mode information (Can be obtained by ``C-h m``). + +How to define snippets with named by characters not supported by the filesystem? +================================================================================ +For example, you want to define a snippet by the key ``<`` which is not a +valid character for filename on Windows. In this case, you may use +``yas/define`` to define the snippet. If you want to enjoy defining +snippets in a file, you can use the ``key`` property to specify the key of +the defined snippet explicitly. + +Just name your snippet with an arbitrary valid filename, ``lt`` for +example. and specify ``<`` for the ``key`` property: + +.. sourcecode:: text + + #key: < + #name: <...> + # -- + <${1:div}>$0 + diff --git a/doc/images/group.png b/doc/images/group.png new file mode 100644 index 0000000..fd09698 Binary files /dev/null and b/doc/images/group.png differ diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..192028e --- /dev/null +++ b/doc/index.html @@ -0,0 +1,137 @@ + + + + + + +Yet Another Snippet extension + + + + + +
+
+
+
+ +
+
+
+
+ +

Yasnippet is a template system for emacs. It allows you to type a +abbrevation and automatically expand the abbreviation into function +templates.

+

Bundled language templates includes: C, C++, C#, Perl, Python, Ruby, +SQL, LaTeX, HTML, CSS and more.

+

Yasnippet system is inspired from TextMate's template system. You can +use a tool +to import any TextMate template you have to Yasnippet. It is a +re-design and re-write of my original extension smart-snippet. It +is much cleaner and more powerful than smart-snippet.

+
+

Video Demo

+

Watch the demo at YouTube (download a higher +resolution version: yasnippet.avi).

+
+
+

Brief Install Instruction

+

There are two archives of YASnippet. One is a single file compiled +“bundle”, and the other is normal. If all you need is to use the +builtin templates, download the bundle one. If you want to add your +own templates, download the normal one.

+
+

Bundle Install

+
    +
  1. Download the latest yasnippet-bundle-x.y.z.el.tgz and unpack it.
  2. +
  3. You'll get a file named yasnippet-bundle.el, put it under +~/.emacs.d/plugins/ (create the directory if not exists).
  4. +
  5. Open the file in Emacs, and type Alt+x eval-buffer.
  6. +
+

That's it. Now open any one of your language file, you'll see a menu +YASnippet. you can pull the menu to insert a template. Or, you can +type the pre-defined abbrev and press TAB to expand it.

+

To have emacs load YASnippet automatically when it starts, put the +following in your ~/.emacs file:

+
+
(add-to-list 'load-path
+              "~/.emacs.d/plugins")
+(require 'yasnippet-bundle)
+
+
+
+
+

Normal Install

+

For full install of the normal archive, just download and unpack the +latest yasnippet-x.y.z.tar.bz2. You'll get a directory named +yasnippet, put it in your ~/.emacs.d/plugins and add the +following in your .emacs file:

+
+
(add-to-list 'load-path
+              "~/.emacs.d/plugins")
+(require 'yasnippet) ;; not yasnippet-bundle
+(yas/initialize)
+(yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets")
+
+
+

Please refer to the documentation for full customization.

+
+
+
+

Bugs, Contribution and Support

+ +

Thank you very much for using YASnippet!

+
+
+
+
+
+
+
+
+ + diff --git a/doc/index.rst b/doc/index.rst index 74aebdc..fa01873 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -8,131 +8,95 @@ Yet Another Snippet extension .. contents:: -YASnippet is a re-design and re-write of my original extension -`smart-snippet`_. It is much cleaner and more powerful than -smart-snippet. +Yasnippet is a template system for emacs. It allows you to type a +abbrevation and automatically expand the abbreviation into function +templates. + +Bundled language templates includes: C, C++, C#, Perl, Python, Ruby, +SQL, LaTeX, HTML, CSS and more. + +Yasnippet system is inspired from TextMate's template system. You can +use `a tool +`_ +to import any TextMate template you have to Yasnippet. It is a +re-design and re-write of my original extension `smart-snippet`_. It +is much cleaner and more powerful than smart-snippet. .. _smart-snippet: http://code.google.com/p/smart-snippet/ -Getting Started -=============== -For the busy or impatient people --------------------------------- +Video Demo +========== -Watch the `screencast at YouTube -`_ or download `the one -with a higher resolution -`_. +Watch the `demo at YouTube +`_ (download a higher +resolution version: `yasnippet.avi +`_). -For lazy poeple or beginners ----------------------------- +Brief Install Instruction +========================= -.. _downloads page: http://code.google.com/p/yasnippet/downloads/list +There are two archives of YASnippet. One is a single file compiled +“bundle”, and the other is normal. If all you need is to use the +builtin templates, download the bundle one. If you want to add your +own templates, download the normal one. + +Bundle Install +-------------- + +1. Download the latest ``yasnippet-bundle-x.y.z.el.tgz`` and unpack it. +2. You'll get a file named ``yasnippet-bundle.el``, put it under + ``~/.emacs.d/plugins/`` (create the directory if not exists). +3. Open the file in Emacs, and type ``Alt+x eval-buffer``. + +That's it. Now open any one of your language file, you'll see a menu +YASnippet. you can pull the menu to insert a template. Or, you can +type the pre-defined abbrev and press ``TAB`` to expand it. + +To have emacs load YASnippet automatically when it starts, put the +following in your ``~/.emacs`` file: -1. Download the latest bundle release [1]_ from the `downloads page`_. -2. Create a directory ``~/emacs/plugins``. -3. Unpack the downloaded bundle to that directory. -4. Add the following code to your ``~/.emacs`` file: - .. sourcecode:: common-lisp (add-to-list 'load-path - "~/emacs/plugins") + "~/.emacs.d/plugins") (require 'yasnippet-bundle) -For you -------- +Normal Install +-------------- -1. Download the latest YASnippet release package [2]_ from the - `downloads page`_. -2. Unpack it to a directory and add that directory to your - ``load-path``. -3. Add the following code to your ``~/.emacs`` file: +For full install of the normal archive, just download and unpack the +latest ``yasnippet-x.y.z.tar.bz2``. You'll get a directory named +``yasnippet``, put it in your ``~/.emacs.d/plugins`` and add the +following in your ``.emacs`` file: .. sourcecode:: common-lisp + (add-to-list 'load-path + "~/.emacs.d/plugins") (require 'yasnippet) ;; not yasnippet-bundle (yas/initialize) - (yas/load-directory "/path/to/the/snippets/directory/") + (yas/load-directory "~/.emacs.d/plugins/yasnippet/snippets") -4. You can inspect into the ``snippets`` directory for adding your own - snippets. -5. Detailed document can be found at the ``doc`` directory. +Please refer to the documentation for full customization. -For geeks ---------- +Bugs, Contribution and Support +============================== -If you want to always follow the latest code. You can check out it -from the svn repository: - -.. sourcecode:: bash - - svn checkout http://yasnippet.googlecode.com/svn/trunk/ yasnippet - -However, I try to release a new version as soon as I made some changes -that will affect the normal use or added some new features. So there's -usually no need to follow the svn repository. Except that you might -find ``svn up`` is more convenient than downloading and unpacking the -release package. :D - -How to contribute ? -=================== - -If you like YASnippet, you can recommendate it to your friends. - -Issues ------- - -If you find a bug you can create a new issue at the `issue list -`_. Please describe -the problem as clear as possible. - -Suggestion, Feature Request ---------------------------- - -There's a `discussion group`_ for both smart-snippet and yasnippet. If -you have any suggesion, you can post to there and discuss with other -members. - -Especially, there's a `wish list`_ wiki page. I'll collect ideas from -the `discussion group`_ to the `wish list`_. So you might want to look -at the `wish list`_ before you post something. - -Snippets --------- - -YASnippet comes with some default snippet definitions. However, they -are far from complete. So I'm calling users to share their -snippets. If you have some good snippet definitions, you can post them -to the `discussion group`_. You can specify the ``contributor`` -property of the snippet like: - -.. sourcecode:: text - - #contributor : pluskid - #name : __...__ - # -- - __${init}__ - -I'll incorporate (some of) them in the release if suitable. However, -if you have *many* snippets (especially when they need to be -maintained and updated constantly), it is not suitable to put them in -the YASnippet release package. A better way is to make your snippets -publicly available and tell me the URL. I'll try to keep a list of -them on the wiki page. +* If you find a bug, please report it at `Issue List + `_. +* If you have problem using YASnippet, or have some new ideas, please + post to the `discussion group`_. Especially, there's a `wish list`_ + wiki page. I'll collect ideas from the `discussion group`_ to the + `wish list`_. So you might want to look at the `wish list`_ before + you post something. +* If you want to contribute some snippets, you can also post them to + the `discussion group`_. Some common snippets may be added to + YASnippet, while others will be collected at the + `UserContributedSnippets wiki page + `_. .. _discussion group: http://groups.google.com/group/smart-snippet .. _wish list: http://code.google.com/p/yasnippet/wiki/WishList -Detailed Documentation -====================== - -* See `this page `_ on how to define a snippet by - yourself. -* Here's the `FAQ `_ page. -* Here's the `ChangeLog `_. - -.. [1] They usually named like ``yasnippet-bundle-x.y.z.el.tgz`` where - ``x.y.z`` is the version number. -.. [2] They usually named like ``yasnippet.x.y.z.tar.bz2``. +Thank you very much for using YASnippet! diff --git a/snippets/text-mode/cc-mode/c++-mode/class b/snippets/text-mode/cc-mode/c++-mode/class index e4a7032..820fc6c 100644 --- a/snippets/text-mode/cc-mode/c++-mode/class +++ b/snippets/text-mode/cc-mode/c++-mode/class @@ -3,6 +3,6 @@ class ${1:Name} { public: - $1($2); - virtual ~$1(); + ${1:$(yas/substr text "[^: ]*")}($2); + virtual ~${1:$(yas/substr text "[^: ]*")}(); }; \ No newline at end of file diff --git a/snippets/text-mode/cc-mode/c++-mode/ns b/snippets/text-mode/cc-mode/c++-mode/ns new file mode 100644 index 0000000..0c2513f --- /dev/null +++ b/snippets/text-mode/cc-mode/c++-mode/ns @@ -0,0 +1,3 @@ +#name : namespace ... +# -- +namespace \ No newline at end of file diff --git a/snippets/text-mode/cc-mode/c++-mode/template b/snippets/text-mode/cc-mode/c++-mode/template new file mode 100644 index 0000000..7e50616 --- /dev/null +++ b/snippets/text-mode/cc-mode/c++-mode/template @@ -0,0 +1,3 @@ +#name : template +# -- +template \ No newline at end of file diff --git a/snippets/text-mode/cc-mode/csharp-mode/attrib b/snippets/text-mode/cc-mode/csharp-mode/attrib new file mode 100644 index 0000000..9e14e22 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/attrib @@ -0,0 +1,7 @@ +#contributor : Alejandro Espinoza Esparza +#name : private attribute ....; +# -- +/// +/// $3 +/// +private $1 $2; diff --git a/snippets/text-mode/cc-mode/csharp-mode/attrib.1 b/snippets/text-mode/cc-mode/csharp-mode/attrib.1 new file mode 100644 index 0000000..099cc7b --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/attrib.1 @@ -0,0 +1,21 @@ +#contributor : Alejandro Espinoza Esparza +#name : private attribute ....; public property ... ... { ... } +# -- +/// +/// $3 +/// +private $1 $2; + +/// +/// $4 +/// +/// $5 +public $1 $2 +{ + get { + return this.$2; + } + set { + this.$2 = value; + } +} diff --git a/snippets/text-mode/cc-mode/csharp-mode/attrib.2 b/snippets/text-mode/cc-mode/csharp-mode/attrib.2 new file mode 100644 index 0000000..566eacf --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/attrib.2 @@ -0,0 +1,21 @@ +#contributor : Alejandro Espinoza Esparza +#name : private _attribute ....; public Property ... ... { ... } +# -- +/// +/// $3 +/// +private $1 ${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")}; + +/// +/// ${3:Description} +/// +/// $1 +public ${1:Type} ${2:Name} +{ + get { + return this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")}; + } + set { + this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")} = value; + } +} diff --git a/snippets/text-mode/cc-mode/csharp-mode/class b/snippets/text-mode/cc-mode/csharp-mode/class new file mode 100644 index 0000000..1cce2e8 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/class @@ -0,0 +1,21 @@ +#contributor : Alejandro Espinoza Esparza +#name : class ... { ... } +# -- +${5:public} class ${1:Name} +{ + #region Ctor & Destructor + /// + /// ${3:Standard Constructor} + /// + public $1($2) + { + } + + /// + /// ${4:Default Destructor} + /// + public ~$1() + { + } + #endregion +} diff --git a/snippets/text-mode/cc-mode/csharp-mode/comment b/snippets/text-mode/cc-mode/csharp-mode/comment new file mode 100644 index 0000000..3bd20d3 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/comment @@ -0,0 +1,6 @@ +#contributor : Alejandro Espinoza Esparza +#name : /// ... +# -- +/// +/// $1 +/// diff --git a/snippets/text-mode/cc-mode/csharp-mode/comment.1 b/snippets/text-mode/cc-mode/csharp-mode/comment.1 new file mode 100644 index 0000000..3c14ad9 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/comment.1 @@ -0,0 +1,4 @@ +#contributor : Alejandro Espinoza Esparza +#name : /// ... +# -- +/// $2 diff --git a/snippets/text-mode/cc-mode/csharp-mode/comment.2 b/snippets/text-mode/cc-mode/csharp-mode/comment.2 new file mode 100644 index 0000000..63a6a20 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/comment.2 @@ -0,0 +1,4 @@ +#contributor : Alejandro Espinoza Esparza +#name : /// ... +# -- +/// $1 diff --git a/snippets/text-mode/cc-mode/csharp-mode/comment.3 b/snippets/text-mode/cc-mode/csharp-mode/comment.3 new file mode 100644 index 0000000..394c323 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/comment.3 @@ -0,0 +1,4 @@ +#contributor : Alejandro Espinoza Esparza +#name : /// ... +# -- +/// $2 diff --git a/snippets/text-mode/cc-mode/csharp-mode/method b/snippets/text-mode/cc-mode/csharp-mode/method new file mode 100644 index 0000000..e9a5906 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/method @@ -0,0 +1,10 @@ +#contributor : Alejandro Espinoza Esparza +#name : public void Method { ... } +# -- +/// +/// ${5:Description} +/// ${2:$(if (string= (upcase text) "VOID") "" (format "%s%s%s" "\n/// " text ""))} +${1:public} ${2:void} ${3:MethodName}($4) +{ +$0 +} diff --git a/snippets/text-mode/cc-mode/csharp-mode/namespace b/snippets/text-mode/cc-mode/csharp-mode/namespace new file mode 100644 index 0000000..af7c928 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/namespace @@ -0,0 +1,7 @@ +#contributor : Alejandro Espinoza Esparza +#name : namespace .. { ... } +# -- +namespace $1 +{ +$0 +} diff --git a/snippets/text-mode/cc-mode/csharp-mode/prop b/snippets/text-mode/cc-mode/csharp-mode/prop new file mode 100644 index 0000000..df9df91 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/prop @@ -0,0 +1,16 @@ +#contributor : Alejandro Espinoza Esparza +#name : property ... ... { ... } +# -- +/// +/// $5 +/// +/// $6 +$1 $2 $3 +{ + get { + return this.$4; + } + set { + this.$4 = value; + } +} diff --git a/snippets/text-mode/cc-mode/csharp-mode/region b/snippets/text-mode/cc-mode/csharp-mode/region new file mode 100644 index 0000000..83f9a24 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/region @@ -0,0 +1,6 @@ +#contributor : Alejandro Espinoza Esparza +#name : #region ... #endregion +# -- +#region $1 +$0 +#endregion diff --git a/snippets/text-mode/cc-mode/csharp-mode/using b/snippets/text-mode/cc-mode/csharp-mode/using new file mode 100644 index 0000000..704637e --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/using @@ -0,0 +1,4 @@ +#contributor : Alejandro Espinoza Esparza +#name : using ...; +# -- +using $1; diff --git a/snippets/text-mode/cc-mode/csharp-mode/using.1 b/snippets/text-mode/cc-mode/csharp-mode/using.1 new file mode 100644 index 0000000..e9f0bb0 --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/using.1 @@ -0,0 +1,4 @@ +#contributor : Alejandro Espinoza Esparza +#name : using System; +# -- +using System; diff --git a/snippets/text-mode/cc-mode/csharp-mode/using.2 b/snippets/text-mode/cc-mode/csharp-mode/using.2 new file mode 100644 index 0000000..0a3c07d --- /dev/null +++ b/snippets/text-mode/cc-mode/csharp-mode/using.2 @@ -0,0 +1,4 @@ +#contributor : Alejandro Espinoza Esparza +#name : using System....; +# -- +using System.$1; diff --git a/snippets/text-mode/cc-mode/objc-mode/prop b/snippets/text-mode/cc-mode/objc-mode/prop new file mode 100644 index 0000000..4d585db --- /dev/null +++ b/snippets/text-mode/cc-mode/objc-mode/prop @@ -0,0 +1,13 @@ +#name : foo { ... } ; setFoo { ... } +# -- +- (${1:id})${2:foo} +{ + return $2; +} + +- (void)set${2:$(capitalize text)}:($1)aValue +{ + [$2 autorelease]; + $2 = [aValue retain]; +} +$0 \ No newline at end of file diff --git a/snippets/text-mode/emacs-lisp-mode/.read_me b/snippets/text-mode/emacs-lisp-mode/.read_me new file mode 100644 index 0000000..9e6e532 --- /dev/null +++ b/snippets/text-mode/emacs-lisp-mode/.read_me @@ -0,0 +1,11 @@ +TITLE: Emacs Idiom Template Set. Version 1. 2009-02-22 + +DESCRIPTION: Some useful templates for emacs lisp. This template set is based on useful elisp idioms on common tasks. + +LICENSING: GPL version 3. + +AUTHOR: Xah Lee + +Home Page: latest version at: +• Emacs Lisp Idiom Templates + http://xahlee.org/emacs/elisp_idiom_templates.html diff --git a/snippets/text-mode/emacs-lisp-mode/defun b/snippets/text-mode/emacs-lisp-mode/defun new file mode 100644 index 0000000..0105d20 --- /dev/null +++ b/snippets/text-mode/emacs-lisp-mode/defun @@ -0,0 +1,11 @@ +#name : function template +#contributor : Xah Lee +# -- +(defun $1 () + "thisandthat." + (interactive) + (let (var1) + (setq var1 some) + $0 + ) +) \ No newline at end of file diff --git a/snippets/text-mode/emacs-lisp-mode/dired.process_marked b/snippets/text-mode/emacs-lisp-mode/dired.process_marked new file mode 100644 index 0000000..1b42597 --- /dev/null +++ b/snippets/text-mode/emacs-lisp-mode/dired.process_marked @@ -0,0 +1,16 @@ +#name : process marked files in dired +#contributor : Xah Lee +# -- +;; idiom for processing a list of files in dired's marked files + +;; suppose myProcessFile is your function that takes a file path +;; and do some processing on the file + +(defun dired-myProcessFile () + "apply myProcessFile function to marked files in dired." + (interactive) + (require 'dired) + (mapc 'myProcessFile (dired-get-marked-files)) +) + +;; to use it, type M-x dired-myProcessFile diff --git a/snippets/text-mode/emacs-lisp-mode/file.process b/snippets/text-mode/emacs-lisp-mode/file.process new file mode 100644 index 0000000..abd1a33 --- /dev/null +++ b/snippets/text-mode/emacs-lisp-mode/file.process @@ -0,0 +1,17 @@ +#name : a function that process a file +#contributor : Xah Lee +# -- +(defun doThisFile (fpath) + "Process the file at path FPATH ..." + (let () + ;; create temp buffer without undo record or font lock. (more efficient) + ;; first space in temp buff name is necessary + (set-buffer (get-buffer-create " myTemp")) + (insert-file-contents fpath nil nil nil t) + + ;; process it ... + ;; (goto-char 0) ; move to begining of file's content (in case it was open) + ;; ... do something here + ;; (write-file fpath) ;; write back to the file + + (kill-buffer " myTemp"))) diff --git a/snippets/text-mode/emacs-lisp-mode/file.read-lines b/snippets/text-mode/emacs-lisp-mode/file.read-lines new file mode 100644 index 0000000..b4a1942 --- /dev/null +++ b/snippets/text-mode/emacs-lisp-mode/file.read-lines @@ -0,0 +1,17 @@ +#name : read lines of a file +#contributor : Xah Lee +# -- +(defun read-lines (filePath) + "Return a list of lines in FILEPATH." + (with-temp-buffer + (insert-file-contents filePath) + (split-string + (buffer-string) "\n" t)) ) + +;; process all lines +(mapc + (lambda (aLine) + (message aLine) ; do your stuff here + ) + (read-lines "inputFilePath") +) \ No newline at end of file diff --git a/snippets/text-mode/emacs-lisp-mode/find-replace b/snippets/text-mode/emacs-lisp-mode/find-replace new file mode 100644 index 0000000..cefcf51 --- /dev/null +++ b/snippets/text-mode/emacs-lisp-mode/find-replace @@ -0,0 +1,17 @@ +#name : find and replace on region +#contributor : Xah Lee +# -- +(defun replace-html-chars-region (start end) + "Replace “<” to “<” and other chars in HTML. +This works on the current region." + (interactive "r") + (save-restriction + (narrow-to-region start end) + (goto-char (point-min)) + (while (search-forward "&" nil t) (replace-match "&" nil t)) + (goto-char (point-min)) + (while (search-forward "<" nil t) (replace-match "<" nil t)) + (goto-char (point-min)) + (while (search-forward ">" nil t) (replace-match ">" nil t)) + ) + ) diff --git a/snippets/text-mode/emacs-lisp-mode/grabstring b/snippets/text-mode/emacs-lisp-mode/grabstring new file mode 100644 index 0000000..55600b1 --- /dev/null +++ b/snippets/text-mode/emacs-lisp-mode/grabstring @@ -0,0 +1,4 @@ +#name : grab buffer substring +#contributor : Xah Lee +# -- +(setq $0 (buffer-substring-no-properties myStartPos myEndPos)) diff --git a/snippets/text-mode/emacs-lisp-mode/grabthing b/snippets/text-mode/emacs-lisp-mode/grabthing new file mode 100644 index 0000000..772b8dc --- /dev/null +++ b/snippets/text-mode/emacs-lisp-mode/grabthing @@ -0,0 +1,4 @@ +#name : grab word under cursor +#contributor : Xah Lee +# -- +(setq $0 (thing-at-point 'symbol)) diff --git a/snippets/text-mode/emacs-lisp-mode/traverse_dir b/snippets/text-mode/emacs-lisp-mode/traverse_dir new file mode 100644 index 0000000..2859cbd --- /dev/null +++ b/snippets/text-mode/emacs-lisp-mode/traverse_dir @@ -0,0 +1,6 @@ +#name : traversing a directory +#contributor : Xah Lee +# -- +;; apply a function to all files in a dir +(require 'find-lisp) +(mapc 'my-process-file (find-lisp-find-files "~/myweb/" "\\.html$")) diff --git a/snippets/text-mode/emacs-lisp-mode/word-or-region b/snippets/text-mode/emacs-lisp-mode/word-or-region new file mode 100644 index 0000000..66a59e4 --- /dev/null +++ b/snippets/text-mode/emacs-lisp-mode/word-or-region @@ -0,0 +1,27 @@ +#name : Command that works on region or word +#contributor : Xah Lee +# -- +;; example of a command that works on current word or text selection +(defun down-case-word-or-region () + "Lower case the current word or text selection." +(interactive) +(let (pos1 pos2 meat) + (if (and transient-mark-mode mark-active) + (setq pos1 (region-beginning) + pos2 (region-end)) + (setq pos1 (car (bounds-of-thing-at-point 'symbol)) + pos2 (cdr (bounds-of-thing-at-point 'symbol)))) + + ; now, pos1 and pos2 are the starting and ending positions + ; of the current word, or current text selection if exists + + ;; put your code here. + $0 + ;; Some example of things you might want to do + (downcase-region pos1 pos2) ; example of a func that takes region as args + (setq meat (buffer-substring-no-properties pos1 pos2)) ; grab the text. + (delete-region pos1 pos2) ; get rid of it + (insert "newText") ; insert your new text + + ) +) diff --git a/snippets/text-mode/erlang-mode/after b/snippets/text-mode/erlang-mode/after new file mode 100644 index 0000000..264e201 --- /dev/null +++ b/snippets/text-mode/erlang-mode/after @@ -0,0 +1,4 @@ +#name : after ... -> +# -- +after + $1 -> $0 diff --git a/snippets/text-mode/erlang-mode/begin b/snippets/text-mode/erlang-mode/begin new file mode 100644 index 0000000..7b48494 --- /dev/null +++ b/snippets/text-mode/erlang-mode/begin @@ -0,0 +1,5 @@ +#name : begin ... end +# -- +begin + $0 +end diff --git a/snippets/text-mode/erlang-mode/beh b/snippets/text-mode/erlang-mode/beh new file mode 100644 index 0000000..4975b26 --- /dev/null +++ b/snippets/text-mode/erlang-mode/beh @@ -0,0 +1,4 @@ +#name : -behaviour(...). +# -- +-behaviour(${1:gen_server}). +$0 diff --git a/snippets/text-mode/erlang-mode/case b/snippets/text-mode/erlang-mode/case new file mode 100644 index 0000000..5bed114 --- /dev/null +++ b/snippets/text-mode/erlang-mode/case @@ -0,0 +1,5 @@ +#name : case ... of ... end +# -- +case $1 of + $0 +end diff --git a/snippets/text-mode/erlang-mode/compile b/snippets/text-mode/erlang-mode/compile new file mode 100644 index 0000000..ae3a4d8 --- /dev/null +++ b/snippets/text-mode/erlang-mode/compile @@ -0,0 +1,4 @@ +#name : -compile(...). +# -- +-compile([${1:export_all}]). +$0 diff --git a/snippets/text-mode/erlang-mode/def b/snippets/text-mode/erlang-mode/def new file mode 100644 index 0000000..6fb92f1 --- /dev/null +++ b/snippets/text-mode/erlang-mode/def @@ -0,0 +1,4 @@ +#name : -define(...,...). +# -- +-define($1,$2). +$0 diff --git a/snippets/text-mode/erlang-mode/fun b/snippets/text-mode/erlang-mode/fun new file mode 100644 index 0000000..77f8293 --- /dev/null +++ b/snippets/text-mode/erlang-mode/fun @@ -0,0 +1,3 @@ +#name : fun (...) -> ... end +# -- +fun ($1) -> $0 end diff --git a/snippets/text-mode/erlang-mode/if b/snippets/text-mode/erlang-mode/if new file mode 100644 index 0000000..45674c4 --- /dev/null +++ b/snippets/text-mode/erlang-mode/if @@ -0,0 +1,6 @@ +#name : if ... -> ... ; true -> ... end +# -- +if + $1 -> $2; + true -> $0 +end diff --git a/snippets/text-mode/erlang-mode/ifdef b/snippets/text-mode/erlang-mode/ifdef new file mode 100644 index 0000000..ea89ecf --- /dev/null +++ b/snippets/text-mode/erlang-mode/ifdef @@ -0,0 +1,5 @@ +#name : -ifdef(...). ... -endif. +# -- +-ifdef($1). +$0 +-endif. diff --git a/snippets/text-mode/erlang-mode/ifndef b/snippets/text-mode/erlang-mode/ifndef new file mode 100644 index 0000000..dcd67a7 --- /dev/null +++ b/snippets/text-mode/erlang-mode/ifndef @@ -0,0 +1,5 @@ +#name : -ifndef(...). ... -endif. +# -- +-ifndef($1). +$0 +-endif. diff --git a/snippets/text-mode/erlang-mode/inc b/snippets/text-mode/erlang-mode/inc new file mode 100644 index 0000000..f7b2161 --- /dev/null +++ b/snippets/text-mode/erlang-mode/inc @@ -0,0 +1,4 @@ +#name : -include("..."). +# -- +-include("$1"). +$0 diff --git a/snippets/text-mode/erlang-mode/inc.lib b/snippets/text-mode/erlang-mode/inc.lib new file mode 100644 index 0000000..09a6723 --- /dev/null +++ b/snippets/text-mode/erlang-mode/inc.lib @@ -0,0 +1,4 @@ +#name : -include_lib("..."). +# -- +-include_lib("$1"). +$0 diff --git a/snippets/text-mode/erlang-mode/loop b/snippets/text-mode/erlang-mode/loop new file mode 100644 index 0000000..0205802 --- /dev/null +++ b/snippets/text-mode/erlang-mode/loop @@ -0,0 +1,8 @@ +#name : loop(...) -> receive _ -> loop(...) end. +# -- +${1:loop}($2) -> + receive + ${3:_} -> + $1($2) + end. +$0 diff --git a/snippets/text-mode/erlang-mode/rcv b/snippets/text-mode/erlang-mode/rcv new file mode 100644 index 0000000..804fb3f --- /dev/null +++ b/snippets/text-mode/erlang-mode/rcv @@ -0,0 +1,5 @@ +#name : receive ... -> ... end +# -- +receive + $1 -> $0 +end diff --git a/snippets/text-mode/erlang-mode/rcv.after b/snippets/text-mode/erlang-mode/rcv.after new file mode 100644 index 0000000..51046df --- /dev/null +++ b/snippets/text-mode/erlang-mode/rcv.after @@ -0,0 +1,6 @@ +#name : receive after ... -> ... end +# -- +receive +after + $1 -> $0 +end diff --git a/snippets/text-mode/erlang-mode/rec b/snippets/text-mode/erlang-mode/rec new file mode 100644 index 0000000..0d67834 --- /dev/null +++ b/snippets/text-mode/erlang-mode/rec @@ -0,0 +1,4 @@ +#name : -record(...,{...}). +# -- +-record($1,{$2}). +$0 diff --git a/snippets/text-mode/erlang-mode/try b/snippets/text-mode/erlang-mode/try new file mode 100644 index 0000000..fa5c9c2 --- /dev/null +++ b/snippets/text-mode/erlang-mode/try @@ -0,0 +1,7 @@ +#name : try ... of ... catch after end +# -- +try $1 of + $0 +catch +after +end diff --git a/snippets/text-mode/erlang-mode/undef b/snippets/text-mode/erlang-mode/undef new file mode 100644 index 0000000..7ab5dd4 --- /dev/null +++ b/snippets/text-mode/erlang-mode/undef @@ -0,0 +1,4 @@ +#name : -undef(...). +# -- +-undef($1). +$0 diff --git a/snippets/text-mode/html-mode/dd b/snippets/text-mode/html-mode/dd new file mode 100644 index 0000000..8120b13 --- /dev/null +++ b/snippets/text-mode/html-mode/dd @@ -0,0 +1,5 @@ +#contributor : Rodrigo Setti +#name :
...
+#group : list +# -- +
$1
\ No newline at end of file diff --git a/snippets/text-mode/html-mode/div b/snippets/text-mode/html-mode/div index 0ecfde3..1c9c0c8 100644 --- a/snippets/text-mode/html-mode/div +++ b/snippets/text-mode/html-mode/div @@ -1,3 +1,3 @@ #name : ... # -- -$0 \ No newline at end of file +$0 \ No newline at end of file diff --git a/snippets/text-mode/html-mode/dl b/snippets/text-mode/html-mode/dl new file mode 100644 index 0000000..be11bb5 --- /dev/null +++ b/snippets/text-mode/html-mode/dl @@ -0,0 +1,7 @@ +#contributor : Rodrigo Setti +#name :
...
+#group : list +# -- +
+ $0 +
diff --git a/snippets/text-mode/html-mode/dl.id b/snippets/text-mode/html-mode/dl.id new file mode 100644 index 0000000..16aba53 --- /dev/null +++ b/snippets/text-mode/html-mode/dl.id @@ -0,0 +1,7 @@ +#contributor : Rodrigo Setti +#name :
...
+#group : list +# -- +
+ $0 +
\ No newline at end of file diff --git a/snippets/text-mode/html-mode/doctype b/snippets/text-mode/html-mode/doctype index 5e678d5..a60dfb6 100644 --- a/snippets/text-mode/html-mode/doctype +++ b/snippets/text-mode/html-mode/doctype @@ -1,3 +1,4 @@ #name : Doctype HTML 4.01 Strict +#group : meta # -- \ No newline at end of file diff --git a/snippets/text-mode/html-mode/doctype.xhml1 b/snippets/text-mode/html-mode/doctype.xhml1 index c5cfb6f..5d95e07 100644 --- a/snippets/text-mode/html-mode/doctype.xhml1 +++ b/snippets/text-mode/html-mode/doctype.xhml1 @@ -1,3 +1,4 @@ #name : DocType XHTML 1.0 frameset +#group : meta # -- \ No newline at end of file diff --git a/snippets/text-mode/html-mode/doctype.xhtml1_1 b/snippets/text-mode/html-mode/doctype.xhtml1_1 index 72076c0..fec46d7 100644 --- a/snippets/text-mode/html-mode/doctype.xhtml1_1 +++ b/snippets/text-mode/html-mode/doctype.xhtml1_1 @@ -1,3 +1,4 @@ #name : DocType XHTML 1.1 +#group : meta # -- \ No newline at end of file diff --git a/snippets/text-mode/html-mode/doctype.xhtml1_strict b/snippets/text-mode/html-mode/doctype.xhtml1_strict index 176616b..20d95d3 100644 --- a/snippets/text-mode/html-mode/doctype.xhtml1_strict +++ b/snippets/text-mode/html-mode/doctype.xhtml1_strict @@ -1,3 +1,4 @@ #name : DocType XHTML 1.0 Strict +#group : meta # -- \ No newline at end of file diff --git a/snippets/text-mode/html-mode/doctype.xhtml1_transitional b/snippets/text-mode/html-mode/doctype.xhtml1_transitional index d6b6bae..c5255fc 100644 --- a/snippets/text-mode/html-mode/doctype.xhtml1_transitional +++ b/snippets/text-mode/html-mode/doctype.xhtml1_transitional @@ -1,3 +1,4 @@ #name : DocType XHTML 1.0 Transitional +#group : meta # -- \ No newline at end of file diff --git a/snippets/text-mode/html-mode/dt b/snippets/text-mode/html-mode/dt new file mode 100644 index 0000000..f385cec --- /dev/null +++ b/snippets/text-mode/html-mode/dt @@ -0,0 +1,5 @@ +#contributor : Rodrigo Setti +#name :
...
+#group : list +# -- +
$1
\ No newline at end of file diff --git a/snippets/text-mode/html-mode/h1 b/snippets/text-mode/html-mode/h1 index 614c626..414e457 100644 --- a/snippets/text-mode/html-mode/h1 +++ b/snippets/text-mode/html-mode/h1 @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name :

...

+#group : header # --

$1

\ No newline at end of file diff --git a/snippets/text-mode/html-mode/h2 b/snippets/text-mode/html-mode/h2 index 1d7c8a0..3722a29 100644 --- a/snippets/text-mode/html-mode/h2 +++ b/snippets/text-mode/html-mode/h2 @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name :

...

+#group : header # --

$1

\ No newline at end of file diff --git a/snippets/text-mode/html-mode/h3 b/snippets/text-mode/html-mode/h3 index 321877c..a1eaab1 100644 --- a/snippets/text-mode/html-mode/h3 +++ b/snippets/text-mode/html-mode/h3 @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name :

...

+#group : header # --

$1

\ No newline at end of file diff --git a/snippets/text-mode/html-mode/h4 b/snippets/text-mode/html-mode/h4 index 49af37b..df71628 100644 --- a/snippets/text-mode/html-mode/h4 +++ b/snippets/text-mode/html-mode/h4 @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name :

...

+#group : header # --

$1

\ No newline at end of file diff --git a/snippets/text-mode/html-mode/h5 b/snippets/text-mode/html-mode/h5 index dbce14c..0109822 100644 --- a/snippets/text-mode/html-mode/h5 +++ b/snippets/text-mode/html-mode/h5 @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name :
...
+#group : header # --
$1
\ No newline at end of file diff --git a/snippets/text-mode/html-mode/h6 b/snippets/text-mode/html-mode/h6 index 855ef7f..21c718f 100644 --- a/snippets/text-mode/html-mode/h6 +++ b/snippets/text-mode/html-mode/h6 @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name :
...
+#group : header # --
$1
\ No newline at end of file diff --git a/snippets/text-mode/html-mode/li b/snippets/text-mode/html-mode/li index 93f9c4c..c5139fa 100644 --- a/snippets/text-mode/html-mode/li +++ b/snippets/text-mode/html-mode/li @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name :
  • ...
  • +#group : list # --
  • $1
  • \ No newline at end of file diff --git a/snippets/text-mode/html-mode/li.class b/snippets/text-mode/html-mode/li.class index 9f0443c..90f0c65 100644 --- a/snippets/text-mode/html-mode/li.class +++ b/snippets/text-mode/html-mode/li.class @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name :
  • ...
  • +#group : list # --
  • $2
  • \ No newline at end of file diff --git a/snippets/text-mode/html-mode/meta b/snippets/text-mode/html-mode/meta index b729207..30319ef 100644 --- a/snippets/text-mode/html-mode/meta +++ b/snippets/text-mode/html-mode/meta @@ -1,4 +1,5 @@ #contributor : Jimmy Wu +#group : meta #name : # -- \ No newline at end of file diff --git a/snippets/text-mode/html-mode/meta.http-equiv b/snippets/text-mode/html-mode/meta.http-equiv index 7e21a8e..c059a44 100644 --- a/snippets/text-mode/html-mode/meta.http-equiv +++ b/snippets/text-mode/html-mode/meta.http-equiv @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name : +#group : meta # -- \ No newline at end of file diff --git a/snippets/text-mode/html-mode/ol b/snippets/text-mode/html-mode/ol index 3fa3fd8..58899fa 100644 --- a/snippets/text-mode/html-mode/ol +++ b/snippets/text-mode/html-mode/ol @@ -1,5 +1,6 @@ #contributor : Jimmy Wu #name :
      ...
    +#group : list # --
      $0 diff --git a/snippets/text-mode/html-mode/ol.class b/snippets/text-mode/html-mode/ol.class index 3b7b1e3..b091f08 100644 --- a/snippets/text-mode/html-mode/ol.class +++ b/snippets/text-mode/html-mode/ol.class @@ -1,5 +1,6 @@ #contributor : Jimmy Wu #name :
        ...
      +#group : list # --
        $0 diff --git a/snippets/text-mode/html-mode/ol.id b/snippets/text-mode/html-mode/ol.id index b906264..13c7c06 100644 --- a/snippets/text-mode/html-mode/ol.id +++ b/snippets/text-mode/html-mode/ol.id @@ -1,5 +1,6 @@ #contributor : Jimmy Wu #name :
          ...
        +#group : list # --
          $0 diff --git a/snippets/text-mode/html-mode/table b/snippets/text-mode/html-mode/table index 0dded23..561614f 100644 --- a/snippets/text-mode/html-mode/table +++ b/snippets/text-mode/html-mode/table @@ -1,5 +1,6 @@ #contributor : Jimmy Wu #name : ...
          +#group : table # -- $0 diff --git a/snippets/text-mode/html-mode/td b/snippets/text-mode/html-mode/td index 8a9b791..4f494eb 100644 --- a/snippets/text-mode/html-mode/td +++ b/snippets/text-mode/html-mode/td @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name : +#group : table # -- $2 \ No newline at end of file diff --git a/snippets/text-mode/html-mode/th b/snippets/text-mode/html-mode/th index e6b8e0a..3b5fab1 100644 --- a/snippets/text-mode/html-mode/th +++ b/snippets/text-mode/html-mode/th @@ -1,4 +1,5 @@ #contributor : Jimmy Wu #name : +#group : table # -- $2 \ No newline at end of file diff --git a/snippets/text-mode/html-mode/tr b/snippets/text-mode/html-mode/tr index 210ec45..3878a1c 100644 --- a/snippets/text-mode/html-mode/tr +++ b/snippets/text-mode/html-mode/tr @@ -1,5 +1,6 @@ #contributor : Jimmy Wu #name : ... +#group : table # -- $0 diff --git a/snippets/text-mode/html-mode/ul b/snippets/text-mode/html-mode/ul index 1262154..981e6e7 100644 --- a/snippets/text-mode/html-mode/ul +++ b/snippets/text-mode/html-mode/ul @@ -1,5 +1,6 @@ #contributor : Jimmy Wu #name :
            ...
          +#group : list # --
            $0 diff --git a/snippets/text-mode/html-mode/ul.class b/snippets/text-mode/html-mode/ul.class index 6c59820..c1e3e91 100644 --- a/snippets/text-mode/html-mode/ul.class +++ b/snippets/text-mode/html-mode/ul.class @@ -1,5 +1,6 @@ #contributor : Jimmy Wu #name :
              ...
            +#group : list # --
              $0 diff --git a/snippets/text-mode/html-mode/ul.id b/snippets/text-mode/html-mode/ul.id index 76146d3..ababf37 100644 --- a/snippets/text-mode/html-mode/ul.id +++ b/snippets/text-mode/html-mode/ul.id @@ -1,5 +1,6 @@ #contributor : Jimmy Wu #name :
                ...
              +#group : list # --
                $0 diff --git a/snippets/text-mode/latex-mode/begin b/snippets/text-mode/latex-mode/begin new file mode 100644 index 0000000..dc42d2f --- /dev/null +++ b/snippets/text-mode/latex-mode/begin @@ -0,0 +1,7 @@ +#contributor : Rodrigo Setti +#name : \begin{environment} ... \end{environment} +# -- + +\begin{${1:environment}} +$0 +\end{$1} diff --git a/snippets/text-mode/nxml-mode/body b/snippets/text-mode/nxml-mode/body new file mode 100644 index 0000000..ddcf0cf --- /dev/null +++ b/snippets/text-mode/nxml-mode/body @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- + + $0 + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/br b/snippets/text-mode/nxml-mode/br new file mode 100644 index 0000000..ba35773 --- /dev/null +++ b/snippets/text-mode/nxml-mode/br @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name :
                +# -- +
                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/code b/snippets/text-mode/nxml-mode/code new file mode 100644 index 0000000..b7c43fd --- /dev/null +++ b/snippets/text-mode/nxml-mode/code @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- + + $0 + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/div b/snippets/text-mode/nxml-mode/div new file mode 100644 index 0000000..90fbc2e --- /dev/null +++ b/snippets/text-mode/nxml-mode/div @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$0 \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/doctype b/snippets/text-mode/nxml-mode/doctype new file mode 100644 index 0000000..3fdcf17 --- /dev/null +++ b/snippets/text-mode/nxml-mode/doctype @@ -0,0 +1,5 @@ +#contributor : Anders Bach Nielsen +#name : DocType XHTML 1.1 +#group : meta +# -- + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/doctype.xhtml1_strict b/snippets/text-mode/nxml-mode/doctype.xhtml1_strict new file mode 100644 index 0000000..eca5860 --- /dev/null +++ b/snippets/text-mode/nxml-mode/doctype.xhtml1_strict @@ -0,0 +1,5 @@ +#contributor : Anders Bach Nielsen +#name : DocType XHTML 1.0 Strict +#group : meta +# -- + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/doctype.xhtml1_transitional b/snippets/text-mode/nxml-mode/doctype.xhtml1_transitional new file mode 100644 index 0000000..fba232a --- /dev/null +++ b/snippets/text-mode/nxml-mode/doctype.xhtml1_transitional @@ -0,0 +1,5 @@ +#contributor : Anders Bach Nielsen +#name : DocType XHTML 1.0 Transitional +#group : meta +# -- + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/form b/snippets/text-mode/nxml-mode/form new file mode 100644 index 0000000..252253e --- /dev/null +++ b/snippets/text-mode/nxml-mode/form @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name :
                +# -- +
                + $0 + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/h1 b/snippets/text-mode/nxml-mode/h1 new file mode 100644 index 0000000..bc72fd6 --- /dev/null +++ b/snippets/text-mode/nxml-mode/h1 @@ -0,0 +1,5 @@ +#contributor : Anders Bach Nielsen +#name :

                ...

                +#group : header +# -- +

                $1

                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/h2 b/snippets/text-mode/nxml-mode/h2 new file mode 100644 index 0000000..b790e56 --- /dev/null +++ b/snippets/text-mode/nxml-mode/h2 @@ -0,0 +1,5 @@ +#contributor : Anders Bach Nielsen +#name :

                ...

                +#group : header +# -- +

                $1

                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/h3 b/snippets/text-mode/nxml-mode/h3 new file mode 100644 index 0000000..7dfd9d7 --- /dev/null +++ b/snippets/text-mode/nxml-mode/h3 @@ -0,0 +1,5 @@ +#contributor : Anders Bach Nielsen +#name :

                ...

                +#group : header +# -- +

                $1

                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/h4 b/snippets/text-mode/nxml-mode/h4 new file mode 100644 index 0000000..b782998 --- /dev/null +++ b/snippets/text-mode/nxml-mode/h4 @@ -0,0 +1,5 @@ +#contributor : Anders Bach Nielsen +#name :

                ...

                +#group : header +# -- +

                $1

                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/h5 b/snippets/text-mode/nxml-mode/h5 new file mode 100644 index 0000000..13a51a1 --- /dev/null +++ b/snippets/text-mode/nxml-mode/h5 @@ -0,0 +1,5 @@ +#contributor : Anders Bach Nielsen +#name :
                ...
                +#group : header +# -- +
                $1
                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/h6 b/snippets/text-mode/nxml-mode/h6 new file mode 100644 index 0000000..b2f0c55 --- /dev/null +++ b/snippets/text-mode/nxml-mode/h6 @@ -0,0 +1,5 @@ +#contributor : Anders Bach Nielsen +#name :
                ...
                +#group : header +# -- +
                $1
                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/head b/snippets/text-mode/nxml-mode/head new file mode 100644 index 0000000..91347b9 --- /dev/null +++ b/snippets/text-mode/nxml-mode/head @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- + + $0 + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/hr b/snippets/text-mode/nxml-mode/hr new file mode 100644 index 0000000..a17e1db --- /dev/null +++ b/snippets/text-mode/nxml-mode/hr @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name :
                +# -- +
                diff --git a/snippets/text-mode/nxml-mode/href b/snippets/text-mode/nxml-mode/href new file mode 100644 index 0000000..0db2fae --- /dev/null +++ b/snippets/text-mode/nxml-mode/href @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$2 \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/html b/snippets/text-mode/nxml-mode/html new file mode 100644 index 0000000..85e09f7 --- /dev/null +++ b/snippets/text-mode/nxml-mode/html @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- + + $0 + diff --git a/snippets/text-mode/nxml-mode/img b/snippets/text-mode/nxml-mode/img new file mode 100644 index 0000000..1f4382b --- /dev/null +++ b/snippets/text-mode/nxml-mode/img @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$2 \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/input b/snippets/text-mode/nxml-mode/input new file mode 100644 index 0000000..80c3503 --- /dev/null +++ b/snippets/text-mode/nxml-mode/input @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : +# -- + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/li b/snippets/text-mode/nxml-mode/li new file mode 100644 index 0000000..c952682 --- /dev/null +++ b/snippets/text-mode/nxml-mode/li @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name :
              • ...
              • +# -- +
              • $1
              • \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/link b/snippets/text-mode/nxml-mode/link new file mode 100644 index 0000000..d93b7a5 --- /dev/null +++ b/snippets/text-mode/nxml-mode/link @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : +# -- + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/meta b/snippets/text-mode/nxml-mode/meta new file mode 100644 index 0000000..dfee1f2 --- /dev/null +++ b/snippets/text-mode/nxml-mode/meta @@ -0,0 +1,5 @@ +#contributor : Anders Bach Nielsen +#name : +#group : meta +# -- + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/name b/snippets/text-mode/nxml-mode/name new file mode 100644 index 0000000..592d0da --- /dev/null +++ b/snippets/text-mode/nxml-mode/name @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : +# -- + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/ol b/snippets/text-mode/nxml-mode/ol new file mode 100644 index 0000000..16cfe8d --- /dev/null +++ b/snippets/text-mode/nxml-mode/ol @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name :
                  ...
                +# -- +
                  + $0 +
                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/p b/snippets/text-mode/nxml-mode/p new file mode 100644 index 0000000..6845ba5 --- /dev/null +++ b/snippets/text-mode/nxml-mode/p @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name :

                ...

                +# -- +

                $1

                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/pre b/snippets/text-mode/nxml-mode/pre new file mode 100644 index 0000000..d70b722 --- /dev/null +++ b/snippets/text-mode/nxml-mode/pre @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name :
                ...
                +# -- +
                +  $0
                +
                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/quote b/snippets/text-mode/nxml-mode/quote new file mode 100644 index 0000000..20fed1e --- /dev/null +++ b/snippets/text-mode/nxml-mode/quote @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name :
                ...
                +# -- +
                + $1 +
                \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/span b/snippets/text-mode/nxml-mode/span new file mode 100644 index 0000000..a0bba2a --- /dev/null +++ b/snippets/text-mode/nxml-mode/span @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$1 \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/style b/snippets/text-mode/nxml-mode/style new file mode 100644 index 0000000..b80be1c --- /dev/null +++ b/snippets/text-mode/nxml-mode/style @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name : +# -- + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/table b/snippets/text-mode/nxml-mode/table new file mode 100644 index 0000000..03fd119 --- /dev/null +++ b/snippets/text-mode/nxml-mode/table @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name :
          ......
          ...
          +# -- + + $0 +
          \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/tag.1l b/snippets/text-mode/nxml-mode/tag.1l new file mode 100644 index 0000000..8988635 --- /dev/null +++ b/snippets/text-mode/nxml-mode/tag.1l @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +<${1:tag}>$2$0 \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/tag.2l b/snippets/text-mode/nxml-mode/tag.2l new file mode 100644 index 0000000..08b4a26 --- /dev/null +++ b/snippets/text-mode/nxml-mode/tag.2l @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name : \n...\n +# -- +<${1:tag}> + $2 +$0 \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/td b/snippets/text-mode/nxml-mode/td new file mode 100644 index 0000000..f4615a7 --- /dev/null +++ b/snippets/text-mode/nxml-mode/td @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$2 \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/th b/snippets/text-mode/nxml-mode/th new file mode 100644 index 0000000..d988b20 --- /dev/null +++ b/snippets/text-mode/nxml-mode/th @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$2 \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/title b/snippets/text-mode/nxml-mode/title new file mode 100644 index 0000000..7cd238a --- /dev/null +++ b/snippets/text-mode/nxml-mode/title @@ -0,0 +1,4 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- +$1 \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/tr b/snippets/text-mode/nxml-mode/tr new file mode 100644 index 0000000..c72daf2 --- /dev/null +++ b/snippets/text-mode/nxml-mode/tr @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name : ... +# -- + + $0 + \ No newline at end of file diff --git a/snippets/text-mode/nxml-mode/ul b/snippets/text-mode/nxml-mode/ul new file mode 100644 index 0000000..dac5a66 --- /dev/null +++ b/snippets/text-mode/nxml-mode/ul @@ -0,0 +1,6 @@ +#contributor : Anders Bach Nielsen +#name :
            ...
          +# -- +
            + $0 +
          \ No newline at end of file diff --git a/snippets/text-mode/objc-mode/crazy b/snippets/text-mode/objc-mode/crazy new file mode 100644 index 0000000..6aa0220 --- /dev/null +++ b/snippets/text-mode/objc-mode/crazy @@ -0,0 +1,4 @@ +#name : foo { ... } ; setFoo { ... } +# -- +I say ${1:hello} and so ${2: goodbye $1} +She also says $2 \ No newline at end of file diff --git a/snippets/text-mode/python-mode/class b/snippets/text-mode/python-mode/class index 72f339b..9617c07 100644 --- a/snippets/text-mode/python-mode/class +++ b/snippets/text-mode/python-mode/class @@ -36,19 +36,23 @@ class ${1:ClassName}(${2:object}): indent))) } ${4:$ - (mapconcat - '(lambda (x) - (if (not (string= (nth 0 x) "")) - (concat "self._" (nth 0 x) " = " (nth 0 x)))) - (mapcar - '(lambda (x) - (mapcar - '(lambda (x) - (replace-regexp-in-string "[[:blank:]]*$" "" - (replace-regexp-in-string "^[[:blank:]]*" "" x))) - x)) - (mapcar '(lambda (x) (split-string x "=")) - (split-string text ","))) - (concat "\n" (make-string (current-column) 32))) + (let* ((indent (concat "\n" (make-string (current-column) 32))) + (self-vars (mapconcat + '(lambda (x) + (if (not (string= (nth 0 x) "")) + (concat "self._" (nth 0 x) " = " (nth 0 x)))) + (mapcar + '(lambda (x) + (mapcar + '(lambda (x) + (replace-regexp-in-string "[[:blank:]]*$" "" + (replace-regexp-in-string "^[[:blank:]]*" "" x))) + x)) + (mapcar '(lambda (x) (split-string x "=")) + (split-string text ","))) + (concat indent)))) + (if (string= self-vars "") + indent + self-vars)) } $0 diff --git a/snippets/text-mode/python-mode/def b/snippets/text-mode/python-mode/def index 1ea3aa5..6898dd6 100644 --- a/snippets/text-mode/python-mode/def +++ b/snippets/text-mode/python-mode/def @@ -6,29 +6,6 @@ def ${1:name}($2): """$3 ${2:$ - (let* ((indent - (concat "\n" (make-string (current-column) 32))) - (args - (mapconcat - '(lambda (x) - (if (not (string= (nth 0 x) "")) - (concat "- " (char-to-string 96) (nth 0 x) - (char-to-string 96) ":"))) - (mapcar - '(lambda (x) - (mapcar - '(lambda (x) - (replace-regexp-in-string "[[:blank:]]*$" "" - (replace-regexp-in-string "^[[:blank:]]*" "" x))) - x)) - (mapcar '(lambda (x) (split-string x "=")) - (split-string text ","))) - indent))) - (if (string= args "") - (make-string 3 34) - (mapconcat - 'identity - (list "" "Arguments:" args (make-string 3 34)) - indent))) + (yas/python-rebuscate) } $0 diff --git a/snippets/text-mode/python-mode/prop b/snippets/text-mode/python-mode/prop new file mode 100644 index 0000000..107730a --- /dev/null +++ b/snippets/text-mode/python-mode/prop @@ -0,0 +1,15 @@ +# contributor: Mads D. Kristensen +# name: prop +# -- +def ${1:foo}(): + doc = """${2:Doc string}""" + def fget(self): + return self._$1 + def fset(self, value): + self._$1 = value + def fdel(self): + del self._$1 + return locals() +$1 = property(**$1()) + +$0 diff --git a/snippets/text-mode/ruby-mode/# b/snippets/text-mode/ruby-mode/# index 7d21bb4..33581c8 100644 --- a/snippets/text-mode/ruby-mode/# +++ b/snippets/text-mode/ruby-mode/# @@ -1,3 +1,4 @@ #name : # => +#group : general # -- # => \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/=b b/snippets/text-mode/ruby-mode/=b index c93d6db..22a013f 100644 --- a/snippets/text-mode/ruby-mode/=b +++ b/snippets/text-mode/ruby-mode/=b @@ -1,3 +1,6 @@ +#name : =begin rdoc ... =end +#group : general +# -- =begin rdoc $0 =end \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/Comp b/snippets/text-mode/ruby-mode/Comp index 9602d59..03f2b35 100644 --- a/snippets/text-mode/ruby-mode/Comp +++ b/snippets/text-mode/ruby-mode/Comp @@ -1,4 +1,5 @@ #name : include Comparable; def <=> ... end +#group : definitions # -- include Comparable diff --git a/snippets/text-mode/ruby-mode/all b/snippets/text-mode/ruby-mode/all index 8bafece..a98a9f4 100644 --- a/snippets/text-mode/ruby-mode/all +++ b/snippets/text-mode/ruby-mode/all @@ -1,3 +1,4 @@ #name : all? { |...| ... } +#group : collections # -- all? { |${e}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/am b/snippets/text-mode/ruby-mode/am index 20594fd..7675a97 100644 --- a/snippets/text-mode/ruby-mode/am +++ b/snippets/text-mode/ruby-mode/am @@ -1,3 +1,4 @@ #name : alias_method new, old +#group : definitions # -- alias_method :${new_name}, :${old_name} \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/any b/snippets/text-mode/ruby-mode/any index 084a2c7..d0b6dd2 100644 --- a/snippets/text-mode/ruby-mode/any +++ b/snippets/text-mode/ruby-mode/any @@ -1,3 +1,4 @@ #name : any? { |...| ... } +#group : collections # -- any? { |${e}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/app b/snippets/text-mode/ruby-mode/app index 7bda767..19bf60a 100644 --- a/snippets/text-mode/ruby-mode/app +++ b/snippets/text-mode/ruby-mode/app @@ -1,4 +1,5 @@ #name : if __FILE__ == $PROGRAM_NAME ... end +#group : general # -- if __FILE__ == $PROGRAM_NAME $0 diff --git a/snippets/text-mode/ruby-mode/bm b/snippets/text-mode/ruby-mode/bm index 934ff85..4789f64 100644 --- a/snippets/text-mode/ruby-mode/bm +++ b/snippets/text-mode/ruby-mode/bm @@ -1,4 +1,5 @@ #name : Benchmark.bmbm(...) do ... end +#group : general # -- Benchmark.bmbm(${1:10}) do |x| $0 diff --git a/snippets/text-mode/ruby-mode/case b/snippets/text-mode/ruby-mode/case index acc03ba..40c3529 100644 --- a/snippets/text-mode/ruby-mode/case +++ b/snippets/text-mode/ruby-mode/case @@ -1,4 +1,5 @@ #name : case ... end +#group : general # -- case ${1:object} when ${2:condition} diff --git a/snippets/text-mode/ruby-mode/cla b/snippets/text-mode/ruby-mode/cla index c8f3524..81ccf45 100644 --- a/snippets/text-mode/ruby-mode/cla +++ b/snippets/text-mode/ruby-mode/cla @@ -1,4 +1,5 @@ #name : class << self ... end +#group : definitions # -- class << ${self} $0 diff --git a/snippets/text-mode/ruby-mode/classify b/snippets/text-mode/ruby-mode/classify index 0fffa2d..2378afa 100644 --- a/snippets/text-mode/ruby-mode/classify +++ b/snippets/text-mode/ruby-mode/classify @@ -1,3 +1,4 @@ #name : classify { |...| ... } +#group : collections # -- classify { |${e}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/cls b/snippets/text-mode/ruby-mode/cls index e4a8747..4ce8a0b 100644 --- a/snippets/text-mode/ruby-mode/cls +++ b/snippets/text-mode/ruby-mode/cls @@ -1,5 +1,6 @@ #name : class ... end #contributor : hitesh +#group : definitions # -- class ${1:$ (let ((fn (capitalize (file-name-nondirectory @@ -8,5 +9,5 @@ class ${1:$ (cond ((string-match "_" fn) (replace-match "" nil nil fn)) (t fn)))} - $0 + $0 end diff --git a/snippets/text-mode/ruby-mode/collect b/snippets/text-mode/ruby-mode/collect index 32ec608..934014a 100644 --- a/snippets/text-mode/ruby-mode/collect +++ b/snippets/text-mode/ruby-mode/collect @@ -1,3 +1,4 @@ #name : collect { |...| ... } +#group : collections # -- collect { |${e}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/dee b/snippets/text-mode/ruby-mode/dee index ecec2f7..56d0a18 100644 --- a/snippets/text-mode/ruby-mode/dee +++ b/snippets/text-mode/ruby-mode/dee @@ -1,3 +1,4 @@ #name : deep_copy(...) +#group : general # -- Marshal.load(Marshal.dump($0)) \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/deli b/snippets/text-mode/ruby-mode/deli index a91fc7b..843b154 100644 --- a/snippets/text-mode/ruby-mode/deli +++ b/snippets/text-mode/ruby-mode/deli @@ -1,3 +1,4 @@ #name : delete_if { |...| ... } +#group : collections # -- delete_if { |${e} $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/det b/snippets/text-mode/ruby-mode/det index 734d45c..6a17da9 100644 --- a/snippets/text-mode/ruby-mode/det +++ b/snippets/text-mode/ruby-mode/det @@ -1,3 +1,4 @@ #name : detect { |...| ... } +#group : collections # -- detect { |${e}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/dow b/snippets/text-mode/ruby-mode/dow new file mode 100644 index 0000000..3b65271 --- /dev/null +++ b/snippets/text-mode/ruby-mode/dow @@ -0,0 +1,6 @@ +#name : downto(...) { |n| ... } +#group : control structure +# -- +downto(${0}) { |${n}| + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/ea b/snippets/text-mode/ruby-mode/ea index c779dd6..9cdf8dc 100644 --- a/snippets/text-mode/ruby-mode/ea +++ b/snippets/text-mode/ruby-mode/ea @@ -1,3 +1,4 @@ #name : each { |...| ... } +#group : collections # -- each { |${e}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/eac b/snippets/text-mode/ruby-mode/eac index 2547b2d..f0d9cb1 100644 --- a/snippets/text-mode/ruby-mode/eac +++ b/snippets/text-mode/ruby-mode/eac @@ -1,3 +1,4 @@ #name : each_cons(...) { |...| ... } +#group : collections # -- each_cons(${1:2}) { |${group}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/eai b/snippets/text-mode/ruby-mode/eai index 4136dc0..5b0ed67 100644 --- a/snippets/text-mode/ruby-mode/eai +++ b/snippets/text-mode/ruby-mode/eai @@ -1,3 +1,4 @@ #name : each_index { |i| ... } +#group : collections # -- each_index { |${i}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/eav b/snippets/text-mode/ruby-mode/eav index 4ff171a..558e5b4 100644 --- a/snippets/text-mode/ruby-mode/eav +++ b/snippets/text-mode/ruby-mode/eav @@ -1,3 +1,4 @@ #name : each_value { |val| ... } +#group : collections # -- each_value { |${val}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/eawi b/snippets/text-mode/ruby-mode/eawi index 3d03998..edf8418 100644 --- a/snippets/text-mode/ruby-mode/eawi +++ b/snippets/text-mode/ruby-mode/eawi @@ -1,3 +1,4 @@ #name : each_with_index { |e, i| ... } +#group : collections # -- each_with_index { |${e}, ${i}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/forin b/snippets/text-mode/ruby-mode/forin index 3d7e4d2..36b4387 100644 --- a/snippets/text-mode/ruby-mode/forin +++ b/snippets/text-mode/ruby-mode/forin @@ -1,4 +1,5 @@ #name : for ... in ...; ... end +#group : control structure # -- for ${1:element} in ${2:collection} $0 diff --git a/snippets/text-mode/ruby-mode/if b/snippets/text-mode/ruby-mode/if index 51bf24c..077b097 100644 --- a/snippets/text-mode/ruby-mode/if +++ b/snippets/text-mode/ruby-mode/if @@ -1,4 +1,5 @@ #name : if ... end +#group : control structure # -- if ${1:condition} $0 diff --git a/snippets/text-mode/ruby-mode/ife b/snippets/text-mode/ruby-mode/ife index 08fbb81..e57d395 100644 --- a/snippets/text-mode/ruby-mode/ife +++ b/snippets/text-mode/ruby-mode/ife @@ -1,4 +1,5 @@ #name : if ... else ... end +#group : control structure # -- if ${1:condition} $2 diff --git a/snippets/text-mode/ruby-mode/inject b/snippets/text-mode/ruby-mode/inject index f6adb5c..37932e5 100644 --- a/snippets/text-mode/ruby-mode/inject +++ b/snippets/text-mode/ruby-mode/inject @@ -1,3 +1,4 @@ #name : inject(...) { |...| ... } +#group : collections # -- inject(${1:0}) { |${2:injection}, ${3:element}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/mm b/snippets/text-mode/ruby-mode/mm index 5f1ebfc..3f62b10 100644 --- a/snippets/text-mode/ruby-mode/mm +++ b/snippets/text-mode/ruby-mode/mm @@ -1,4 +1,5 @@ #name : def method_missing ... end +#group : definitions # -- def method_missing(method, *args) $0 diff --git a/snippets/text-mode/ruby-mode/r b/snippets/text-mode/ruby-mode/r index b8d68d3..2e7b797 100644 --- a/snippets/text-mode/ruby-mode/r +++ b/snippets/text-mode/ruby-mode/r @@ -1,3 +1,4 @@ #name : attr_reader ... +#group : definitions # -- attr_reader : \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/rb b/snippets/text-mode/ruby-mode/rb index 9153653..74d26dd 100644 --- a/snippets/text-mode/ruby-mode/rb +++ b/snippets/text-mode/ruby-mode/rb @@ -1,3 +1,4 @@ #name : /usr/bin/ruby -wKU +#group : general # -- #!/usr/bin/ruby -wKU diff --git a/snippets/text-mode/ruby-mode/reject b/snippets/text-mode/ruby-mode/reject index 9625fe9..c2501bc 100644 --- a/snippets/text-mode/ruby-mode/reject +++ b/snippets/text-mode/ruby-mode/reject @@ -1,3 +1,4 @@ #name : reject { |...| ... } +#group : collections # -- reject { |${1:element}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/req b/snippets/text-mode/ruby-mode/req index 2fbc3d4..3e001ec 100644 --- a/snippets/text-mode/ruby-mode/req +++ b/snippets/text-mode/ruby-mode/req @@ -1,3 +1,4 @@ #name : require "..." +#group : general # -- require "$0" \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/rreq b/snippets/text-mode/ruby-mode/rreq index 84ac9df..0b9c6a4 100644 --- a/snippets/text-mode/ruby-mode/rreq +++ b/snippets/text-mode/ruby-mode/rreq @@ -1,3 +1,4 @@ #name : require File.join(File.dirname(__FILE__), ...) +#group : general # -- require File.join(File.dirname(__FILE__), $0) \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/rw b/snippets/text-mode/ruby-mode/rw index aadf605..a364675 100644 --- a/snippets/text-mode/ruby-mode/rw +++ b/snippets/text-mode/ruby-mode/rw @@ -1,3 +1,4 @@ #name : attr_accessor ... +#group : definitions # -- attr_accessor : \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/select b/snippets/text-mode/ruby-mode/select index b18a17d..78bca8f 100644 --- a/snippets/text-mode/ruby-mode/select +++ b/snippets/text-mode/ruby-mode/select @@ -1,3 +1,4 @@ #name : select { |...| ... } +#group : collections # -- select { |${1:element}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/tim b/snippets/text-mode/ruby-mode/tim new file mode 100644 index 0000000..0da115f --- /dev/null +++ b/snippets/text-mode/ruby-mode/tim @@ -0,0 +1,4 @@ +#name : times { |n| ... } +#group : control structure +# -- +times { |${n}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/until b/snippets/text-mode/ruby-mode/until new file mode 100644 index 0000000..476966a --- /dev/null +++ b/snippets/text-mode/ruby-mode/until @@ -0,0 +1,6 @@ +#name : until ... end +#group: control structure +# -- +until ${condition} + $0 +end \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/upt b/snippets/text-mode/ruby-mode/upt new file mode 100644 index 0000000..6fc6810 --- /dev/null +++ b/snippets/text-mode/ruby-mode/upt @@ -0,0 +1,6 @@ +#name : upto(...) { |n| ... } +#group : control structure +# -- +upto(${n}) { |${i}| + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/w b/snippets/text-mode/ruby-mode/w index d680f25..9edbfcb 100644 --- a/snippets/text-mode/ruby-mode/w +++ b/snippets/text-mode/ruby-mode/w @@ -1,3 +1,4 @@ #name : attr_writer ... +#group : definitions # -- attr_writer : \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/when b/snippets/text-mode/ruby-mode/when new file mode 100644 index 0000000..9b06f21 --- /dev/null +++ b/snippets/text-mode/ruby-mode/when @@ -0,0 +1,6 @@ +#name : when ... end +#group : control structure +# -- +when ${condition} + $0 +end \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/while b/snippets/text-mode/ruby-mode/while new file mode 100644 index 0000000..4c9ad35 --- /dev/null +++ b/snippets/text-mode/ruby-mode/while @@ -0,0 +1,6 @@ +#name : while ... end +#group : control structure +# -- +while ${condition} + $0 +end \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/y b/snippets/text-mode/ruby-mode/y index cdec730..0ddf0f9 100644 --- a/snippets/text-mode/ruby-mode/y +++ b/snippets/text-mode/ruby-mode/y @@ -1,3 +1,4 @@ #name : :yields: arguments (rdoc) +#group : general # -- :yields: $0 \ No newline at end of file diff --git a/snippets/text-mode/ruby-mode/zip b/snippets/text-mode/ruby-mode/zip index 1da1086..56f4266 100644 --- a/snippets/text-mode/ruby-mode/zip +++ b/snippets/text-mode/ruby-mode/zip @@ -1,3 +1,4 @@ #name : zip(...) { |...| ... } +#group : collections # -- zip(${enums}) { |${row}| $0 } \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/act b/snippets/text-mode/scala-mode/act new file mode 100644 index 0000000..fce52fc --- /dev/null +++ b/snippets/text-mode/scala-mode/act @@ -0,0 +1,10 @@ +#Author : Jonas Bonèr +#name : def act = { ..} +# -- +def act = { + loop { + react { + $0 + } + } +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/act.arg b/snippets/text-mode/scala-mode/act.arg new file mode 100644 index 0000000..fc6df9e --- /dev/null +++ b/snippets/text-mode/scala-mode/act.arg @@ -0,0 +1,10 @@ +#Author : Jonas Bonèr +#name : def act(arg: T) = { ..} +# -- +def act(${1:arg}: ${2:type}) = { + loop { + react { + $0 + } + } +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/actor b/snippets/text-mode/scala-mode/actor new file mode 100644 index 0000000..d38a183 --- /dev/null +++ b/snippets/text-mode/scala-mode/actor @@ -0,0 +1,10 @@ +#Author : Jonas Bonèr +#name : val a = actor { ..} +# -- +val a = actor { + loop { + react { + $0 + } + } +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/ano b/snippets/text-mode/scala-mode/ano new file mode 100644 index 0000000..b949801 --- /dev/null +++ b/snippets/text-mode/scala-mode/ano @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : (args) => ... +# -- +($1) => ${2:body} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/app b/snippets/text-mode/scala-mode/app new file mode 100644 index 0000000..b89bab9 --- /dev/null +++ b/snippets/text-mode/scala-mode/app @@ -0,0 +1,6 @@ +#Author : Anders Bach Nielsen +#name : object name extends Application +# -- +object ${1:name} extends Application { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/arr.new b/snippets/text-mode/scala-mode/arr.new new file mode 100644 index 0000000..e3297ca --- /dev/null +++ b/snippets/text-mode/scala-mode/arr.new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : Array[T](..) +# -- +Array[${1:value}](${2:args}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/arr.val-new b/snippets/text-mode/scala-mode/arr.val-new new file mode 100644 index 0000000..4de4720 --- /dev/null +++ b/snippets/text-mode/scala-mode/arr.val-new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : val a = Array[T](..) +# -- +val ${1:arr} = Array[${2:value}](${3:args}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/asof b/snippets/text-mode/scala-mode/asof new file mode 100644 index 0000000..3b2b209 --- /dev/null +++ b/snippets/text-mode/scala-mode/asof @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : asInstanceOf[T] +# -- +asInstanceOf[${1:type}] $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/ass b/snippets/text-mode/scala-mode/ass new file mode 100644 index 0000000..653dcef --- /dev/null +++ b/snippets/text-mode/scala-mode/ass @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : assert(x === y) +# -- +assert(${1:x} === ${2:y}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/ass.true b/snippets/text-mode/scala-mode/ass.true new file mode 100644 index 0000000..923c518 --- /dev/null +++ b/snippets/text-mode/scala-mode/ass.true @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : assert(true) +# -- +assert(true) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/at.author b/snippets/text-mode/scala-mode/at.author new file mode 100644 index 0000000..82fe4cc --- /dev/null +++ b/snippets/text-mode/scala-mode/at.author @@ -0,0 +1,4 @@ +#Author : Anders Bach Nielsen +#name : @author name +# -- +@author ${1:name} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/at.param b/snippets/text-mode/scala-mode/at.param new file mode 100644 index 0000000..72b6e79 --- /dev/null +++ b/snippets/text-mode/scala-mode/at.param @@ -0,0 +1,4 @@ +#Author : Anders Bach Nielsen +#name : @param name description +# -- +@param ${1:name} ${2:description} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/at.return b/snippets/text-mode/scala-mode/at.return new file mode 100644 index 0000000..9c3f41c --- /dev/null +++ b/snippets/text-mode/scala-mode/at.return @@ -0,0 +1,4 @@ +#Author : Anders Bach Nielsen +#name : @return description +# -- +@return ${1:description} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/at.version b/snippets/text-mode/scala-mode/at.version new file mode 100644 index 0000000..1158ce2 --- /dev/null +++ b/snippets/text-mode/scala-mode/at.version @@ -0,0 +1,4 @@ +#Author : Anders Bach Nielsen +#name : @version number +# -- +@version ${1:0.1} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/bang b/snippets/text-mode/scala-mode/bang new file mode 100644 index 0000000..a547da8 --- /dev/null +++ b/snippets/text-mode/scala-mode/bang @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : actor ! message +# -- +${1:actor} ! ${2:message} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/case b/snippets/text-mode/scala-mode/case new file mode 100644 index 0000000..13d6aec --- /dev/null +++ b/snippets/text-mode/scala-mode/case @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : case pattern => +# -- +case ${1:pattern} => $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/case.match-all b/snippets/text-mode/scala-mode/case.match-all new file mode 100644 index 0000000..028bf5f --- /dev/null +++ b/snippets/text-mode/scala-mode/case.match-all @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : case _ => +# -- +case _ => $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/cast b/snippets/text-mode/scala-mode/cast new file mode 100644 index 0000000..3b2b209 --- /dev/null +++ b/snippets/text-mode/scala-mode/cast @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : asInstanceOf[T] +# -- +asInstanceOf[${1:type}] $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/cc b/snippets/text-mode/scala-mode/cc new file mode 100644 index 0000000..7ed1142 --- /dev/null +++ b/snippets/text-mode/scala-mode/cc @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : case class T(arg: A) +# -- +case class ${1:name}(${2:arg}: ${3:type}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/cl b/snippets/text-mode/scala-mode/cl new file mode 100644 index 0000000..1fd712c --- /dev/null +++ b/snippets/text-mode/scala-mode/cl @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : class T { .. } +# -- +class ${1:name} { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/cl.abs b/snippets/text-mode/scala-mode/cl.abs new file mode 100644 index 0000000..402dec7 --- /dev/null +++ b/snippets/text-mode/scala-mode/cl.abs @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : abstract class T { .. } +# -- +abstract class ${1:name} { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/cl.abs-arg b/snippets/text-mode/scala-mode/cl.abs-arg new file mode 100644 index 0000000..fe29524 --- /dev/null +++ b/snippets/text-mode/scala-mode/cl.abs-arg @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : abstract class T(args) { .. } +# -- +abstract class ${1:name}(${2:args}) { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/cl.arg b/snippets/text-mode/scala-mode/cl.arg new file mode 100644 index 0000000..f82460f --- /dev/null +++ b/snippets/text-mode/scala-mode/cl.arg @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : class T(args) { .. } +# -- +class ${1:name}(${2:args}) { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/clof b/snippets/text-mode/scala-mode/clof new file mode 100644 index 0000000..955726c --- /dev/null +++ b/snippets/text-mode/scala-mode/clof @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : classOf[T] +# -- +classOf[${1:type}] $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/co b/snippets/text-mode/scala-mode/co new file mode 100644 index 0000000..75b1f3b --- /dev/null +++ b/snippets/text-mode/scala-mode/co @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : case object T +# -- +case object ${1:name} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/cons b/snippets/text-mode/scala-mode/cons new file mode 100644 index 0000000..a48e4ff --- /dev/null +++ b/snippets/text-mode/scala-mode/cons @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : element1 :: element2 +# -- +${1:element1} :: ${2:element2} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/cons.nil b/snippets/text-mode/scala-mode/cons.nil new file mode 100644 index 0000000..c288f93 --- /dev/null +++ b/snippets/text-mode/scala-mode/cons.nil @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : element1 :: Nil +# -- +${1:element1} :: Nil $0 diff --git a/snippets/text-mode/scala-mode/def.arg b/snippets/text-mode/scala-mode/def.arg new file mode 100644 index 0000000..7765bbf --- /dev/null +++ b/snippets/text-mode/scala-mode/def.arg @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : def f(arg: T) = ... +# -- +def ${1:name}(${2:args}) = $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/def.arg-body b/snippets/text-mode/scala-mode/def.arg-body new file mode 100644 index 0000000..e6e278e --- /dev/null +++ b/snippets/text-mode/scala-mode/def.arg-body @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : def f(arg: T) = {...} +# -- +def ${1:name}(${2:args}) = { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/def.arg-ret b/snippets/text-mode/scala-mode/def.arg-ret new file mode 100644 index 0000000..dddb9ce --- /dev/null +++ b/snippets/text-mode/scala-mode/def.arg-ret @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : def f(arg: T): R = ... +# -- +def ${1:name}(${2:args}): ${3:Unit} = $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/def.arg-ret-body b/snippets/text-mode/scala-mode/def.arg-ret-body new file mode 100644 index 0000000..862f7fd --- /dev/null +++ b/snippets/text-mode/scala-mode/def.arg-ret-body @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : def f(arg: T): R = {...} +# -- +def ${1:name}(${2:args}): ${3:Unit} = { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/def.body b/snippets/text-mode/scala-mode/def.body new file mode 100644 index 0000000..858908c --- /dev/null +++ b/snippets/text-mode/scala-mode/def.body @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : def f = {...} +# -- +def ${1:name} = { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/def.ret b/snippets/text-mode/scala-mode/def.ret new file mode 100644 index 0000000..e5483fb --- /dev/null +++ b/snippets/text-mode/scala-mode/def.ret @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : def f: R = ... +# -- +def ${1:name}: ${2:Unit} = $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/def.ret-body b/snippets/text-mode/scala-mode/def.ret-body new file mode 100644 index 0000000..f342e04 --- /dev/null +++ b/snippets/text-mode/scala-mode/def.ret-body @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : def f: R = {...} +# -- +def ${1:name}: ${3:Unit} = { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/def.simple b/snippets/text-mode/scala-mode/def.simple new file mode 100644 index 0000000..4814c73 --- /dev/null +++ b/snippets/text-mode/scala-mode/def.simple @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : def f = ... +# -- +def ${1:name} = $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/doc.class b/snippets/text-mode/scala-mode/doc.class new file mode 100644 index 0000000..60442f1 --- /dev/null +++ b/snippets/text-mode/scala-mode/doc.class @@ -0,0 +1,8 @@ +#Author : Anders Bach Nielsen +#name : /** cls/trt/obj name */ +# -- +/** + * `(scala-mode-find-clstrtobj-name-doc)` + * ${1:description} + * $0 + */ \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/doc.def b/snippets/text-mode/scala-mode/doc.def new file mode 100644 index 0000000..8a3d614 --- /dev/null +++ b/snippets/text-mode/scala-mode/doc.def @@ -0,0 +1,6 @@ +#Author : Anders Bach Nielsen +#name : /** method name */ +# -- +/** + * `(scala-mode-def-and-args-doc)` + */ \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/doc.file b/snippets/text-mode/scala-mode/doc.file new file mode 100644 index 0000000..7da4289 --- /dev/null +++ b/snippets/text-mode/scala-mode/doc.file @@ -0,0 +1,9 @@ +#Author : Anders Bach Nielsen +#name : /** file name */ +# -- +/** + * `(scala-mode-file-doc)` + * $0 + * @author ${1:name} + * @version ${2:0.1} + */ \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/doc.file-scala b/snippets/text-mode/scala-mode/doc.file-scala new file mode 100644 index 0000000..6719348 --- /dev/null +++ b/snippets/text-mode/scala-mode/doc.file-scala @@ -0,0 +1,16 @@ +#Author : Anders Bach Nielsen +#name : /** scala file */ +# -- +/* __ *\ +** ________ ___ / / ___ Scala $3 ** +** / __/ __// _ | / / / _ | (c) 2005-`(format-time-string "%Y")` , LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ +/** + * $0 + * @author ${1:name} + * @version ${2:0.1} + * $Id$ + */ \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/doc.file-scala-api b/snippets/text-mode/scala-mode/doc.file-scala-api new file mode 100644 index 0000000..4a762f5 --- /dev/null +++ b/snippets/text-mode/scala-mode/doc.file-scala-api @@ -0,0 +1,16 @@ +#Author : Anders Bach Nielsen +#name : /** scala api file */ +# -- +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2005-`(format-time-string "%Y")`, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ +/** + * $0 + * @author ${1:name} + * @version ${2:0.1} + * $Id$ + */ \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/doc.scaladoc b/snippets/text-mode/scala-mode/doc.scaladoc new file mode 100644 index 0000000..038428c --- /dev/null +++ b/snippets/text-mode/scala-mode/doc.scaladoc @@ -0,0 +1,7 @@ +#Author : Anders Bach Nielsen +#name : /** ... */ +# -- +/** + * ${1:description} + * $0 + */ \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/expect b/snippets/text-mode/scala-mode/expect new file mode 100644 index 0000000..94c742c --- /dev/null +++ b/snippets/text-mode/scala-mode/expect @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : expect(value) { ..} +# -- +expect(${1:reply}) { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/ext b/snippets/text-mode/scala-mode/ext new file mode 100644 index 0000000..e256317 --- /dev/null +++ b/snippets/text-mode/scala-mode/ext @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : extends T +# -- +extends $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/for.extract b/snippets/text-mode/scala-mode/for.extract new file mode 100644 index 0000000..60f1155 --- /dev/null +++ b/snippets/text-mode/scala-mode/for.extract @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : x <- xs +# -- +${1:x} <- ${2:xs} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/for.if b/snippets/text-mode/scala-mode/for.if new file mode 100644 index 0000000..f44c544 --- /dev/null +++ b/snippets/text-mode/scala-mode/for.if @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : for (x <- xs if guard) { ... } +# -- +for (${1:x} <- ${2:xs} if ${3:guard}) { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/for.loop b/snippets/text-mode/scala-mode/for.loop new file mode 100644 index 0000000..050d5e8 --- /dev/null +++ b/snippets/text-mode/scala-mode/for.loop @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : for (x <- xs) { ... } +# -- +for (${1:x} <- ${2:xs}) { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/for.multi b/snippets/text-mode/scala-mode/for.multi new file mode 100644 index 0000000..c512067 --- /dev/null +++ b/snippets/text-mode/scala-mode/for.multi @@ -0,0 +1,9 @@ +#Author : Jonas Bonèr +#name : for {x <- xs \ y <- ys} { yield } +# -- +for { + ${1:x} <- ${2:xs} + ${3:x} <- ${4:xs} +} { + yield $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/foreach b/snippets/text-mode/scala-mode/foreach new file mode 100644 index 0000000..cafdd00 --- /dev/null +++ b/snippets/text-mode/scala-mode/foreach @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : foreach(x => ..) +# -- +foreach(${1:x} => ${2:body}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/hmap.new b/snippets/text-mode/scala-mode/hmap.new new file mode 100644 index 0000000..dd564a0 --- /dev/null +++ b/snippets/text-mode/scala-mode/hmap.new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : new HashMap[K, V] +# -- +new HashMap[${1:key}, ${2:value}] $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/hmap.val-new b/snippets/text-mode/scala-mode/hmap.val-new new file mode 100644 index 0000000..2f4a3c2 --- /dev/null +++ b/snippets/text-mode/scala-mode/hmap.val-new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : val m = new HashMap[K, V] +# -- +val ${1:m} = new HashMap[${2:key}, ${3:value}] $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/hset.new b/snippets/text-mode/scala-mode/hset.new new file mode 100644 index 0000000..d1be3ee --- /dev/null +++ b/snippets/text-mode/scala-mode/hset.new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : new HashSet[K] +# -- +new HashSet[${1:key}] $0 diff --git a/snippets/text-mode/scala-mode/hset.val-new b/snippets/text-mode/scala-mode/hset.val-new new file mode 100644 index 0000000..ba792a2 --- /dev/null +++ b/snippets/text-mode/scala-mode/hset.val-new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : val m = new HashSet[K] +# -- +val ${1:m} = new HashSet[${2:key}] $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/if b/snippets/text-mode/scala-mode/if new file mode 100644 index 0000000..24891c0 --- /dev/null +++ b/snippets/text-mode/scala-mode/if @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : if (cond) { .. } +# -- +if (${1:condition}) { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/if.else b/snippets/text-mode/scala-mode/if.else new file mode 100644 index 0000000..ebff471 --- /dev/null +++ b/snippets/text-mode/scala-mode/if.else @@ -0,0 +1,8 @@ +#Author : Jonas Bonèr +#name : if (cond) { .. } else { .. } +# -- +if (${1:condition}) { + $2 +} else { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/imp b/snippets/text-mode/scala-mode/imp new file mode 100644 index 0000000..cf5efa1 --- /dev/null +++ b/snippets/text-mode/scala-mode/imp @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : import .. +# -- +import $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/intercept b/snippets/text-mode/scala-mode/intercept new file mode 100644 index 0000000..4725eaa --- /dev/null +++ b/snippets/text-mode/scala-mode/intercept @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : intercept(classOf[T]) { ..} +# -- +intercept(classOf[${1:Exception]}) { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/isof b/snippets/text-mode/scala-mode/isof new file mode 100644 index 0000000..a3538c8 --- /dev/null +++ b/snippets/text-mode/scala-mode/isof @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : isInstanceOf[T] +# -- +isInstanceOf[${1:type}] $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/ls.new b/snippets/text-mode/scala-mode/ls.new new file mode 100644 index 0000000..7a28e61 --- /dev/null +++ b/snippets/text-mode/scala-mode/ls.new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : List(..) +# -- +List(${1:args}, ${2:args}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/ls.val-new b/snippets/text-mode/scala-mode/ls.val-new new file mode 100644 index 0000000..37138f0 --- /dev/null +++ b/snippets/text-mode/scala-mode/ls.val-new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : val l = List(..) +# -- +val ${1:l} = List(${2:args}, ${3:args}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/main b/snippets/text-mode/scala-mode/main new file mode 100644 index 0000000..ad314b3 --- /dev/null +++ b/snippets/text-mode/scala-mode/main @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name: def main(args: Array[String]) = { ... } +# -- +def main(args: Array[String]) = { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/map b/snippets/text-mode/scala-mode/map new file mode 100644 index 0000000..17322a5 --- /dev/null +++ b/snippets/text-mode/scala-mode/map @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : map(x => ..) +# -- +map(${1:x} => ${2:body}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/map.new b/snippets/text-mode/scala-mode/map.new new file mode 100644 index 0000000..21c95fb --- /dev/null +++ b/snippets/text-mode/scala-mode/map.new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : Map(key -> value) +# -- +Map(${1:key} -> ${2:value}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/match b/snippets/text-mode/scala-mode/match new file mode 100644 index 0000000..e85fac1 --- /dev/null +++ b/snippets/text-mode/scala-mode/match @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : cc match { .. } +# -- +${1:cc} match { + case ${2:pattern} => $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/match.can b/snippets/text-mode/scala-mode/match.can new file mode 100644 index 0000000..77d475b --- /dev/null +++ b/snippets/text-mode/scala-mode/match.can @@ -0,0 +1,11 @@ +#Author : Jonas Bonèr +#name : can match { case Full(res) => .. } +# -- +${1:option} match { + case Full(res) => $0 + + case Empty => + + case Failure(msg, _, _) => + +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/match.option b/snippets/text-mode/scala-mode/match.option new file mode 100644 index 0000000..5b098f1 --- /dev/null +++ b/snippets/text-mode/scala-mode/match.option @@ -0,0 +1,8 @@ +#Author : Jonas Bonèr +#name : option match { case None => .. } +# -- +${1:option} match { + case None => $0 + case Some(res) => + +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/mix b/snippets/text-mode/scala-mode/mix new file mode 100644 index 0000000..5261e32 --- /dev/null +++ b/snippets/text-mode/scala-mode/mix @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : trait T { .. } +# -- +trait ${1:name} { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/ob b/snippets/text-mode/scala-mode/ob new file mode 100644 index 0000000..efbc82e --- /dev/null +++ b/snippets/text-mode/scala-mode/ob @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : object name extends T +# -- +object ${1:name} extends ${2:type} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/pac b/snippets/text-mode/scala-mode/pac new file mode 100644 index 0000000..ed32216 --- /dev/null +++ b/snippets/text-mode/scala-mode/pac @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : package .. +# -- +package $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/pr.newline b/snippets/text-mode/scala-mode/pr.newline new file mode 100644 index 0000000..77088cb --- /dev/null +++ b/snippets/text-mode/scala-mode/pr.newline @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : println(..) +# -- +println(${1:obj}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/pr.simple b/snippets/text-mode/scala-mode/pr.simple new file mode 100644 index 0000000..3a73f9d --- /dev/null +++ b/snippets/text-mode/scala-mode/pr.simple @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : print(..) +# -- +print(${1:obj}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/pr.string b/snippets/text-mode/scala-mode/pr.string new file mode 100644 index 0000000..9c06ef7 --- /dev/null +++ b/snippets/text-mode/scala-mode/pr.string @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : println("..") +# -- +println("${1:msg}") $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/pr.trace b/snippets/text-mode/scala-mode/pr.trace new file mode 100644 index 0000000..9a0579c --- /dev/null +++ b/snippets/text-mode/scala-mode/pr.trace @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : println("obj: " + obj) +# -- +println("${1:obj}: " + ${1:obj}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/pri b/snippets/text-mode/scala-mode/pri new file mode 100644 index 0000000..643ef2c --- /dev/null +++ b/snippets/text-mode/scala-mode/pri @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : private +# -- +private $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/pri.param b/snippets/text-mode/scala-mode/pri.param new file mode 100644 index 0000000..e53638a --- /dev/null +++ b/snippets/text-mode/scala-mode/pri.param @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : private[this] +# -- +private[${1:this}] $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/pro b/snippets/text-mode/scala-mode/pro new file mode 100644 index 0000000..e4b7b59 --- /dev/null +++ b/snippets/text-mode/scala-mode/pro @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : protected +# -- +protected $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/pro.param b/snippets/text-mode/scala-mode/pro.param new file mode 100644 index 0000000..712b050 --- /dev/null +++ b/snippets/text-mode/scala-mode/pro.param @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : protected[this] +# -- +protected[${1:this}] $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/suite b/snippets/text-mode/scala-mode/suite new file mode 100644 index 0000000..a65cea7 --- /dev/null +++ b/snippets/text-mode/scala-mode/suite @@ -0,0 +1,8 @@ +#Author : Jonas Bonèr +#name : class T extends Suite { .. } +# -- +import org.scalatest._ + +class ${1:name} extends Suite { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/test b/snippets/text-mode/scala-mode/test new file mode 100644 index 0000000..c4d13f6 --- /dev/null +++ b/snippets/text-mode/scala-mode/test @@ -0,0 +1,7 @@ +#Author : Jonas Bonèr +#name : @Test def testX = ... +# -- +//@Test +def test${1:name} = { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/throw b/snippets/text-mode/scala-mode/throw new file mode 100644 index 0000000..f9a4932 --- /dev/null +++ b/snippets/text-mode/scala-mode/throw @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : throw new Exception +# -- +throw new ${1:Exception}(${2:msg}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/tr b/snippets/text-mode/scala-mode/tr new file mode 100644 index 0000000..68d8162 --- /dev/null +++ b/snippets/text-mode/scala-mode/tr @@ -0,0 +1,6 @@ +#Author : Anders Bach Nielsen +#name : trait T { .. } +# -- +trait ${1:name} { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/tr.ext b/snippets/text-mode/scala-mode/tr.ext new file mode 100644 index 0000000..2b82154 --- /dev/null +++ b/snippets/text-mode/scala-mode/tr.ext @@ -0,0 +1,6 @@ +#Author : Anders Bach Nielsen +#name : trait T extends C { .. } +# -- +trait ${1:name} extends ${2:class} { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/tr.ext-with b/snippets/text-mode/scala-mode/tr.ext-with new file mode 100644 index 0000000..8edb409 --- /dev/null +++ b/snippets/text-mode/scala-mode/tr.ext-with @@ -0,0 +1,6 @@ +#Author : Anders Bach Nielsen +#name : trait T1 extends C with T2 { .. } +# -- +trait ${1:name} extends ${2:class} with ${3:trait} { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/tr.with b/snippets/text-mode/scala-mode/tr.with new file mode 100644 index 0000000..19801eb --- /dev/null +++ b/snippets/text-mode/scala-mode/tr.with @@ -0,0 +1,6 @@ +#Author : Anders Bach Nielsen +#name : trait T1 with T2 { .. } +# -- +trait ${1:name} with ${2:trait} { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/try b/snippets/text-mode/scala-mode/try new file mode 100644 index 0000000..0c33f10 --- /dev/null +++ b/snippets/text-mode/scala-mode/try @@ -0,0 +1,9 @@ +#Author : Jonas Bonèr +#name : try { .. } catch { case e => ..} +# -- +try { + $0 +} catch { + case ${1:e}: ${2:Exception} => + ${1:println(\"ERROR: \" + e) // TODO: handle exception}\n} +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/try.catch-finally b/snippets/text-mode/scala-mode/try.catch-finally new file mode 100644 index 0000000..f146a20 --- /dev/null +++ b/snippets/text-mode/scala-mode/try.catch-finally @@ -0,0 +1,11 @@ +#Author : Jonas Bonèr +#name : try { .. } catch { case e => ..} finally { ..} +# -- +try { + $0 +} catch { + case ${1:e}: ${2:Exception} => + ${1:println(\"ERROR: \" + e) // TODO: handle exception}\n} +} finally { + +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/try.finally b/snippets/text-mode/scala-mode/try.finally new file mode 100644 index 0000000..63625f2 --- /dev/null +++ b/snippets/text-mode/scala-mode/try.finally @@ -0,0 +1,8 @@ +#Author : Jonas Bonèr +#name : try { .. } finally { .. } +# -- +try { + +} finally { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/tup.arrow b/snippets/text-mode/scala-mode/tup.arrow new file mode 100644 index 0000000..4e7ad69 --- /dev/null +++ b/snippets/text-mode/scala-mode/tup.arrow @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : element1 -> element2 +# -- +${1:element1} -> ${2:element2} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/tup.paren b/snippets/text-mode/scala-mode/tup.paren new file mode 100644 index 0000000..4bff202 --- /dev/null +++ b/snippets/text-mode/scala-mode/tup.paren @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : (element1, element2) +# -- +(${1:element1}, ${2:element2}) $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/val b/snippets/text-mode/scala-mode/val new file mode 100644 index 0000000..3067cd4 --- /dev/null +++ b/snippets/text-mode/scala-mode/val @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : val name = .. +# -- +val ${1:name} = ${2:obj} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/val.new b/snippets/text-mode/scala-mode/val.new new file mode 100644 index 0000000..35a0c6a --- /dev/null +++ b/snippets/text-mode/scala-mode/val.new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : val name = new .. +# -- +val ${1:name} = new ${2:obj} $0 \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/val.ret b/snippets/text-mode/scala-mode/val.ret new file mode 100644 index 0000000..4bf4f10 --- /dev/null +++ b/snippets/text-mode/scala-mode/val.ret @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : val name: T = .. +# -- +val ${1:name}: ${2:T} = ${3:obj} $0 diff --git a/snippets/text-mode/scala-mode/var b/snippets/text-mode/scala-mode/var new file mode 100644 index 0000000..662d6c8 --- /dev/null +++ b/snippets/text-mode/scala-mode/var @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : var name = .. +# -- +var ${1:name} = ${2:obj} $0 diff --git a/snippets/text-mode/scala-mode/var.new b/snippets/text-mode/scala-mode/var.new new file mode 100644 index 0000000..d681c4a --- /dev/null +++ b/snippets/text-mode/scala-mode/var.new @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : var name = new .. +# -- +var ${1:name} = new ${2:obj} $0 diff --git a/snippets/text-mode/scala-mode/var.ret b/snippets/text-mode/scala-mode/var.ret new file mode 100644 index 0000000..9d0ac3a --- /dev/null +++ b/snippets/text-mode/scala-mode/var.ret @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : var name: T = .. +# -- +var ${1:name}: ${2:T} = ${3:obj} $0 diff --git a/snippets/text-mode/scala-mode/whi b/snippets/text-mode/scala-mode/whi new file mode 100644 index 0000000..082c139 --- /dev/null +++ b/snippets/text-mode/scala-mode/whi @@ -0,0 +1,6 @@ +#Author : Jonas Bonèr +#name : while(cond) { .. } +# -- +while (${1:condition}) { + $0 +} \ No newline at end of file diff --git a/snippets/text-mode/scala-mode/with b/snippets/text-mode/scala-mode/with new file mode 100644 index 0000000..6bd94e4 --- /dev/null +++ b/snippets/text-mode/scala-mode/with @@ -0,0 +1,4 @@ +#Author : Jonas Bonèr +#name : with T +# -- +with $0 \ No newline at end of file diff --git a/snippets/text-mode/sql-mode/column b/snippets/text-mode/sql-mode/column new file mode 100644 index 0000000..90e4963 --- /dev/null +++ b/snippets/text-mode/sql-mode/column @@ -0,0 +1,4 @@ +#contributor : Alejandro Espinoza Esparza +#name : , ColumnName ColumnType NOT NULL... +# -- + , ${1:Name} ${2:Type} ${3:NOT NULL} diff --git a/snippets/text-mode/sql-mode/constraint b/snippets/text-mode/sql-mode/constraint new file mode 100644 index 0000000..989e508 --- /dev/null +++ b/snippets/text-mode/sql-mode/constraint @@ -0,0 +1,4 @@ +#contributor : Alejandro Espinoza Esparza +#name : CONSTRAINT [..] PRIMARY KEY ... +# -- +CONSTRAINT [${1:PK_Name}] PRIMARY KEY ${2:CLUSTERED} ([${3:ColumnName}]) diff --git a/snippets/text-mode/sql-mode/constraint.1 b/snippets/text-mode/sql-mode/constraint.1 new file mode 100644 index 0000000..98d89f0 --- /dev/null +++ b/snippets/text-mode/sql-mode/constraint.1 @@ -0,0 +1,4 @@ +#contributor : Alejandro Espinoza Esparza +#name : CONSTRAINT [..] FOREIGN KEY ... +# -- +CONSTRAINT [${1:FK_Name}] FOREIGN KEY ${2:CLUSTERED} ([${3:ColumnName}]) diff --git a/snippets/text-mode/sql-mode/create b/snippets/text-mode/sql-mode/create new file mode 100644 index 0000000..a34624d --- /dev/null +++ b/snippets/text-mode/sql-mode/create @@ -0,0 +1,10 @@ +#contributor : Alejandro Espinoza Esparza +#name : create table ... +# -- +CREATE TABLE [${1:dbo}].[${2:TableName}] +( + ${3:Id} ${4:INT IDENTITY(1,1)} ${5:NOT NULL} +$0 + CONSTRAINT [${6:PK_}] PRIMARY KEY ${7:CLUSTERED} ([$3]) +) +GO diff --git a/snippets/text-mode/sql-mode/create.1 b/snippets/text-mode/sql-mode/create.1 new file mode 100644 index 0000000..1323daf --- /dev/null +++ b/snippets/text-mode/sql-mode/create.1 @@ -0,0 +1,12 @@ +#contributor : Alejandro Espinoza Esparza +#name : create procedure ... +# -- +CREATE PROCEDURE [${1:dbo}].[${2:Name}] +( + $3 $4 = ${5:NULL} ${6:OUTPUT} +) +AS +BEGIN +$0 +END +GO diff --git a/snippets/text-mode/sql-mode/references b/snippets/text-mode/sql-mode/references new file mode 100644 index 0000000..f2e4eab --- /dev/null +++ b/snippets/text-mode/sql-mode/references @@ -0,0 +1,4 @@ +#contributor : Alejandro Espinoza Esparza +#name : REFERENCES ... +# -- +REFERENCES ${1:TableName}([${2:ColumnName}])