4

I found when i use the command sudo vim /etc/www/main.wsgi the vim said:

neocomplcache disabled: "sudo vim" is detected and $HOME is set to your user's home. You may want to use the sudo.vim plugin, the "-H" option with "sudo" or set always_set_home in /etc/sudoers instead. Press ENTER or type command to continue

and when i ENTER and edit file, the neocomplcache seems goes wrong function.

the i search the google, I found the command vim sudo:/etc/www/main.wsgi but it seems doesn't use my own .vimrc configure file.

so, what you others to do ?

1 Answer 1

5

Add following mapping to your vimrc:

" Editing a protected file as 'sudo'
cmap W w !sudo tee % >/dev/null<CR>

Now edit the protected files as you normally do:

vim /etc/www/main.wsgi

but when you want to save the changes use :W instead of :w, vim will prompt for a sudo password, enter your sudo password and hit Enter. That's it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.