Public bug reported:
Binary package hint: vim
Description:
When running vim for the first time, if you run it with sudo (e.g. "sudo
vim /tmp/file.txt"), the $HOME/.viminfo file is created with root:root
permissions, and the usual vim session environment (e.g. command
history, markers) does not work anymore until you fix .viminfo
permissions.
Steps do reproduce the problem:
1) Remove previous .viminfo file:
$ rm -f ~/.viminfo
2) Run vim with sudo to edit a file:
$ sudo vim /tmp/test1.txt
3) Run commands in normal mode (e.g. :1d, :wq), save the file and exit.
4) Run vim again, this time as a normal user:
$ vim /tmp/test2.txt
5) Type, in normal mode, ":history". You should see:
# cmd history
> 1 history
Note the commands typed in previous session are not listed. From now on,
any commands typed will not be saved to the .viminfo file, because of
its wrong permissions:
$ ls -l ~/.viminfo
-rw------- 1 root root 593 2007-03-18 12:43 .viminfo
Workaround:
- Create a empty .viminfo in /etc/skel/, so new accounts have vim
history working properly from the beginning:
# touch /etc/skel/.viminfo
- Fix .viminfo permissions for existing users. For each existing user on
the system, run (as the user):
$ sudo chown $(id -u):$(id -g) .viminfo
** Affects: vim (Ubuntu)
Importance: Undecided
Status: Unconfirmed
--
Wrong .viminfo creation permissions when running "sudo vim"
https://launchpad.net/bugs/93449
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs