Your comments

  { "keys": ["alt+c"], "command": "toggle_case_sensitive", "context":
     [
       { "key": "setting.is_widget", "operator": "equal", "operand": true }
     ]
   },
   { "keys": ["alt+r"], "command": "toggle_regex", "context":
     [
       { "key": "setting.is_widget", "operator": "equal", "operand": true }
     ]
   },
   { "keys": ["alt+w"], "command": "toggle_whole_word", "context":
     [
       { "key": "setting.is_widget", "operator": "equal", "operand": true }
     ]
   },
   { "keys": ["alt+a"], "command": "toggle_preserve_case", "context":
     [
       { "key": "setting.is_widget", "operator": "equal", "operand": true }
     ]
   },
Apparently these are the only toggle keybindings for find widgets. Seeing that they have a specific command name I don't think you can add a command yourself.

There is a serious problem for keybindings and the way they are implemented because they disregard the keyboard layout. This applies to Windows as well and means that I have to remap all the keybindings that are not accessable via my keyboard or I just don't know which key is actually represented with my layout (e.g. the console binding ctrl+` maps to ctrl+ö).


I consider this a serious issue but it might take a while until something in this direction will be done.

That's what the plugin API is for. SublimeCodeIntel already does this for a few languages.

Scope selectors work like so:

 <scope>source.python, text.plain</scope>
See: https://manual.macromates.com/en/scope_selectors#scope_selectors
<snippet>
  <description>$var['']['']</description>
  <tabTrigger>var2</tabTrigger>
  <scope>text.plain</scope>
  <content>
<![CDATA[\$${1:var}['${1/^./\u$0/}']['${2}']]]>
  </content>
</snippet>

See:
http://docs.sublimetext.info/en/latest/extensibility/snippets.html#substitutions
http://www.boost.org/doc/libs/1_44_0/libs/regex/doc/html/boost_regex/format/perl_format.html
Ok, I see what you mean. I agree with you that this should be possible in the on_new command and that those functions should return something (values should be assigned). But maybe this just wasn't intended for the function so maybe an "on_post_new" callback should be added.

Well, for the time being you can use this workaround with sublime.set_timeout:

import sublime
import sublime_plugin

class EventDump(sublime_plugin.EventListener):
  def on_new(self, view):
  self.view = view
  sublime.set_timeout(self.on_post_new, 200)

  def on_post_new(self):
  view = self.view
  w = view.window() or sublime.active_window()
  print view.window().__class__, w.__class__
  grp = w.active_group()
  print w.get_view_index(view)
  print grp.__class__, w.views_in_group(grp)
  w.set_view_index(view, grp, len(w.views_in_group(grp)) - 1)
Phew, I got that shit working. Was pretty hard because the syntax definition hierarchy did not behave as I wanted it to so I had to use a workaround. However, unless you do not define constants like "none" or "false" as variable identifier or type you should be safe. ;) At least your example file works as expected. If there are other things besides these constants (including numbers) that can be defined as default value, you will know how to implement that.

 

Still the same link, I edited it.

Try this one.

I can also have 416+ lines of "function (type variable, othertype var2)" in a buffer, they are highlighted correctly.

Also highlights invalid characters as "invalid.illegal".

That behaviour is really weird.

Well, back to your syntax definition. The part you mentioned seems to be
		<key>params</key>
		<dict>
			<key>begin</key>
			<string>\b</string>
			<key>end</key>
			<string>\)</string>
			<key>endCaptures</key>
			<dict>
				<key>1</key>
				<dict>
					<key>name</key>
					<string>variable.parameter.papyrus</string>
				</dict>
			</dict>
			<key>patterns</key>
			<array>
				<dict>
					<key>include</key>
					<string>$self</string>
				</dict>
			</array>
		</dict>

 However, when you look at it it does not seem to do what you intend it to (what would you want to achieve by self-including this pattern?).

Furthermore, it uses an anchor only ("\b"), which is what I mentioned in my first comment.

And the "endCaptures": 1 will never be defined because your "end" regexp does not define any matching group.


Seems like your file got corrupted your something, this makes absolutely no sense.

How do you want to pass "function parameters"? And what parameters?

Usually a self-include should not result in an infinite loop. It is likely that your regex you are using does not consume any character at all (it matches, but it does not match any character). Thus it would be called again and again without moving forward in the file. An example regex would be ".*?". A self-inclusion of this pattern would result in an infinite loop.