gvim interview questions
Top gvim frequently asked interview questions
A small but visually pleasing feature, and slightly adding to usability, I'd like to have Vim use different background color for the active window.
Here's a sketch of what I am after:

Normally that vim would have all the background in black, but if only the active window had its own color to highlight user's attention. Highlighting just the statusbar only isn't enough!
Source: (StackOverflow)
There is a part in my ~/.bashrc
, which sets $EDITOR to be gvim. It works fine when I am in X window. However, if I ssh to my workstation (from another workstation) gvim starts to complain "cannot open display".
Therefore I wish to put an if
statement in bashrc, that if X window is available then use gvim, otherwise let it be vim.
How could I achieve that?
Source: (StackOverflow)
Undo is nice to have in Vim. But sometimes, at a known good point, I want to erase my undo history - to be able to use u
to undo individual changes, but only back to a certain point. (For instance, this might be when I last committed.)
One way to accomplish this would be to close and reopen the file - the undo history starts clean at that point. But that's a hassle.
In the past, I accomplished this with :edit!
. But in Vim 7.3, that doesn't discard the undo history.
Is there another way to do this, apart from closing the file?
Source: (StackOverflow)
For example, if I type ':pwd
' to get the current working directory, I can select the text in gvim but I can't figure out how to copy it to the clipboard. If I try the same in console vim, I can't even select it with the mouse. I would like this to work with all vim commands, such as set guifont
to copy the guifont=Consolas:h10:cANSI
output.
Source: (StackOverflow)
When I open a new tab with different path from the previous file in VIM, NERDTree will still remains the same directory hierarchy of the previous file.
Is there a sync shortcut to change the current root directory to the new opened file's directory?
Source: (StackOverflow)
In GVIM for Windows I know you are supposed to be able to add something to the $VIM/_vimrc
file in order to customize the start up and I have managed how to figure out a few neat tricks with that but I can't figure out how to change the default color settings. Right now every time I start vim, I have to type
:color pablo
before I can do any work (black on white bothers me when coding in anything but Java). I feel like this is 12 extra keystrokes I shouldn't have to be making every time I start vim. Is there a way I can have vim start using this setting by default?
Source: (StackOverflow)
Must be something super obvious, but I can't figure out, and Google is not helping out either.
Source: (StackOverflow)
Say I am editing some file with vim (or gvim). I have no idea about the file's encoding and I want to know whether it is in UTF-8 or ISO-8859-1 or whatever? Can I somehow tell vim to show me what encoding is used?
Source: (StackOverflow)
I'd like to remove some of the default icons and maybe add one or two icons of my own. For example, it would be nice if there were icons for the NerdTree and the Taglist.
Source: (StackOverflow)
I use a terminal with white text on black background (I just like it better), so I wrote the following line in my .vimrc
file:
set background=dark
However, gvim
has black on white text. How do I do either of the following:
- Set the background of
gvim
to black
- Check in
.vimrc
if I'm using gvim
I tried this: I started up gvim
, and typed echo &term
. The answer was "builtin_gui". So I wrote the following into .vimrc
:
if &term == "builtin_gui"
set background=light
else
set background=dark
endif
Somehow, it didn't work.
Source: (StackOverflow)
I've investigated a few ways to maintain a list of open buffers in Vim, and some of them are very good, but none of them seem to behave the way I'd like. It's very possible that nothing like what I want exists, and it can't hurt to ask.
I've been using NERDTree in GVim, and I like the idea of putting the information in a slender left-hand window. I've put together a handy diagram for how I'd like my environment to look:
|--------|---------------------------------------|
| | |
| | |
|NERDTree| Windows |
| | |
| | |
| | |
|--------| |
| | |
| | |
| List | |
| of | |
| Open | |
| Buffers| |
| | |
| | |
|--------|---------------------------------------|
So my question is: Is there a vim-native or plugin-enabled way to maintain a list of currently open buffers and select/edit/close from that list, inside a window similar to NERDTree?
I understand that this approach may be incongruous with the Vim way of doing things, and if you feel like I'm missing something about how to manage multiple files in a Vim session, please leave a comment with suggestions!
Source: (StackOverflow)
in most GUI text editor I can use ctrl click to open multiple files at once.
I can't do that in gvim.
What the gvim way to do it?
Tnx.
-edit-
...using gui way instead of command line.
Source: (StackOverflow)
I'm trying to get started with things like FuzzyFinder, but I am stuck at the point where it says:
INSTALLATION
Put all files into your runtime directory. If you have the zip file, extract
it to your runtime directory.
You should place the files as follows:
your_runtime_directory/plugin/fuf.vim
...
What is a "runtime directory"? What goes in there? Where is mine?
Source: (StackOverflow)
I enjoy using vim, its endless features and the way it does things (for the most part). I've been using it on and off (not as my main editor) for at least 7 years now, so while I'm far from being an expert, I generally know my way around it.
Now, while I love it in the command-line, I'd really like it to be my main editor in Windows and Linux GUIs. But... gvim... is horrible. It breaks so many usability "rules" on Windows that it's not even worth fighting with it. Not even Cream, with its changes and fancy .vimrc, saves the day.
So, my question is: is there a modern vim GUI for Windows and Linux that makes it look and behave as most GUI editors? Having Sublime Text, Kate, TextMate or Editra's GUI with vim's features would be incredible. I realize all four (as well as many other editors) have plugins that sort of makes them behave like vim, but it's nowhere close (at least for Editra and Sublime Text, not sure for the others) the real vim.
Vim being open source, I'm really not sure why there hasn't been a complete GUI overhaul yet. Do people not use gvim?
Source: (StackOverflow)