Why would I ever want to find every reference to a loop or lambda variable with a given name in a file? Such variables repeat frequently with distinct meanings, and each has a narrow scope.
In any case, I wouldn't use an IDE that was so glitchy unless I was forced by necessity; I certainly wouldn't adopt a coping mechanism for it into other languages. Also, for a typical compiled language, deleting the declaration gives you all usages as long as you can (attempt to) build.
Are there any other reasons?
Edit: Is this advice perhaps intended to be specific to a particular context?
Actually, if your cursor is on the variable "i", just pressing * or # will do the trick. I'm pretty sure other editors have similar functions.
If you really want double-letter names, :%s/\(\<[a-z]\>\)/\1\1/g would probably do the trick (well, except that every occurrence of "a" in a comment will become "aa": how to avoid it is left as exercise).
Just tested it in some different editors with some javascript because I care way too much about editors or something.
Sublime Text 3 captures the independent 'i' correctly. Though it also picks it up in comments and strings.
VS Code incorrectly highlighted all instances of the character 'i', even if it was part of another symbol. "Change All Occurrences" affected all instances of the character 'i'.
Atom doesn't appear to have this feature without plugins (though someone should correct me if I'm wrong).
IntelliJ and it's variants handled it perfectly, even understanding the actual variable, rather than just the symbol. "Rename All" would ask if I wanted to affect strings and comments, or just code (if there was an ' i ' in a string or comment, otherwise it wouldn't prompt), and it would only rename the variable within the correct scope. I tried it with both var and let.
I would try more, but I think I'm wasting too much time, haha. But moreover, like others are saying, I can't think of a time where I've ever actually wanted to do that. Renaming all instances of a single letter variable? Generally the single letter is a very common convention I wouldn't change (i,j,k, u, x,y, _), or is in a very small, uncomplicated function where I wouldn't need a text editor's help to rename it because it only occurs once or twice. Anything more advanced than that gets a more verbose name that any of these editors could easily ctrl+F.
Try searching for all the instances of variable "u" or "i" in a file.
Syntax-aware IDE's fail often enough that I have to rely on "search-and-destroy" far more often than I would prefer.