On Sat, Sep 17, 2011 at 9:18 AM, Donald Allen <[email protected]> wrote: > On Fri, Sep 16, 2011 at 9:06 AM, Jakson Alves de Aquino > <[email protected]> wrote: >> I agree that the indent/r.vim script is very slow, but I don't know >> how to improve the speed. For each line to be indented, the script has >> to calculate what was the indent level of the last command, but the >> last command is not always the line above. So the algorithm goes >> slowly upwards until finding the beginning of the last command. I >> think it would be necessary to take a different approach. > > I haven't read your code, but perhaps remember the indent level of the > 'last command' as you make your forward pass over the indentation > region?
Yes, I have already thought about this. Instead of going backwards looking for the beginning of the command the script could first go backwards looking for any character in column 1 or the beginning of the file and, then, goes forward, remembering the current indent level. While going forward, it would be possible to keep track of the indentation level. This could be faster, but I don't have the necessary spare time to implement this alternate algorithm. Best regards, Jakson -- You received this message from the "vim_dev" 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
