Home Download Buy Blog Forum Support

Vintage mode key binding?

Vintage mode key binding?

Postby roblight on Thu Aug 25, 2011 6:27 pm

Would it be possible to create a key binding that could enable/disable Vintage mode vs. having to edit the "ignored_packages" setting?

Thanks in advance,
Rob
roblight
 
Posts: 13
Joined: Fri Jul 08, 2011 2:25 am

Re: Vintage mode key binding?

Postby guillermooo on Thu Aug 25, 2011 6:59 pm

Code: Select all
import sublime, sublime_plugin

class ToggleVintagePackageCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        setts = sublime.load_settings("Global.sublime-settings")

        ipacks = setts.get('ignored_packages')
        if not ipacks: ipacks = []
        if "Vintage"  in ipacks:
            ipacks.pop(ipacks.index("Vintage"))
        else:
            ipacks.append("Vintage")
       
        setts.set('ignored_packages', ipacks)
        sublime.save_settings("Global.sublime-settings")



Code: Select all
[
   {
      "keys": ["alt+f10"],
      "command": "toggle_vintage_package"
   }
]
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: Vintage mode key binding?

Postby sfranky on Fri Aug 26, 2011 9:32 am

eeer sorry, complete noob here, where do I put the first one? the shortcut I know where!
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Vintage mode key binding?

Postby jps on Fri Aug 26, 2011 10:01 am

Can I ask why you want a key binding to disable Vintage mode? Staying in insert mode is more or less the same thing as disabling Vintage entirely. There's no harm in having it running, and only using command mode occasionally. The reason why Vintage is disabled by default is so that anyone not familiar with vi key bindings won't unintentionally get stuck in command mode.
jps
Site Admin
 
Posts: 3071
Joined: Wed Mar 19, 2008 12:33 pm

Re: Vintage mode key binding?

Postby sfranky on Fri Aug 26, 2011 11:29 am

I guess it's for psychological reasons mostly ("Now I m on vim, now I m not").
Who knows, maybe at some point you ll add insert mode bindings from vim
And, last time I checked it, vintage mode was unusable, I couldn't type a thing, couldn't get out of vi mode, couldn't enter it..
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Vintage mode key binding?

Postby roblight on Mon Aug 29, 2011 4:37 pm

jps wrote:Can I ask why you want a key binding to disable Vintage mode? Staying in insert mode is more or less the same thing as disabling Vintage entirely.


Because I didn't know that :)

jps wrote:There's no harm in having it running, and only using command mode occasionally. The reason why Vintage is disabled by default is so that anyone not familiar with vi key bindings won't unintentionally get stuck in command mode.


Makes sense - thanks so much. I think I'll leave it enabled!
roblight
 
Posts: 13
Joined: Fri Jul 08, 2011 2:25 am

Re: Vintage mode key binding?

Postby sfranky on Tue Aug 30, 2011 9:48 am

@Jon:
i have a better answer for you now:
because Esc as 'go to command mode' is inserted in places where it shouldn't be.
For instance:
you are in insert mode
ctrl+down a couple of times to have multiple cursors
You want to cancel your selection and go back to one cursor, so you press Esc. Oops! now you are in command mode.
You press esc again, you get one cursor, and then you have to press i to go back to your previously working mode.
sfranky
 
Posts: 96
Joined: Mon Oct 19, 2009 10:06 pm

Re: Vintage mode key binding?

Postby chendo on Wed Aug 31, 2011 4:55 am

sfranky wrote:@Jon:
i have a better answer for you now:
because Esc as 'go to command mode' is inserted in places where it shouldn't be.
For instance:
you are in insert mode
ctrl+down a couple of times to have multiple cursors
You want to cancel your selection and go back to one cursor, so you press Esc. Oops! now you are in command mode.
You press esc again, you get one cursor, and then you have to press i to go back to your previously working mode.


I have the same issue heh. The only thing I like vim for is the diw/ci"/etc commands. What I'd like is probably a temporary Command mode? Like a press a shortcut, it drops me into Command mode for one command, then back to insert mode.
chendo
 
Posts: 1
Joined: Wed Aug 31, 2011 4:50 am

Re: Vintage mode key binding?

Postby jbjornson on Wed Aug 31, 2011 6:22 am

sfranky wrote:@Jon:
...
because Esc as 'go to command mode' is inserted in places where it shouldn't be.
...


This is the same reason that I have for not using Vintage mode. I find that I inadvertently switch between modes when I don't want to, mostly because I'm trying to get rid of the find box or escape out of multiple selections. I'm sure there are other key bindings to achieve the same goals, but the behaviour I am used to from normal SublimeText editing doesn't seem to play well with Vintage mode (for me at least).
jbjornson
 
Posts: 350
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland


Return to Technical Support

Who is online

Users browsing this forum: ninjaroll and 31 guests