Enter key prints ^M in certain situations in iTerm
I am using iTerm2 on a Macbook Pro running MacOS Mojave.
In certain situations, such as when doing a git add -p, pressing return ends up printing ^M instead of performing the action.
Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? ^M

That means I am unable to take any action on a hunk as I cannot submit any of the given choices.
I though this could be because of how git handles returns, so I modified the core.autocrlf config but none of its valid values cause any change in this behaviour.
Then when trying other methods I relaized that this problem is visible only when using iTerm and NOT the Terminal app despite using zsh in both.
What configuration should I modify to allow for the return key to behave normally in this case?
macos terminal git zsh iterm2
add a comment |
I am using iTerm2 on a Macbook Pro running MacOS Mojave.
In certain situations, such as when doing a git add -p, pressing return ends up printing ^M instead of performing the action.
Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? ^M

That means I am unable to take any action on a hunk as I cannot submit any of the given choices.
I though this could be because of how git handles returns, so I modified the core.autocrlf config but none of its valid values cause any change in this behaviour.
Then when trying other methods I relaized that this problem is visible only when using iTerm and NOT the Terminal app despite using zsh in both.
What configuration should I modify to allow for the return key to behave normally in this case?
macos terminal git zsh iterm2
By any chance... do you press accidentallyCTRL+Vbefore hitting theENTERkey? In the standard zsh keybindingsCTRL+V(^V) this is bound toquoted-insert, i.e. the next pressed key is inserted literally.^MforENTER,^[forESCand so on.
– mpy
Feb 7 at 17:37
@mpy Did not know about that. Tried carefully again, same behaviour observed
– Sinstein
Feb 8 at 10:33
add a comment |
I am using iTerm2 on a Macbook Pro running MacOS Mojave.
In certain situations, such as when doing a git add -p, pressing return ends up printing ^M instead of performing the action.
Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? ^M

That means I am unable to take any action on a hunk as I cannot submit any of the given choices.
I though this could be because of how git handles returns, so I modified the core.autocrlf config but none of its valid values cause any change in this behaviour.
Then when trying other methods I relaized that this problem is visible only when using iTerm and NOT the Terminal app despite using zsh in both.
What configuration should I modify to allow for the return key to behave normally in this case?
macos terminal git zsh iterm2
I am using iTerm2 on a Macbook Pro running MacOS Mojave.
In certain situations, such as when doing a git add -p, pressing return ends up printing ^M instead of performing the action.
Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? ^M

That means I am unable to take any action on a hunk as I cannot submit any of the given choices.
I though this could be because of how git handles returns, so I modified the core.autocrlf config but none of its valid values cause any change in this behaviour.
Then when trying other methods I relaized that this problem is visible only when using iTerm and NOT the Terminal app despite using zsh in both.
What configuration should I modify to allow for the return key to behave normally in this case?
macos terminal git zsh iterm2
macos terminal git zsh iterm2
edited Feb 7 at 15:15
Sinstein
asked Feb 7 at 8:22
SinsteinSinstein
1207
1207
By any chance... do you press accidentallyCTRL+Vbefore hitting theENTERkey? In the standard zsh keybindingsCTRL+V(^V) this is bound toquoted-insert, i.e. the next pressed key is inserted literally.^MforENTER,^[forESCand so on.
– mpy
Feb 7 at 17:37
@mpy Did not know about that. Tried carefully again, same behaviour observed
– Sinstein
Feb 8 at 10:33
add a comment |
By any chance... do you press accidentallyCTRL+Vbefore hitting theENTERkey? In the standard zsh keybindingsCTRL+V(^V) this is bound toquoted-insert, i.e. the next pressed key is inserted literally.^MforENTER,^[forESCand so on.
– mpy
Feb 7 at 17:37
@mpy Did not know about that. Tried carefully again, same behaviour observed
– Sinstein
Feb 8 at 10:33
By any chance... do you press accidentally
CTRL+V before hitting the ENTER key? In the standard zsh keybindings CTRL+V (^V) this is bound to quoted-insert, i.e. the next pressed key is inserted literally. ^M for ENTER, ^[ for ESC and so on.– mpy
Feb 7 at 17:37
By any chance... do you press accidentally
CTRL+V before hitting the ENTER key? In the standard zsh keybindings CTRL+V (^V) this is bound to quoted-insert, i.e. the next pressed key is inserted literally. ^M for ENTER, ^[ for ESC and so on.– mpy
Feb 7 at 17:37
@mpy Did not know about that. Tried carefully again, same behaviour observed
– Sinstein
Feb 8 at 10:33
@mpy Did not know about that. Tried carefully again, same behaviour observed
– Sinstein
Feb 8 at 10:33
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fsuperuser.com%2fquestions%2f1403020%2fenter-key-prints-m-in-certain-situations-in-iterm%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Super User!
- 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%2fsuperuser.com%2fquestions%2f1403020%2fenter-key-prints-m-in-certain-situations-in-iterm%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
By any chance... do you press accidentally
CTRL+Vbefore hitting theENTERkey? In the standard zsh keybindingsCTRL+V(^V) this is bound toquoted-insert, i.e. the next pressed key is inserted literally.^MforENTER,^[forESCand so on.– mpy
Feb 7 at 17:37
@mpy Did not know about that. Tried carefully again, same behaviour observed
– Sinstein
Feb 8 at 10:33