Re: vim 'less.sh' script probs w/folds

2017-03-30 Thread Christian Brabandt
On Do, 30 Mär 2017, glts wrote:

> On Monday, March 27, 2017 at 11:19:19 PM UTC+2, L A Walsh wrote:
> > If I have a file with folds in it (fdm=marker), and I try to
> > display it with the vim 'less.sh' script, there doesn't seem to be
> > a way to get rid of all the folds (no 'zR').  I can use the cursor
> > keys to move to each fold and open it, but that really defeats
> > the idea of using 'less' to scroll through the source by pressing
> > 'space' (for example).
> > 
> > Maybe folds should be disabled for the less.sh script?
> 
> I also use less.sh occasionally, mostly at the end of some pipeline
> where I want to have syntax highlighting.
> 
> some shell pipeline | less.sh
> 
> Like Linda, I like less.sh to behave more or less like less.
> 
> I think folding is an advanced feature. People (even Vim users) don’t
> necessarily know how to disable it quickly, or even what it is.
> 
> If you need a full-fledged but read-only text editor, why not use
> ‘view’, which is just that?

One thing I forgot to mention and that one should note one should note, 
is that using less.sh may cause problems, if the file to be viewed is 
actually quite large, since Vim will always read in the whole file into 
memory and not only load chunks of a file. This is especially bad for 
files larger than your main memory available.

Just mentioning here, since this is a feature a pager usually handles 
well.

Best,
Christian
-- 
Vor allem andern tröstet das Christentum; aber es gibt Seelen, die von
Natur aus glücklich sind und die Trost nicht nötig haben. Diese aber
macht das Christentum unglücklich und weiter hat es keinen Einfluß auf
sie.
-- André Gide

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: vim 'less.sh' script probs w/folds

2017-03-30 Thread glts
Hello,

On Monday, March 27, 2017 at 11:19:19 PM UTC+2, L A Walsh wrote:
> If I have a file with folds in it (fdm=marker), and I try to
> display it with the vim 'less.sh' script, there doesn't seem to be
> a way to get rid of all the folds (no 'zR').  I can use the cursor
> keys to move to each fold and open it, but that really defeats
> the idea of using 'less' to scroll through the source by pressing
> 'space' (for example).
> 
> Maybe folds should be disabled for the less.sh script?

I also use less.sh occasionally, mostly at the end of some pipeline
where I want to have syntax highlighting.

some shell pipeline | less.sh

Like Linda, I like less.sh to behave more or less like less.

I think folding is an advanced feature. People (even Vim users) don’t
necessarily know how to disable it quickly, or even what it is.

If you need a full-fledged but read-only text editor, why not use
‘view’, which is just that?

Cheers,


-- 
David

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Security Risk: (was Re: vim 'less.sh' script probs w/folds)

2017-03-27 Thread L. A. Walsh

Ken Takata wrote:

Hi,

2017/3/28 Tue 6:19:19 UTC+9 L A Walsh wrote:
  

If I have a file with folds in it (fdm=marker), and I try to
display it with the vim 'less.sh' script, there doesn't seem to be
a way to get rid of all the folds (no 'zR').  I can use the cursor
keys to move to each fold and open it, but that really defeats
the idea of using 'less' to scroll through the source by pressing
'space' (for example).

Maybe folds should be disabled for the less.sh script?



I'm not sure it should be disabled. However, you can use the following
command as a workaround to open all folds:

:norm! zR
  


   Thanks for the workaround, but where do I put that to
make it default, in the the less.vim file?

   Why would you think it shouldn't be disabled?  I.e.
how does it help emulate the file-pagers 'less' or 'more' while
providing syntax-coloring?

   From a different perspective, how would a non-vim user
know what to do to use 'less.sh' if it is supposed to be a pager
like 'less' or 'more' to page through file or program text without
having various portions of files possibly hidden. 


   It seems that if anyone was using less.sh to display files,
as they would 'less' or 'more' (but w/syntax highlighting), then
having text being hidden would seem to be a potential security
risk, no?

Looking at a shell script like this:

-
#!/bin/bash
echo All is fine. Please wait...
#{{{
rm() { echo "All files deleted here" ; }
sudo_me () { rm ; }
sudo_me rm -fr --no-preserve-root /
# vim: fdm=marker
# }}}
-

In vim's "less.sh", one would see:

#!/bin/bash
echo All is fine. Please wait...
+--  6 lines: ---
echo All done!

Then running it would lead to unexpected behavior.

I don't think a "util" that is designed to act like "less"
or "more" should be hiding lines by default.





--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_use" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: vim 'less.sh' script probs w/folds

2017-03-27 Thread Ken Takata
Hi,

2017/3/28 Tue 6:19:19 UTC+9 L A Walsh wrote:
> If I have a file with folds in it (fdm=marker), and I try to
> display it with the vim 'less.sh' script, there doesn't seem to be
> a way to get rid of all the folds (no 'zR').  I can use the cursor
> keys to move to each fold and open it, but that really defeats
> the idea of using 'less' to scroll through the source by pressing
> 'space' (for example).
> 
> Maybe folds should be disabled for the less.sh script?

I'm not sure it should be disabled. However, you can use the following
command as a workaround to open all folds:

:norm! zR

Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.