Vim is getting more popular. Not just within vim, but outside vim! Practically every full-featured editor has a vi or vim mode, and when they say vi, usually they also mean vim. Things that have nothing to do with vim but are inspired by vim are even sprouting up! And apparently it's OK to name something based on vim: https://groups.google.com/g/vim_use/c/EnSMrx_rGg4/m/d_nVlmLQ... Edit: In Bram's reply he mentioned t…
I used to work near a gym called “Vim Fitness”[0] in Cambridge, MA and there were endless jokes about trainers calling out: “H! J! K! L!” [0] https://vimfitness.com/
A Vim Guide for Advanced Users
91–100 of 179 posts
Re: A Vim Guide for Advanced Users
#92Earlier quoted context omitted.
I was meant to write a blog post like this since forever. Anyway, if you want really advanced stuff this[0] is definitely a way to go. As for ```gx``` since I'm using aerc as my email client, a trick I found very useful to open links using only the keyboard is to open an email then rq (reply with quote) search for the link and gx. 0: https://www.ele.uri.edu/faculty/vetter/Other-stuff/vi/009-in... Edit: add the bit ab…
Do you have any more aerc tricks? I use it and do like it but there's a whole lot of basic things even that I don't know how to do. And some things like saving file attachments that I'm not even sure if it supports or if I'm just clueless
Re: A Vim Guide for Advanced Users
#93One 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…
If I understand the question correctly then the answer is ":bd" after ":w"riting the file. If you just want to switch between buffers (switch between the two files) then use ":b#". You can also list open buffers with ":ls"
Someone recently told me of :tabedit, though, and that is lookin' way nicer to me. But I haven't gotten used to it yet or know how to make it work with gf or other handy things.
As for split screen, those are hotkeys I have yet to learn. If someone has an answer to that question, please reply here so the parent commenter and I both see it :)
Re: A Vim Guide for Advanced Users
#94Nice, but still wondering if I should know vim since nano is enough for me :)
I recommend learning the basics. It's great being able to navigate around a file with the keyboard in ways other than arrow keys to move a line at a time. Stuff like hitting "%" to move between matching parenthesis, { and } to move between paragraphs, etc. And if you do any kind of development, the automatic indentation (and to indent and outdent ranges) are hugely useful. All of these are also things you can use in…
I've mapped cnext and cprev to tab and shift-tab, to make it easy to bounce through things.
Also, in my shell I have defined
alias cbuf='vim - -c cbuffer!'
which lets me do things like "make | cbuf" or "git grep -n foo | cbuf", which is great.Tangentially, all of this plays well with some things I've built out for dealing with diffs (https://github.com/dlthomas/diff-kit) - dklocs will turn a unified diff into location-prefixed changed lines, dkcov will find the intersection of a diff and a coverage report (very useful for answering the question "how did I break that test?"), either of which can be piped right into cbuf.
Re: A Vim Guide for Advanced Users
#95Re: A Vim Guide for Advanced Users
#96One 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…
If you want to return to the previous file without closing the new file, you can just use :bp(rev) so that the new file also stays in memory.
Relevant man page is available at :help buffers.
>Also curious if there is a way to open the file as a new split screen rather than replacing the entire window?
CTRL-W f
Another remark: vim's shortcuts are organized in a way that you are often able to guess what the correct shortcut should be. CTRL-W is the common prefix for commands regarding split windows CTRL-W v/s for splits, CTRL-W CTRL-W cycle through windows. So naturally you can guess that CTRL-W f should be open file in split and CTRL-W ] should be jump to definition in split.
Re: A Vim Guide for Advanced Users
#97One 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…
> is there a a way to close such that the previous file that was originally opened to return? If I understand the question correctly then the answer is ":bd" after ":w"riting the file. If you just want to switch between buffers (switch between the two files) then use ":b#". You can also list open buffers with ":ls" Someone recently told me of :tabedit, though, and that is lookin' way nicer to me. But I haven't gotten…
Re: A Vim Guide for Advanced Users
#98One 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
#99One 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)?
Re: A Vim Guide for Advanced Users
#100One 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)?