> and if you want to add one (or perform other calculations),
> simply adjust this to (There is no need to do the processing
> in shell and fork another couple of processes, since vim can
> do it perfectly well itself):
>
> :let &makeprg = 'make -j'.(system('grep -c ^processor
> /proc/cpuinfo')[:-2]+1)
Of course! Very nice. Amazingly, it can be further shortened
because the trailing newline is ignored when adding 1 (so you
can omit "[:-2]" from the above.
I used this to update the tip:
http://vim.wikia.com/wiki/Auto-detect_number_of_cores_for_parallel_built
It suffers a defect that on a single-processor system it will
use 'make -j2' which is probably not helpful. Fixing that would
require a function that detracts from the elegance.
John
--
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
No comments:
Post a Comment