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

Create file with '>' freeze terminal #5046

Closed
danilopinotti opened this issue Apr 27, 2016 · 3 comments
Closed

Create file with '>' freeze terminal #5046

danilopinotti opened this issue Apr 27, 2016 · 3 comments

Comments

@danilopinotti
Copy link

danilopinotti commented Apr 27, 2016

Hello,
when i try to create a file using '>', the command freeze and need to press Ctrl C.

Example:

$ > file.txt

In a native terminal emulator works.
">" is faster to create files that use the touch command

@moore3071
Copy link

moore3071 commented Apr 30, 2016

It looks like to me that this is a problem with zsh itself, and not oh-my-zsh.

EDIT: this is indeed on Zsh's part and I have sent an email to their mailing list reporting it. I would however like to note the danger of using this command in place of touch, as this command will overwrite the file if it already exists.

If you are absolutely insistent on using this shortcut perhaps add the extra keystroke to do

>> file.txt

Also note that while this command is "hanging" you can type normally and upon doing c-c the text you typed will be inserted into the file, leading me to believe this may be a feature, and not a bug.

@moore3071
Copy link

From a zsh-contributor,

What you see is not a bug, it is a feature. Configurable feature:

$ zsh -f
% emulate bash
% > file

does exactly what you request. See man zshmisc, section REDIRECTIONS WITH NO COMMAND.

@mcornella
Copy link
Member

A faster solution is setting up the sh_nullcmd option using setopt sh_nullcmd. You can find more info about it at Redirections with no command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants