Earlier quoted context omitted.
Lord, that's so useful. I normally include a move to next line part in my macro and then guess at how many times to run it (20@q, repeat until I get it right). It's actually the main reason I often don't bother using macros. This is such a great tip. Thanks!
You can combine regexes with macros if you only wish to run your macro on a particular set of lines: :' g/foobar/norm @q will run the macro only on the subset of selected lines that match the regex "foobar". :g/.../ will match the regex against all lines in the file.
How to boost your Vim productivity
111–120 of 130 posts
Re: How to boost your Vim productivity
#112Earlier quoted context omitted.
Pardon, it might have been a trivial example. I managed to find a real-world example I encountered in February this year. The PAPI library has a utility program papi_avail which prints a table of supported performance counters. The lines may look like this: PAPI_VEC_SP 0x80000069 Yes Single precision vector/SIMD instructions PAPI_VEC_DP 0x8000006a Yes Double precision vector/SIMD instructions PAPI_REF_CYC 0x8000006b…
You can do this with a few shortcuts in sublime. It requires about the same number of keystrokes, but far less cognitive overhead. { down { down { to insert all three leftmost brackets. up up up to go to first bracket. shift+left to select first bracket. cmd+d cmd+d cmd+d to select all three next brackets including the first. ctrl+shift right to move all three cursors to the end of word. comma space " to type your ch…
Re: How to boost your Vim productivity
#113Earlier quoted context omitted.
Er, I've done this with Visual Studio... just export your settings as an XML file, import them in the new install, and of course install VsVim[1], and you're good to go. [1] https://github.com/jaredpar/VsVim
Big difference: 1. You have to import/export every time a change is made! 2. Visual Studio takes like 6 hours to install.
2. I install VS quite a bit, it's not that long at all. More time than sublime et all though, agreed. I usually have it as my "parallel" process while I go clone my repos.
Re: How to boost your Vim productivity
#114Re: How to boost your Vim productivity
#115Earlier quoted context omitted.
I just spent minutes to parse that instruction. Mind blown. Thank you for this enlightenment.
You need to know how dw, de, cw, ce relate to each other, when the cursor is on a token character vs. a whitespace character, and so on, in order for this to be truly useful -- but luckily, ordinary practice with those commands in Vim can lead to an efficient internal idea of how it works. "You get used to it, though. Your brain does the translating. I don't even see the code. All I see is blonde, brunette, redhead."
Re: How to boost your Vim productivity
#116Step 1 for those who really want to boost productivity (but let's be honest, most of us don't!): forget about all those plugins that are time sinks to configure and integrate with each other, about obscure tweaks that take half a day to get right, and about elaborate .vimrc's that take you so far away from 'standard' that you're crippled without them. Stick to a fairly basic standard install and a .vimrc of 50 lines,…
I've been cutting down on plugin use and esoteric mappings because of similar reasons but 50 is really small. I still hover around 10ish plugins, some of them are language dependent to help with indentation. Some of them just aid in intergrating with tmux or git, make it just a bit easier to open a file (ctrlp), or some show syntax errors. Without stuff like that I'm still fine should I find myself on a remote machin…
From memory I've only changed about 5 lines in my vimrc ? enabling mouse and setting indentation levels for some less common filetypes.
Re: How to boost your Vim productivity
#117Earlier quoted context omitted.
FYI: there is a setting that flips everything around – F1 to get F1, Fn+F1 to lower the brightness.
But it's also not the default (at least on OSX).
Re: How to boost your Vim productivity
#118Earlier quoted context omitted.
Isn't :%s/.)/hello)/ simpler? Maybe that's because I know nothing about macros. Thanks for the explanation.
Pardon, it might have been a trivial example. I managed to find a real-world example I encountered in February this year. The PAPI library has a utility program papi_avail which prints a table of supported performance counters. The lines may look like this: PAPI_VEC_SP 0x80000069 Yes Single precision vector/SIMD instructions PAPI_VEC_DP 0x8000006a Yes Double precision vector/SIMD instructions PAPI_REF_CYC 0x8000006b…
Re: How to boost your Vim productivity
#119Earlier quoted context omitted.
Additionally, on many keyboards (specifically Apple keyboards), you have to hit a modifier key plus the function key. For example, you have to hit Fn + F1 to get F1 because otherwise it's the "Lower LCD Brightness" hotkey. This makes them even less useful.
FYI: there is a setting that flips everything around – F1 to get F1, Fn+F1 to lower the brightness.
The sad thing is that I've personally experienced all three of these problems. #%^$ whoever decided that the Function keys should be brightness etc by default.