Sublime Forum

Vim like editing modes in sublime text x?

#1

I’ve been using vim a bit lately(but of course still prefer sublime) and can see real value in some basic modal editing & navigation. With the exciting new direction Sublime Text X is taking, perhaps it might be a good time to build in basic modal editing support? Not suggesting anything comprehensive, just a couple basic commands that users can use as they become more experienced with sublime.

Here’s a blog post from another editor on the subject. e-texteditor.com/blog/2010/beyond-vi

0 Likes

#2

Mike,

In case you hadn’t run across it, there is a Vim plugin for mainstream Sublime Text on the GoogleCode packages site:
sublime-text-community-packages. … s/Vim.html

I played with it a little bit, and it worked pretty well. I think the j & k might be swapped for navigation, but easy to fix though. I started playing with key bindings in X this weekend for a bit, and was actually considering converting this plugin over to X and making it a bit better.

0 Likes

#3

Thanks I wasn’t aware of that plugin and will try it out. I just wanted to bring up the topic as something to seriously consider building into the editor natively given that X is still in it’s early development and there would be no better time to add support for it than right now.

0 Likes

#4

I haven’t looked at the plugin mentioned above, but I do know that support for any type of modal editing already exists in Sublime – only the bindings themselves are missing. Add a binding like this:

<binding key="escape" command="toggle commandMode"/>
then add some bindings like this:

<binding key="j" command="move characters -1"> <context name="option" value="commandMode"/> </binding> ...etc.

Et voilà, you’ve got modal editing.

Note that “commandMode” is an option I made up: you could name this anything. If the option is unset (i.e. set to None), then toggle will change it to True, and once it’s True it’s as good as any other option.

Edit: note that multi-key commands (e.g. “:q”) will show up in the buffer and not the status bar as you’re typing them.

0 Likes

#5

[quote=“adzenith”]Note that “commandMode” is an option I made up: you could name this anything. If the option is unset (i.e. set to None), then toggle will change it to True, and once it’s True it’s as good as any other option.

Edit: note that multi-key commands (e.g. “:q”) will show up in the buffer and not the status bar as you’re typing them.[/quote]

There is an actual option called “commandMode”, and it’s designed for just this: when it’s turned on, character input will no longer be echoed into the buffer.

0 Likes

#6

Well I’ll be damned… When I was testing it myself, I was using another name for the option, but I changed it to “commandMode” when I posted to make it more clear.
A relevant thread, whose existence I had apparently completely forgotten, is here: Sublime API request

0 Likes

#7

[quote=“willi297”]Mike,

In case you hadn’t run across it, there is a Vim plugin for mainstream Sublime Text on the GoogleCode packages site:
sublime-text-community-packages. … s/Vim.html

I played with it a little bit, and it worked pretty well. I think the j & k might be swapped for navigation, but easy to fix though. I started playing with key bindings in X this weekend for a bit, and was actually considering converting this plugin over to X and making it a bit better.[/quote]

How do I install this plugin on Ubuntu 11.10? I found no reference.

0 Likes

#8

[quote=“ivanelson”]
How do I install this plugin on Ubuntu 11.10? I found no reference.[/quote]

This is a very old thread… Sublime Text now comes with Vintage mode pre-installed. Vintage mode aims to emulate vim keybindings… In enable it, just open up your Global Settings - User and removing or commenting out “Vintage” from the list of ignored packages.

0 Likes

#9

[quote=“C0D312”]

[quote=“ivanelson”]
How do I install this plugin on Ubuntu 11.10? I found no reference.[/quote]

This is a very old thread… Sublime Text now comes with Vintage mode pre-installed. Vintage mode aims to emulate vim keybindings… In enable it, just open up your Global Settings - User and removing or commenting out “Vintage” from the list of ignored packages.[/quote]

Expressions of the type ->: g/old/s//new/g not seem to work. Yet the editor is very good, congratulations to the community.

Thank You.

0 Likes

#10

[quote=“ivanelson”]

Expressions of the type ->: g/old/s//new/g not seem to work. Yet the editor is very good, congratulations to the community.

Thank You.[/quote]

The vintage package is open-source, so if you find a problem, you can look here: https://github.com/sublimehq/vintage to submit bugs or feature requests.

You may also be interested in the VintageEx package, available here: https://github.com/SublimeText/VintageEx which extends Vintage modes functionality

0 Likes

#11

[quote=“C0D312”]

[quote=“ivanelson”]

Expressions of the type ->: g/old/s//new/g not seem to work. Yet the editor is very good, congratulations to the community.

Thank You.[/quote]

The vintage package is open-source, so if you find a problem, you can look here: https://github.com/sublimehq/vintage to submit bugs or feature requests.

You may also be interested in the VintageEx package, available here: https://github.com/SublimeText/VintageEx which extends Vintage modes functionality[/quote]

Thanks again I will install VintageEx, maybe I find it more vim commands.

0 Likes