Live data from Hacker News

Show HN: Subvim – Vim customized to be like SublimeText

github.com

21–30 of 68 posts

Re: Show HN: Subvim – Vim customized to be like SublimeText

#22
post #6

Earlier quoted context omitted.

Vim 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!

I 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 a…

I might not fully understand the use cases of multiple cursors, but if you were trying to accomplish the same thing (change every other occurrence of "item" to "item odd") in vim, you could do it with 'n' and '.'

    /item        (search for 'item')
    cwitem odd^C (replace with the new text)
    nn.nn.nn.    (next occurrence, next occurrence, repeat last command)

Re: Show HN: Subvim – Vim customized to be like SublimeText

#23

Earlier quoted context omitted.

I 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 a…

I'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 usi…

For 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.

Re: Show HN: Subvim – Vim customized to be like SublimeText

#24
post #6

Earlier quoted context omitted.

Vim 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!

I 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 a…

For the mentioned task, I prefer to hold control, double click on "item" on lines 1 and 3, press right, and type " odd". Then pressing up, left and type " even".

Re: Show HN: Subvim – Vim customized to be like SublimeText

#25
post #9

Earlier quoted context omitted.

I 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).

That sounds like a lot more work...

Do you mean it's a lot of work to type in that prefix? Because vim automatically inserts it for you when you enter command mode while something is visually selected. A making a visual selection is very quick and easy.

Re: Show HN: Subvim – Vim customized to be like SublimeText

#26

Earlier quoted context omitted.

I 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 a…

I'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 usi…

Oh 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.

Re: Show HN: Subvim – Vim customized to be like SublimeText

#27
post #20

slightly 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

A 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.

Re: Show HN: Subvim – Vim customized to be like SublimeText

#29
post #9

Earlier quoted context omitted.

Just 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`.

I 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).

Ctrl+cmd+g is cmd+d for all occurrences on the page.

Re: Show HN: Subvim – Vim customized to be like SublimeText

#30
post #6

Earlier quoted context omitted.

Vim 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!

I 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 a…

This would be easily done by recording a macro and replaying it numlines/2-1 times. Possibly if starting on the first line: q,a,j,$,i, odd,esc,j,q,4@a

    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)
Post reply on HN