Re: echo question

2006-05-14 Thread Yakov Lerner

On 5/14/06, Jared [EMAIL PROTECTED] wrote:

I have a simple question that I can't seem to figure out.  When I use the
echo command to echo a statement on my open window, it simply displays that
message in the status bar.  However, if I use echo in a function, it adds
Please ENTER or type command to continue after it.

How do I make it not do that?  Eg, I just want it to display the message,
not prompt me to press a key.


Try 2 things
(1) add :redraw before the :echo in question
(2) if that doesn't help, make message shorter.
I noticed that if message is longer than screen width-15,
it cases the prompt.

Yakov


Re: echo question

2006-05-14 Thread Gerald Lai

On Sun, 14 May 2006, Yakov Lerner wrote:


On 5/14/06, Jared [EMAIL PROTECTED] wrote:

I have a simple question that I can't seem to figure out.  When I use the
echo command to echo a statement on my open window, it simply displays that
message in the status bar.  However, if I use echo in a function, it adds
Please ENTER or type command to continue after it.

How do I make it not do that?  Eg, I just want it to display the message,
not prompt me to press a key.


Try 2 things
(1) add :redraw before the :echo in question
(2) if that doesn't help, make message shorter.
I noticed that if message is longer than screen width-15,
it cases the prompt.


You could also readjust the height of the command-line dynamically:

  let msg = str
  let len = strlen(substitute(msg, ., x, g))
  let t_ch = cmdheight
  let cmdheight = len / (columns - 15) + 1
  echo msg
  let cmdheight = t_ch

See :help 'cmdheight'  :help strlen().

HTH :)
--
Gerald


Re: echo question

2006-05-14 Thread Jared
On 5/14/2006 1:37 AM, Gerald Lai wrote:
 On Sun, 14 May 2006, Yakov Lerner wrote:
 Try 2 things
 (1) add :redraw before the :echo in question
 (2) if that doesn't help, make message shorter.
 I noticed that if message is longer than screen width-15,
 it cases the prompt.
 
 You could also readjust the height of the command-line dynamically:
 
   let msg = str
   let len = strlen(substitute(msg, ., x, g))
   let t_ch = cmdheight
   let cmdheight = len / (columns - 15) + 1
   echo msg
   let cmdheight = t_ch
 
 See :help 'cmdheight'  :help strlen().


I tried adding :redraw, but that didn't seem to work.  As for making the
message shorter or the changing the height, I don't think those are
applicable.  The line is not longer than the window width.  In fact, this is
the function:

function Toggle_spell()
   if spell
  exec set nospell
   else
  exec set spell
  echo ]s to skip to word, zg to add word, z= to suggest word
   endif
endfunction
nmap C-s :call Toggle_spell()CR

I just want to display a message in the status reminding me of the commands
when I enable the spell checker.

Any other ideas?  Thanks.

--
Jared



Re: echo question

2006-05-14 Thread Yakov Lerner

On 5/14/06, Jared [EMAIL PROTECTED] wrote:

On 5/14/2006 1:37 AM, Gerald Lai wrote:
 On Sun, 14 May 2006, Yakov Lerner wrote:
 Try 2 things
 (1) add :redraw before the :echo in question
 (2) if that doesn't help, make message shorter.
 I noticed that if message is longer than screen width-15,
 it cases the prompt.

 You could also readjust the height of the command-line dynamically:

   let msg = str
   let len = strlen(substitute(msg, ., x, g))
   let t_ch = cmdheight
   let cmdheight = len / (columns - 15) + 1
   echo msg
   let cmdheight = t_ch

 See :help 'cmdheight'  :help strlen().


I tried adding :redraw, but that didn't seem to work.  As for making the
message shorter or the changing the height, I don't think those are
applicable.  The line is not longer than the window width.  In fact, this is
the function:

function Toggle_spell()
   if spell
  exec set nospell
   else
  exec set spell
  echo ]s to skip to word, zg to add word, z= to suggest word
   endif
endfunction
nmap C-s :call Toggle_spell()CR

I just want to display a message in the status reminding me of the commands
when I enable the spell checker.


Doesn't cause Hit Enter prompt for me.
In any case, try to add silent to your nmap:

nmap silentC-s :call Toggle_spell()CR

Yakov


Re: echo question

2006-05-14 Thread Yukihiro Nakadaira

I forgot CC:[EMAIL PROTECTED] Then I'll send you twice.
Jared wrote:

 On 5/14/2006 1:37 AM, Gerald Lai wrote:

 On Sun, 14 May 2006, Yakov Lerner wrote:

 Try 2 things
 (1) add :redraw before the :echo in question
 (2) if that doesn't help, make message shorter.
 I noticed that if message is longer than screen width-15,
 it cases the prompt.
 
 You could also readjust the height of the command-line dynamically:
 
   let msg = str

   let len = strlen(substitute(msg, ., x, g))
   let t_ch = cmdheight
   let cmdheight = len / (columns - 15) + 1
   echo msg
   let cmdheight = t_ch
 
 See :help 'cmdheight'  :help strlen().
 
 
 I tried adding :redraw, but that didn't seem to work.  As for making the

 message shorter or the changing the height, I don't think those are
 applicable.  The line is not longer than the window width.  In fact, this is
 the function:
 
 function Toggle_spell()

if spell
   exec set nospell
else
   exec set spell
   echo ]s to skip to word, zg to add word, z= to suggest word
endif
 endfunction
 nmap C-s :call Toggle_spell()CR
 
 I just want to display a message in the status reminding me of the commands

 when I enable the spell checker.
 
 Any other ideas?  Thanks.


I think that your 'cmdheight' is 1 and 'showcmd' or 'ruler' is on and
perhaps 'laststatus' is 0 or 1.
How about this

let ru_save = ruler
let sc_save = showcmd
set noruler noshowcmd
echo ]s to skip to word, zg to add word, z= to suggest word
let showcmd = sc_save
let ruler = ru_save

But the message may be truncated when there is no space for showcmd and
ruler.  It seems that showcmd and ruler require some spaces on the right
side of cmdline area.

--
Yukihiro Nakadaira [EMAIL PROTECTED]


Re: echo question

2006-05-14 Thread Yegappan Lakshmanan

Hi Jared,

On 5/14/06, Jared [EMAIL PROTECTED] wrote:

On 5/14/2006 1:37 AM, Gerald Lai wrote:
 On Sun, 14 May 2006, Yakov Lerner wrote:
 Try 2 things
 (1) add :redraw before the :echo in question
 (2) if that doesn't help, make message shorter.
 I noticed that if message is longer than screen width-15,
 it cases the prompt.

 You could also readjust the height of the command-line dynamically:

   let msg = str
   let len = strlen(substitute(msg, ., x, g))
   let t_ch = cmdheight
   let cmdheight = len / (columns - 15) + 1
   echo msg
   let cmdheight = t_ch

 See :help 'cmdheight'  :help strlen().


I tried adding :redraw, but that didn't seem to work.  As for making the
message shorter or the changing the height, I don't think those are
applicable.  The line is not longer than the window width.  In fact, this is
the function:

function Toggle_spell()
   if spell
  exec set nospell
   else
  exec set spell
  echo ]s to skip to word, zg to add word, z= to suggest word
   endif
endfunction
nmap C-s :call Toggle_spell()CR

I just want to display a message in the status reminding me of the commands
when I enable the spell checker.

Any other ideas?  Thanks.



You can try adding the following echo statement before the above
echo statement:

   echo \r

- Yegappan


Re: echo question

2006-05-14 Thread Jared
On 5/14/2006 8:44 AM, Yukihiro Nakadaira wrote:
 I think that your 'cmdheight' is 1 and 'showcmd' or 'ruler' is on and
 perhaps 'laststatus' is 0 or 1.
 How about this
 
 let ru_save = ruler
 let sc_save = showcmd
 set noruler noshowcmd
 echo ]s to skip to word, zg to add word, z= to suggest word
 let showcmd = sc_save
 let ruler = ru_save

I think it was the ruler option that was causing the problem.  I still can't
figure out why echo would behave differently depending on whether it's
called interactively or as part of a function, but by adding the three ruler
lines you suggested above I was able to make it work correctly.

Thanks!

--
Jared


echo question

2006-05-13 Thread Jared
I have a simple question that I can't seem to figure out.  When I use the
echo command to echo a statement on my open window, it simply displays that
message in the status bar.  However, if I use echo in a function, it adds
Please ENTER or type command to continue after it.

How do I make it not do that?  Eg, I just want it to display the message,
not prompt me to press a key.

Thanks.

--
Jared