When entering the grep command in an eshell in spacemacs, a separate window and buffer are created to list the grep output results. However, I would prefer for the output to be listed in the eshell buffer like how a stand-alone terminal application would normally behave. How can this be achieved?
eshell has several built-in commands (
grep among them) and it prefers to use the built-in version:
~ $ which grep eshell/grep is a compiled Lisp function in ‘em-unix.el’.
As the manual that I linked to above says:
If you want to discard a given built-in command, you could declare an alias (see Aliases). Example: ~ $ which sudo eshell/sudo is a compiled Lisp function in `em-tramp.el'. ~ $ alias sudo '*sudo $*' ~ $ which sudo sudo is an alias, defined as "*sudo $*"
So you could do the following to get the external
~ $ alias grep '*grep $*' ~ $ which grep grep is an alias, defined as "*grep $*" ~ $ grep foo * *scratch*~: "foo") *scratch*~:(cancel-timer[nil 23357 43792 121024 30 message ("foo") nil 748000]) /usr/bin/grep: Audiobooks/: Is a directory /usr/bin/grep: Desktop/: Is a directory ...
And as @TPog (the OP) points out in a comment, you can go back to the built-in meaning of grep, by removing the alias:
~ $ alias grep ~ $ which grep eshell/grep is a compiled Lisp function in ‘em-unix.el’. ~ $