Are touch typists rare these days? I feel like people these days forego even learning to type properly. I dont understand why they refuse to just learn it, it is such an essential skill to have.
Intermediate Vim
81–90 of 130 posts
Re: Intermediate Vim
#82For anybody who's found more IDE-y activities a bit beyond the current generation of VIM plugins (looking at you Typescript), the Vim plugins for VsCode and Visual Studio are actually surprisingly good and I find myself at least as productive as I do in Vim. I imagine it might be quite a good starting point for somebody who's used to VsCode productivity but wanted to get into vim without going full vim!
The problem I have with those plugins is that I use a lot of split buffers not just for editing but also for exploring directories using :Explore for example. Some IDEs+vim plugins support horizontal splits but then when you have to jump between different modes such as explorer or console they use different shortcuts. Nevertheless, I think that VIM support for IDEs has improved a lot these past years. VSCode and Jet…
My annoyances are pretty small: not being able to do `:e ` and then tab complete the directory structure and the fact that VSCode has splits with tabs rather than tabs with splits.
Re: Intermediate Vim
#83Maybe you can cover macros since they are conceptually very simple and very powerful. They may seem a bit complex but are quite simple. Basically you just record your editing movements and play it back. How macros work: press q x to record and q to end. Then repeat with @ x, where x is the name of the macro you want to use (you can have several macros). Anything you do will be played back. That's it... Conceptually s…
My favorite newish-to-me macro trick is to use "recursive macros" -- macros that call themselves at the end, eg `qa[do something]@aq`. The idea (at least for me so far) is to record a line-wise action that goes to the next line before calling itself and will fail on the first non-matching line. For example, if you need to put some text after the first `0`, using commands like `t` or `f` to get there will fail if ther…
I use it so I can run the macro in batches a couple times and check if I made any mistakes, before picking an absurdly high number to hit the whole file.
Re: Intermediate Vim
#84If you are on twitter, you might want to follow MasteringVim. You'll learn one trick every day.
Re: Intermediate Vim
#85Earlier quoted context omitted.
I've used vim for a couple of decades, but never pushed to many advanced features. For your example above I'd do :%s/^/"/ and :%s/$/",/ Unless I use a feature regularly I find it's a higher cognative load. I use bash, sed and perl regexps on a near daily basis. Macros are very rare.
Likewise - with visual mode it's normally pretty quick to select an area and do a basic regex, even for things like re-indentation (auto-completes to something like :' s/^/\t/) even though I'm sure there's a 'proper' way to do that
Re: Intermediate Vim
#86Re: Intermediate Vim
#87“If you’re like me and never learned to touch type properly, just use the arrow keys, it’s fine, don’t worry about it.” Are touch typists rare these days? I feel like people these days forego even learning to type properly. I dont understand why they refuse to just learn it, it is such an essential skill to have.
Re: Intermediate Vim
#88One thing I miss on Vim I have on Spacemacs with the Evil layer is the "a" object (for "argument"). With it I can delete/change an argument of a function in a flash. Example (cursor on the last arg): importAntigravity(usePython, crashTheUniverse) importAntigravity(usePython)
I use it all the time! The only reason I don't use Spacemacs is the startup time/GUI lag, but if it works for you keep at it!
Re: Intermediate Vim
#89Earlier quoted context omitted.
My favorite newish-to-me macro trick is to use "recursive macros" -- macros that call themselves at the end, eg `qa[do something]@aq`. The idea (at least for me so far) is to record a line-wise action that goes to the next line before calling itself and will fail on the first non-matching line. For example, if you need to put some text after the first `0`, using commands like `t` or `f` to get there will fail if ther…
A slight alternative to recursive macros, macros are repeatable actions, so this works: 100@a I use it so I can run the macro in batches a couple times and check if I made any mistakes, before picking an absurdly high number to hit the whole file.
:'normal @q
to apply the macro (in q) to that region. You might want to remap the above command to some shortcut if you find it useful often.
Re: Intermediate Vim
#90Earlier quoted context omitted.
I've used vim for a couple of decades, but never pushed to many advanced features. For your example above I'd do :%s/^/"/ and :%s/$/",/ Unless I use a feature regularly I find it's a higher cognative load. I use bash, sed and perl regexps on a near daily basis. Macros are very rare.
For that same example, you can accomplish the job in one substitute command: :%s/.*/"&",/ The & special character gets replaced with the whole matched pattern.