1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

irb like Prompt

Discussion in 'T&T - Miscellaneous' started by Joe Caverly, Nov 15, 2009.

  1. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    680
    Likes Received:
    8
    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
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,304
    Likes Received:
    39
    Did you know that you can also

    Code:
    set titleprompt=%%_cwd
    
     
  3. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,189
    Likes Received:
    11
    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:


    modifications.



    prompt.



     

Share This Page