Re: Best practice and enhance performance duration of vimscript

2009-12-23 Thread epanda
I'm not sure what exactly you're trying to achieve here -- mostly the source of the l:lineToChange -- is this from some larger loop?  The reason it's confusing is that after you've gone through the loop once, I'd expect that TO_SUB_WITH_KEY is no longer in the string, so subsequent passes

Re: Match

2009-12-23 Thread Jan-Herbert Damm
Hello, Christian Brabandt wrote on 22.12.09: On Tue, December 22, 2009 10:35 am, epanda wrote: I detect the first column of a csv file like that. ^\([^;]\+\); I would like to search in the match string those which contains spaces. ^\([^; ]*\)\s[^;]*; Could you explain these

Re: Best practice and enhance performance duration of vimscript

2009-12-23 Thread Mikołaj Machowski
I have all book on gvim but no one tells me the best practice to have good performance when we write vimscript. 1. In regexps avoid when possible * wildcard. 2. When doing substitutions think if it is possible to check if substitution is really necessary - in long run expression if {is there

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Sergey Khorev
Chris, I am still at version 7.1 but I don't suppose a more current version of Vim supports plugins or extensions written in a compiled language such as C, or even semi-compiled languages such as python et al... or that there are any plans to do so at some point in the future? Starting from

Re: Match

2009-12-23 Thread Tim Chase
Jan-Herbert Damm wrote: Hello, Christian Brabandt wrote on 22.12.09: On Tue, December 22, 2009 10:35 am, epanda wrote: I detect the first column of a csv file like that. ^\([^;]\+\); I would like to search in the match string those which contains spaces. ^\([^; ]*\)\s[^;]*;

Mapping only fields of a Dictionnary (help says only List and all items of Dict)

2009-12-23 Thread epanda
Hi, I am building some info in Dict and hash like this : let myHash = {} let g:cnt = 1 g/pattern/=call storingData()/ func! storingData(param1, param2) let myHash[g:cnt] = {'information':a:param1 , 'clue':a:param2 } let g:cnt += 1 endfunc

Re: Best practice and enhance performance duration of vimscript

2009-12-23 Thread Tim Chase
epanda wrote: I'm not sure what exactly you're trying to achieve here -- mostly the source of the l:lineToChange -- is this from some larger loop? The reason it's confusing is that after you've gone through the loop once, I'd expect that TO_SUB_WITH_KEY is no longer in the string, so

Re: Best practice and enhance performance duration of vimscript

2009-12-23 Thread Tim Chase
Mikołaj Machowski wrote: I have all book on gvim but no one tells me the best practice to have good performance when we write vimscript. 1. In regexps avoid when possible * wildcard. I've never had problems with this, but it may affect long lines. It might be possible to tweak the regex

Re: Best practice and enhance performance duration of vimscript

2009-12-23 Thread Mikołaj Machowski
Dnia 23-12-2009 o godz. 13:19 Tim Chase napisał(a): Mikołaj Machowski wrote: I have all book on gvim but no one tells me the best practice to have good performance when we write vimscript. 1. In regexps avoid when possible * wildcard. I've never had problems with this, but it may

Re: Match

2009-12-23 Thread Christian Brabandt
On Wed, December 23, 2009 12:54 pm, Tim Chase wrote: ^\([^; ]*\) zero or more anything except a semicolon or space (or newline, implicitly) at the beginning of the line Is that true? Does [ ] really match a newline? I don't think so and I can't find it in the help. To match the newline,

Concatenate each item of two list

2009-12-23 Thread epanda
Hi, I would like to concatenate each item of two list together and resulting another list. let list1 = [one, two] let list2 = [1, 2] concat(list1,list2) resultingList = [one1, two2] Is it possible without doing for or other loop that takes too much time. thanks -- You received this

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Jon Trelfa
On Wed, Dec 23, 2009 at 2:25 AM, Chris Jones cjns1...@gmail.com wrote: Just a quick update to mention that I installed NERDTree, and as I suspected, when restoring a previous session, it comes up with an empty side bar. ... As an aside, this is a great plugin, bu I noted that on my

Concatenate each items of two Lists

2009-12-23 Thread epanda
Hi, I have tried to concat each items of two lists I have. let list1 = [one,two] let list2 = [1,2] let globalList = map(list1, 'v:val . list2[v:count]') but it fails, v:count seems to not be incremented Thanks for help -- You received this message from the vim_use maillist. For more

Re: Concatenate each item of two list

2009-12-23 Thread Christian Brabandt
Hi epanda! On Mi, 23 Dez 2009, epanda wrote: I would like to concatenate each item of two list together and resulting another list. let list1 = [one, two] let list2 = [1, 2] concat(list1,list2) resultingList = [one1, two2] If you have a recent enough vim, something like this should

Re: Concatenate each item of two list

2009-12-23 Thread Jürgen Krämer
Hi, Christian Brabandt wrote: On Mi, 23 Dez 2009, epanda wrote: I would like to concatenate each item of two list together and resulting another list. let list1 = [one, two] let list2 = [1, 2] concat(list1,list2) resultingList = [one1, two2] If you have a recent enough vim,

Re: Concatenate each item of two list

2009-12-23 Thread Jürgen Krämer
Hi, epanda wrote: On 23 déc, 15:37, Jürgen Krämer jottka...@googlemail.com wrote: Christian Brabandt wrote: If you have a recent enough vim, something like this should work: call map(list1, 'v:val.list2[v:idx]') it's v:key, not v:idx. You need to have at least patchlevel 295 of

Re: Concatenate each item of two list

2009-12-23 Thread Jürgen Krämer
Hi, epanda schrieb: Ok, can you send the link to download last patch. I don't see it on official website you can get all patches from ftp://ftp.vim.org/pub/editors/vim/patches/7.2/ but this means you will have to compile the sources yourself. It might be easier for you to get a

Re: Concatenate each item of two list

2009-12-23 Thread Christian Brabandt
Hi Jürgen! On Mi, 23 Dez 2009, Jürgen Krämer wrote: it's v:key, not v:idx. of course. Thanks for pointing it out. regards, Christian -- :wq -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php

Re: Concatenate each item of two list

2009-12-23 Thread epanda
On 23 déc, 15:57, Jürgen Krämer jottka...@googlemail.com wrote: Hi, epanda schrieb: Ok, can you send the link to download last patch. I don't see it on official website you can get all patches from  ftp://ftp.vim.org/pub/editors/vim/patches/7.2/ but this means you will have to

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Francisco Dibar
On Wed, Dec 23, 2009 at 10:53 AM, Jon Trelfa jtre...@gmail.com wrote: Back to the question, then... is there a better/faster way for me to move around and open files in the various directories without having to type :e ~/public_html/project_folder/system/application/controllers/home.php when I

Re: Is there a tool that can compute how many keystrokes are need to modify a file to another?

2009-12-23 Thread Peng Yu
On Dec 23, 6:34 pm, Christophe-Marie Duquesne chm.duque...@gmail.com wrote: On 12/23/2009 12:23 AM, Peng Yu wrote: I'm wondering if there is a tool that can roughly estimate how many keystrokes (in vim) are needed to modify a file to another. Well, with diff and wc, depending on what you

Re: search across lines?

2009-12-23 Thread Bee
On Dec 22, 6:19 pm, John Beckett johnb.beck...@gmail.com wrote: Bee wrote:    /\Vc-r=substitute(escape(@, '\'), '\n', '\\n', 'g') The tip puts the search pattern in the search history and it's nice to be able to later recall that pattern. It's slightly nicer if you don't have ugly \V in

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Chris Jones
On Wed, Dec 23, 2009 at 06:20:02AM EST, Sergey Khorev wrote: Chris, I am still at version 7.1 but I don't suppose a more current version of Vim supports plugins or extensions written in a compiled language such as C, or even semi-compiled languages such as python et al... or that there

Re: counting keystrokes

2009-12-23 Thread Sven Guckes
* Peng Yu pengyu...@gmail.com [2009-12-23 16:53]: I want a tool that can at least take consideration of copy and paste (e.g. 'yy' and 'p'). Or better, given a set of commonly used vim editing commands, to find the optimal number of keystrokes that are needed to achieve the final result.

Re: Match

2009-12-23 Thread Tim Chase
Christian Brabandt wrote: On Wed, December 23, 2009 12:54 pm, Tim Chase wrote: ^\([^; ]*\) zero or more anything except a semicolon or space (or newline, implicitly) at the beginning of the line Is that true? Does [ ] really match a newline? I don't think so and I can't find it in the

Re: Best practice and enhance performance duration of vimscript

2009-12-23 Thread Tim Chase
Mikołaj Machowski wrote: Dnia 23-12-2009 o godz. 13:19 Tim Chase napisał(a): Mikołaj Machowski wrote: I have all book on gvim but no one tells me the best practice to have good performance when we write vimscript. 1. In regexps avoid when possible * wildcard. I've never had problems with

Re: Best practice and enhance performance duration of vimscript

2009-12-23 Thread epanda
My first thought would be to do fewer substitutes, which could be done if your hashes are nested, so you have a double-dereferencing. Something like :%s/TSWK1\|TSWK2\|TSWK3/\=s:hash[submatch(0)]/g or, if you have a bunch of keys, you might be able to

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Chris Jones
On Wed, Dec 23, 2009 at 08:53:19AM EST, Jon Trelfa wrote: On Wed, Dec 23, 2009 at 2:25 AM, Chris Jones cjns1...@gmail.com wrote: Just a quick update to mention that I installed NERDTree, and as I suspected, when restoring a previous session, it comes up with an empty side bar. ... As

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Chris Jones
On Wed, Dec 23, 2009 at 10:45:35AM EST, Chris Jones wrote: On Wed, Dec 23, 2009 at 06:20:02AM EST, Sergey Khorev wrote: Chris, I am still at version 7.1 but I don't suppose a more current version of Vim supports plugins or extensions written in a compiled language such as C, or even

Re: counting keystrokes

2009-12-23 Thread Chris Jones
On Wed, Dec 23, 2009 at 11:18:36AM EST, Sven Guckes wrote: [..] Hi Sven, years ago i had asked Bram to add some options to keep statistics of the tzping - but he reclined. i still would find this very useful - and fun! :) Bram - would you reconsider? vim-8.0 with typing stats? I hope he

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Christian Brabandt
Hi Chris! On Mi, 23 Dez 2009, Chris Jones wrote: Where slow is concerned, the feature might be that Bram does not favor the idea of turning vim into an IDE, or so I heard.. All the same, even if vimscript is not C, I am quite shocked at how long it takes to load a 100-file or so directory..

Re: Is there a tool that can compute how many keystrokes are need to modify a file to another?

2009-12-23 Thread Gary Johnson
On 2009-12-23, Peng Yu wrote: On Dec 23, 6:34 pm, Christophe-Marie Duquesne chm.duque...@gmail.com wrote: On 12/23/2009 12:23 AM, Peng Yu wrote: I'm wondering if there is a tool that can roughly estimate how many keystrokes (in vim) are needed to modify a file to another. Well,

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Chris Jones
On Wed, Dec 23, 2009 at 12:55:03PM EST, Christian Brabandt wrote: Hi Chris! On Mi, 23 Dez 2009, Chris Jones wrote: Where slow is concerned, the feature might be that Bram does not favor the idea of turning vim into an IDE, or so I heard.. All the same, even if vimscript is not C, I am

Re: search across lines?

2009-12-23 Thread Gary Johnson
On 2009-12-22, Bee wrote: 2) I tried Gary's second version which substitutes all white space runs '\_s\+', it works on MacOS terminal with vim 7.2.315 but fails to substitute line endings with vi 6.2 and search fails. Any idea why? If I manually do a search for '\_s\+' line

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Christian Brabandt
Hi Chris! On Mi, 23 Dez 2009, Chris Jones wrote: On Wed, Dec 23, 2009 at 12:55:03PM EST, Christian Brabandt wrote: This sounds like something where you don't need to interact with the process while it's running. Wouldn't it be a case where it's better to use the usual batch tools such as

Re: Is there a tool that can compute how many keystrokes are need to modify a file to another?

2009-12-23 Thread Dominique Pellé
Peng Yu wrote: I'm wondering if there is a tool that can roughly estimate how many keystrokes (in vim) are needed to modify a file to another. 'diff -e' does that: it outputs an 'ed' script (see 'man diff'). So the lengh of 'diff -e' output gives you the number of keystrokes. Of course, it

Best practice to put lines into new buffer

2009-12-23 Thread epanda
Hi, I have some data into Dict or List I use actually this command in order to put data from my List to the current buffer and saving it to a new file. let newContent .= join(g:myListOfLines,'') exec 'norm O' . newContent Is there a better solution to have a real gain of time ? Thanks --

Re: counting keystrokes

2009-12-23 Thread Erik Falor
On Wed, Dec 23, 2009 at 05:18:36PM +0100, Sven Guckes wrote: years ago i had asked Bram to add some options to keep statistics of the tzping - but he reclined. i still would find this very useful - and fun! :) Bram - would you reconsider? vim-8.0 with typing stats? At the most fundamental

Re: Best practice to put lines into new buffer

2009-12-23 Thread Christian Brabandt
Hi epanda! On Mi, 23 Dez 2009, epanda wrote: Hi, I have some data into Dict or List I use actually this command in order to put data from my List to the current buffer and saving it to a new file. let newContent .= join(g:myListOfLines,'') exec 'norm O' . newContent Is there a

Re: Best practice to put lines into new buffer

2009-12-23 Thread epanda
On 23 déc, 21:23, Christian Brabandt cbli...@256bit.org wrote: Hi epanda! On Mi, 23 Dez 2009, epanda wrote: Hi, I have some data into Dict or List I use actually this command in order to put data from my List to the current buffer and saving it to a new file. let newContent .=

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Chris Jones
On Wed, Dec 23, 2009 at 01:53:12PM EST, Christian Brabandt wrote: Hi Chris! On Mi, 23 Dez 2009, Chris Jones wrote: On Wed, Dec 23, 2009 at 12:55:03PM EST, Christian Brabandt wrote: This sounds like something where you don't need to interact with the process while it's running. Wouldn't

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Charles Campbell
Chris Jones wrote: I tried it with a fairly large tree called ~/tarballs and it took over a minute, with Vim flying at 100% CPU. There was a message to the effect that it was indexing/caching the nodes or something. Now the weird thing is that in another test, my home directory, which contains

Re: counting keystrokes

2009-12-23 Thread Matt Wozniski
On Wed, Dec 23, 2009 at 3:20 PM, Erik Falor wrote: At the most fundamental level, one can record a single macro of their editing session ... This wouldn't help the OP much, but would make possible Vim-Golf competitions to see who could transform a given file into a designated form through the

How using put = stringVar with carriage return into stringVar

2009-12-23 Thread epanda
Hi, I have a vimscript that does this : let stringVar = sometext\nsomefootext' exec 'put = stringVar' does not interpret carriage return Thanks for help -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php

Re: How using put = stringVar with carriage return into stringVar

2009-12-23 Thread Tim Chase
let stringVar = sometext\nsomefootext' exec 'put = stringVar' does not interpret carriage return You need double-quotes instead of single-quotes so the escaping gets translated: :let abc=abc\ndef\nghi :put=abc does the trick for me. -tim -- You received this message from the

Re: Is there a tool that can compute how many keystrokes are need to modify a file to another?

2009-12-23 Thread Tim Chase
Dominique Pellé wrote: 'diff -e' does that: it outputs an 'ed' script (see 'man diff'). So the lengh of 'diff -e' output gives you the number of keystrokes. Of course, it won't give you the minimal number of keystrokes in Vim. Finding the minimal number of keystrokes would be quite a

Re: Best practice and enhance performance duration of vimscript

2009-12-23 Thread Tim Chase
epanda wrote: My first thought would be to do fewer substitutes, which could be done if your hashes are nested, so you have a double-dereferencing. Something like :%s/TSWK1\|TSWK2\|TSWK3/\=s:hash[submatch(0)]/g or, if you have a bunch of keys, you might be

Re: How using put = stringVar with carriage return into stringVar

2009-12-23 Thread epanda
On 23 déc, 22:59, Tim Chase v...@tim.thechases.com wrote: let stringVar = sometext\nsomefootext' exec 'put = stringVar' does not interpret carriage return You need double-quotes instead of single-quotes so the escaping gets translated:    :let abc=abc\ndef\nghi    :put=abc does

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Chris Jones
On Wed, Dec 23, 2009 at 04:08:26PM EST, Charles Campbell wrote: Chris Jones wrote: Hello Charles, I tried it with a fairly large tree called ~/tarballs and it took over a minute, with Vim flying at 100% CPU. There was a message to the effect that it was indexing/caching the nodes or

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Chris Jones
On Wed, Dec 23, 2009 at 04:08:26PM EST, Charles Campbell wrote: Chris Jones wrote: [..] So it looks as if there are glitches when it takes forever, and normal circumstances where it takes somwhere between 3-5 seconds to load a directory, why is too slow to my taste. I'll try to run

Re: Counting ; character

2009-12-23 Thread Chris Jones
On Tue, Dec 15, 2009 at 04:20:05PM EST, Christian Brabandt wrote: Hi On Di, 15 Dez 2009, Christian Brabandt wrote: đ)I changed your function to save and restore cursor position. ē)http://www.vim.org/scripts/script.php?script_id=1530 Grml, thouse were supposed to be footnotes. Don't

Re: Not necessarily a question - but need help nonetheless

2009-12-23 Thread Sergey Khorev
I take that to mean that C/C++ extensions are not an option. One obvious downside with general-purpose scripting languages is that you would need Python, etc. installed to use such plugins. Not a problem in my case, since I have admin authority to this machine, but are there other issues,

Python: module-aware jumping to class definition - possible?

2009-12-23 Thread Piotr Czachur
Hi! Lets assume I got InterestingClass definitions in various python modules. I've set proper PYTHONPATH for VIM. I'm heavy wondering whether it is possible to jump from: ### my/package/one.py from my.other_package.two import utils class Foo(utils.InterestingClass): ## HERE, cursor placed on