Home Download Buy Blog Forum Support

20091017 Beta

20091017 Beta

Postby jps on Sat Oct 17, 2009 10:47 am

20091017 is out now, with key bindings to toggle find options, as well as various other small requests.

Find flags (regex, case sensitive, etc) are now specified via the application options, which are accessible from python plugins via sublime.options(), eg., running sublime.options().set("find.regex", True) will turn regex mode on from a plugin.

Also now exposed to plugins is the ability to change the current search string (as shown in the find panel, and used by F3): overwrite the option "find.string" to change this.

The main new bit of functionality in this beta is an experimental API to add tracked regions to the view (say, what bookmarks do), which will be updated as the buffer is modified, and can optionally be drawn. The functions are likely to change, so I haven't added them to the API reference, but in brief:

Code: Select all
view.addRegions(key, regions, scope)
view.getRegions(key)
view.eraseRegions(key)


eg., addRegions("findResults", [sublime.Region(0, 100), sublime.Region(150, 200)], "string")

The first argument, key, is a string used to retrieve the stored regions later. The second is simply the list of regions. The third argument is a scope name, which, if not blank, will be used to find the colors to draw the regions in.

getRegions can be used to retrieve previously set regions: this is handy if you're trying to track a position in the buffer, as the regions will be updated to maintain their position when the buffer is modified.

I'm keen for feedback on the API, and if it's sufficient for the plugins you want to write.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: 20091017 Beta

Postby ilya on Sat Oct 17, 2009 11:26 am

* Added new application option, createTabsAtEnd

How to use it? :roll:
ilya
 
Posts: 122
Joined: Fri Sep 11, 2009 8:32 pm

Re: 20091017 Beta

Postby ilya on Sat Oct 17, 2009 7:56 pm

Got it! Thanks.
ilya
 
Posts: 122
Joined: Fri Sep 11, 2009 8:32 pm

Re: 20091017 Beta

Postby EJ12N on Sun Oct 18, 2009 4:33 am

Nice work on the "find" stuff :D I appreciate the shortcuts!

Is good that you can alter the search string now via plugins but one feature I really want (and Im sure others too) is that when I record a macro, find/replace actions get recorded... oh lord how much good stuff you could do with that :)
I could do a macro to regex search all html tags, then erase them... (stripHTMLTags.sublime-macro) fine I can do this via a plugin but I'm just giving one example of how this can be used, and many other people have no idea how they would do it via a plugin.
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: 20091017 Beta

Postby mrdctaylor on Mon Oct 19, 2009 3:12 pm

FYI, I checked the JSP support and while it is included, it really does not do syntax highlighting. If you find a JSP somewhere and load it into the editor you'll see what I mean.
mrdctaylor
 
Posts: 14
Joined: Fri Oct 16, 2009 1:37 pm

Re: 20091017 Beta

Postby vim on Mon Oct 19, 2009 9:23 pm

jon, this is what i have been looking for!! thanks:

sticky-search, see: http://pastie.org/private/ngrwvsgkmnmky133p6dz9w

usage:
Code: Select all
   <binding key="ctrl+shift+f,*" command="stickySearch add" />
   <binding key="ctrl+shift+f,-" command="stickySearch clear" />


ctrl+shift+f followed by * will mark the selected word all over your file (if non selected it will use clipboard content)
ctrl+shift+f followed by - will clear the marking

note: to always add markings (till you clear) you can change line 18 from:
Code: Select all
regions = []

to
Code: Select all
regions = view.getRegions(key)


jon, what strings can i use as 3rd param (i used 'string'), what are my options?
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: 20091017 Beta

Postby vim on Mon Oct 19, 2009 9:36 pm

one thing is missing though - it doesn't reflect on the minimap...
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: 20091017 Beta

Postby jps on Mon Oct 19, 2009 9:58 pm

vim wrote:what strings can i use as 3rd param (i used 'string'), what are my options?


You can use any scope name you wish, same as a tmLanguage file would, eg., "comment.block.c source.c++"
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: 20091017 Beta

Postby vim on Mon Oct 19, 2009 10:10 pm

jps wrote:
vim wrote:what strings can i use as 3rd param (i used 'string'), what are my options?


You can use any scope name you wish, same as a tmLanguage file would, eg., "comment.block.c source.c++"


it seems it use the foreground color as background, i think this is also why i can't see it on the minimap.
vim
 
Posts: 298
Joined: Tue May 27, 2008 6:51 pm

Re: 20091017 Beta

Postby jps on Mon Oct 19, 2009 10:13 pm

Yeah that's right, it looks up the colour, uses it for the background, and then generates a contrasting colour to use as the foreground. I can't say I'm that happy with this method, it should likely be replaced by a system that lets colour schemes explicitly assign colours to regions.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 31 guests