My guess is that vim is not reading your personal .exrc (or whatever vim uses) since the uid doesn't match what you are running but doesn't use root's since the HOME environment points to your homedir, not root's. Try using "sudo -H vi test.txt" and see if that changes things. - todd