13 ms·
Show HN: Subvim – Vim customized to be like SublimeText
- namtrac 14y agoLooks lovely! Though I would appreciate non-Mac shortcuts too (I am guessing ctrl- can be used instead of cmd-)
- swdunlop 14y agoAgreed. I got excited, because it looked like a way to get Sublime-friendly features in a remote terminal, but all the macvim-centric bindings look like a blocker. Still, it's a great reference for Vim plugins that can bring Vim closer to Sublime.
- njoh 14y agoThe most awesome feature of SublimeText for me is multiple-cursor editing (Ctrl-D on a word). It only bothers me when I can't skip next occurrences easily (It's possible, but it's hard) 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.
- m4rkuskk 14y agoPressing Ctrl-K,D to skip an entry is quite cumbersome, especially if you missed an entry and there is no way of undoing the last selection.
- JeanMertz 14y agoCtrl/Cmd-U is a "soft undo" that undoes your last selection. I agree that Cmd-K,D isn't ideal, but that, combined with Cmd-U works perfectly.
- chr1 14y agoCloud9 have a nice solution for that, ctrl-alt-left/right to select next previous and same with shift to not keep last added selection. This way you can even skip some words in the middle. I've tried to make a plugin for this, but sublime doesn't keep the order in which ranges were added.
- efnx 14y agoVim has block editing mode (ctrl v - select, shift i, write text, esc) and the ability to record macros. With those two features you can do everything multiple cursors does and more!
- weaksauce 14y agoI love vim but I don't think that block editing mode does what they want to do quite as well. Do you have an example where they excluded a line or lines from block editing? 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-released http://www.sublimetext.com/blog/articles/sublime-text-2-0-re...
- Keyneston 14y agoI'm probably being very defensive but I use macros for this. 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.
- njoh 14y agoFor more complex tasks like data format conversion, It's probably easier to write some small script and refine a couple of times to resolve possible conversion errors.
- weaksauce 14y agoOh I agree that macros are a daily use thing for me and I haven't used sublimetext more than a handful of times; I was merely playing devils advocate to see if vim had an interesting feature I was unaware of that I could use in my day to day editing.
- ineedtosleep 14y agoJust tried C-D on my rarely used Sublime Text, but I'm not sure if I'd personally prefer that over something like `:%s/one/two/gc`.
- njoh 14y agoI rarely use global find and replace nowadays (just for complex regex replaces). I hold Ctrl-D until all occurrences are selected and type the replacement string (assuming occurrences are low in quantity, which they usually are in most cases).
- weaksauce 14y agovisual selection replacement is good too. :'<,'>s/this/to that/g I think vim does that automatically when you have a selection active and hit :
- caioariede 14y agoNote that this will replace over the entirely lines even if it's a blockwise selection. So you might consider using :'<,'>s/\%Vthis/to that/g
- weaksauce 14y agoIt might be a setting or something but it definitely doesn't do that on my machine or the linux machine I have in the cloud. 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
- Already__Taken 14y agoYou know crt + H (global find and replace) takes what's highlighted and uses the last thing you looked for it nothing is highlighted.
- daGrevis 14y agoMultiple-cursors are just a syntactic sugar for macros. s/syntactic/visual/
- roryokane 14y agoMultiple cursors simulate not just macros, but also setting lots of marks and iterating the macros through them. It’s relatively easy to write an equivalent macro if you’re just placing a cursor every three lines or at every occurence of some string; you can have the macro move three lines down when it’s done, or search for the next occurence of some regex. But if you’re actually clicking on places in the code that only a human can identify need changing, then it’s much harder to write an equivalent macro.
- shared4you 14y agoNo editor wars intended, but for someone interested: multiple cursors for Emacs: https://github.com/emacsmirror/multiple-cursors https://github.com/emacsmirror/multiple-cursors Do watch the video linked to on this page!
- maxmcd 14y agoCommand + K skips the most recently highlighted occurrence. Usually works for me.
- farslan 14y agoOP here. There are some plugins but I didn't research it. But here is one that I think do it (and if it's good I'll integrate it): https://github.com/paradigm/vim-multicursor https://github.com/paradigm/vim-multicursor
- jQueryIsAwesome 14y agoIs awesome but it needs some work, it would be _really_ nice if it were syntax aware, so if you start Ctrl+D in a variable it should only select where is being used as a variable and not other things (regex, strings, etc) or at least a boolean option to enable this behavior.
- h2s 14y agoI'm a Vim user and this is the only Sublime feature that I think I'd like to see in a future version of core Vim. Another comment called it "syntactic sugar for macros"[1] and that's true. Multicursor functionality allows you to avoid repetition in so many cases that it's worthy of inclusion as a feature in its own right. [1] https://news.ycombinator.com/item?id=5504507 https://news.ycombinator.com/item?id=5504507
- eddieplan9 14y agoI think what we already have in vim is even better: just use dot (.) to repeat the last action. So you make some edits in your first cursor position, move to the next cursor position and press dot to repeat the edit.
- m_mueller 14y agoNo offence, but that's the typical kind of comment coming from someone who's never actually tried multicursor functionality. The thing about multicursor is that it's seamlessly integrated not only with editor commands, but also with commands that create multicursors. 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.
- Derbasti 14y agoI would not say it's essential, but multiple cursors is certainly one of the features I use quite frequently in Emacs. In many occasions, it is more useful than plain search and replace, though even that is kind of super charged in Emacs to bein with.
- efnx 14y agoThis seems rad, my only 2cents is that using modifier keys is not very vimmy. But altogether really cool. Nice work.
- farslan 14y agoThe whole point is for people who want to switch from ST to Vim or for people who used to use VIM, but loves ST. There are still cases that should be handled trough. But I will add an entry to the FAQ, that explains the target user. This is IMO not for everybody.
- cachemeifyoucan 14y agoGood work! Love the color scheme.
- farslan 14y agoThanks! I've made some hacks to the original molokai (like the background on the numbers).
- phreeza 14y agoslightly off topic, but I think a thing that is sorely needed is a kind of libvim that provides proper vim functionality, which can then be linke
- terhechte 14y agoA thousand times yes. I'm using Vim keybindings in most of my editors, and every time it is something somebody implemented anew which is kinda like vim, but not really like vim. It would be great to take the complete set of keybindings > actions out of vim, abstract it away, and put it into a library. I looked into the vim code a bit, and it seems that this is a lot of work.
- dhamidi 14y agoGNU Readline already provides a lot of VI's (so almost VIM) functionality as a library. Maybe that could be used as a starting point? It probably still is a lot of work though.
- andyl 14y agoyes agreed - JetBrains has IdeaVim, but it is so lame compared to the real thing.
- deleted 14y ago[deleted]
- hack_edu 14y agoHow is the speed? Last time I tried it, about 6 months ago, there was a very noticeable lag when switching between modes. I ran into the maintainer of IdeaVim at PyCon and he said it should be better but my trial period expired and I never got a chance to try it again.
- tomlu 14y agoThey just released an update a week ago that was supposed to have fixed the problem. It does seem better, but I haven't used it for long enough to properly verify that.
- nu2ycombinator 14y agoSeriously why do we need this?
- eksith 14y agoBecause we can do it. 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.
- QuantumGuy 14y agoI have got to ask the obvious here, why not just switch?
- farslan 14y agoBecause i love Vim :) Then there was Sublime that really changed the way of editing in some way. I first tried vintage and make it vim-like. However it was slow and not much was I wanted. Thus finally creates this project. For Vim users who like Sublime.
- jQueryIsAwesome 14y agoST3 will be released soon and is supposedly going go fully support all vim commands in vintage mode with better performance.
- adamors 14y agoYou mean the vintage mode that comes with ST? Because I didn't see anything being announced regarding vintage mode. Some guys forked the ST vintage package but that's 3rd party.
- tomschlick 14y agoThis is awesome. As a Sublime user I'm going to put this on my dev server for those times when I have to SSH in and make an emergency code change without my primary machine handy.
- cseelus 14y agoDid that too 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.
- bisu-shield 14y agotoo bad CtrlP is crap compared to sublime's fuzzy searching
- farslan 14y agoI tweaked the settings. It's a little better than with the default settings. Just give try :)
- deleted 14y ago[deleted]
- lucisferre 14y agoWonder how this compares to SPF13, which I've been using lately. https://github.com/spf13/spf13-vim https://github.com/spf13/spf13-vim
- farslan 14y agoOP here. SPF13 itself is really nice. But the main difference here is first I try to emulate ST2, second I'm really picky which plugins are integrated. I also don't use vundle (because It should always have the same feature regardless of the state of plugin), instead of I'm using pathogen (which I like more). With time I will update the plugins myself, but only if they have bugfixes or features that are necessary to be added. 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 :)
- skopp 14y agoVim reminds me of this white powder my mother used to use to clean drains or something. Weird.