vimrc

How to easily test for guifont in vimrc?

I have many different machines that I am logging into and none of them have decent fonts in common. So, I would like to be able to have my first preferance for a font but if it does not exist on the machine use another one and so on. Has anyone done this before? ... So after re-reading the help on guifont it seems that I should be able...

How to share one vimrc file among multiple clients?

I am not a very orderly person at times and I often find myself in the situation of loosing my old fully tweaked vimrc file and having to start over all again. Or having different versions of vimrc files on different clients. Since this mess is getting out of hand for me, I would like to know if there is a good way of managing your vimrc...

VIM Disable Automatic Newline At End Of File

So I work in a PHP shop, and we all use different editors, and we all have to work on windows. I use vim, and everyone in the shop keeps complaining that whenever I edit a file there is a newline at the bottom. I've searched around and found that this is a documented behavior of vi & vim... but I was wondering if there was some way to d...

Same _vimrc, two different computers.

I have one folder synced between two computers (using one of online sync tools). I have gVim installed in this folder and I am wondering, is there a way, that I can distinguish those two computers in _vimrc file? I know that testing with if has("win32") ... elseif has("macunix") ... endif I can check different operating syst...

Vim comma command keys

I downloaded this vimrc file. It contains entries for mapping comma seperated keys to certain commands. ie: map ,e :e <C-R>=expand("%:p:h") . "/" <CR> What i can't figure out is how to run these commands in Vim. How to i run ",e"? ...

Vim customization -- .vimrc -- mapping of keys

Vim customization -- I have added these lines in my .vimrc inoremap /* /**/< Left > what i intend is, when in press open comments /* -- it should automically print the closing comment. when in comments, what do i add to .vimrc, so that when in comments block at each enter, an "*" is printed at the next line. / * * * ...

vim getting the current value of vim foldmarker

How do you find the value of vim variables that are set with one word commands such as :set foldmarker={,} I'm writing a simple custom function for foldtext() to set a custom one line summary of the folded region it works great but looks funny when I open a documents with any fold marker other than what I've hard coded into the funct...

VIM: Zero-Indexed Line Numbers in :set number

Using VIM, it is easy to display line numbers for any given file with: :set number However, the line numbering is 1-indexed, this means that the numbering starts at 1. Normally this is exactly what i want, however a particular tool I am using to compile my code reports zero-indexed line numbers - that is, line numbers start at zero. ...

Vim cursor shape question

I currently use MacVim for a lot of my editor needs but occasionally I need to edit files remotely over ssh. In MacVim the shape of the cursor varies depending on your current mode, i.e. command mode -> block cursor, insert mode -> vertical bar cursor, which I find very helpful. Is there a way to replicate this behavior in a .vimrc fil...

"Minimizing" vertical VIM window splits

I use horizontal and vertical window splits in religiously in VIM and up until recently, I enjoyed the comfort of two commands to effectively hide (or minimize) my horizontal splits. I set them up adding the following lines to my .vimrc file: set winminheight=0 map <C-J> <C-W>j<C-W>_ map <C-K> <C-W>k<C-W>_ Hitting Control-j or Control...

Very strange behavior with Vim syntax and filetype detection

I have a file, called WrongFileTypeDetection.R, containing the following text: # This file is sometimes wrongly detected as a conf file I also have two versions of _vimrc, that I would have thought to be absolutely identical. However, when I use the first version, the above file is incorrectly detected as a "conf" file, even though I...

Quicker way to enter ex mode in vim?

Is there a somewhat orthodox way to enter ex mode faster, like with a single key stroke, instead of hitting shift-; for ':'? Why was that character ever chosen for such a frequently accessed mode? Often enough to be annoying I'll accidentally miss the shift key, start typing an ex command, and find I have a lot to undo. Thanks for you...

Vim: write back my file on each key press

I'd like vim to automatically write my file as often as possible. The ideal would be every keystroke. I need to save regularly so that my background build process will see it. It's a makefile for a latex document, and I'd like the previewer to show me a nearly up-to-date document when I'm finished typing. Eventual answer (the answers b...

Vim oddities in keymapping.

I like to insert blank lines without entering insert mode and I used this keymapping: nomap go o <esc> This does create the blank line but introduces some weird behaviour. I have smart indent and autoindent set. The new line follows the indents but doesn't remove them even though doing so manually automatically removes the redundant w...

Vim LocateFile Plugin with fastfind

I built a fastfind database as mentioned in the following link as mentioned in the Unix Power Tools book. FastFind db is nothing but a file which contains a list of files in my project and I wrote a script to search the list for faster lookup. Now, I would like to integrate this script with lookupfile plugin. From the lookupfile plugin...

vimrc - current working directory

I would like to be able to access the current working directory in my vimrc. For example, I can access the current file by using %. Specifically, I have the following line in my vimrc: map ,l :!latex % When it runs everything works fine, except the resulting dvi and other files are stored in my home directory instead of my current work...

Vi /Vim restore opened files

Hi, I was wondering if this common IDE feature is available. Suppose i open many files using VIM, using vsplit and split. Then , I close everthing. The next day, i want to recover those files. That is, recover the way they were opened, not having to open each one (using split and vsplit) again. Is that possible? UPDATE: Using :mkse...

Vim: C++ symbols' color

VIM: Is it possible to change the color of these symbols: ~!%^&*()-+=[]{},.<>?:/; like Visual Studio does? ...

Automatically center vim search results

When I do a search with vim or gvim, the resulting positioning of the cursor within the window is somewhat random, all too frequently landing on the last (or first) line in the window. Search highlighting helps, but it's still cumbersome to have to look all around on the screen to find the cursor ... and a bit ironic, that after vim loc...

How do I use my .vimrc file in Cygwin?

I just installed Cygwin on my work machine and would like to use the .vimrc file I use on my Linux box at home. Is that possible, or does it need to have Cygwin-specific settings? Where would I put the .vimrc file? I'm a little unsure of what directory I'm being dropped into at the bash prompt under Cygwin, but I think I'd create a s...