How to enter non-ascii characters using hex or octal codes in vi
I'm trying to write a golfing library for postscript. But it needs to be condensed itself. So I need a convenient way to type-in arbitrary bytes within mostly ascii text.
I know this can easily be done with absolutely any programming language, but can I do it in vi? (:help octal
was no help).
Edit: Here's the resulting golfing library for postscript. Fortunately, I realized early on that golfing the library itself was a stupid idea and I did not do that.
vim binary
add a comment |
I'm trying to write a golfing library for postscript. But it needs to be condensed itself. So I need a convenient way to type-in arbitrary bytes within mostly ascii text.
I know this can easily be done with absolutely any programming language, but can I do it in vi? (:help octal
was no help).
Edit: Here's the resulting golfing library for postscript. Fortunately, I realized early on that golfing the library itself was a stupid idea and I did not do that.
vim binary
6
If Vim is available, this might help
– sr_
Jan 13 '13 at 9:53
related: unix.stackexchange.com/questions/108020/…
– luser droog
Apr 4 '15 at 16:24
add a comment |
I'm trying to write a golfing library for postscript. But it needs to be condensed itself. So I need a convenient way to type-in arbitrary bytes within mostly ascii text.
I know this can easily be done with absolutely any programming language, but can I do it in vi? (:help octal
was no help).
Edit: Here's the resulting golfing library for postscript. Fortunately, I realized early on that golfing the library itself was a stupid idea and I did not do that.
vim binary
I'm trying to write a golfing library for postscript. But it needs to be condensed itself. So I need a convenient way to type-in arbitrary bytes within mostly ascii text.
I know this can easily be done with absolutely any programming language, but can I do it in vi? (:help octal
was no help).
Edit: Here's the resulting golfing library for postscript. Fortunately, I realized early on that golfing the library itself was a stupid idea and I did not do that.
vim binary
vim binary
edited Jan 9 at 23:32
Thomas Dickey
52.4k595166
52.4k595166
asked Jan 13 '13 at 7:51
luser droogluser droog
2621212
2621212
6
If Vim is available, this might help
– sr_
Jan 13 '13 at 9:53
related: unix.stackexchange.com/questions/108020/…
– luser droog
Apr 4 '15 at 16:24
add a comment |
6
If Vim is available, this might help
– sr_
Jan 13 '13 at 9:53
related: unix.stackexchange.com/questions/108020/…
– luser droog
Apr 4 '15 at 16:24
6
6
If Vim is available, this might help
– sr_
Jan 13 '13 at 9:53
If Vim is available, this might help
– sr_
Jan 13 '13 at 9:53
related: unix.stackexchange.com/questions/108020/…
– luser droog
Apr 4 '15 at 16:24
related: unix.stackexchange.com/questions/108020/…
– luser droog
Apr 4 '15 at 16:24
add a comment |
2 Answers
2
active
oldest
votes
I assume that you use vim
, because :help
octal
is a vim's command. On some systems vi
is just a symlink to vim
which runs it in vi-compatible mode.
In vim:
- You can enter unicode characters from basic multilingual plane you can use:
Press ctrl+v and then enter four digit hex unicode code. - Another option is digraphs. You can read more about them in
vim
's help (help: dig
).
Press ctrl+k and then two-character sequence.
You can list sequences supported in you vim usig command:digraph
.
In nvi, vi and elsewhere:
Ctrl+Shift and hit U and then enter unicode hex code.
1
I think thatCtrl+V
is for entering decimal digits, if not followed byx
– Carlos Heuberger
Apr 21 '17 at 12:48
@Carlos is correct. This answer is wrong. Alan's answer is correct.
– malan
Jul 14 '18 at 19:52
add a comment |
:help i_CTRL-V_digit
In insert-mode, type control+V followed by
- a decimal number
x
then a hex number
u
then a 4-hexchar unicode sequence
U
then an 8-hexchar unicode sequence
To add some more tips: the decimal number must be between 0-255. The hex number between x00-xFF.
– wisbucky
Jun 7 '18 at 18:34
ascii esaple is ctrl+vx1b
(for ascii color sequences)
– ThorSummoner
Jan 9 at 23:24
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f61118%2fhow-to-enter-non-ascii-characters-using-hex-or-octal-codes-in-vi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I assume that you use vim
, because :help
octal
is a vim's command. On some systems vi
is just a symlink to vim
which runs it in vi-compatible mode.
In vim:
- You can enter unicode characters from basic multilingual plane you can use:
Press ctrl+v and then enter four digit hex unicode code. - Another option is digraphs. You can read more about them in
vim
's help (help: dig
).
Press ctrl+k and then two-character sequence.
You can list sequences supported in you vim usig command:digraph
.
In nvi, vi and elsewhere:
Ctrl+Shift and hit U and then enter unicode hex code.
1
I think thatCtrl+V
is for entering decimal digits, if not followed byx
– Carlos Heuberger
Apr 21 '17 at 12:48
@Carlos is correct. This answer is wrong. Alan's answer is correct.
– malan
Jul 14 '18 at 19:52
add a comment |
I assume that you use vim
, because :help
octal
is a vim's command. On some systems vi
is just a symlink to vim
which runs it in vi-compatible mode.
In vim:
- You can enter unicode characters from basic multilingual plane you can use:
Press ctrl+v and then enter four digit hex unicode code. - Another option is digraphs. You can read more about them in
vim
's help (help: dig
).
Press ctrl+k and then two-character sequence.
You can list sequences supported in you vim usig command:digraph
.
In nvi, vi and elsewhere:
Ctrl+Shift and hit U and then enter unicode hex code.
1
I think thatCtrl+V
is for entering decimal digits, if not followed byx
– Carlos Heuberger
Apr 21 '17 at 12:48
@Carlos is correct. This answer is wrong. Alan's answer is correct.
– malan
Jul 14 '18 at 19:52
add a comment |
I assume that you use vim
, because :help
octal
is a vim's command. On some systems vi
is just a symlink to vim
which runs it in vi-compatible mode.
In vim:
- You can enter unicode characters from basic multilingual plane you can use:
Press ctrl+v and then enter four digit hex unicode code. - Another option is digraphs. You can read more about them in
vim
's help (help: dig
).
Press ctrl+k and then two-character sequence.
You can list sequences supported in you vim usig command:digraph
.
In nvi, vi and elsewhere:
Ctrl+Shift and hit U and then enter unicode hex code.
I assume that you use vim
, because :help
octal
is a vim's command. On some systems vi
is just a symlink to vim
which runs it in vi-compatible mode.
In vim:
- You can enter unicode characters from basic multilingual plane you can use:
Press ctrl+v and then enter four digit hex unicode code. - Another option is digraphs. You can read more about them in
vim
's help (help: dig
).
Press ctrl+k and then two-character sequence.
You can list sequences supported in you vim usig command:digraph
.
In nvi, vi and elsewhere:
Ctrl+Shift and hit U and then enter unicode hex code.
answered Mar 17 '13 at 0:37
Alex BolotovAlex Bolotov
469613
469613
1
I think thatCtrl+V
is for entering decimal digits, if not followed byx
– Carlos Heuberger
Apr 21 '17 at 12:48
@Carlos is correct. This answer is wrong. Alan's answer is correct.
– malan
Jul 14 '18 at 19:52
add a comment |
1
I think thatCtrl+V
is for entering decimal digits, if not followed byx
– Carlos Heuberger
Apr 21 '17 at 12:48
@Carlos is correct. This answer is wrong. Alan's answer is correct.
– malan
Jul 14 '18 at 19:52
1
1
I think that
Ctrl+V
is for entering decimal digits, if not followed by x
– Carlos Heuberger
Apr 21 '17 at 12:48
I think that
Ctrl+V
is for entering decimal digits, if not followed by x
– Carlos Heuberger
Apr 21 '17 at 12:48
@Carlos is correct. This answer is wrong. Alan's answer is correct.
– malan
Jul 14 '18 at 19:52
@Carlos is correct. This answer is wrong. Alan's answer is correct.
– malan
Jul 14 '18 at 19:52
add a comment |
:help i_CTRL-V_digit
In insert-mode, type control+V followed by
- a decimal number
x
then a hex number
u
then a 4-hexchar unicode sequence
U
then an 8-hexchar unicode sequence
To add some more tips: the decimal number must be between 0-255. The hex number between x00-xFF.
– wisbucky
Jun 7 '18 at 18:34
ascii esaple is ctrl+vx1b
(for ascii color sequences)
– ThorSummoner
Jan 9 at 23:24
add a comment |
:help i_CTRL-V_digit
In insert-mode, type control+V followed by
- a decimal number
x
then a hex number
u
then a 4-hexchar unicode sequence
U
then an 8-hexchar unicode sequence
To add some more tips: the decimal number must be between 0-255. The hex number between x00-xFF.
– wisbucky
Jun 7 '18 at 18:34
ascii esaple is ctrl+vx1b
(for ascii color sequences)
– ThorSummoner
Jan 9 at 23:24
add a comment |
:help i_CTRL-V_digit
In insert-mode, type control+V followed by
- a decimal number
x
then a hex number
u
then a 4-hexchar unicode sequence
U
then an 8-hexchar unicode sequence
:help i_CTRL-V_digit
In insert-mode, type control+V followed by
- a decimal number
x
then a hex number
u
then a 4-hexchar unicode sequence
U
then an 8-hexchar unicode sequence
answered Apr 2 '15 at 20:02
AlanAlan
361134
361134
To add some more tips: the decimal number must be between 0-255. The hex number between x00-xFF.
– wisbucky
Jun 7 '18 at 18:34
ascii esaple is ctrl+vx1b
(for ascii color sequences)
– ThorSummoner
Jan 9 at 23:24
add a comment |
To add some more tips: the decimal number must be between 0-255. The hex number between x00-xFF.
– wisbucky
Jun 7 '18 at 18:34
ascii esaple is ctrl+vx1b
(for ascii color sequences)
– ThorSummoner
Jan 9 at 23:24
To add some more tips: the decimal number must be between 0-255. The hex number between x00-xFF.
– wisbucky
Jun 7 '18 at 18:34
To add some more tips: the decimal number must be between 0-255. The hex number between x00-xFF.
– wisbucky
Jun 7 '18 at 18:34
ascii esaple is ctrl+v
x1b
(for ascii color sequences)– ThorSummoner
Jan 9 at 23:24
ascii esaple is ctrl+v
x1b
(for ascii color sequences)– ThorSummoner
Jan 9 at 23:24
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f61118%2fhow-to-enter-non-ascii-characters-using-hex-or-octal-codes-in-vi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
6
If Vim is available, this might help
– sr_
Jan 13 '13 at 9:53
related: unix.stackexchange.com/questions/108020/…
– luser droog
Apr 4 '15 at 16:24