Thursday, March 14, 2013

Re: Aligning slowing down (:1,$Align |)

tooth pik wrote:
> On Thu, Mar 14, 2013 at 01:48:05PM +1100, Philip Rhoades wrote:
>> People,
>> I have been using this plugin for some time now and it has been
>> exactly what I wanted. One thing I use it for is to align text that
>> has been pasted into a file from online bank payments (I have been
>> burnt in the past by relying on the banks records and not having my
>> own) but I have noticed that as my receipts text file gets larger,
>> the align command starts slowing down dramatically and I think it
>> might be hanging now - I have to kill the process, reopen the file,
>> recover the file in Vim - and mostly it has seemed OK. The text
>> file is now 2103 lines - I am expecting too much of this plugin?
> why align the whole file every time? why not align only the freshly
> pasted receipts?
>
* See if using let g:Align_xstrlen= 0 speeds things up a bit (:help
align-option). Don't use this setting if you're using multibyte
characters, though -- it won't align properly then.
* Set up a dummy line and align using it and new stuff. As an example,
let's assume that you're using |s as field delimiters:

|one|two|three|four
|four|three|two|one

After aligning these, one gets (use a monospace font to see this properly)

|one |two |three|four
|four|three|two |one

Then take the last line and convert it into a "dummy" line:

Yp:s/[^|]/\~/g
yielding
|~~~~|~~~~~|~~~~~|~~~

Aligning your new entries with the dummy line should speed things up a
lot. You could wrap that process into a custom mapping, too (and have
it generate the dummy line, align, remove the dummy line).

Regards,
C Campbell


--
--
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.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: