Home Download Buy Blog Forum Support

Dev Build 2096

Re: Dev Build 2096

Postby jps on Thu Aug 04, 2011 12:23 am

aparajita wrote:Can you give a few details on how Command.description() might be used?

It's commonly used on the C++ side to display lists of things in the menus, for example:

Code: Select all
class UrlListCommand(sublime_plugin.WindowCommand):
    urls = [...]

    def run(self, index):
        if index < len(urls):
            open_url(index)
   
    def is_visible()
        return index < len(urls)
   
    def description(self, index):
        if index < len(urls):
            return "Open URL: " + urls[index]


You can then create menu items that call this command with various indices, as done for the open_recent_file command in the main menu.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Dev Build 2096

Postby jps on Thu Aug 04, 2011 1:55 am

Another otherwise undocumented feature is 2096 is the ability to bind to wildcard characters. If you setup a key binding to "<character>", then that'll match any character, and forward the matched character onto the command via the "character" argument. For example:

Code: Select all
{ "keys": ["r", "<character>"], "command": "replace_character" }

This is used by Vintage to implement, 'r', 'f', 't', etc.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Dev Build 2096

Postby jps on Thu Aug 04, 2011 2:09 am

If you specify an argument called "character" in the binding, then it'll get overwritten by the actual typed character. Other arguments are unaffected.

Next build will be out today.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Dev Build 2096

Postby adzenith on Thu Aug 04, 2011 6:03 am

For some reason it seems like my User Key Bindings aren't loading. If I remove the Default (OSX).sublime-keymap file from Packages/User, the console prints:
Code: Select all
found 5 files for base name Default.sublime-keymap

If I put it back, it still prints the same thing. If I fill it with mal-formed JSON, it doesn't give me an error message on save, even though the default Default (OSX).sublime-keymap will give me such an error.
Thougts?
Thanks!
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: Dev Build 2096

Postby jps on Thu Aug 04, 2011 7:46 am

Build 2097 is out now, addressing the issue where platform specific key bindings weren't read from the user package.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: Dev Build 2096

Postby ceej on Thu Aug 04, 2011 2:48 pm

Wow....i love this!!! You have to keep vintage part of sublime :) (you might want to make the cursor more visable in visual mode like http://screencast.com/t/j2Uk1Z5kDrO)

If I could figure out viewtopic.php?f=3&t=2510&p=12132#p12132 and viewtopic.php?f=3&t=2511&p=12131#p12131 I would buy sublime today.
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Dev Build 2096

Postby jeberius on Thu Aug 04, 2011 4:01 pm

iamntz wrote:
. So when I hold down "j" to move down, it will only move down one line, while the original VI will move down continuously until I let the key go.

Are you on Lion? If yes, this os has a... feature that prevent repeat keystrokes.


Thank you. This was indeed the issue. This new Lion function can fortunately be disabled using

defaults write -g ApplePressAndHoldEnabled -bool false
jeberius
 
Posts: 7
Joined: Fri Feb 04, 2011 1:16 pm

Re: Dev Build 2096

Postby ceej on Thu Aug 04, 2011 6:10 pm

I like that / is mapped and opens the find menu, can we have : mapped to goto line number?

Many thanks
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Dev Build 2096

Postby ceej on Thu Aug 04, 2011 6:29 pm

also f then a letter works great but it's missing ; which is the next occurrence of the letter, if that could be added it would be great :D
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Dev Build 2096

Postby alanandersen1 on Thu Aug 04, 2011 7:18 pm

@sublimator

I'm on win7 64 bit.
alanandersen1
 
Posts: 10
Joined: Mon Jul 25, 2011 4:45 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: Google [Bot], mlf and 23 guests