4 ms·
can you give more examples of <C-x><C-n> in code editing? I have tested that out in vim and its cool but i cant think of times I want to repeat a series in anot
by Exuma 7y ago
can you give more examples of <C-x><C-n> in code editing? I have tested that out in vim and its cool but i cant think of times I want to repeat a series in another part of the document, perhaps I'm just very uncreative right now
Thanks
- godelski 7y agoTotally. But I will tell you, <C-x> is a habit built around the other options too. So I just use <C-x> on any completion (which I frequently use <C-x><C-f>). Here's a dumb example (dumb because there's other ways to do it that are better) Let's say I'm overloading a function. void foo(int a, int b) {} I could do v<C-x><C-p> until I fill in the b, then type ", int c)". Now it'd be totally easier to do "v<C-x><C-l> backspace , int c)", but that's a different point. Maybe this one is a little more useful "def _<C-x><C-p><C-x><C-p>" may expand to "def __init__(self" Note that here I'm holding down ctrl and just hitting "xpxp" Honestly I end up finding a lot of patterns in my code just because I started thinking about it this way. It is more one of those things where once you start thinking about it with it in mind you will find patterns. It is also an easy habit to develop, if you already use <C-n>, because when you press ctrl you just also hit x and keep your pinky down on ctrl. I feel like there is just no downside to using <C-x> because in reality it is just one more keystroke, which is done with the other hand (so even less increase in work).
- Exuma 7y agoDude! That is awesome... it makes sense now. I totally didn't even know bout <C-x><C-l> either! Do you rebind your caps to control as well? That was another thing I did which is 10/10
- godelski 7y agoYeah I rebind keys and write my own functions. I have a preference for distilling things that I use out of plugins[0] and into just vanilla vim (I still use plugins). I'll share my configurations[1]. I don't document it well btw and there's frequently changes. But I find that looking at others rc files many times gives me ideas that I hadn't seen before. Also, if you have any suggestions I'd love to hear them. [0]see my git rebindings instead of using tpope's plugin [1]https://github.com/stevenwalton/.dotfiles https://github.com/stevenwalton/.dotfiles
- Exuma 7y agoAwesome! Here's mine. I am busy atm but I will circle back and tell you my favorite tricks. Read my README for most of my favorite tricks. https://github.com/9mm/dotfiles https://github.com/9mm/dotfiles Things that come to mind - ZSH-autocomplete is probably by far my favorite thing ever - iterm3 full overlay with <C-i> means that i have a full overlay terminal immediately available no matter what im doing. No messing with stupid windows - i made my own custom theme etc you can check out Vim favorite things - `gx` opens the current URL under the cursor in your browser - `gq` for word rewrapping comments on the fly - `Bda!` look in my .vimrc for Bda! which deletes all open buffers, useful when youre working and have 40 open buffers you forgot about and want to start fresh I'll think of more later!
- Exuma 7y agoI forgot to mention these are also critical to know, because they apply to pretty much everywhere in OSX (even inside chrome address bar, terminal, plain text areas like the HN reply box, etc): c-f Move forward c-b Move backward c-p Move up c-n Move down c-a Jump to beginning of line c-e Jump to end of line c-d Delete forward c-h Delete backward c-k Delete forward to end of line c-u Delete entire line