Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning messages on resource `.nvimrc` about utf #3435

Closed
jbaum98 opened this issue Oct 8, 2015 · 7 comments

Comments

Projects
None yet
4 participants
@jbaum98
Copy link

commented Oct 8, 2015

My .nvimrc contains the following lines:

scriptencoding utf-8
set encoding=utf-8
set fileencoding=utf-8

When I execute :so ~/.nvimrc, I get the following error messages:

Error detected while processing /home/jake/.nvimrc:
line    4:
E905: Cannot set this option after startup: encoding=utf-8

This only happens in neovim, not in vim. I'm on Ubuntu Trusty with Vim 7.4 and Neovim 0.0.0-alpha+201510042257 (compiled Oct 7 2015 15:39:03)

@justinmk

This comment has been minimized.

Copy link
Member

commented Oct 8, 2015

Read the help.

@justinmk justinmk closed this Oct 8, 2015

@languitar

This comment has been minimized.

Copy link

commented Jun 16, 2016

What is the solution to this? I can't find anything in the help how to overcome this apart from the reason why it doesn't work.

@justinmk

This comment has been minimized.

Copy link
Member

commented Jun 16, 2016

You don't need to set this option, it is utf8 by default.

And it is not settable after startup because of the reasons mentioned in the help. Why would you want to set it after startup?

@jamessan

This comment has been minimized.

Copy link
Member

commented Jun 16, 2016

Even in Vim, there's no reason to set 'encoding' again after the initial sourcing of your vimrc. It's best to guard it if you really want to be able to re-:source your vimrc during a running session, just like you need to do for various other things that may be in your vimrc.

if !exists('g:encoding_set') || !has('nvim')
    set encoding=utf-8
    let g:encoding_set = 1
endif
scriptencoding utf-8
setglobal fileencoding=utf-8

Everything encoding related should be performed after 'encoding' is set and then 'encoding' should never be changed again for that session.

@languitar

This comment has been minimized.

Copy link

commented Jun 16, 2016

Ok, but scriptencoding should probably also go into the if section. I get the same warning for this setting.

@jamessan

This comment has been minimized.

Copy link
Member

commented Jun 16, 2016

Are you sure you're sourcing the right file? :scriptencoding shouldn't be causing the E905 warning.

@languitar

This comment has been minimized.

Copy link

commented Jun 16, 2016

Strange, you are right. I thought I also received a warning there.

adityam added a commit to adityam/vim-context that referenced this issue Aug 12, 2016

Remove encoding=utf8
It gives an error message in neovim. Based on the discussion on
neovim/neovim#3435
one should only set it in .vimrc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.