[GRASS-dev] Custom GRASS command line prompt

Nikos Alexandris nik at nikosalexandris.net
Sun Jul 28 12:48:13 PDT 2013


Nikos:

> > I want to alter the default GRASS command line prompt.
..
> > As a first experiment, I edited the corresponding file in place:
> > grass7_trunk/dist.x86_64-unknown-linux-gnu/grass70.tmp, line 1039:
..
> > f.write("PS1='G %s (%s/%s):\w > '\n" % (grass_version, location_name,
> > mapset))

> > Now it appears like:  "G 7.0.svn (utm_37s/post):~ >".  My understanding is
> > that I probably need to edit the file:
> > grass7_trunk/dist.x86_64-unknown-linux-gnu/grass70.tmp

> > Do you have customised prompts?  Any ideas for a more productive
> > command line?

Hamish wrote:
 
> I'd suggest to put the change in ~/.grass.bashrc instead.

Somehow it got stuck in my mind that I need to do it in the source...

 
> fwiw here's what I have there wrt the prompt:
 
> SHORT_VER=`echo "$GRASS_VERSION" | cut -f1,2 -d. | sed -e 's/\.//'`
> export PS1='G$SHORT_VER:\W > '

Yes! Was thinking exactly about Gxx :-)


> export HISTSIZE=3000

here: export HISTSIZE=15000 :D


> .or.
 
> export PS1='G$SHORT_VER:\w > '
> export PROMPT_DIRTRIM=2
> 
> as full dir path gets much too long, especially on WinGrass where the
> terminal width is a pain to resize.

Just a thought: would be nice to customise as to have a top or a bottom "info-line", or two 
"info-lines" below 80 chars (what's the max that should be respected?), like


show a "+" for many Mapsets------------------- vvv
                                                v
,--%<---
|Gxx | Location/Mapset [Mapset2 Mapset3 Mapset4 +] Datum Units
| n=1111111 s=22222222 w=333333 e=444444 ns=4 ew=4 cells=4664r x 4446c
`--->%--

or stuff can go in the terminals title-bar -- this, I guess, works easily with a few terminals 
like xterm.


> For simplicity one of my favourites is still just:
 
> export PS1='GRASS$SHORT_VER> '
  
> If you do most of your work with a small set of locations, it might
> also be an idea to figure something out with Xresources to color the
> terminal background based on which one you're running in.

Nice!! I was looking the past week at <http://www.funtoo.org/Prompt_Magic>.

Thanks a lot!

Nikos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20130728/3f8fd479/attachment.html>


More information about the grass-dev mailing list