How to change encoding for an unnamed buffer in VIM?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Is it possible?
I only know how it can be done for a named buffer (file). It should be reopened with
++enc=<encoding>
option. But an unnamed buffer cannot be reopened.
I executed :set encoding=utf-8
but the text displayed in VIM was still unreadable. Only after I saved the buffer to a file, opened it and reopened it with :e ++enc=utf-8
it could be read well. However I noticed that there was an error [ILLEGAL BYTE in line 37]
. But I'm happy with that. The main thing is that the contents are readable.
There was no error when I ran :set encoding=utf-8
, but nothing seemed to happen too.
VIM 7.4
vim character-encoding
add a comment |Â
up vote
0
down vote
favorite
Is it possible?
I only know how it can be done for a named buffer (file). It should be reopened with
++enc=<encoding>
option. But an unnamed buffer cannot be reopened.
I executed :set encoding=utf-8
but the text displayed in VIM was still unreadable. Only after I saved the buffer to a file, opened it and reopened it with :e ++enc=utf-8
it could be read well. However I noticed that there was an error [ILLEGAL BYTE in line 37]
. But I'm happy with that. The main thing is that the contents are readable.
There was no error when I ran :set encoding=utf-8
, but nothing seemed to happen too.
VIM 7.4
vim character-encoding
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Is it possible?
I only know how it can be done for a named buffer (file). It should be reopened with
++enc=<encoding>
option. But an unnamed buffer cannot be reopened.
I executed :set encoding=utf-8
but the text displayed in VIM was still unreadable. Only after I saved the buffer to a file, opened it and reopened it with :e ++enc=utf-8
it could be read well. However I noticed that there was an error [ILLEGAL BYTE in line 37]
. But I'm happy with that. The main thing is that the contents are readable.
There was no error when I ran :set encoding=utf-8
, but nothing seemed to happen too.
VIM 7.4
vim character-encoding
Is it possible?
I only know how it can be done for a named buffer (file). It should be reopened with
++enc=<encoding>
option. But an unnamed buffer cannot be reopened.
I executed :set encoding=utf-8
but the text displayed in VIM was still unreadable. Only after I saved the buffer to a file, opened it and reopened it with :e ++enc=utf-8
it could be read well. However I noticed that there was an error [ILLEGAL BYTE in line 37]
. But I'm happy with that. The main thing is that the contents are readable.
There was no error when I ran :set encoding=utf-8
, but nothing seemed to happen too.
VIM 7.4
vim character-encoding
edited Dec 25 '17 at 10:30
asked Dec 25 '17 at 9:33
ka3ak
536415
536415
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
There's no need to re-open it - while in command mode, you can set the encoding to whatever you like with:
:set encoding=whatever
e.g.
:set encoding=utf-8
BTW, type :help encoding-names
in vim
for a list of supported encodings.
I've tried it, but there may be a difference between '++enc' and 'set encoding'. I'll update my question.
â ka3ak
Dec 25 '17 at 10:06
maybe put it in your ~/.vimrc so that utf-8 is the default encoding (i'm a little surprised it isn't aready the default...unless your .vimrc has decades worth of cruft like mine)
â cas
Dec 25 '17 at 10:21
It is the default encoding. Because if I start vim and execute ':set encoding?' it shows me 'encoding=utf-8'. I don't know whether this is an intentional behaviour or not but '++enc' seems to be able to force encoding regardless whether there are some invalid characters there while 'set encoding' can't.
â ka3ak
Dec 25 '17 at 10:27
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
There's no need to re-open it - while in command mode, you can set the encoding to whatever you like with:
:set encoding=whatever
e.g.
:set encoding=utf-8
BTW, type :help encoding-names
in vim
for a list of supported encodings.
I've tried it, but there may be a difference between '++enc' and 'set encoding'. I'll update my question.
â ka3ak
Dec 25 '17 at 10:06
maybe put it in your ~/.vimrc so that utf-8 is the default encoding (i'm a little surprised it isn't aready the default...unless your .vimrc has decades worth of cruft like mine)
â cas
Dec 25 '17 at 10:21
It is the default encoding. Because if I start vim and execute ':set encoding?' it shows me 'encoding=utf-8'. I don't know whether this is an intentional behaviour or not but '++enc' seems to be able to force encoding regardless whether there are some invalid characters there while 'set encoding' can't.
â ka3ak
Dec 25 '17 at 10:27
add a comment |Â
up vote
0
down vote
There's no need to re-open it - while in command mode, you can set the encoding to whatever you like with:
:set encoding=whatever
e.g.
:set encoding=utf-8
BTW, type :help encoding-names
in vim
for a list of supported encodings.
I've tried it, but there may be a difference between '++enc' and 'set encoding'. I'll update my question.
â ka3ak
Dec 25 '17 at 10:06
maybe put it in your ~/.vimrc so that utf-8 is the default encoding (i'm a little surprised it isn't aready the default...unless your .vimrc has decades worth of cruft like mine)
â cas
Dec 25 '17 at 10:21
It is the default encoding. Because if I start vim and execute ':set encoding?' it shows me 'encoding=utf-8'. I don't know whether this is an intentional behaviour or not but '++enc' seems to be able to force encoding regardless whether there are some invalid characters there while 'set encoding' can't.
â ka3ak
Dec 25 '17 at 10:27
add a comment |Â
up vote
0
down vote
up vote
0
down vote
There's no need to re-open it - while in command mode, you can set the encoding to whatever you like with:
:set encoding=whatever
e.g.
:set encoding=utf-8
BTW, type :help encoding-names
in vim
for a list of supported encodings.
There's no need to re-open it - while in command mode, you can set the encoding to whatever you like with:
:set encoding=whatever
e.g.
:set encoding=utf-8
BTW, type :help encoding-names
in vim
for a list of supported encodings.
answered Dec 25 '17 at 9:57
cas
37.7k44394
37.7k44394
I've tried it, but there may be a difference between '++enc' and 'set encoding'. I'll update my question.
â ka3ak
Dec 25 '17 at 10:06
maybe put it in your ~/.vimrc so that utf-8 is the default encoding (i'm a little surprised it isn't aready the default...unless your .vimrc has decades worth of cruft like mine)
â cas
Dec 25 '17 at 10:21
It is the default encoding. Because if I start vim and execute ':set encoding?' it shows me 'encoding=utf-8'. I don't know whether this is an intentional behaviour or not but '++enc' seems to be able to force encoding regardless whether there are some invalid characters there while 'set encoding' can't.
â ka3ak
Dec 25 '17 at 10:27
add a comment |Â
I've tried it, but there may be a difference between '++enc' and 'set encoding'. I'll update my question.
â ka3ak
Dec 25 '17 at 10:06
maybe put it in your ~/.vimrc so that utf-8 is the default encoding (i'm a little surprised it isn't aready the default...unless your .vimrc has decades worth of cruft like mine)
â cas
Dec 25 '17 at 10:21
It is the default encoding. Because if I start vim and execute ':set encoding?' it shows me 'encoding=utf-8'. I don't know whether this is an intentional behaviour or not but '++enc' seems to be able to force encoding regardless whether there are some invalid characters there while 'set encoding' can't.
â ka3ak
Dec 25 '17 at 10:27
I've tried it, but there may be a difference between '++enc' and 'set encoding'. I'll update my question.
â ka3ak
Dec 25 '17 at 10:06
I've tried it, but there may be a difference between '++enc' and 'set encoding'. I'll update my question.
â ka3ak
Dec 25 '17 at 10:06
maybe put it in your ~/.vimrc so that utf-8 is the default encoding (i'm a little surprised it isn't aready the default...unless your .vimrc has decades worth of cruft like mine)
â cas
Dec 25 '17 at 10:21
maybe put it in your ~/.vimrc so that utf-8 is the default encoding (i'm a little surprised it isn't aready the default...unless your .vimrc has decades worth of cruft like mine)
â cas
Dec 25 '17 at 10:21
It is the default encoding. Because if I start vim and execute ':set encoding?' it shows me 'encoding=utf-8'. I don't know whether this is an intentional behaviour or not but '++enc' seems to be able to force encoding regardless whether there are some invalid characters there while 'set encoding' can't.
â ka3ak
Dec 25 '17 at 10:27
It is the default encoding. Because if I start vim and execute ':set encoding?' it shows me 'encoding=utf-8'. I don't know whether this is an intentional behaviour or not but '++enc' seems to be able to force encoding regardless whether there are some invalid characters there while 'set encoding' can't.
â ka3ak
Dec 25 '17 at 10:27
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f412923%2fhow-to-change-encoding-for-an-unnamed-buffer-in-vim%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password