3 ms·
>In most text editors you might grab your mouse and click on one end and drag through to the other end of the text and press backspace. In vim you can just tell
by nnoitra 5y ago
>In most text editors you might grab your mouse and click on one end and drag through to the other end of the text and press backspace. In vim you can just tell your editor to delete the paragraph. Or maybe you want to change what's inside the parentheses, so you tell your editor you want to change what's inside the parentheses and you do that. If anything, the 'normal' way of text editing has almost nothing to do with how my mind models editing text while vim allows me to tell the editor exactly what I want it to do and it performs it.
That's the problem with telling the editor to do exactly what you tell it to do. Telling a machine to do exactly what you want is programming. For text editing doing what I want with 95% percent precision is more than enough. If that fails I can press CTRL + Backspace to delete few more words. How would you delete a paragraph in vim? I reckon something like:
1) Visually see the line where the paragraph is
2) Jump to that line with 100 gg
3) Run another command to delete the paragraph. Now again some thinking needs here is it a code block between curly braces {} or is it a textual paragraph but why is that thinking required when I can actually see it in front of me and select it.
4) Get back to insert mode
In a normal text-editor:
1) Visually see the line and select it with cursor and delete it.
- aw1621107 5y ago> How would you delete a paragraph in vim? I reckon something like: <snip> I think more experienced vim users would use "dip" for text (<d>elete <i>n <p>aragraph) or "di}"/"di{" (<d>elete <i>n <brace>) for stuff in braces. If you want to change something instead? "cip" (<c>hange <i>n <p>aragraph) or "ci{"/"ci}" (<c>hange <i>n <braces>).
- least 5y agoThis is just making it all the more apparent that you didn't really grok vim while you were using it. to get to a paragraph you can use navigation keys, you can click on it with your mouse, you can jump to a line directly by its number, relative or absolute, you can search for a snippet of text inside of it. There's a myriad of ways you can move your cursor so that you can perform actions on a specific block of text, which includes the way you would do so in a normal text editor. > Now again some thinking needs here is it a code block between curly braces {} or is it a textual paragraph but why is that thinking required when I can actually see it in front of me and select it. There is almost no overhead to performing this action when you are even modestly proficient in vim, no more than the cognitive load it takes you to decide you must use a mouse to select that portion of text, which also requires more precision since you must accurately place the cursor both at the start and end points.
- nnoitra 5y agoAgain going to a line with cursor is not even enabled by default on vim. Instead we have to add "set mouse=a" in .vimrc. I guess it's a luxury to be able to do that so one needs to lookup online for how to enable very basic and core features.
- least 5y agoYou had to learn how to use a cursor at some point in your life and you had to learn how to edit text in the fashion that you do as well.
- drekipus 5y ago>How would you delete a paragraph in vim? I reckon something like ... `dip` will delete all contiguous lines (ie: lines between blanks) `cip` will change in paragraph, (delete text and then put you in insert mode) Here's another one: if the cursor is in the middle of a line, and you want to delete the rest of the line to change it, do you click and drag the mouse? Our do you hold shift, press down, backspace, and then press up again to get back to where you were? I just press `C` The vim "every key is a command" mode is called `normal` for a reason