Re: write to command0line prompt

2018-02-20 Thread Christian Brabandt

On Mi, 21 Feb 2018, Renato Fabbri wrote:

> 
> 
> :'-|
> 
> 
> may one assume that is is not possible to leave the cursor
> in the command line with some text written if not through a mapping?

:call feedkeys(':foobar', 'n')

Best,
Christian

-- 
-- 
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: write to command0line prompt

2018-02-20 Thread Renato Fabbri
:'-|


may one assume that is is not possible to leave the cursor
in the command line with some text written if not through a mapping?

Best,
rf

On Sun, Feb 18, 2018 at 7:08 PM, Renato Fabbri 
wrote:

> Em domingo, 18 de fevereiro de 2018 18:09:10 UTC-3, Tim Chase  escreveu:
> > On 2018-02-18 13:05, Renato Fabbri wrote:
> > > :normal :ls
> > > does not leave the user with the cursor at the command-line, e.g.
> > > in: :ls
> > >
> > > Is there a way to write a function or is there a command I might
> > > use to leave the user with a given string in the command-line?
> >
> > A mapping can leave you at the prompt if you don't append "" to
> > it:
> >
> >   :nnoremap  :ls
> >
> > Without knowing the context and what you're hoping to do with it,
> > it's hard to give much more detail.
>
> Some context...
>
> I have these mappings:
> nnoremap ^[FF :Split echo globpath('/home/renato/repos/', "**/rdf*")
> nnoremap ^[Ff :Split echo globpath(, "*/ttm*")
> nnoremap ^[Fa :Split echo globpath(, "*/ttm*")
> nnoremap ^[FA :Split echo globpath(, "**/pack/**")
> (^[ stands for Alt here, achieved using .)
>
> I want the following mapping:
> " nnoremap ^[Ff :Split echo globpath(, '"**/' . expand("") .
> "*")
>
> which does not work because Vim considers the whole expression as a string
> and does note evaluate expand().
>
> To make this work, I made a function with variations such as:
>
> fu! SearchFilenameRTP()
>   let a = expand("")
>   let b = '**/' . l:a . '*'
>   let c = ':Split echo globpath(, "' . l:b . '")'
>   normal l:c
> endfu
>
> but I can't get the string in l:c into the command-line.
>
> -renato
>
>
> >
> > -tim
>
> --
> --
> 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 a topic in the
> Google Groups "vim_use" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/vim_use/fZowH6oqwYE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> vim_use+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Renato Fabbri
GNU/Linux User #479299
labmacambira.sourceforge.net

-- 
-- 
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: build dict key:val from map list and substitute

2018-02-20 Thread Nikolay Aleksandrovich Pavlov
2018-02-20 22:52 GMT+03:00 Ni Va :
> Hi,
>
> map(copy(totaltimelist)[0:10], 'substitute(v:val, linepat, "\\1 : \\2", "")')
>
> Two values as backward ref are retrieved from a mapped list but I would like 
> to use :
> - first value \\1 as dict.key
> - second value \\2 is added to dict[key].values = [\\2,...,..]
>
>
> How doing this into first map( function above ?

You need to use `\=` as a replacement with `submatch(1)` for `\1`.
Expressions after `\=` are fully capable of side-effects, though I
should say that unless there are performance requirements replacing
`map()` with `:for` would be more readable. Also unless you do need
`substitute()` results it is better to discard `substitute()` and use
`matchlist()`, putting side-effects in the top-level expression thus
saving another level of escaping. Though most likely you would need
`extend(l:, …)` to create temporary variables in this case, as I said
earlier lambdas are not good for performance.

Ah, and you must remove `copy()`. What you are doing here is creating
a copy of a list, slicing it (thus creating *another* list) and
immediately discarding the list created by `copy()`.

>
> Thank in advance
> Nicolas
>
> --
> --
> 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.

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


build dict key:val from map list and substitute

2018-02-20 Thread Ni Va
Hi,

map(copy(totaltimelist)[0:10], 'substitute(v:val, linepat, "\\1 : \\2", "")')

Two values as backward ref are retrieved from a mapped list but I would like to 
use :
- first value \\1 as dict.key
- second value \\2 is added to dict[key].values = [\\2,...,..]


How doing this into first map( function above ?

Thank in advance
Nicolas

-- 
-- 
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: Moving away from SourceForge

2018-02-20 Thread Charles Sheridan
Currently at 09h50 CST from Safari on a mac, http://www.vim.org gets 

   Warning: Unknown: failed to open stream: Permission denied in Unknown on 
line 0

   Fatal error: Unknown: Failed opening required 
'/home/project-web/vim/htdocs/index.php' 
   (include_path='.:/usr/local/lib/php') in Unknown on line 0

Chrome gets to the site, but hitting the add script button results in a white 
browser screen hang at
https://vim.sourceforge.io/scripts/add_script.php

Nothing new posted on sourceforge blog.

Charles

-- 
-- 
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: A syntax highlighting trivia: matching operators

2018-02-20 Thread Lifepillar

On 20/02/2018 16:10, Charles E Campbell wrote:

Lifepillar wrote:

Suppose that @, @@, and @@@ are three operators and that @ is not in
iskeyword. Besides, the operators may not necessarily be surrounded
by spaces or alphanumeric characters: for example, one may encounter
@( at the begin of the line (as in this line).

How would you define syntax rules to highlight those three operators,
but not , @, and so on?

The above is an instance of a problem I have encountered in my
PostgreSQL syntax plugin. Currently, I have rules like these:

   syn match sqlIsOperator "[!?~#^@<=>%&|*/+-]\+" contains=sqlOperator
   syn match sqlOperator contained "@@@\|@@\|@"
   etc...

but those do not limit the highlighted sequences to just those defined
by the sqlOperator rules. More precisely,  is entirely highlighted
because its @@@ prefix matches and the last @ matches, too.

Hello:

Please try the attached at.vim file.  I've included a "junk" file for
illustration.


Nice! I think that the first syntax rule should include \ze, though:

   syn match OneAt '@\{1,3}\ze\([^@]\|$\)'

And, correct me if I am wrong, the rules can be further simplified to:

  syn match OneAt'@\{1,3}'
  syn match LotsaAt  '@\{4,}'

  hi default link OneAt Operator

I hadn't thought of using a rule without a corresponding highlighting
to catch "negative" matches. Clever trick!

Thanks!
Life.

--
--
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: A syntax highlighting trivia: matching operators

2018-02-20 Thread Charles E Campbell
Lifepillar wrote:
> Suppose that @, @@, and @@@ are three operators and that @ is not in
> iskeyword. Besides, the operators may not necessarily be surrounded
> by spaces or alphanumeric characters: for example, one may encounter
> @( at the begin of the line (as in this line).
>
> How would you define syntax rules to highlight those three operators,
> but not , @, and so on?
>
> The above is an instance of a problem I have encountered in my
> PostgreSQL syntax plugin. Currently, I have rules like these:
>
>   syn match sqlIsOperator "[!?~#^@<=>%&|*/+-]\+" contains=sqlOperator
>   syn match sqlOperator contained "@@@\|@@\|@"
>   etc...
>
> but those do not limit the highlighted sequences to just those defined
> by the sqlOperator rules. More precisely,  is entirely highlighted
> because its @@@ prefix matches and the last @ matches, too.
Hello:

Please try the attached at.vim file.  I've included a "junk" file for
illustration.

Enjoy!
Chip Campbell

-- 
-- 
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.
one   @   two
two   @@  three
three @@@ four
lotsa s
one   @
two   @@
three @@@
lotsa 
syn match OneAt '@\{1,3}\([^@]\|$\)'
syn match LotsaAt   '@\{4,}'

hi default link OneAt   Operator
hi default link TwoAt   Operator
hi default link ThreeAt Operator


Re: pattern of func

2018-02-20 Thread Ni Va
Le mardi 20 février 2018 00:27:36 UTC+1, Arun E a écrit :
> That is due to the "greedy" nature of ".*". Replace ".*" with ".\{-}".
> 
> 
> Anycase, for a preview of what your pattern would match, you could 
> surround your expression of interest within \zs and \ze like
>    /^.*\zs\(\S\+()\)\ze
> 
> 
> If you have "incsearch" set, you could immediately see what your
> pattern matches.
> 
> 
> Regards,
> -Arun
> 
> 
> On Mon, Feb 19, 2018 at 12:40 PM, Ni Va  wrote:
> Hi,
> 
> 
> 
> 1/Got a list mirror of file read that contains these kind of lines:
> 
> 19 févr. 2018 15:49:09.301       Foo.BarFoo() - FIN TOTAL temps : 0,013ms
> 
> 
> 
> 
> 
> 2/ attempt to map( the list and retrieve func and time
> 
> 
> 
>   let patfunc = '\(\S\+()\)'
> 
>   let pattime = '\(\d\+\,\d\+\)'
> 
>   let linepat = '^.*'.patfunc.'.*'.pattime.'.*$'
> 
> 
> 
>   let minitestlist = map(totaltimelist[0:10], 'substitute(v:val, linepat, 
> "\\1 : \\2", "")')
> 
> 
> 
> 
> 
> 
> 
> 3/ It results in
> 
> 
> 
> ['o():0,013',
> 
> 
> 
> Why for the first backward ref I got only last char.
> 
> 
> 
> Thank you
> 
> Niva
> 
> 
> 
> --
> 
> --
> 
> 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+u...@googlegroups.com.
> 
> For more options, visit https://groups.google.com/d/optout.

Thank you it works like that:

  let patfunc = '\(\S\+()\)'
  let pattime = '\(\d\+\,\d\+\)'

  let linepat = '^.\{-}'.patfunc.'.*'.pattime.'.\{-}$'
  let minitestlist = map(copy(totaltimelist)[0:10], 'substitute(v:val, linepat, 
"\\1 : \\2", "")')

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