Wednesday, March 29, 2017

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

Christian Brabandt wrote:
> Hi L.!
>
> On Di, 28 Mär 2017, L. A. Walsh wrote:
>
>
>> Here is the problem -- I am not using "less.vim"...
>>
>> I type in (at the command prompt):
>> less.sh <filename>
>>
>
> Here is the problem: Why do you type less.sh and not less or more or
> most. And why is this in your path?
>
----
I wanted syntax highlighting in less, so
I copied 'less.sh' into ~/bin/vless for testing. If it
was a suitable (compatible) pager, I might want it to
replace less as a default when I'm doing SW development.

At the very least, if it was 'less'-feature
compatible, highlighting could be invoked as a special
call out from 'less'.

Note: my first attempt to get this functionality was
to use the convert-to-HTML feature, and setup 'less'
to display the syntax-colorized version of the file
via 'lynx'. unfortunately 'lynx' doesn't implement
text coloring, and the alternate, 'w3m' gave even
worse looking output.

So..why did I use less.sh? Because I followed the
vim instructions to get 'vim' to be usable like "less" or
"more". Neither of those utils hide blocks of text based on
settings in the file. If I want smarter text display,
I'd bring up the file in a text editor, like vim! ;-)

Text files are supposed to be "dumb". From there, you
can add on specific features. In this case, highlighting
was supposed to be added to a 'less/more' like interface.
That excludes automatic visual formatting of the
text to look different than it does in the file.

In the same way, I wouldn't expect vim to automatically
justify text on output when trying to be a simple
replacement for 'less/more' pagers, but w/syntax.

I.e. the defaults should be the simple case as displayed in
'less/more'. Having options to add in hidden text or
word-break line-folding are fine options -- just not
for the default case where it's suppose to be like
a dumb-text pager (except for HLing feature).

"If you use the less or more program to view a file, you
don't get syntax highlighting. Thus you would like to
use Vim instead. You can do this by using the shell script
"$VIMRUNTIME/macros/less.sh".

So if I use less, and don't see syntax highlighting but
want to, then I'd expect vim to do that (only because it is
documented to do so in the help).

>
>> In regards to the 2nd sentence... it is also, not
>> quite accurate: when I saw the folds, the
>> first thing I tried was 'zR' (which didn't work).
>>
>
> You can still use :set nofoldenable
>
---
It's not about all the different things that might
work -- it's about the default inability to display the
file as it is on disk (without folds or text processing
markup).

Do you use 'less' or try to display syntax HLing using
'less.sh'?

What's the use case or reason for insisting that
the script shouldn't function like 'more' or 'less' by
default (as the documentation seems to indicate)?


*curious*,
Linda

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: