View Full Version : Fedora Core 9: VIM ignores .vimrc

26th July 2008, 04:39 PM
Upgraded to FC9 a few days ago and after initially being wowed by the new look and feel I'm starting to have reservations! There seem to be loads of little annoyances which I don't remember from FC6.

Has anyone had VIM ignoring the contents of ~/.vimrc yet?
I do not want auto formatting of any description when writing native 'C' and - after a search of the vim options in the online reference manual - I set things like 'formatoptions=""' which is the recommended way of having no format options.

I go back into vim vis; vim my-C-program.c and enter a single line comment:
// This is the comment I want in there

When I hit newline I get an auto-generated comment at the start of the next line!!!!!!

Frustrated - I type ':set formatoptions' and get the reply;

This is NOT what I asked for waiter!!!
I checked /etc/vimrc and (surprisingly!) there are NO default format options set in there - so it can't be a hangover from the global rc file.

What do I have to beat to death to give me command of my own word processor?

If anyone can point me in the right general direction I'd be very happy.
Thanks in advance.....

26th July 2008, 05:08 PM
Should have said earlier that I've proved my ~/.vimrc file IS being executed by placing a;

set undefinedoption=silly

in there are getting a whinge from vim when it starts up.

Also; if I "set formatoptions=" while inside my edit session, it takes and works correctly. i.e. Formatting is turned off.

I'm certain it's just the line in .vimrc that is being ignored or defaulted somehow.
It definitely isn't doing what the ref manual says it should be - for certain. :confused:

Anyone else seen this?

26th July 2008, 05:15 PM
Use a ~/.vimrc that works ;)

Here's mine (http://rafb.net/p/EC3BkE48.html).

26th July 2008, 05:47 PM
One thing I've found is that sometimes you need to specify vim-enhanced. That is, if I type vi at a command prompt, I get vim-minimal, (I think--or maybe it is just vi.)

I forget the playing around I did to get it to work the way I wanted, but I think I had to specifically install vim-enhanced, and on at least one machine, type vim rather than vi.

Otherwise, as you've seen, it will acknowledge errors, but it will ignore things like set ruler.

Doing rpm -qa |grep vim should show you if you have the vim-enhanced installed.

26th July 2008, 07:02 PM
In ~/.bashrc

alias vi=/usr/bin/vim
# For vim in Arch: http://bbs.archlinux.org/viewtopic.php?id=36221
# So that it actually uses ~/.vimrc
export EDITOR=vim
export VISUAL=vim

26th July 2008, 08:37 PM
as scottro says, if you install vim-enhanced then vi gets aliased to vim automagically for normal users

$ which vi
alias vi='vim'

For root and user ids below id 100 it doesn't

$ cat /etc/profile.d/vim.sh
if [ -n "$BASH_VERSION" -o -n "$KSH_VERSION" -o -n "$ZSH_VERSION" ]; then
[ -x //usr/bin/id ] || return
[ `//usr/bin/id -u` -le 100 ] && return
# for bash and zsh, only if no alias is already set
alias vi >/dev/null 2>&1 || alias vi=vim

# which vi

26th July 2008, 08:45 PM
vim-enhanced also installs the vi help tutorial, which no one seems to bother using ;)

26th July 2008, 08:54 PM
Many thanks guys for the responses.

Thank you also Brebs for the demo .vimrc that works.
I have vim-enhanced installed anyway but I'll check that it has replaced the standard vi alias - that just might be why some of the vimrc commands get executed properly and some don't.

Thank you all again - I've got some good data to work with now.