Wednesday, 15 May 2013

bash - How can I include return codes and the command number in my eshell prompt? -



bash - How can I include return codes and the command number in my eshell prompt? -

i have need of shell while using emacs. recently, have been trying switch on shell eshell, able utilize same commands regardless of platform.

one of first things customize prompt match bash prompt. this, customizing eshell-prompt-function. thing still missing current command count , lastly homecoming code. can in bash setting ps1 e.g. \! , $? respectively. have tried (eshell/echo "$?") latter, doesn't work (though works if execute command manually in eshell).

edit: illustration of part of current bash prompt looks [~][501:0], 501 current command number (so if type command , nail enter show 502), , 0 homecoming code.

this puts homecoming code eshell prompt:

class="lang-lisp prettyprint-override">(setq eshell-prompt-function (lambda () (format "[%s][%s] " (abbreviate-file-name (eshell/pwd)) eshell-last-command-status)))

i couldn't find simple way set latest command number prompt—and might less useful, since eshell seems utilize ring command history, @ point counter stuck @ 128, , previous prompts inaccurate.

note should update eshell-prompt-regexp match eshell-prompt-function come with.

bash emacs eshell

No comments:

Post a Comment