Re: Best practice and enhance performance duration of vimscript
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 through the loop look like they're just appending the same line (which, btw, I'd perform with put=line instead of via normal mode.) 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 do something like :let @/=join(keys(s:hash), '\|') :%s//\=s:hash[submatch[0]]/g (you might have to escape the keys if there are funky regexp metacharacter values in the hash keys) -tim Tim, see my first post, l:lineToChange is defined before the loop that is doing mapping. In fact, I prefered concat my xml line before loop and doing mapping (substitute) into the loop thinking it was faster. I don't see exactly the soluce you submit to me but I explain the current process. I am defining a templateLine l:lineToChange = 'xmltag WORD_TO_SUBSTITUTE1foofoofoofoobarWORD_TO_SUBSTITUTE2foofofofofofofobarWORD_TO_SUBSTITUTE3/ ' myHash[KEY]= {'word1':WORD1,'word2':WORD2,'word3':WORD3} for key in keys(. Then in the loop on keys(myHash) I am doing substitutes that I need to do (mapping no ?) endfor NB : I didn't know if exec 'norm o' take a long time, thank you for your response. If you have other advises or link I will be glad to apply them. Thank you Tim -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Match
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 regexes? I reckon that ^\([^;]\+\); Means: at least once anything but a semicolon at the beginning of a line and then a semicolon. (But why the grouping \(...\)?) But in Christians enhancement ^\([^; ]*\)\s[^;]*; I am confused: i read it as: ^\([^; ]*\) One or more times a semicolon followed by a space \s[^;]* and followed by another whitespace and anything but a semicolon zero or more times ; and then a semicolon I think this is not quite right... jan -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Best practice and enhance performance duration of vimscript
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 something} substitute() endif is often faster than empty run of substitute(). For this reason map() can be real bottleneck. 3. :help profiling is your friend m. Tanie mieszkania! Atrakcyjne lokalizacje nawet poniżej 5 000 zł za metr. http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fogl_do_5000zl.htmlsid=938 -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 versions 5.x you can script Vim in a number of languages: Python, Perl, Tcl, Ruby. MzScheme is available since version 7. -- Sergey Khorev http://sites.google.com/site/khorser Can anybody think of a good tagline I can steal? -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Match
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[^;]*; Could you explain these regexes? I reckon that ^\([^;]\+\); Means: at least once anything but a semicolon at the beginning of a line and then a semicolon. (But why the grouping \(...\)?) But in Christians enhancement ^\([^; ]*\)\s[^;]*; I am confused: i read it as: ^\([^; ]*\) One or more times a semicolon followed by a space zero or more anything except a semicolon or space (or newline, implicitly) at the beginning of the line so this is everything before the space-of-interest \s[^;]* and followed by another whitespace and anything but a semicolon zero or more times ; and then a semicolon yes :) -tim -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Mapping only fields of a Dictionnary (help says only List and all items of Dict)
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 - I would like to know if I can map only the field of a dictionnary: eg information below Furthermore, I would like to map differently my two fields information and clue Can we do that ? map(copy(values(myHash).information,PREFIX_BARTEXT v:val SUFFIX_BARTEXT) map(copy(values(myHash).clue, v:val SUFFIX_FOOTEXT) Thanks -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Best practice and enhance performance duration of vimscript
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 subsequent passes through the loop look like they're just appending the same line (which, btw, I'd perform with put=line instead of via normal mode.) 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 do something like :let @/=join(keys(s:hash), '\|') :%s//\=s:hash[submatch[0]]/g (you might have to escape the keys if there are funky regexp metacharacter values in the hash keys) -tim Tim, see my first post, l:lineToChange is defined before the loop on my hash. Yeah, I read that, but unless the values of your key:value pairs have additional TSWK values in them to be later replaced, your first pass through the loop removes everything your later passes are looking for, so they're moot (and time-consuming) I prefered concat my xml line before loop and doing mapping (substitute) into the loop thinking it was faster (but not after measurement) I've found that in general, if your file has lots of lines rather than one long single line, Vim tends to play better/faster with it. I expect it has to do with how much needs to be rejiggered in memory with each change, and how much has to be allocated for a single line. If you have short lines, small allocations and small copies happen per-line. If everything is on one line, you have to have a large buffer into which you copy the modified long-line and perhaps copy that large quantity multiple times per match. I didn't know if exec 'norm o' take a long time, thank you for your response. This has been my gut feel, that changing modes takes a fair bit of context preservation and restoration which in turn takes time. Glad to see this hopefuly helped you speed it up. If you have other advises or link I will be glad to apply them. Perhaps if you describe what you're trying to achieve rather than the methods you're trying to achieve them, a wildly different solution could be feasible. Particularly if the command can be executed across a buffer or a range of lines instead of a string-variable. -tim -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Best practice and enhance performance duration of vimscript
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 to use the \{-} as few as possible operator to minimize forward searching in the FSM after the first/shortest match is found. 2. When doing substitutions think if it is possible to check if substitution is really necessary - in long run expression if {is there something} substitute() endif is often faster than empty run of substitute(). Unless your test is something simple instead of a regep, the regex engine ends up parsing the line twice, the first time for the test and the second time for the substitute. So if you can make a quick non-regex determination on the line like if (line[0] == 'a') s/complexregex/replacement/ endif it will be faster. But checking for regex containment like if line=~'complexregex' s/complexregex/replacement/ endif will just be slower. 3. :help profiling is your friend definitely good advice :) -tim -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Best practice and enhance performance duration of vimscript
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 affect long lines. Simple test on big file - trimming whitespaces from end of line: %s/\s*$// %s/\s\+$// Basically this is special case of my second tip - * matches everywhere, \+ tests if action is necessary. Unless your test is something simple instead of a regep, the regex engine ends up parsing the line twice, the first time for the test and the second time for the substitute. So if you can make a quick non-regex determination on the line like if (line[0] == 'a') s/complexregex/replacement/ endif it will be faster. But checking for regex containment like if line=~'complexregex' s/complexregex/replacement/ endif will just be slower. True (and I thought obvious) but '=~' or stridx() works my way even with long strings or simple regexps (without * ;). IMO usually worth to try. This is other way of :g/simpleregexp/s/complexregexp/replacement/ instead of :%s/complexregexp/replacement/ Sad truth about such optimizations is that they often take more time to implement than actual savings during execution :D m. Wygraj nagrody za kupowanie prezentów - zobacz: http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Ftaniokonkurs.htmlsid=935 -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Match
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, you should prepend \_ to the collection, shouldn't you? regards, Christian -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Concatenate each item of two list
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 message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 hardware running terminal Vim, loading large directories is very slow, to the point that I probably will not use it. The problem here is usability rather than the actual measured slowness, since it is not _that_ slow. But because everything else in terminal Vim is so very fast, I found that it was kind of breaking my rhythm to the point that on a couple of occasions I lost my train of thought. You bring up a great point - which is the root of where I'm having difficulty - work flow. the NERDTree plugin is great for me because it's a quick and easy way to browse my file system and open files. There's a couple of limitations that I'm sure I could figure out but that's not the point. I don't think I need to be more proficient at using that particular plugin - I need to figure out a faster workflow using vim! :) So - is there a better way to deal with managing a folder full of files? For example, I use CodeIgniter PHP framework. I regularly switch between files in different directories: system application controllers views models public css js the NERDTree gives me a nice way to navigate the folder structure. You said it yourself, though--- it's just slow enough that it broke your train of thought - maybe I'm just missing a key feature of vim? My workflow: editing system/application/controllers/home.php i need to add a login screen create system/application/views/login.php and add the necessary code I need access to the database create system/application/models/user.php and add code I need to open the form validation config file open system/application/config/form_validation.php etc... In a previous life full of graphical IDEs and heavy mouse usage, I would just double-click on the file(s) and start editing. The vim way - at least for now - is a lot slower for me to move around. 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 need to open a file? Thanks, Jon -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Concatenate each items of two Lists
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 information, visit http://www.vim.org/maillist.php
Re: Concatenate each item of two list
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 work: call map(list1, 'v:val.list2[v:idx]') You need to have at least patchlevel 295 of version 7.2, otherwise this won't work. I have only 7.2.284, so I can't test. 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
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, 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 version 7.2, otherwise this won't work. I have only 7.2.284, so I can't test. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) -- 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
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 version 7.2, otherwise this won't work. I have only 7.2.284, so I can't test. v:key is for Dict, I am using List now in order to use map in order to accelerate process no, it's v:key. This additional use of v:key was introduced with patch 295. If you have a recent version you find this documented at :help map() Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) -- 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
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 pre-build version from the Cream project home page at http://cream.sourceforge.net/download.html If you are on Windows you can find a standard Vim version without the Cream additions at http://sourceforge.net/projects/cream/files/Vim Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) -- 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
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
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 compile the sources yourself. It might be easier for you to get a pre-build version from the Cream project home page at http://cream.sourceforge.net/download.html If you are on Windows you can find a standard Vim version without the Cream additions at http://sourceforge.net/projects/cream/files/Vim Regards, J rgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin) I will need to recompile cause I have done another toolbar so I have to compile my Gvim for windows with all 7.2 patch Since that day, I uses the 7.2.320 in order to get benefit of v:key in map func Thanks a lot -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 need to open a file? hi, why don't you try the fuzzyfinder plugin... http://www.vim.org/scripts/script.php?script_id=1984 -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Is there a tool that can compute how many keystrokes are need to modify a file to another?
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 call roughly and depending on the text editor, you may obtain a satisfying result... What about diff file1 file2 | wc --chars This is too rough. 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. Essentially, I want to evaluate how much time it is need to edit a given file by a human being. -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: search across lines?
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 patterns, particularly when it's not required (most searches won't need it). Why do you think \V is 'ugly'? Using \V seems (to me) an appropriate use of a tool. -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 are any plans to do so at some point in the future? Starting from versions 5.x you can script Vim in a number of languages: Python, Perl, Tcl, Ruby. MzScheme is available since version 7. I take that to mean that C/C++ extensions are not an issue. 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, maybe in terms of integration, both with Vim and other plugins? Thank you for your comments, CJ -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: counting keystrokes
* 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. Essentially, I want to evaluate how much time it is need to edit a given file by a human being. 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? Sven -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Match
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 help. To match the newline, you should prepend \_ to the collection, shouldn't you? We're both right...just a miscommunication on my part or a misunderstanding/misreading on yours (or both) My comment was intended to mean that semi+space+nl are excluded from matching because by default (as you note) the NL never matches a character-collection unless you explicitly request it via \_[...] -tim -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Best practice and enhance performance duration of vimscript
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 this, but it may affect long lines. Simple test on big file - trimming whitespaces from end of line: %s/\s*$// %s/\s\+$// Basically this is special case of my second tip - * matches everywhere, \+ tests if action is necessary. Ah...I see where you were making the comparison now. To get accurate differences in timing, you'd have to compare regexps that do the same thing, So comparing the two would be done with %s/\s\s*//g %s/\s\+//g which should time out negligibly the same (minus the extra character to type in the 1st one :) Sad truth about such optimizations is that they often take more time to implement than actual savings during execution :D oh, so true. :) Unless a regex/batch change take more than about 1-2+ minutes to run, I never consider optimization on a micro level. I burn enough braincells in other areas of life. Gotta save them where I can. -tim -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Best practice and enhance performance duration of vimscript
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 do something like :let @/=join(keys(s:hash), '\|') :%s//\=s:hash[submatch[0]]/g (you might have to escape the keys if there are funky regexp metacharacter values in the hash keys) I think your first idea was the best even if I don't understand how it works and so can help to my pb. Sum up : A - I read some data and building structure to stored them. - let myHash= {} let g:cnt = 1 g/patternOfReadline/=call myStoredFunc(submatch(0),..submatch (dataN)) func! myStoredFunc() let myHash[g:cnt]= {'data1':a:data1,'data2':a:data2 etc 'data5':a:data5} let g:cnt +=1 endfunc take 10 seconds so it's nothing... well B - Using the stored data to generate xml data - B1 - by for on key of my hash = 35 seconds let lineToChange = 'xmltag attr=DATA1_TO_CHANGE attr=DATA2_TO_CHANGE attr=DATA1_TO_CHANGE attr=DATA4_TO_CHANGE/ ' for key in keys(myHash) let newline = substitute(lineToChange, DATA1_TO_CHANGE, myHash [key].data1,g) let newline .= substitute(lineToChange, DATA2_TO_CHANGE, myHash [key].data2,) let newline .= substitute(lineToChange, DATA4_TO_CHANGE, myHash [key].data4,) let newcontent .= newline endfor exec 'norm O' . newContent 35 seconds B2 - by map and join Instead of hash of Dict I have 4 List (as many as fields of the old Dict) and then : let lineToChange = 'xmltag attr=DATA1_TO_CHANGE attr=DATA2_TO_CHANGE attr=DATA1_TO_CHANGE attr=DATA4_TO_CHANGE/ ' let List= map(copy(myList_data1), 'xmltag attr=\ . v:val . attr= \. myList_data2[v:key]. \ attr=\ . v:val etc... ',) let newContent = join(List,'') exec 'norm O' . newContent 50 seconds If I do as many map as that I have concat to do , 50 * N of concat Can you explain again you method please ? :let @/=join(keys(s:hash), '\|') :%s//\=s:hash[submatch[0]]/g -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 an aside, this is a great plugin, bu I noted that on my hardware running terminal Vim, loading large directories is very slow, to the point that I probably will not use it. The problem here is usability rather than the actual measured slowness, since it is not _that_ slow. But because everything else in terminal Vim is so very fast, I found that it was kind of breaking my rhythm to the point that on a couple of occasions I lost my train of thought. You bring up a great point - which is the root of where I'm having difficulty - work flow. the NERDTree plugin is great for me because it's a quick and easy way to browse my file system and open files. There's a couple of limitations that I'm sure I could figure out but that's not the point. I don't think I need to be more proficient at using that particular plugin - I need to figure out a faster workflow using vim! :) So - is there a better way to deal with managing a folder full of files? For example, I use CodeIgniter PHP framework. I regularly switch between files in different directories: system application controllers views models public css js the NERDTree gives me a nice way to navigate the folder structure. You said it yourself, though--- it's just slow enough that it broke your train of thought - maybe I'm just missing a key feature of vim? 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.. feels like minutes and must be something like five seconds, on my laptop. My workflow: editing system/application/controllers/home.php i need to add a login screen create system/application/views/login.php and add the necessary code I need access to the database create system/application/models/user.php and add code I need to open the form validation config file open system/application/config/form_validation.php etc... Once the directory is loaded, hjkl + go or Ctrl-W l/j, Ctrl-O to go back to editing previous files, etc. is quite fast really. I'm so used to the Ctrl-W windowed mode shorcuts that I find them quicker than reaching for a mouse, with the added time savers that (1) I don't have to take my hands off thekeyboard, and (2) I don't have to mentally switch modes. The above workflow would be something like: :NERDTree ~/system/application [down to controllers subfolder - hit O] # open recursive [down to controllers/home.php - hit s] # split vertical + open [...] [back to NERDTree panel Ctrl-W h] [down to views/login.php - hit o # reuse same window etc. One possible improvement might be if you could jump directly to a file or directory by line number - i.e. if you have asked NERDTree to display line numbers, and application is line 53, just [53O] would open the sub-tree, and likewise, if home.php shows up on line 67, [67s] would open your first source file. I'm surprised the author(s) have not considered this feature, which I use frequently in my mailer, because in the above example, hitting 53O67s, which is only six key strokes would present you with home.php ready to edit. True this works better if you are a seasoned typist with good hand-to-eye coordination. But if you feel more comfortable with a mouse, it seems that NERDTree also provides the feature, where you can double-click to open folders or directories. In a previous life full of graphical IDEs and heavy mouse usage, I would just double-click on the file(s) and start editing. The vim way - at least for now - is a lot slower for me to move around. I think you can be just about as quick with either the mouse or keyboard, although I favor the latter. I guess if keyboard navigation is not second nature, it may take time before you become as comfortable as you are with a mouse. 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 need to open a file? I'm not sure about the Vim way, but I guess if you want to cut down on the number of keystrokes, some variation on the following would achieve this: :map LeaderC1 :lcd /frequently/used/project/directory1Enter :map LeaderC2 :lcd /frequently/used/project/directory2Enter :map LeaderNTEnter Unless you have changed the Leader default, you would type to open the NERDTree panel on e.g. ~/public_html/../../application/ \C1 \NT Hit 'O' to open all subfolders recursively and you are able to quickly access
Re: Not necessarily a question - but need help nonetheless
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 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 versions 5.x you can script Vim in a number of languages: Python, Perl, Tcl, Ruby. MzScheme is available since version 7. I take that to mean that C/C++ extensions are not an issue. er.. I think he means. s/issue/option/ :-) CJ -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: counting keystrokes
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 does, as soon as he's done 'reclining', that is.. ;-) CJ -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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.. feels like minutes and must be something like five seconds, on my laptop. Is that the NERDtree that is so slow? I am asking, because a file with several hundreds of lines opens nearly instantaneously here. But then, I usually try to avoid loading plugins, since I need to work on many different places where often I usually only have a vanilla vim available and try not to become dependent on plugins. Though I have had speed problems with vim before. But that was with files of several hundred thousands of lines. (At work I need to load a lot of large CSV files into a DWH.) And I often find it very frustrating that vim is so slow. But then I think of the situations, like today, where I needed to transform a tab delimited file into a sql insert statements (by the use of some regex). This resulted in a file of about 65k lines (about 16,000 insert statements). Loading that file into Toad, made it so slow, that I couldn't even navigate anymore (Windows complained about running out of virtual memory) and when trying to execute it, Toad crashed ;) So Vim is certainly capable of handling large files just find. I still wish, it could be just a little bit faster ;) Having said that, I wonder, whether it would be possible to have NERDtree cash its directory listings, so it wouldn't be so time consuming to recreate the view. But then I do not know anything about Nerdtree either (not even how it is spelled correctly ;)) and maybe it does that already… regards, Christian -- hundred-and-one symptoms of being an internet addict: 32. You don't know what sex three of your closest friends are, because they have neutral nicknames and you never bothered to ask. -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Is there a tool that can compute how many keystrokes are need to modify a file to another?
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, with diff and wc, depending on what you call roughly and depending on the text editor, you may obtain a satisfying result... What about diff file1 file2 | wc --chars This is too rough. 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. Essentially, I want to evaluate how much time it is need to edit a given file by a human being. That would be a _huge_ task with little utility. For one thing, if you have a good estimate of what the final file would look like for comparison, you wouldn't need to edit the first file--you'd be better off starting with your estimate of the final file. Secondly, a program's determination of the optimal editing tasks is likely to be different from a person's choice. Thirdly, the time I spend editing a file is not spent typing--it's spent thinking about the meaning of the changes that I'm making. I think the number of keystrokes needed to edit a file is a pretty meaningless metric, unless you're comparing editors. You'd be better off measuring how long it actually takes a person of a similar skill set to make similar types of changes to a similarly-sized file. Regards, Gary -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 quite shocked at how long it takes to load a 100-file or so directory.. feels like minutes and must be something like five seconds, on my laptop. Is that the NERDtree that is so slow? It's just loading directories. Since I do not see anything remotely comparable and NERDTree has been around for quite some time, it could be either some Vim option or other, or else, it's doing some really fancy stuff with the directories behind the scenes. Something the developer could enlighten us about. I am asking, because a file with several hundreds of lines opens nearly instantaneously here. But then, I usually try to avoid loading plugins, since I need to work on many different places where often I usually only have a vanilla vim available and try not to become dependent on plugins. Which is really the issue with non-trivial plugins. As long as you have access to a full-blown Vim, I guess this means you'd have to take a plugin CD along everywhere you travel. Unless you are at secure sites where they would be very cross indeed if you loaded anything fancy on one of their computers, that is. Though I have had speed problems with vim before. But that was with files of several hundred thousands of lines. (At work I need to load a lot of large CSV files into a DWH.) And I often find it very frustrating that vim is so slow. None here, but then I don't manipulate files that large or directory trees with more than a few thousand files. But then I think of the situations, like today, where I needed to transform a tab delimited file into a sql insert statements (by the use of some regex). This resulted in a file of about 65k lines (about 16,000 insert statements). Loading that file into Toad, made it so slow, that I couldn't even navigate anymore (Windows complained about running out of virtual memory) and when trying to execute it, Toad crashed ;) So Vim is certainly capable of handling large files just find. I still wish, it could be just a little bit faster ;) 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 sed, awk, or even something like ed to achieve the desired result? Having said that, I wonder, whether it would be possible to have NERDtree cash its directory listings, so it wouldn't be so time consuming to recreate the view. But then I do not know anything about Nerdtree either (not even how it is spelled correctly ;)) and maybe it does that already… Still wouldn't address the issue of the initial loading of something as small as the average linux system's /etc taking about five seconds. Five seconds is not a lot as compared to what you are doing, but then my perception is that it's a trivial task that I perform hundreds of times daily and it response should be instantaneous. CJ -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: search across lines?
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 endings are found. I don't know. I'd guess that the mapping uses some feature that was added to vim after 6.2, but I couldn't tell you what. 3) Below, the search part is separated out for emphasis. In Gary's example escape() lists all items that are 'magic'. /C-RC-R=substitute(escape(@, '\\/.*$^~[]'), '\n', '\\n', 'g') In the second, I use '\V' ('very nomagic') to make all but '\' not magic and then escape just '\' /\Vc-r=substitute(escape(@, '\'), '\n', '\\n', 'g') Both work and all registers look the same. Is there some functional difference I am missing? Other than the C-R= vs. C-RC-R= thing, and without comparing the two in detail, not that I know of. Regards, Gary -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 sed, awk, or even something like ed to achieve the desired result? Sure, I could probably have used Perl for that, (s)ed/awk have unfortunately not that powerful regular expressions. Secondly I do not have any of these available on Windows and lastly I am faster doing the manipulation in vim, than I am writing Perl programs. Plus, in Vim it is really easy to try different ways out, undo, try again, etc. That really is easier for me that running batch jobs and check the resulting file afterwards. Still wouldn't address the issue of the initial loading of something as small as the average linux system's /etc taking about five seconds. Five seconds is not a lot as compared to what you are doing, but then my perception is that it's a trivial task that I perform hundreds of times daily and it response should be instantaneous. That sounds seriously wrong. Is this also happening, when you start vim using vim -u NONE -N yourfile? regards, Christian -- :wq -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Is there a tool that can compute how many keystrokes are need to modify a file to another?
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 won't give you the minimal number of keystrokes in Vim. Finding the minimal number of keystrokes would be quite a challenge. -- Dominique -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Best practice to put lines into new buffer
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 -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: counting keystrokes
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 level, one can record a single macro of their editing session, save that out to a file, and perform whatever analytics on that they wish. wc -c would give the number of keystrokes used. You could count ^[ chars to see how many times insert or visual mode were entered/exited. 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 least effort. -- Erik Falor Registered Linux User #445632 http://counter.li.org signature.asc Description: Digital signature
Re: Best practice to put lines into new buffer
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 better solution to have a real gain of time ? Well you could test using http://www.vim.org/scripts/script.php?script_id=1530 Here is a simple test case: :TIME 100 :call append('$', join(g:a)) Execution took 0.005195 sec. (count=100) :TIME 100 :put =join(g:a) Execution took 0.004757 sec. (count=100) :TIME :exe 'norm o'.join(g:a) Execution took 0.036771 sec. (count=100) So :exe 'norm o' is one order of magnitude slower. But I am interested in your timings. regards, Christian -- :wq -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Best practice to put lines into new buffer
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 .= join(g:myListOfLines,'') exec 'norm O' . newContent Is there a better solution to have a real gain of time ? Well you could test usinghttp://www.vim.org/scripts/script.php?script_id=1530 Here is a simple test case: :TIME 100 :call append('$', join(g:a)) Execution took 0.005195 sec. (count=100) :TIME 100 :put =join(g:a) Execution took 0.004757 sec. (count=100) :TIME :exe 'norm o'.join(g:a) Execution took 0.036771 sec. (count=100) So :exe 'norm o' is one order of magnitude slower. But I am interested in your timings. regards, Christian -- :wq put does not understand either \n or windows CR : ^M It put my string which contains CR on one line. -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 it be a case where it's better to use the usual batch tools such as sed, awk, or even something like ed to achieve the desired result? Sure, I could probably have used Perl for that, (s)ed/awk have unfortunately not that powerful regular expressions. Or more prosaically, egrep.. -:) Secondly I do not have any of these available on Windows and lastly I am faster doing the manipulation in vim, than I am writing Perl programs. Plus, in Vim it is really easy to try different ways out, undo, try again, etc. That really is easier for me that running batch jobs and check the resulting file afterwards. Still wouldn't address the issue of the initial loading of something as small as the average linux system's /etc taking about five seconds. Five seconds is not a lot as compared to what you are doing, but then my perception is that it's a trivial task that I perform hundreds of times daily and it response should be instantaneous. That sounds seriously wrong. Is this also happening, when you start vim using vim -u NONE -N yourfile? 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 the tarballs tree only took 3-4 seconds - go figure. Actually I did the same test again with another instance of Vim, naturally, in order to take a closer look at the message, same tarballs directory and this time it only took about two seconds. 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 tests again when I have more time. Thanks for your comments, CJ -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 the tarballs tree only took 3-4 seconds - go figure. Actually I did the same test again with another instance of Vim, naturally, in order to take a closer look at the message, same tarballs directory and this time it only took about two seconds. 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 tests again when I have more time. Would you try this with netrw? Since you seem to like tree mode, put let g:netrw_liststyle= 3 in your .vimrc. In a directory of mine with 245 files: (and loading all my usual plugins, etc) time gvim . -c q real0m0.22s user0m0.17s sys 0m0.02s Regards, Chip Campbell -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: counting keystrokes
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 least effort. Unless, of course, they wanted to use macros. ;-) ~Matt -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
How using put = stringVar with carriage return into stringVar
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
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 vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Is there a tool that can compute how many keystrokes are need to modify a file to another?
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 challenge. ...and an NP-complete sort of problem like the TSP. You'd have to enumerate all possible solutions (possibly an infinite number of solutions) and then do character counts for each. I second the diff -e approximation. -tim -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Best practice and enhance performance duration of vimscript
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 able to do something like :let @/=join(keys(s:hash), '\|') :%s//\=s:hash[submatch[0]]/g (you might have to escape the keys if there are funky regexp metacharacter values in the hash keys) I think your first idea was the best even if I don't understand how it works and so can help to my pb. The two are similar, as they create a chained list of possible matches all separated by \|, and then the replacement uses submatch(0) (the text that was found) to index into the hash/map. You could also do something like %s/\w\+/\=get(s:hash, submatch(0), submatch(0))/g which is a sneaky way of replacing every word (\w\+) with either its match in your hash, or, if it's not in the hash, just use the original as the replacement (thus making no change). If you can tighten up your search for only things that look like your magic replacement constants, it may be faster, something like %s/\\w\{-1,}_\w\+/\=get(s:hash, submatch(0), submatch(0))/g (which would match things with at least one underscore in it, if you knew all your map-keys contained underscores). -tim -- 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
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 the trick for me. -tim you've just save my perf duration elapsed time = thanks !!! -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 something. Now the weird thing is that in another test, my home directory, which contains the tarballs tree only took 3-4 seconds - go figure. Actually I did the same test again with another instance of Vim, naturally, in order to take a closer look at the message, same tarballs directory and this time it only took about two seconds. 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 tests again when I have more time. Would you try this with netrw? Shoot.. :-( I mean.. I meant to mention in my post about having no such problem with netrw and one thing leading to another.. I just forgot. Speculating that there might be a problem with NERDTree.vim, either when it runs into a particular directory setup, or possibly some vim option I have set that slows it down to a crawl, or some clash with another plugin... etc. Since you seem to like tree mode, put let g:netrw_liststyle= 3 in your .vimrc. In a directory of mine with 245 files: (and loading all my usual plugins, etc) time gvim . -c q real0m0.22s user0m0.17s sys 0m0.02s Sure, don't have the time right now but the test I ran was just a couple of directories accessed via: $ cd ~/a/large/directory/tree $ vim . $ cd ~/another/large/directory $ vim . I'll take a closer look later today. Thank you for your comments, CJ -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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 tests again when I have more time. Would you try this with netrw? Since you seem to like tree mode, put let g:netrw_liststyle= 3 in your .vimrc. In a directory of mine with 245 files: (and loading all my usual plugins, etc) time gvim . -c q real0m0.22s user0m0.17s sys 0m0.02s Here's what I get with NERDTree: $ cd $ time vim . -c q real0m12.837s user0m5.060s sys 0m0.296s ahem.. A couple more runs: real0m12.021s user0m4.988s sys 0m0.412s real0m11.642s user0m5.260s sys 0m0.292s So it wasn't my imagination :-) Home directory stats: $ ls -a ~ | wc 194 1941981 And here's what I get with netrw: $ time vim . -c q real0m5.265s user0m2.356s sys 0m0.264s Not what I call blistering fast, but definitely more acceptable. CJ -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Counting ; character
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 know, why mutt mangled this mail back to latin1, it was supposed to be in an utf8 encoding. I think I accidentally reproduced this when posting on another vim_use thread whose subject is something like 'printing with UTF-8 characters from Windows'. What happened was that I replied to the OP in mutt, but before I hit 'y' to send the message, I thought of something I wanted to correct or add, hit 'e' to edit, and was confronted by an absolute mess where my non-ASCII stuff was concerned. I checked mutt's idea of the encoding and it said something like 'text/plain, 7bit, iso-8859-1'. After twiddling a bit, I managed to convince Vim to convert my message back to UTF-8, wrote it to a temp file, started over and copied the temp file back into my reply and this time when I got to the compose/send screen in mutt, the message was correctly reported as 'text/plain, 8bit, UTF-8. Since the thread was about someone experiencing problems with encodings, what I assume is that I did change something manually, while replying, possibly I did a 'set fenc=latin1, or possibly cp1252.. don't remember exactly, and forgot to set it back to UTF-8 before posting. On the other hand, since I had no reason to do anything like this with my other garbled message, it looks like there may be some form of miscommunication between mutt and Vim at some point or other. I assume that my locale, which is set to UTF-8, is used by default when mutt decodes the message I am responding to, and that iconv is used to convert the message before it is passed on to Vim, and that mutt keeps track of this pending my :wq. When I finish editing, mutt creates the content header, adjusting it to reflect whatever change I may have made while editing. Just wondering if anything in the above speculations might be confirmed by something you might remember happened at the time you posted the message where your footnote superscripts got messed up? At this point, I'm not sure looking at the code would help, unless we manage to determine a pattern and are able to reproduce. Thanks, CJ -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Re: Not necessarily a question - but need help nonetheless
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, maybe in terms of integration, both with Vim and other plugins? Well, the only problem is that interpreter support should be compiled into Vim so in the worst case scenario you end up compiling both Vim and, say, Python. BTW I can't believe that a plugin should use enormous resources just to display directory listing even if it uses VimL. Something must be wrong. -- Sergey Khorev http://sites.google.com/site/khorser Can anybody think of a good tagline I can steal? -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php
Python: module-aware jumping to class definition - possible?
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 InterestingClass pass ### ...directly to InterestingClass definition in my/other_package/two/ utils.py? Jumping using ctags and Ctrl-] is a bit dumb, because it matches classes only by name, ignoring from ... import statement, so I have to manually choose from multiple matches. My PYTHONPATH is set correctly for VIM, so it can use it to figure out in which source file it should look up InterestingClass definition: :python from my.other_package.two import utils (runs without any error) pydev plugin for eclipse can do that, why VIM would not? :-) It would definitely be a killer feature for pythoners! Cheers! -- You received this message from the vim_use maillist. For more information, visit http://www.vim.org/maillist.php