Home Download Buy Blog Forum Support

Tab completion weirdness

Re: Tab completion weirdness

Postby ninjaroll on Tue May 29, 2012 6:26 am

Sorry, I meant to say Python...long day :D

So I finally figured it out. For people interested, here is what I did.

    1. Create new html document
    2. Type out any tag pair that you're using as a tab completion. For this example, let's use h1. So type out h1 and hit the tab key
    3. This should result in <h1>|</h1> (notice the cursor is between the two tags). You should also see on the bottom left of your window the words "Field 1 of 2"
    4. Click control+q on your keyboard to start recording the marco.
    5. Click ESC on your keyboard to escape out of the field order
    6. Click Return to add a return break
    7. Click control+q to stop recording the macro
    8. Next, we want to save the macro, so select Tools > Save Macro...
    9. Save it under Package/User. For this example, we'll call it "Enter-Exit-Field.sublime-macro"

Next, we want to bind this macro to the Enter key which will run both keystrokes (esc, and then Enter) in that exact order.
    1. Go to Preferences > Key Bindings - User
    2. Add these lines which will look for the macro that we just saved, and run it
    Code: Select all
    {
        "keys": ["enter"],
        "command": "run_macro_file",
        "args": {"file": "Packages/User/Enter-Exit-Field.sublime-macro"}
    }

    3. Save
ninjaroll
 
Posts: 31
Joined: Tue Jan 03, 2012 7:10 pm

Re: Tab completion weirdness

Postby xeno.by on Tue May 29, 2012 7:35 am

Wow great, now I know about macros, thanks, guys!

Never thought of learning about them, because, hey, I know how to write commands. However, macros do seems to be more lightweight and might have occasional usages. In your opinion, what are those?
xeno.by
 
Posts: 106
Joined: Mon Jan 30, 2012 10:03 am
Location: Lausanne, Switzerland

Re: Tab completion weirdness

Postby ninjaroll on Tue May 29, 2012 6:28 pm

One thing I did notice is that this only works for when HTML is selected as a language on the bottom right. Anything else, the Return key fails to do anything. This is what my macro looks like if anyone is interested:

Code: Select all
[
   {
      "args": null,
      "command": "clear_fields"
   },
   {
      "args":
      {
         "action": "insert_formatted_newline",
         "mode": "html"
      },
      "command": "run_zen_action"
   }
]
ninjaroll
 
Posts: 31
Joined: Tue Jan 03, 2012 7:10 pm

Previous

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 21 guests