Seems like the second someone decides to add/remove a country or number of elements, you have to start all over again. Not saying this isn't cool, but seems overkill.
For example:
langs = ['en','de',...]
elems = [1,2,...]
for elem in elems:
for lang in langs:
print(base_url + '/element' + str(elem) + '/' + lang)
print('')
In your example, you end up with the same five URLs repeated. E.g. line offset 40 is identical to line offset 33 in your last Vim screenshot. I'm not sure if this means you left off the final step?
Adding a blank line and then removing all the blank lines makes sense for understanding what you're doing (I do this sort of thing all the time) but for the purpose of this demo it's just extra work. I think you could improve the post by explaining that it's just done to make the screen of text easier to follow.
I know your post is demonstrating a bunch of different techniques, but you did ask for comments, so I'm going off on an efficiency jaunt.
The step of replicating the block could be reduced to simply adding a blank line at the end and then copy-pasting the whole thing, rather than using another macro recording:
Go<esc> # add a blank line at the end of the file
Ygg # copy from the end to the top
5P # paste the block (including its empty line) 5 times
You can also use 2G to go to the second line instead of 2gg if you want fewer keypresses but are ok with chords. Likewise Y5 instead of yy5.
Hi, I’m Steffen. I create Embedded software for a living.
I always strive to improve the quality of my code by studying new methods, paradigms and technologies.
Lol I bet that sublime also has a fast way of doing this same job.
One thing that I noticed with vim is that you never stop learning so your editing skills are leveling up all the time, which makes you think different while programming, making it more enjoyable.
We're a place where coders share, stay up-to-date and grow their careers.
Oh, this is awesome
That would solve the problem faster!
Why not use a simple python script for this?
Seems like the second someone decides to add/remove a country or number of elements, you have to start all over again. Not saying this isn't cool, but seems overkill.
For example:
A cleaner way:
The goal is practice new vim commands, the problem is not important in the context of this post.
In your example, you end up with the same five URLs repeated. E.g. line offset 40 is identical to line offset 33 in your last Vim screenshot. I'm not sure if this means you left off the final step?
Adding a blank line and then removing all the blank lines makes sense for understanding what you're doing (I do this sort of thing all the time) but for the purpose of this demo it's just extra work. I think you could improve the post by explaining that it's just done to make the screen of text easier to follow.
I know your post is demonstrating a bunch of different techniques, but you did ask for comments, so I'm going off on an efficiency jaunt.
The step of replicating the block could be reduced to simply adding a blank line at the end and then copy-pasting the whole thing, rather than using another macro recording:
You can also use
2Gto go to the second line instead of2ggif you want fewer keypresses but are ok with chords. LikewiseY5instead ofyy5.For the record, on most Linux distributions the tool to use is
xdg-openNice use case!
I‘m just wondering whether we could utilize C-a for increasing numbers from within insert mode.
By the way, is there a typo in the numbering?
Yes could be used for increasing numbers
And yes there is a typo on numbering, good catch!
Where is this function in sublime?
Lol I bet that sublime also has a fast way of doing this same job.
One thing that I noticed with vim is that you never stop learning so your editing skills are leveling up all the time, which makes you think different while programming, making it more enjoyable.