• Member for 6 years, 11 months
  • Last seen more than a week ago
How can I open very large files with good performance?
Accepted answer
57 votes

First, try loading vim with no plugins or vimrc: vim -u NONE gargantuan.txt If this is substantially faster, then you probably have syntax highlighting, folding, plugins, or something else going on ...

View answer
How do I jump to the location of my last edit?
30 votes

Here's another approach that fits your given scenario, and will jump to where you were immediately prior to the gg (not to the last changed line). Use CtrlO When you press gg, your old cursor ...

View answer
How can I copy text to the system clipboard from Vim?
21 votes

The other answers cover how to copy text from your buffer into the system clipboard. Another common operation is to copy text from another register to the clipboard. For example, if you've already ...

View answer
How to comment out a set of lines which are selected in visual mode?
19 votes

If you just need a quick solution for whatever language you're currently in, and you already have the text selected in visual mode, then :norm 0i# does the job. (For each line, in normal mode, go to ...

View answer
How can I safely undo changes that I may or may not have made?
Accepted answer
14 votes

Invoke :undolist to see when you made the last set of changes. If it says that there were a few changes made, e.g., "3 seconds ago," and you know that you only intentionally changed it, say, a ...

View answer
Autocorrect spelling mistakes
11 votes

I would recommend against automatically fixing every word that is marked wrong, for two reasons. First, you'll get a lot of false positives on things you meant to type, especially in more technical ...

View answer
How do I move vertically until reaching a non-whitespace character?
Accepted answer
10 votes

How about this function? function FloatUp() while line(".") > 1 \ && (strlen(getline(".")) < col(".") \ || getline(".")[col(".") - 1] =~ '\s') ...

View answer
How can I use Vim's spellcheck with ‘smart quotes’
Accepted answer
7 votes

$ grep "'" /usr/share/dict/words | wc -l 26226 $ grep -i python /usr/share/dict/words Python Python's python python's pythons The problem is that all these words with apostrophes are actually in your ...

View answer
How can text be moved from one register to an arbitrary number of registers?
6 votes

Using getreg and setreg To copy from q to registers 1–5: let src=getreg('q', 1) for i in range(1, 5) call setreg(i, src) endfor To copy to a more general list: let src=getreg('q', 1) for ...

View answer
Automatically delete closing pair without causing unbalanced pairs
1 votes

If I understand your question correctly, the key is to determine whether the character on the cursor is a matched delimiter. Consider the normal mode commands v%"zy and v%%"zy. If the cursor is on a ...

View answer