One thing I've never been able to figure out in Vim: why does O (insert new line above the current line and enter insert mode) often wait and hang? And when you start typing, it'll sometimes do random stuff? Is there a way to just make it behave like a true counterpart of o (insert new line below and enter insert mode)?
A Vim Guide for Advanced Users
171–179 of 179 posts
Re: A Vim Guide for Advanced Users
#172gx is cool, but seems broken on mac at the moment: https://github.com/vim/vim/issues/4738
Re: A Vim Guide for Advanced Users
#173The article mentions ”gn” in passing, but it doesn’t give it enough credit: this is an enormously useful motion, almost more useful on its own than the rest of the article. The thing that makes it golden is that it is a motion, and thus combined with a command, it is repeatable! So, like: 1. Search for something (either using / or *). 2. Type ”cgn” in Normal mode (i.e. change next search match) and replace what you s…
Re: A Vim Guide for Advanced Users
#174One thing I've never been able to figure out in Vim: why does O (insert new line above the current line and enter insert mode) often wait and hang? And when you start typing, it'll sometimes do random stuff? Is there a way to just make it behave like a true counterpart of o (insert new line below and enter insert mode)?
set timeout timeoutlen=1000 ttimeoutlen=100 " Fix slow O inserts
Re: A Vim Guide for Advanced Users
#175One of my goals is to become a really good vim power user. I am not able to pick up all of these but one here and there. In the first command gf, once new file opened and then closed (wq), is there a a way to close such that the previous file that was originally opened to return? At moment returning back to shell prompt. Also curious if there is a way to open the file as a new split screen rather than replacing the e…
Re: A Vim Guide for Advanced Users
#176This was a really nice refresher and I learned a few new cool tricks (like gx). I'm a bit surprised that the 'u' flag for sort wasn't mentioned. That's the most useful one in my mind and I use it almost every time.
... I forgot it :D I'll fix that. Thanks to point it out :)
Re: A Vim Guide for Advanced Users
#177gx is cool, but seems broken on mac at the moment: https://github.com/vim/vim/issues/4738
Re: A Vim Guide for Advanced Users
#178Earlier quoted context omitted.
The u option making it keep only unique lines, for anyone else left wondering. Personally, instead of re-learning how to do stuff with vim-sepecific commands, I just use the existing command line tool, especially since I don't do this on a daily/weekly basis (but I use sort in command line pipes at least weekly). The command is literally "sort" and for unique you just pass the -u flag, e.g. select something in Vim an…
Vim's sort is handy on Windows where the option to shell out usually doesn't exist. Additionally you have the full power of Vim regex to sort on subsets of lines.