Re: vimdiff - how to jump to next difference in long line - shortcut ]c does not work

2018-02-23 Thread Arun
On Fri, Feb 23, 2018 at 9:43 AM, Igor Forca  wrote:

> @Arun, I have tested your code in deep. It is working perfectly. What I
> have found is little trouble in the case when first line include the change.
>
> File1:
> aaa ccc
> aaa ccc
>
> File2:
> aaa bbb
> aaa bbb
>
> If cursor is in file1 at first line first column, diff enabled and
> pressing ]x I expect cursor to jump to first line first c letter, but it
> jumps to second line first c character. It looks this problem only appears
> if difference is in first line. If difference is any other line but first
> one the problem does not appear.
>
>
That is expected, the script searches by going down a line first, so hits
on the current line will be missed. Optimizing for that case was not worth
the changes it introduced.

As for the difference between the mappings ]c and ]x, the former goes over
all diff context (addition, deletion), where as the latter would only look
for DiffChanges. If your diff buffer does not have any additions or
deletions, both would behave the same.

Regards,
-Arun

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


enhance macro to profile C family code

2018-02-23 Thread Ni Va
Hi,

Seeing the attached macro @a which aims to add begin/end profile trace in C 
family block code, you can see that :

1/ multiply and executing 100@a works fine
2/ executing by command :1,$ normal @a echoes so many lines that it make macro 
effect slow


How can I optimize this ?
Thanks in advance
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Profile C Family Block

2018-02-23 Thread Ni Va
Hi,

I want to profile C block code adding begin/end trace at start and end of block.

public string Separator
{
set 
{
Trace.Write(string.Format("{0}::{1}", this.GetType().Name, 
MethodBase.GetCurrentMethod().Name));
mSeparator = value;
}

I have done a macro you can see in the attached gif that transform into that 
code.

set 
{
Trace.Write(string.Format("{0}::{1} BEGIN", 
this.GetType().Name, MethodBase.GetCurrentMethod().Name));
mSeparator = value;
Trace.Write(string.Format("{0}::{1} END", this.GetType().Name, 
MethodBase.GetCurrentMethod().Name));
}
   



How can I do to hide display of search result in order to make it faster ?

Thank you

-- 
-- 
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: vimdiff - how to jump to next difference in long line - shortcut ]c does not work

2018-02-23 Thread Igor Forca
@Arun, I have tested your code in deep. It is working perfectly. What I have 
found is little trouble in the case when first line include the change.

File1:
aaa ccc
aaa ccc

File2:
aaa bbb
aaa bbb

If cursor is in file1 at first line first column, diff enabled and pressing ]x 
I expect cursor to jump to first line first c letter, but it jumps to second 
line first c character. It looks this problem only appears if difference is in 
first line. If difference is any other line but first one the problem does not 
appear.

@Rick, thanks for providing the info about diffchar plugin. I tested it and it 
is awesome. I will definitely use it for projects when I work with code. But 
for projects where I analyze huge data files like long lines and 3000+ rows, 
this plugin is understandably little bit slow. Thanks.

-- 
-- 
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: making custom key names for mappings

2018-02-23 Thread Renato Fabbri
Em quinta-feira, 22 de fevereiro de 2018 22:05:29 UTC-3, ZyX  escreveu:
> 2018-02-23 1:43 GMT+03:00 Renato Fabbri:
> > Well, from your comments, i put a:
> >
> > let g:aall = mapleader
> > " let mapleader = ''
> > if exists("g:aa_leader")
> >   let mapleader = g:aa_leader
> > el
> >   let mapleader = 'anything'
> > en
> >
> >
> > before the mappings, and a:
> >
> > let mapleader = g:aall
> >
> > after them and it is all ok.
> > (only these mappings use the
> > temporarily defined leader key.)
> >
> > I did not understand how SourcePre
> > would be used.
> > Something like:
> > au SourcePre mymappings.vim let [g:fooleader, mapleader] = ['something', 
> > mapleader]
> >
> > in combination with a somewhat SourcePost event to
> > set mapleader to fooleader?
> 
> No, you set mapleader for *all* scripts, either to default or to
> something else. There is no SourcePost for some reason; an alternative
> is messing with SourceCmd, but this is harder to do right in general,
> but easier to use for specific use cases.

hum... try this:
let mapleader = 'a'
nn j :ec 'a banana'
let mapleader = 'b'
nn j :ec 'an apple'
let mapleader = 'a'
nn k :ec 'an orange'

which work 100% fine here.
((
:version

  
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan  6 2018 23:48:57)  

  
Included patches: 1-1428

  
Compiled by renato@xps  

  
Huge version without GUI.
)) + python 2-3 and termguicolors


> 
> >
> > Anyway, I understood that it is not needed to define
> > extra  key names, but is it possible within Vim standard
> > capabilities?
> 
> What is possible? All XXX in `` are defined at compile time only,
> you can’t evaluate expression inside XXX or something like this.

Ok, so question closed here.
Notice that  is surely not completely
defined in compile time, for we use
g:mapleader to set  at run time.

Am I following things right?

> 
> >
> >
> > Em quinta-feira, 22 de fevereiro de 2018 18:22:51 UTC-3, ZyX  escreveu:
> >> 2018-02-22 18:58 GMT+03:00 Renato Fabbri:
> >> > leader and localleader are the standard, so one might
> >> > have conflicts between scripts because
> >> > all of them use leader and localleader.
> >> >
> >> > how would you define, say
> >> > , which you set to the
> >> > leader by default,
> >> > but can be changed to any key
> >> > sequence (including c-v derived).
> >> >
> >> > ==
> >> > ideally, I would have a command mkKeyName with which to define
> >> >  such as
> >> >
> >> > :mkKeyName -default=leader coolleader
> >> >
> >> > and might set it to anything such as
> >> > se mapcoolleader=^[
> >> > se mapcoolleader=
> >> > se mapcoolleader!
> >> > se mapcoolleader!=
> >> >
> >> > (this implies that one would also able to use
> >> > :setlocal mapcoolleader ??
> >> >
> >> > and use it in your mappings
> >> > as in
> >> > nnoremap B :call MyCoolFunction()
> >>
> >> This is not needed, there is `:execute` as something requiring changes
> >> to plugin code. E.g. my plugins (on my frawor framework) allow
> >> defining plugin-specific leader.
> >>
> >> To override `mapleader` for plugins which are not nice enough to allow
> >> defining plugin-specific leader there is SourcePre event.
> >>
> >> I personally find mapleader and maplocalleader as quite *incomplete*
> >> thing. For plugins much better idea would be key-value store: e.g. in
> >> place of
> >>
> >> nnoremap (FooPluginDoBar) :call foo#bar()
> >> nnoremap (FooPluginDoZab) :call foo#zab()
> >>
> >> nmap fb (FooPluginDoBar)
> >> nmap fz (FooPluginDoZab)
> >>
> >> (last two possibly surrounded by `if !hasmapto(…)|endif`) one would write 
> >> just
> >>
> >> mapdefineprefix FooPlugin f
> >> nnoremap <:FooPlugin:DoBar(b)> :call foo#bar()
> >> nnoremap <:FooPlugin:DoZab(z)> :call foo#zab()
> >>
> >> and Vim will handle actually substituting values like this: each
> >> `<:prefix:mapname(default)>` expands into a concat of two strings:
> >>
> >> 1. The rhs of the first `:mapdefineprefix` command with lhs equal to 
> >> `prefix`.
> >> 2. The rhs of the first `:mapdefine` command or the `default` value if
> >> no `:mapdefine` commands with lhs equal to `prefix:mapname` were
> >> issued. Inside `default` `<>` are good as long as they are balanced,
> >> various special characters like `)` may be entered via something like
> >> ``.
> >>
> >> In both cases using bang clears the prefix, so next non-banged command
> >> will define it (normally it is ignored).
> >>
> >> E.g. in this case if user 

Re: making custom key names for mappings

2018-02-23 Thread Nikolay Aleksandrovich Pavlov
2018-02-23 18:21 GMT+03:00 Renato Fabbri :
> Em quinta-feira, 22 de fevereiro de 2018 22:05:29 UTC-3, ZyX  escreveu:
>> 2018-02-23 1:43 GMT+03:00 Renato Fabbri:
>> > Well, from your comments, i put a:
>> >
>> > let g:aall = mapleader
>> > " let mapleader = ''
>> > if exists("g:aa_leader")
>> >   let mapleader = g:aa_leader
>> > el
>> >   let mapleader = 'anything'
>> > en
>> >
>> >
>> > before the mappings, and a:
>> >
>> > let mapleader = g:aall
>> >
>> > after them and it is all ok.
>> > (only these mappings use the
>> > temporarily defined leader key.)
>> >
>> > I did not understand how SourcePre
>> > would be used.
>> > Something like:
>> > au SourcePre mymappings.vim let [g:fooleader, mapleader] = ['something', 
>> > mapleader]
>> >
>> > in combination with a somewhat SourcePost event to
>> > set mapleader to fooleader?
>>
>> No, you set mapleader for *all* scripts, either to default or to
>> something else. There is no SourcePost for some reason; an alternative
>> is messing with SourceCmd, but this is harder to do right in general,
>> but easier to use for specific use cases.
>
> hum... try this:
> let mapleader = 'a'
> nn j :ec 'a banana'
> let mapleader = 'b'
> nn j :ec 'an apple'
> let mapleader = 'a'
> nn k :ec 'an orange'
>
> which work 100% fine here.

I do not understand what you are trying to say. I know that ``
is expanded only once, but that is not helpful: SourcePre is run only
before some script, so if your script is not the last one you have to
create SourcePre command which will set mapleader to one value for
your script and to another value for everything else.

> ((
> :version
> VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan  6 2018 23:48:57)
> Included patches: 1-1428
> Compiled by renato@xps
> Huge version without GUI.
> )) + python 2-3 and termguicolors
>
>
>>
>> >
>> > Anyway, I understood that it is not needed to define
>> > extra  key names, but is it possible within Vim standard
>> > capabilities?
>>
>> What is possible? All XXX in `` are defined at compile time only,
>> you can’t evaluate expression inside XXX or something like this.
>
> Ok, so question closed here.
> Notice that  is surely not completely
> defined in compile time, for we use
> g:mapleader to set  at run time.
>
> Am I following things right?

You cannot change semantics of `` or e.g. evaluate `mapleader`
as an expression, so this fact is not helpful. And you also can’t add
any new keys. So “not completely” is not very helpful.

>
>>
>> >
>> >
>> > Em quinta-feira, 22 de fevereiro de 2018 18:22:51 UTC-3, ZyX  escreveu:
>> >> 2018-02-22 18:58 GMT+03:00 Renato Fabbri:
>> >> > leader and localleader are the standard, so one might
>> >> > have conflicts between scripts because
>> >> > all of them use leader and localleader.
>> >> >
>> >> > how would you define, say
>> >> > , which you set to the
>> >> > leader by default,
>> >> > but can be changed to any key
>> >> > sequence (including c-v derived).
>> >> >
>> >> > ==
>> >> > ideally, I would have a command mkKeyName with which to define
>> >> >  such as
>> >> >
>> >> > :mkKeyName -default=leader coolleader
>> >> >
>> >> > and might set it to anything such as
>> >> > se mapcoolleader=^[
>> >> > se mapcoolleader=
>> >> > se mapcoolleader!
>> >> > se mapcoolleader!=
>> >> >
>> >> > (this implies that one would also able to use
>> >> > :setlocal mapcoolleader ??
>> >> >
>> >> > and use it in your mappings
>> >> > as in
>> >> > nnoremap B :call MyCoolFunction()
>> >>
>> >> This is not needed, there is `:execute` as something requiring changes
>> >> to plugin code. E.g. my plugins (on my frawor framework) allow
>> >> defining plugin-specific leader.
>> >>
>> >> To override `mapleader` for plugins which are not nice enough to allow
>> >> defining plugin-specific leader there is SourcePre event.
>> >>
>> >> I personally find mapleader and maplocalleader as quite *incomplete*
>> >> thing. For plugins much better idea would be key-value store: e.g. in
>> >> place of
>> >>
>> >> nnoremap (FooPluginDoBar) :call foo#bar()
>> >> nnoremap (FooPluginDoZab) :call foo#zab()
>> >>
>> >> nmap fb (FooPluginDoBar)
>> >> nmap fz (FooPluginDoZab)
>> >>
>> >> (last two possibly surrounded by `if !hasmapto(…)|endif`) one would write 
>> >> just
>> >>
>> >> mapdefineprefix FooPlugin f
>> >> nnoremap <:FooPlugin:DoBar(b)> :call foo#bar()
>> >> nnoremap <:FooPlugin:DoZab(z)> :call foo#zab()
>> >>
>> >> and Vim will handle actually substituting values like this: each
>> >> `<:prefix:mapname(default)>` expands into a concat of two strings:
>> >>
>> >> 1. The rhs of the first `:mapdefineprefix` command with lhs equal to 
>> >> `prefix`.
>> >> 2. The rhs of the first `:mapdefine` command or the `default` value if
>> >> no `:mapdefine` commands with lhs equal to `prefix:mapname` were
>> >> issued. Inside `default` `<>` are good as long as they are balanced,
>> >> various special characters like `)` may be entered via something like
>> >> 

Re: vimdiff - how to jump to next difference in long line - shortcut ]c does not work

2018-02-23 Thread Ni Va
Le vendredi 23 février 2018 18:43:35 UTC+1, Igor Forca a écrit :
> @Arun, I have tested your code in deep. It is working perfectly. What I have 
> found is little trouble in the case when first line include the change.
> 
> File1:
> aaa ccc
> aaa ccc
> 
> File2:
> aaa bbb
> aaa bbb
> 
> If cursor is in file1 at first line first column, diff enabled and pressing 
> ]x I expect cursor to jump to first line first c letter, but it jumps to 
> second line first c character. It looks this problem only appears if 
> difference is in first line. If difference is any other line but first one 
> the problem does not appear.
> 
> @Rick, thanks for providing the info about diffchar plugin. I tested it and 
> it is awesome. I will definitely use it for projects when I work with code. 
> But for projects where I analyze huge data files like long lines and 3000+ 
> rows, this plugin is understandably little bit slow. Thanks.

Windows' like F3 key :

nnoremap? ']c':''
nnoremap  ? '[c':''

works fine and similar to Windows search.

-- 
-- 
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: difference between min/max timestamps

2018-02-23 Thread Ni Va
Le vendredi 23 février 2018 14:23:19 UTC+1, Ni Va a écrit :
> Hi,
> 
> 
> This is a listoftimestamps=['11:02:02.602','11:00:00.402','11:05:00.402'] 
> 
> I would like to calculate difference in second.ticks betwwen min and max?
> 
> 
> 
> I've seen vim's time func but don't think it could help to do this work.
> 
> 
> Thank you

If it can help :


"time 
fun! helper#timegetseconds(timestamp) "{{{
  " timestart
  let timestamp = split(a:timestamp,'\.')
  let tick = timestamp[1]/1000.0
  let [h,m,s]=split(timestamp[0],':')
  return (3600*str2float(h) + 60*str2float(m) + str2float(s)) + tick
endfunction "}}}
fun! helper#timediff(timestart,timeend) "{{{
  return 
abs(helper#timegetseconds(a:timeend)-helper#timegetseconds(a:timestart))
endfunction "}}}

-- 
-- 
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: Could not load library msvcrt-ruby240.dll

2018-02-23 Thread Ni Va
Le jeudi 22 février 2018 09:33:23 UTC+1, Christian Brabandt a écrit :
> On Do, 22 Feb 2018, Frantz Baustier wrote:
> 
> > >> Ruby is install in C:\Ruby24 and the bin folder containing the 
> > >> msvcrt-ruby240.dll is in %PATH%.
> > >> 
> > >> I also tried to put in my vimrc file set 
> > >> rubydll="C:\Ruby24\bin\msvcrt-ruby240.dll" but I got the following error 
> > >> :
> > > 
> > > did you actually use :set rubydll="..."
> > > 
> > > That does not work, since the `"` is the command character in vim.
> > 
> > You’re right! But I tried with ‘ and IT doen’t work, sale error message
> 
> Do not use quotes at all when using :set
> :set has its own quoting rules, you need to escape whitespace, bars, 
> commas and backslashes. So you would have to use something like this:
> :set rubydll=C:\\Ruby24\\bin\\msvcrt-ruby240.dll
> 
> It is usually easier to avoid all those escaping issues by using the 
> :let form (:h :let-option):
> 
> :let ='C:\Ruby24\bin\msvcrt-ruby240.dll'
> 
> However make sure to use single quotation marks, as otherwise 
> backslashes have to be doubled and might mean something different than 
> intended (see :h expr-quote)
> 
> BTW: Have you tried the answer from Ken (quoting from 
> https://github.com/vim/vim-win32-installer/issues/47#issuecomment-366912233)
> 
> ,
> | Could you try adding C:\Ruby24\bin and also 
> | C:\Ruby24\bin\ruby_builtin_dlls to the PATH environment? (If you use 
> | 64-bit Vim, replace Ruby24 with Ruby24-x64.)
> `
> 
> 
> 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.


extDlls.vim
Description: Binary data


difference between min/max timestamps

2018-02-23 Thread Ni Va
Hi,


This is a listoftimestamps=['11:02:02.602','11:00:00.402','11:05:00.402'] 

I would like to calculate difference in second.ticks betwwen min and max?



I've seen vim's time func but don't think it could help to do this work.


Thank you

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