Show HN: Subvim – Vim customized to be like SublimeText
github.com
github.com
It surprises me how users of other major editors don't use multiple cursors in their day to day editing tasks. It'd be awesome if subvim included the best solution vim community has to offer in this regard.
Do watch the video linked to on this page!
an example:
class="item"
class="item"
class="item"
class="item"
st2 would be able to select the second and fourth line item and be able to change those to "item odd" without touching the first and the third ones. similarly they could do the same and add even to the other two. class="item"
class="item odd"
class="item"
class="item odd"
this blog post shows it in action:http://www.sublimetext.com/blog/articles/sublime-text-2-0-re...
qa // start recording into 'a' register
j // move down
$ // move last char on line
i // insert mode
odd //
esc // back to command mode
j // move down
4@a // replay macro 4 times (if there are 8 more lines)qa$i odd^[jjq
and then '4@a' to run it on all the lines. In a simple case like this is it a bit more complicated than something like multiword editing but I've used this technique in cases that are far more complex then what from my understanding, multiline editing can handle.
For example I turned a spreadsheet of data into a complicated dhcpd.conf file using a couple macros.
/item (search for 'item')
cwitem odd^C (replace with the new text)
nn.nn.nn. (next occurrence, next occurrence, repeat last command)Examples:
- Cmd-Shift-L creates a cursor at the end of every line of the selected area.
- Find all, integrated with Regex, creates multicursors on every match.
- Once you get multicursors, you can still add some manually by holding down Cmd and double clicking at a cursor position.
After you get multicursors, you can then move them around using standard editor commands - that's the real power of this construct, since I'm able to match something much simpler than I actually want to edit (for example end/beginning of line), move to the meat, edit.
:'<,'>s/this/to that/g
I think vim does that automatically when you have a selection active and hit :
So you might consider using :'<,'>s/\%Vthis/to that/g
this ipsum dolor sit amet
this ipsum dolor sit amet
this ipsum dolor sit amet
this ipsum dolor sit amet
this ipsum dolor sit amet
select the middle 3 lines and do what I said will give you:
this ipsum dolor sit amet
to that ipsum dolor sit amet
to that ipsum dolor sit amet
to that ipsum dolor sit amet
this ipsum dolor sit amet
Just give Ctrl-D a try for a couple of days.. It's a total different user experience compared to the traditional find/replace method.
s/syntactic/visual/
It's a decent idea. I'm sure there might be something else that's further along than I got.
It's still not the greatest vim emulator, but it's much more usable now IMO.
Love this project. Sublime Text's awesomeness makes it hard to completely switch back to VIM, but this looks like a good approach to bring features we have grown to love back to VIM, without all the hazzle.
Some of plugins (like ctrlp) is modified in order to use the ctags binary I'm bundling and installing. There is also pre-compiled version of YCM in subvim. Together it means autocompletion and goto features are really working. You really don't install anything.
The plugins settings are modified in order to emulate ST2 like behavior, like accepting autocomplete entry via enter, creating a newline after braces,quotes,etc.., opening a new tabs whenever you call cmd+p (but not if you call cmd+r for using goto), closing the application and starting again brings all you tabs/files again and so on..
They are many things I'm trying to improve, like adding snippet system, more improved installation procedure, multiplatform support (linux and windows). SPF13 is much better on these terms.
I hope with time it will get better :)
Though I would appreciate non-Mac shortcuts too (I am guessing ctrl- can be used instead of cmd-)
I understand the saying "just because you can do something, doesn't mean you should", but really, we do anything because it can be done (or someone said it couldn't be and we had to prove them wrong). Within sane limits, it's amusing, without sane limits...
Meanwhile, I'm enjoying my life living away from a cave thanks to this same delightful aspect of human nature.
Because I didn't see anything being announced regarding vintage mode. Some guys forked the ST vintage package but that's 3rd party.