Re: [GRASS-dev] Custom GRASS command line prompt

2014-12-17 Thread Nikos Alexandris

Huidae Cho wrote:


Mine looks like this (bash shell):



grass_ps(){
echo G `g.gisenv LOCATION_NAME`/`g.gisenv MAPSET`
}
export PS1=\[\033]0;\$(grass_ps) \w\007\]\$(grass_ps) \w 


The prompt gets updated dynamically since grass_ps() is called every 
time

you hit enter.


Oh, this makes life easier :-)

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2014-12-17 Thread Nikos Alexandris

On 16.12.2014 00:14, Martin Landa wrote:

Hi,

2014-12-15 11:33 GMT+01:00 Michel Wortmann wortm...@pik-potsdam.de:
I was just implementing the same thing into my ~/.grass.bashrc 
(GRASS


btw, preferable is .grass7/bashrc rather than .grass.bashrc. Martin


But then, I guess, we need to duplicate this for making it work with 
G64x, right?


Thanks, Nikos
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2014-12-16 Thread Michel Wortmann

Thank you Nikos and others,
Huidae's version works like a charm. I'm on G7.0.0b3 so the g.gisenv 
single call doesnt work for me, neither does the .grass7/bashrc for some 
reason.

Best,
Michel

On 12/15/2014 11:14 PM, Martin Landa wrote:

Hi,

2014-12-15 11:33 GMT+01:00 Michel Wortmann wortm...@pik-potsdam.de:

I was just implementing the same thing into my ~/.grass.bashrc (GRASS

btw, preferable is .grass7/bashrc rather than .grass.bashrc. Martin



___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2014-12-16 Thread Martin Landa
Hi,

2014-12-16 14:57 GMT+01:00 Michel Wortmann wortm...@pik-potsdam.de:
 call doesnt work for me, neither does the .grass7/bashrc for some reason.

thats strange, are we speaking about ~/.grass7/bashrc? Martin


-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2014-12-16 Thread Markus Neteler
Michel,

On Tue, Dec 16, 2014 at 2:57 PM, Michel Wortmann
wortm...@pik-potsdam.de wrote:
 Thank you Nikos and others,
 Huidae's version works like a charm. I'm on G7.0.0b3 so the g.gisenv single
 call doesnt work for me, neither does the .grass7/bashrc for some reason.

To be sure that you use bash, please check

echo $SHELL
ls -la $SHELL

Markus
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2014-12-15 Thread Michel Wortmann

Hi Nikos, Hamish and list,
you guys played around with your commandline prompts last year (see below), I 
was just implementing the same thing into my ~/.grass.bashrc (GRASS 7.0.0b3) 
but found that the location and mapset arent actually changed when changing 
them with g.mapset, i.e. .grass.bashrc isnt actually executed again.
Whats the best way getting that to work with or without changing source or 
$GISBASE files?

Best, Michel



Nikos:


/   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
/

Hamish:


/  I'd suggest to put the change in ~/.grass.bashrc instead.

/

Nikos:


/  Hamish,
//  
//  don't want to waist your time, but I have put soemthing like
//  
//  SHORT_VER=`echo $GRASS_VERSION | cut -f1,2 -d. | sed -e 's/\.//'`

//  GLOCATION=`echo ${LOCATION_NAME}`
//  GMAPSET=`echo ${MAPSET}`
//  export PS1='G$SHORT_VER ${GLOCATION}/${GMAPSET}:\w  '
//  export PROMPT_DIRTRIM=2
//  
//  which doesn't work! :-/
//  
//  Where should $LOCATION_NAME, $MAPSET be fed from?

/
I got it...

GLOCATION=`g.gisenv get=LOCATION_NAME`
GMAPSET=`g.gisenv get=MAPSET`

Nikos

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Custom GRASS command line prompt

2014-12-15 Thread Nikos Alexandris

On 15.12.2014 12:33, Michel Wortmann wrote:


Hi Nikos, Hamish and list,
you guys played around with your commandline prompts last year (see
below), I was just implementing the same thing into my 
~/.grass.bashrc

(GRASS 7.0.0b3) but found that the location and mapset arent actually
changed when changing them with g.mapset, i.e. .grass.bashrc isnt
actually executed again.
Whats the best way getting that to work with or without changing
source or $GISBASE files?


Hi Michel!  How nice that someone else is doing this as well :-).  I 
don't think I changed much since -- here is my current setup:


--%---
SHORT_VER=`echo $GRASS_VERSION | cut -f1,2 -d. | sed -e 's/\.//'`
GDBASE=`g.gisenv get=GISDBASE | rev | cut -d/ -f1 | rev`
GLOCATION=`g.gisenv get=LOCATION_NAME`
GMAPSET=`g.gisenv get=MAPSET`
export PROMPT_DIRTRIM=2
# export PS1='\e[32;40mG$SHORT_VER\e[0m [\e[34;40m${GLOCATION}\e[0m / 
\e[32;40m${GMAPSET}\e[0m] :\e[36;40m\w \e[0m[\#/\!] \n\r\e[32;40m\e[0m 
'
export PS1='\[\e[32m\]G$SHORT_VER\[\e[0m\] [ ${GDBASE} / 
\[\e[33m\]${GLOCATION}\[\e[0m\] @\[\e[32;1m\]${GMAPSET}\[\e[0m\] ] : 
\[\e[36m\]\w \[\e[0m\][\#/\!]

\[\e[32;1m\]\[\e[0m\] '
---%--

and, you are right, the Mapset isn't updated.  The Location, me thinks, 
should not change, or should only in special cases.  We don't usually 
switch Location's from inside a grass session. We do switch Mapsets.  
But we should be careful because we need to manually instruct the use of 
the new history log once changed to another Mapset (history -w; 
history -r etc). Right?


Otherwise, I came with a stupid solution, a function inside 
grass.bashrc to re-source itself:


--%---
# Re-Source Me!
g.src()
{
  source ~/.grass.bashrc
}
---%--

I tested it and it works. Change a mapset and then `g.src` or whatever 
you might name it.  Don't know if it's dangerous though.


Let us know if you come up with something smart.  I would love to see a 
zsh like behaviour inside grass shell.  Would be awesome.


Nikos

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2014-12-15 Thread Huidae Cho
Mine looks like this (bash shell):

grass_ps(){
echo G `g.gisenv LOCATION_NAME`/`g.gisenv MAPSET`
}
export PS1=\[\033]0;\$(grass_ps) \w\007\]\$(grass_ps) \w 

The prompt gets updated dynamically since grass_ps() is called every time
you hit enter.

Huidae

On Mon, Dec 15, 2014 at 6:15 AM, Nikos Alexandris n...@nikosalexandris.net
wrote:

 On 15.12.2014 12:33, Michel Wortmann wrote:

  Hi Nikos, Hamish and list,
 you guys played around with your commandline prompts last year (see
 below), I was just implementing the same thing into my ~/.grass.bashrc
 (GRASS 7.0.0b3) but found that the location and mapset arent actually
 changed when changing them with g.mapset, i.e. .grass.bashrc isnt
 actually executed again.
 Whats the best way getting that to work with or without changing
 source or $GISBASE files?


 Hi Michel!  How nice that someone else is doing this as well :-).  I don't
 think I changed much since -- here is my current setup:

 --%---
 SHORT_VER=`echo $GRASS_VERSION | cut -f1,2 -d. | sed -e 's/\.//'`
 GDBASE=`g.gisenv get=GISDBASE | rev | cut -d/ -f1 | rev`
 GLOCATION=`g.gisenv get=LOCATION_NAME`
 GMAPSET=`g.gisenv get=MAPSET`
 export PROMPT_DIRTRIM=2
 # export PS1='\e[32;40mG$SHORT_VER\e[0m [\e[34;40m${GLOCATION}\e[0m /
 \e[32;40m${GMAPSET}\e[0m] :\e[36;40m\w \e[0m[\#/\!] \n\r\e[32;40m\e[0m '
 export PS1='\[\e[32m\]G$SHORT_VER\[\e[0m\] [ ${GDBASE} /
 \[\e[33m\]${GLOCATION}\[\e[0m\] @\[\e[32;1m\]${GMAPSET}\[\e[0m\] ] :
 \[\e[36m\]\w \[\e[0m\][\#/\!]
 \[\e[32;1m\]\[\e[0m\] '
 ---%--

 and, you are right, the Mapset isn't updated.  The Location, me thinks,
 should not change, or should only in special cases.  We don't usually
 switch Location's from inside a grass session. We do switch Mapsets.  But
 we should be careful because we need to manually instruct the use of the
 new history log once changed to another Mapset (history -w; history -r
 etc). Right?

 Otherwise, I came with a stupid solution, a function inside grass.bashrc
 to re-source itself:

 --%---
 # Re-Source Me!
 g.src()
 {
   source ~/.grass.bashrc
 }
 ---%--

 I tested it and it works. Change a mapset and then `g.src` or whatever you
 might name it.  Don't know if it's dangerous though.

 Let us know if you come up with something smart.  I would love to see a
 zsh like behaviour inside grass shell.  Would be awesome.

 Nikos

 ___
 grass-dev mailing list
 grass-dev@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-dev

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Custom GRASS command line prompt

2014-12-15 Thread Martin Landa
Hi,

2014-12-15 22:34 GMT+01:00 Huidae Cho gras...@gmail.com:
 Mine looks like this (bash shell):

 grass_ps(){
 echo G `g.gisenv LOCATION_NAME`/`g.gisenv MAPSET`

btw, in trunk you can avoid calling `g.gisenv` twice

g.gisenv get=LOCATION_NAME,MAPSET sep='/'

Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2014-12-15 Thread Huidae Cho
That's cool. I'll try it tonight. Thanks.

-- 
Sent from my phone
On Dec 15, 2014 5:12 PM, Martin Landa landa.mar...@gmail.com wrote:

 Hi,

 2014-12-15 22:34 GMT+01:00 Huidae Cho gras...@gmail.com:
  Mine looks like this (bash shell):
 
  grass_ps(){
  echo G `g.gisenv LOCATION_NAME`/`g.gisenv MAPSET`

 btw, in trunk you can avoid calling `g.gisenv` twice

 g.gisenv get=LOCATION_NAME,MAPSET sep='/'

 Martin

 --
 Martin Landa
 http://geo.fsv.cvut.cz/gwiki/Landa
 http://gismentors.eu/mentors/landa

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Custom GRASS command line prompt

2013-08-01 Thread Nikos Alexandris
Nkos:
  Do you have customised prompts?  Any ideas for a more productive
  command line?

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

FWIW,

I use now the following


export PS1='\[\e[32m\]G$SHORT_VER\[\e[0m\] [ \[\e[33m\]${GLOCATION}\[\e[0m\] 
@\[\e[32;1m\]${GMAPSET}\[\e[0m\] ] : \[\e[36m\]\w \[\e[0m\] 
\[\e[32;1m\]\[\e[0m\] '

Apart from the colors (with which I was exeprimenting) I think it's much 
cleaner now -- info as a top line and the  right below in a new line.  It 
looks like:


,--%---
G70 [ utm_37s @change_detection ] : .../grassdb/onsight  

`---%--

This eats-up one line.  But, 1) it gives all the space for longer commands and 
2) it works as a useful separator (especially if it is colorised) and makes 
searching back in time easier.

Nikos


___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2013-08-01 Thread Nikos Alexandris
On Monday 29 of July 2013 17:29:29 Hamish wrote:
 Hamish wrote:
  # example of adding an RGB border color with a #RRGGBB code:
  echo -ne \033]11;#53186f\007
 
 ...
 
  But I think changing the border with a RGB color per mapset
  or location would scale better if you were having a different
  color for each mapset/location.
  Or, for the MASK present I'd prefer a red terminal border to the
  extra line on the command prompt, so it might be nice to search out
  what the different escape codes for gnome-terminal et al. might be.
 
 hmm, doesn't work so well.
 
 this sets the border color in xterm:
 
 echo -e \e]11;#aa186f\007
 CLEAR='\e[2J\e[1;1H'
 echo -ne \e[37m\e[40m$CLEAR
 unset CLEAR
 
 ..for the internalBorder Xresource (xterm -b), but as soon as something
 wraps around column 80 it stops being the border color and becomes the
 background color.
 
 it would be nice to figure a way to get the border color working properly
 though since it seems like a nice way to do it.

Yep, it makes everything magenta-like. A pity this doesn't work as wanted.  
Really good idea.  We can always ask... at stackexchange?

Nikos
 
 Hamish
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2013-07-29 Thread Markus Neteler
On Sun, Jul 28, 2013 at 4:50 AM, Hamish hamis...@yahoo.com wrote:
...
 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  '
 export HISTSIZE=3000

Personally I would suggest 3 lines here (I use 50k). Better save
than sorry :-)

Markus
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2013-07-29 Thread Nikos Alexandris
Hamish:
 ...

  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  '
  export HISTSIZE=3000

Markus Neteler wrote:
 
 Personally I would suggest 3 lines here (I use 50k). Better save
 than sorry :-)

In reality, I forgot to mention that in /home/nik/.bashrc I have

declare -x HISTFILESIZE=10
declare -x HISTSIZE=100

Ha-ha... :D

Nikos

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Custom GRASS command line prompt

2013-07-29 Thread Hamish
Hamish wrote:

 # example of adding an RGB border color with a #RRGGBB code:
 echo -ne \033]11;#53186f\007
...
 But I think changing the border with a RGB color per mapset
 or location would scale better if you were having a different
 color for each mapset/location. 
 Or, for the MASK present I'd prefer a red terminal border to the 
 extra line on the command prompt, so it might be nice to search out
 what the different escape codes for gnome-terminal et al. might be.

hmm, doesn't work so well.

xterm:
echo -e \e]11;#aa186f\007
CLEAR='\e[2J\e[1;1H'
echo -ne \e[37m\e[40m$CLEAR
unset CLEAR

this sets the internalBorder resource (xterm -b) color, but as soon
as something wraps around column 80 it stops being the border color and becomes 
the background color.

it would be nice to figure a way to get the border color working properly 
though.


Hamish

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2013-07-29 Thread Hamish
Hamish wrote:

 # example of adding an RGB border color with a #RRGGBB code:
 echo -ne \033]11;#53186f\007
...
 But I think changing the border with a RGB color per mapset
 or location would scale better if you were having a different
 color for each mapset/location. 
 Or, for the MASK present I'd prefer a red terminal border to the 
 extra line on the command prompt, so it might be nice to search out
 what the different escape codes for gnome-terminal et al. might be.

hmm, doesn't work so well.

this sets the border color in xterm:

echo -e \e]11;#aa186f\007
CLEAR='\e[2J\e[1;1H'
echo -ne \e[37m\e[40m$CLEAR
unset CLEAR

..for the internalBorder Xresource (xterm -b), but as soon as something wraps 
around column 80 it stops being the border color and becomes the background 
color.

it would be nice to figure a way to get the border color working properly 
though since it seems like a nice way to do it.


Hamish

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2013-07-28 Thread Nikos Alexandris
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=111 s= w=33 e=44 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
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Custom GRASS command line prompt

2013-07-28 Thread Nikos Alexandris
Nikos:

  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


Hamish:

 I'd suggest to put the change in ~/.grass.bashrc instead.


Nikos:

 Hamish,
 
 don't want to waist your time, but I have put soemthing like
 
 SHORT_VER=`echo $GRASS_VERSION | cut -f1,2 -d. | sed -e 's/\.//'`
 GLOCATION=`echo ${LOCATION_NAME}`
 GMAPSET=`echo ${MAPSET}`
 export PS1='G$SHORT_VER ${GLOCATION}/${GMAPSET}:\w  '
 export PROMPT_DIRTRIM=2
 
 which doesn't work! :-/
 
 Where should $LOCATION_NAME, $MAPSET be fed from?

I got it...

GLOCATION=`g.gisenv get=LOCATION_NAME`
GMAPSET=`g.gisenv get=MAPSET`

Nikos


___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Custom GRASS command line prompt

2013-07-28 Thread Hamish
Nikos:
 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?),

see MarkusN's [Raster MASK present] command prompt magic using

$PROMPT_COMMAND (set in $GISBASE/etc/Init.sh).

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

see $GISBASE/etc/grass-run.sh


re. using terminal colors, a web-search finds a number of pages like this:
http://superuser.com/questions/270214/how-can-i-change-the-colors-of-my-xterm-using-ansi-escape-sequences
# putting that into practice:
CLEAR='\e[2J\e[1;1H'
FG_CYAN='\e[36m'
BG_BLUE='\e[44m'

echo -en ${FG_CYAN}${BG_BLUE}$CLEAR


# example of adding an RGB border color with a #RRGGBB code:
echo -ne \033]11;#53186f\007

for me, xfce4-terminal and rxvt accepted the old EGA colors for fore/background,
but not the full RGB border -- I had to use xterm to see that work. 

But I think changing the border with a RGB color per mapset or location would
scale better if you were having a different color for each mapset/location. 
Or, for the MASK present I'd prefer a red terminal border to the extra line
on the command prompt, so it might be nice to search out what the different
escape codes for gnome-terminal et al. might be.


Hamish

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


[GRASS-dev] Custom GRASS command line prompt

2013-07-27 Thread Nikos Alexandris
I want to alter the default GRASS command line prompt. For my needs, I find it 
better to 
have the current Mapset shown along with the Location.

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='GRASS %s (%s):\w  '\n % (grass_version, location_name))
+ 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?

Thanks, Nikos
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] Custom GRASS command line prompt

2013-07-27 Thread Hamish
Nikos:
 I want to alter the default GRASS command line prompt. For my needs,
 I find it better to have the current Mapset shown along with the
 Location.
 
 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='GRASS %s (%s):\w  '\n % (grass_version, location_name))
 + 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?

I'd suggest to put the change in ~/.grass.bashrc instead.


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  '
export HISTSIZE=3000

.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.


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.


regards,
Hamish

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev