Enter key prints ^M in certain situations in iTerm












0















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


Actual demo output



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?










share|improve this question

























  • 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
















0















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


Actual demo output



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?










share|improve this question

























  • 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














0












0








0








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


Actual demo output



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?










share|improve this question
















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


Actual demo output



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 7 at 15:15







Sinstein

















asked Feb 7 at 8:22









SinsteinSinstein

1207




1207













  • 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



















  • 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

















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










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
});


}
});














draft saved

draft discarded


















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
















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

How to make a Squid Proxy server?

第一次世界大戦

Touch on Surface Book