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
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
[code]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]
{
"keys": "alt+f10"],
"command": "toggle_vintage_package"
}
]
eeer sorry, complete noob here, where do I put the first one? the shortcut I know where!
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.
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…
Because I didn’t know that
Makes sense - thanks so much. I think I’ll leave it enabled!
@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.
[quote=“sfranky”]@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.[/quote]
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.
[quote=“sfranky”]@Jon:
…
because Esc as ‘go to command mode’ is inserted in places where it shouldn’t be.
…
[/quote]
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).
Mistake, need to use Preferences
import sublime
import sublime_plugin
class toggle_vintageCommand(sublime_plugin.TextCommand):
def run(self, edit):
setts = sublime.load_settings("Preferences.sublime-settings")
ipacks = setts.get('ignored_packages')
if not ipacks: ipacks = []
if "Vintage" in ipacks:
ipacks.remove("Vintage")
else:
ipacks.append("Vintage")
setts.set('ignored_packages', ipacks)
sublime.save_settings("Preferences.sublime-settings")