vim interview questions
Top vim frequently asked interview questions
I'd like to search for an upper case word, for example COPYRIGHT in a file. I tried performing a search like:
/copyright/i # Doesn't work
but it doesn't work. I know that in Perl, if I give the i
flag into a regex it will turn the regex into a case-insensitive regex. It seems that Vim has its own way to indicate a case-insensitive regex.
Source: (StackOverflow)
How do I duplicate a whole line in Vim in a similar way to Ctrl+D in IntelliJ IDEA/Resharper or Ctrl+Alt+↑/↓ in Eclipse?
Source: (StackOverflow)
I'm stuck and cannot escape. It says:
"type :quit<Enter> to quit VIM"
but when I type that it simply appears in the object body.
Source: (StackOverflow)
In Vim, what is the command to correct the indentation of all the lines?
Often times I'll copy and paste code into a remote terminal and have the whole thing messed up. I want to fix this in one fell swoop.
Source: (StackOverflow)
How can you switch your current windows from horizontal split to vertical split and vice versa in Vim?
I did that a moment ago by accident but I cannot find the key again.
Source: (StackOverflow)
I would prefer to write my commit messages in vim
, but it is opening in emacs
.
How do I configure git to always use vim
? Note that I want to do this globally, not just for a single project.
Source: (StackOverflow)
I keep seeing the recording
message at the bottom of my gvim 7.2 window.
What is it and how do I turn it off?
Source: (StackOverflow)
Should be trivial, and it might even be in the help, but I can't figure out how to navigate it. How do I indent multiple lines quickly in vi?
Source: (StackOverflow)
I see <leader>
in many .vimrc files, and I am wondering what the meaning of it is? What is it used for? Just a general overview of the purpose and usage.
Source: (StackOverflow)
If I open files I created in Windows, the lines all end with ^M
.
How do I delete them all in once?
Source: (StackOverflow)
I'm trying to replace each ,
in the current file by a new line:
:%s/,/\n/g
But it inserts what looks like a ^@
instead of an actual newline. The file is not in DOS mode or anything.
What should I do?
EDIT: If you are curious, like me, check the question Why is \r a newline for Vim? as well.
Source: (StackOverflow)
How do I make vi-Vim never use tabs (converting spaces to tabs, bad!), makes the tab key == 4 spaces, and automatically indent code after curly brace blocks like Emacs does?
Also, how do I save these settings so I never have to input them again?
I've seen other questions related to this, but it always seems to be a little off from what I want.
Source: (StackOverflow)