Wednesday, April 1, 2020

Re: Vim saves file with lowercase filename

On Mi, 01 Apr 2020, Ni Va wrote:

> Christian can you help me on the other recent post on autocommand CursorMoved please ?

I just left some hints on your message.

Best,
Christian
--
Was bin ich denn gegen das All?
-- Johann Wolfgang von Goethe (Wanderjahre)

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200402065745.GC16659%40256bit.org.

Re: How to avoid autocmd CursorMoved to lag ?

On Di, 31 Mär 2020, Ni Va wrote:

> Hi,
>
> I use this func to switch filetype when cursor is moving outside/inside embed
> section:
>
>
> fun! helper#SwitchFileType() "{{{
>   if !exists('b:busy')
>   let b:busy=1
> let start = str2nr(search( '^\w\+\s\+<<\s\+EOF', 'n' ))
> if start > 0
>   let end    = str2nr(search( '^EOF', 'n' ))
>   let curpos = getcurpos()[1]
>   let lang   = split(getline(start), '<<')[0]->substitute('\s', '', "g") 
>   if (curpos > start) && (curpos < end)
> exe 'set ft='.lang
>   else
> exe 'set ft=vim'
>   end
> "echo 'Filetype switched to ' . &ft
> end
>   unlet b:busy
>   end
> endfun "}}}
>
>
>   autocmd CursorMoved    *.vim   call helper#SwitchFileType()
>   autocmd CursorMovedI   *.vim   call helper#SwitchFileType()
>  
>
>
> The func is called on event cursormoved and lag cursor effectively moving
> action.
>
> how to avoid this lag ?

I am not exactly sure, but a couple of things to check:

- Loading filetypes every time you move (even for single letters):

:set ft=<filetype>

this will cause vim to load several runtime files (ftplugin, syntax and
indent scripts) and although vim usually checks whether they have been
already loaded using some buffer local variables, the files have to be
read (and loaded from your harddisk). This might make vim slow,
especially, if Vim is installed on a slow hard disk (or even worse: a
network share).

Better here is to cache the current filetype and only call `:set ft=` if
you detect that you are already in a different filetype.

- Second, the searching for the regions of different filetypes happens
every time you move your cursor (even when moving horizontal). This
might slow down vim, although the regular expression does not look
very expansive).
I believe the builtin vim syntax file, already has support for
different syntax regions so you could simply check the name of the
current syntax region using synid()/synidattr() and only load your
filetype scripts then.
However, as mentioned, the vim syntax script already has support for
embedding of a couple of languages, so first check `:h g:vimsyn_embed`
and see if setting this variable can do what you like to achieve.


Best,
Christian
--
Rus, Ute:
leistete fruchtbare Beiträge zur Entwicklung der Gebärdensprache

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200402065706.GB16659%40256bit.org.

Re: ccomplete#Complete very slow on large tags file

On Wed, Apr 1, 2020 at 8:02 PM Pratyush Yadav <me@yadavpratyush.com> wrote:
>
> Hi Tony,
>
> On 01/04/20 07:26PM, Tony Mechelynck wrote:
> > On Wed, Apr 1, 2020 at 7:15 PM Pratyush Yadav <me@yadavpratyush.com> wrote:
> > >
> > > Hi,
> > >
> > > I am using the built-in ccomplete#Complete omnifunc for tags-based
> > > completion. It works pretty well with a small or medium sized project.
> > > But on larger projects like Linux or U-Boot, the tags file is pretty big
> > > (~650k lines/70 for U-Boot and ~4.8 mil lines/630MB for Linux).
> > >
> > > On these projects, especially Linux, if I use ccomplete, completion
> > > takes a huge amount of time. And since the completion is synchronous,
> > > vim just freezes up for that time and I have to wait for the completion
> > > results to show up. On Linux the wait times can go more than a minute on
> > > my modest quad core 4th gen i7 and a SATA SSD.
> > >
> > > So, I intend to set aside some time and try to speed up the completion
> > > and make it asynchronous. I haven't read or written much vimscript so I
> > > don't expect it to be easy or quick. So before I do that, I'd like to
> > > know if anyone here attempted this before.
> > >
> > > If someone did succeed, could you please point me to the optimized
> > > version? If someone tried but failed, could you please let me know where
> > > you had trouble? Is it that the ctags format just not suitable for large
> > > projects? Is there some limitation with vim that makes it impossible? Is
> > > it something else entirely?
> > >
> > > --
> > > Regards,
> > > Pratyush Yadav
> >
> > The Vim tags file is pretty large, but how is your tags file built? In
> > particular, is it case-fold-sorted? If your Vim is built with
> > +tag_binary (nowadays it always is, if yours isn't you need a newer
> > model), and 'tagbsearch' is on (which is the default), then finding a
> > tag in an unsorted tags file uses linear time, in a case-folded sorted
> > tags file it uses logarithmic time, which is much faster, especially
> > for large tags files.
>
> Yes, the tags file is sorted and vim is built with +tag_binary and
> 'tagbsearch' is on. The tags file wasn't case-folded sorted, but I tried
> with that too and I see similar performance.
>
> Anyway, just to remove any potential confusion, jumping to tags via
> 'CTRL-]' is blazing fast. So is listing all alternatives with 'g]'. Does
> ccomplete use the same mechanism for searching tags file as those two?
> If so, then I wonder why it is so much slower.
>
> Also if I have a struct foo, doing something like 'foo->' takes a huge
> amount of time because I think there is no other way to get a list of
> members of a struct without a linear search, but that is a different
> problem entirely.
>
> --
> Regards,
> Pratyush Yadav

Hm, check the help for 'complete' and for the following completion
options (in the current helpfile, options.txt dated 2020 Mar 02, there
are 127 lines for them all). Maybe something will ring a bell with
you.

Best regards,
Tony.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXuSvSNjo3AtWb6MJT1zexLjSYr1yyGWHxPQThmuGHJ1TA%40mail.gmail.com.

Re: ccomplete#Complete very slow on large tags file

Hi Tony,

On 01/04/20 07:26PM, Tony Mechelynck wrote:
> On Wed, Apr 1, 2020 at 7:15 PM Pratyush Yadav <me@yadavpratyush.com> wrote:
> >
> > Hi,
> >
> > I am using the built-in ccomplete#Complete omnifunc for tags-based
> > completion. It works pretty well with a small or medium sized project.
> > But on larger projects like Linux or U-Boot, the tags file is pretty big
> > (~650k lines/70 for U-Boot and ~4.8 mil lines/630MB for Linux).
> >
> > On these projects, especially Linux, if I use ccomplete, completion
> > takes a huge amount of time. And since the completion is synchronous,
> > vim just freezes up for that time and I have to wait for the completion
> > results to show up. On Linux the wait times can go more than a minute on
> > my modest quad core 4th gen i7 and a SATA SSD.
> >
> > So, I intend to set aside some time and try to speed up the completion
> > and make it asynchronous. I haven't read or written much vimscript so I
> > don't expect it to be easy or quick. So before I do that, I'd like to
> > know if anyone here attempted this before.
> >
> > If someone did succeed, could you please point me to the optimized
> > version? If someone tried but failed, could you please let me know where
> > you had trouble? Is it that the ctags format just not suitable for large
> > projects? Is there some limitation with vim that makes it impossible? Is
> > it something else entirely?
> >
> > --
> > Regards,
> > Pratyush Yadav
>
> The Vim tags file is pretty large, but how is your tags file built? In
> particular, is it case-fold-sorted? If your Vim is built with
> +tag_binary (nowadays it always is, if yours isn't you need a newer
> model), and 'tagbsearch' is on (which is the default), then finding a
> tag in an unsorted tags file uses linear time, in a case-folded sorted
> tags file it uses logarithmic time, which is much faster, especially
> for large tags files.

Yes, the tags file is sorted and vim is built with +tag_binary and
'tagbsearch' is on. The tags file wasn't case-folded sorted, but I tried
with that too and I see similar performance.

Anyway, just to remove any potential confusion, jumping to tags via
'CTRL-]' is blazing fast. So is listing all alternatives with 'g]'. Does
ccomplete use the same mechanism for searching tags file as those two?
If so, then I wonder why it is so much slower.

Also if I have a struct foo, doing something like 'foo->' takes a huge
amount of time because I think there is no other way to get a list of
members of a struct without a linear search, but that is a different
problem entirely.

--
Regards,
Pratyush Yadav

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200401180220.ffuizuelijlyd3dr%40yadavpratyush.com.

Re: Vim saves file with lowercase filename

It's mine. Explorer dir/files in ruby that did downcase on explored path..

Sorry for inconvenience. 

Le mer. 1 avr. 2020 à 18:04, Richard Mitchell <rwmitchell@gmail.com> a écrit :
As in a plugin you wrote or one you are using?

If the latter, you could mention its name for others to be aware of.

(just so when someone comes along later googling this same problem, they'll know the resolution)

On Wednesday, April 1, 2020 at 11:14:41 AM UTC-4, Ni Va wrote:
Sorry for inconvenience I cannot reproduce yet with -clean. 
It's a plugin of mine. Sorry.


Le mer. 1 avr. 2020 à 16:34, Christian Brabandt <cbl...@256bit.org> a écrit :

On Mi, 01 Apr 2020, Ni Va wrote:

> I know it is the same but, for human readable reason, I want to keep camelCase notation fileName I had before saving this file with Vim.
>
> It is not OS windows 64 bits enterprise last update that is in cause, but really Vim because when I save the same file with notepad++, this does not modify the camelCase notation of filename.
>
> So it is certainly an option, not of the OS but of Vim. I see that filencoding talked about lowercase depending on which encoding you choose.. but not really got fix for this problem for instant.

I cannot reproduce this. Please provide a reproducible example starting
from vim --clean and mention what filesystem you save on. Best is to
start in an empty directory.

Best,
Christian
--
Alkohol ist nicht die Antwort. Hilft aber, die Frage nicht so ernst
zu nehmen.
                -- Klaus Klages

--
--
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/6gnlKECCDtM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200401143404.GA16659%40256bit.org.

--
--
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/6gnlKECCDtM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/774361cd-d562-4748-abb4-a3cd66fc959e%40googlegroups.com.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAOKxv4EvnsJmC6yWx-R3ebcyUavi2i8%2BDU4Q4a_kR_Tmuyrd%2BA%40mail.gmail.com.

Re: ccomplete#Complete very slow on large tags file

On Wed, Apr 1, 2020 at 7:15 PM Pratyush Yadav <me@yadavpratyush.com> wrote:
>
> Hi,
>
> I am using the built-in ccomplete#Complete omnifunc for tags-based
> completion. It works pretty well with a small or medium sized project.
> But on larger projects like Linux or U-Boot, the tags file is pretty big
> (~650k lines/70 for U-Boot and ~4.8 mil lines/630MB for Linux).
>
> On these projects, especially Linux, if I use ccomplete, completion
> takes a huge amount of time. And since the completion is synchronous,
> vim just freezes up for that time and I have to wait for the completion
> results to show up. On Linux the wait times can go more than a minute on
> my modest quad core 4th gen i7 and a SATA SSD.
>
> So, I intend to set aside some time and try to speed up the completion
> and make it asynchronous. I haven't read or written much vimscript so I
> don't expect it to be easy or quick. So before I do that, I'd like to
> know if anyone here attempted this before.
>
> If someone did succeed, could you please point me to the optimized
> version? If someone tried but failed, could you please let me know where
> you had trouble? Is it that the ctags format just not suitable for large
> projects? Is there some limitation with vim that makes it impossible? Is
> it something else entirely?
>
> --
> Regards,
> Pratyush Yadav

The Vim tags file is pretty large, but how is your tags file built? In
particular, is it case-fold-sorted? If your Vim is built with
+tag_binary (nowadays it always is, if yours isn't you need a newer
model), and 'tagbsearch' is on (which is the default), then finding a
tag in an unsorted tags file uses linear time, in a case-folded sorted
tags file it uses logarithmic time, which is much faster, especially
for large tags files.

Best regards,
Tony.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXutxihhmz38GMK7xiyYcAWtY1ogXfwPAsWaarGczcnp9Q%40mail.gmail.com.

Re: Vim saves file with lowercase filename

As in a plugin you wrote or one you are using?

If the latter, you could mention its name for others to be aware of.

(just so when someone comes along later googling this same problem, they'll know the resolution)

On Wednesday, April 1, 2020 at 11:14:41 AM UTC-4, Ni Va wrote:
Sorry for inconvenience I cannot reproduce yet with -clean. 
It's a plugin of mine. Sorry.


Le mer. 1 avr. 2020 à 16:34, Christian Brabandt <cbl...@256bit.org> a écrit :

On Mi, 01 Apr 2020, Ni Va wrote:

> I know it is the same but, for human readable reason, I want to keep camelCase notation fileName I had before saving this file with Vim.
>
> It is not OS windows 64 bits enterprise last update that is in cause, but really Vim because when I save the same file with notepad++, this does not modify the camelCase notation of filename.
>
> So it is certainly an option, not of the OS but of Vim. I see that filencoding talked about lowercase depending on which encoding you choose.. but not really got fix for this problem for instant.

I cannot reproduce this. Please provide a reproducible example starting
from vim --clean and mention what filesystem you save on. Best is to
start in an empty directory.

Best,
Christian
--
Alkohol ist nicht die Antwort. Hilft aber, die Frage nicht so ernst
zu nehmen.
                -- Klaus Klages

--
--
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/6gnlKECCDtM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200401143404.GA16659%40256bit.org.

--
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/774361cd-d562-4748-abb4-a3cd66fc959e%40googlegroups.com.