Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

irb like Prompt

Aug
1,929
71
Using TCC 11.00.33 Windows XP [Version 5.1.2600]
TCC Build 33 Windows XP Build 2600 Service Pack 3

I am a frequent user of irb (Interactive Ruby Shell), and have become accustomed to the default prompt it provides.

Here is my attempt to duplicate the prompt in TCC, with slight modifications.

First, I need a prompt counter. I do this with the following Prompt Line Counter alias;

Code:
alias plc=`set plc=%@inc[%plc]`
Next, I change my prompt to this;

Code:
PROMPT=`%_cmdproc:%_pid:%@exec[@plc] %plc $g `
The prompt displays the current command processor, the current process ID number, and the current value of the prompt line counter, followed by a > and a space. Put whatever is useful to you in your prompt.

Speaking of useful, it's good to know what directory one is in. I used to have this in my prompt, but have instead placed the name of the current directory in the status bar, using the PRE_INPUT, PRE_EXEC, and POST_EXEC Aliases as follows;

Code:
pre_input=`statusbar %_cwd`
pre_exec=`statusbar %_cwd`
post_exec=`statusbar %_cwd`
You can also place other info in the statusbar, along with the current working directory;

Code:
pre_input=`statusbar Week %_isoweek %_cwd`
pre_exec=`statusbar Week %_isoweek %_cwd`
post_exec=`statusbar Week %_isoweek %_cwd`
Joe
 
Speaking of useful, it's good to know what directory one is in. I used to have this in my prompt, but have instead placed the name of the current directory in the status bar, using the PRE_INPUT, PRE_EXEC, and POST_EXEC Aliases as follows;

Code:
pre_input=`statusbar %_cwd`
pre_exec=`statusbar %_cwd`
post_exec=`statusbar %_cwd`

Did you know that you can also

Code:
set titleprompt=%%_cwd
 
Another option that does not require the use of those aliases is to use
the window title to display that info.

set TITLEPROMPT=%_cmdproc %_4ver (%_BUILD) in %%_cwd
title %_cmdproc %_4ver (%_BUILD)

-Scott

Joe Caverly <> wrote on 11/15/2009 10:49:03 AM:


> Using TCC 11.00.33 Windows XP [Version 5.1.2600]
> TCC Build 33 Windows XP Build 2600 Service Pack 3
>
> I am a frequent user of irb (Interactive Ruby Shell), and have
> become accustomed to the default prompt it provides.
>
> Here is my attempt to duplicate the prompt in TCC, with slight
modifications.

>
> First, I need a prompt counter. I do this with the following Prompt
> Line Counter alias;


> Code:
> alias plc=`set plc=%@inc[%plc]`
> Next, I change my prompt to this;


> Code:
> PROMPT=`%_cmdproc:%_pid:%@exec[@plc] %plc $g `
> The prompt displays the current command processor, the current
> process ID number, and the current value of the prompt line counter,
> followed by a > and a space. Put whatever is useful to you in your
prompt.

>
> Speaking of useful, it's good to know what directory one is in. I
> used to have this in my prompt, but have instead placed the name of
> the current directory in the status bar, using the PRE_INPUT,
> PRE_EXEC, and POST_EXEC Aliases as follows;


> Code:
> pre_input=`statusbar %_cwd`
> pre_exec=`statusbar %_cwd`
> post_exec=`statusbar %_cwd`
> You can also place other info in the statusbar, along with the
> current working directory;


> Code:
> pre_input=`statusbar Week %_isoweek %_cwd`
> pre_exec=`statusbar Week %_isoweek %_cwd`
> post_exec=`statusbar Week %_isoweek %_cwd`
> Joe
>
>
 
Back
Top