Sunday, October 2, 2016

Re: Slow Python syntax highlighting

On 2 October 2016 at 22:29, Dominique Pellé wrote:
> Can you also try to measure it automatically as I did? Just to make
> sure that what I measure is what you also observe.

This is what I got with line 85 (the slow one):

% time vim -u ./vimrc --noplugin +85 -c 'norm! o' -c 'q!' foo.py
0.17s user 0.00s system 63% cpu 0.277 total

% time vim -u ./vimrc --noplugin +85 -c 'norm! o' -c 'q!' foo.py
0.14s user 0.03s system 63% cpu 0.272 total

% time vim -u ./vimrc --noplugin +85 -c 'norm! o' -c 'q!' foo.py
0.16s user 0.02s system 62% cpu 0.275 total


And this is for line 87 (the fast one):

% time vim -u ./vimrc --noplugin +87 -c 'norm! o' -c 'q!' foo.py
0.05s user 0.01s system 98% cpu 0.057 total

% time vim -u ./vimrc --noplugin +87 -c 'norm! o' -c 'q!' foo.py
0.05s user 0.00s system 32% cpu 0.149 total

% time vim -u ./vimrc --noplugin +87 -c 'norm! o' -c 'q!' foo.py
0.04s user 0.00s system 30% cpu 0.146 total


Visually I can tell that the second line executes faster than the
first one. Also note that I used 'o' and not 'O'. With 'O', line 87
takes more time but is still faster than line 85. There's not much
difference for line 85.

--
--
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/d/optout.

Re: Slow Python syntax highlighting

François Ingelrest wrote:

> Hi Dominique,
>
> On 1 October 2016 at 09:46, Dominique Pellé wrote:
>> Can you provide a file where it happens and a minimalistic
>> vimrc, just enough to reproduce it?
>
> Here's what I came up with.
>
> If I type o to open a new line:
> - On line 87, it's instantaneous
> - On line 85, there's a noticeable lag
>
> With :syntax off, it's instantaneous in both cases. It may have
> something to do with indent as well, because turning off indent in the
> .vimrc solves the issue as well.


I downloaded your 2 files and started vim-8.0.20 huge on
Linux x86_64, compiled with gcc -O2 in a terminal like this:

$ vim -u -u vimrc --noplugin +85 foo.py

Then I pressed O. I did not observe an obvious difference
between lines 85 and 87. I then measured it and saw a difference:

3 measurement at line 85:

$ time ./vim -u vimrc --noplugin +85 -c 'norm! O' -c 'q!' foo.py

real 0m0.365s
user 0m0.230s
sys 0m0.033s

$ time ./vim -u vimrc --noplugin +85 -c 'norm! O' -c 'q!' foo.py

real 0m0.359s
user 0m0.221s
sys 0m0.035s

$ time ./vim -u vimrc --noplugin +85 -c 'norm! O' -c 'q!' foo.py

real 0m0.357s
user 0m0.239s
sys 0m0.019s

3 measurements at line 87:

$ time ./vim -u vimrc --noplugin +87 -c 'norm! O' -c 'q!' foo.py

real 0m0.267s
user 0m0.153s
sys 0m0.012s

$ time ./vim -u vimrc --noplugin +87 -c 'norm! O' -c 'q!' foo.py

real 0m0.269s
user 0m0.137s
sys 0m0.028s

$ time ./vim -u vimrc --noplugin +87 -c 'norm! O' -c 'q!' foo.py

real 0m0.267s
user 0m0.144s
sys 0m0.021s

OK, command O is measurably slower at line 85, but from your
email, it seemed like you observed a much longer delay than what
I see.

Interestingly, trying the old vim-7.4.52 (that comes with Ubuntu-14.04)
I see that it's much faster and takes about the same amount of time at line
at line 85 or 87:

$ time /usr/bin/vim -u vimrc --noplugin +85 -c 'norm! O' -c 'q!' foo.py

real 0m0.185s
user 0m0.059s
sys 0m0.027s

$ time /usr/bin/vim -u vimrc --noplugin +87 -c 'norm! O' -c 'q!' foo.py

real 0m0.176s
user 0m0.056s
sys 0m0.017s

I did not have the time yet to perform a bisection yet to see when
performance degraded, but I'll try later.

Can you also try to measure it automatically as I did? Just to make
sure that what I measure is what you also observe.

Regards
Dominique

--
--
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/d/optout.

Re: Slow Python syntax highlighting

# --== Month ==--

if mArgs.action == 'month':

# Set the target day to any day that the target month contains
if mArgs.month is None:
TARGET_DAY = date.Date()

elif re.fullmatch('\d+/\d+/\d+', mArgs.month) is not None or re.fullmatch('\d+/\d+', mArgs.month) is not None:
TARGET_DAY = date.makeFromString(mArgs.month)

else:
month = months.makeFromName(mArgs.month)

if month == months.ERROR_INVALID_MONTH_NAME:
print('%s is not a valid month name, please see help' % mArgs.month)
sys.exit()

if month == months.ERROR_AMBIGUOUS_MONTH_NAME:
print('%s is an ambiguous month name' % mArgs.month)
sys.exit()

TARGET_DAY = date.makeFromString('01/%02u' % month)

# Report
tab = table.Table(options = {'rowSpacing': 0, 'alignments': [table.ALIGN_LEFT, table.ALIGN_RIGHT, table.ALIGN_RIGHT]})
totalDue = 0
totalLoad = 0

tab.appendToHeader(['', 'Work hours', 'Overtime'])

for day in [day for day in TARGET_DAY.makeMonthDays() if day <= TODAY]:

if day not in timeclock:
if day.isWorkDay(): timeclock[day] = {'load': 0, 'tasks': [], 'overtime': 0}
else: continue

if day.getWeekDay() == 0:
tab.appendSeparator()

tab.append([
{'type': table.TYPE_STRING, 'value': '%s %s' % (day.getWeekDayAsShortString(), day) },
{'type': table.TYPE_MINUTES, 'value': timeclock[day]['load'] },
{'type': table.TYPE_MINUTES_DIFFERENCE, 'value': timeclock[day]['load'] - DUE_LOAD_PER_DAY if day.isWorkDay() else 0},
])

totalDue += DUE_LOAD_PER_DAY if day.isWorkDay() else 0
totalLoad += timeclock[day]['load']

tab.appendToFooter([
{'type': table.TYPE_STRING, 'value': '' },
{'type': table.TYPE_MINUTES, 'value': totalLoad },
{'type': table.TYPE_MINUTES_DIFFERENCE, 'value': totalLoad - totalDue},
])

print(tab)

# --== Year ==--

if mArgs.action == 'year':

# Set the target day to any day that the target year contains
if mArgs.year is None: TARGET_DAY = date.Date()
else: TARGET_DAY = date.makeFromString('01/01/%04u' % mArgs.year)

# Compute actual and due load per month
year = [{'due': 0, 'actual': 0, 'manualOT': 0} for i in range(13)]

for day in [day for day in TARGET_DAY.makeYearDays() if day <= TODAY]:

if day.isWorkDay():
year[day.getMonth()]['due'] += DUE_LOAD_PER_DAY

if day in timeclock:
year[day.getMonth()]['actual'] += timeclock[day]['load']
year[day.getMonth()]['manualOT'] += timeclock[day]['overtime']

# Report
tab = table.Table(options = {'alignments': [table.ALIGN_LEFT, table.ALIGN_RIGHT, table.ALIGN_RIGHT, table.ALIGN_RIGHT]})

tab.appendToHeader(['', 'Work hours', 'Overtime', 'Adjustment'])

for monthIdx, day in enumerate([day for day in TARGET_DAY.makeFirstMonthDays() if day <= TODAY]):
tab.append([
{'type': table.TYPE_STRING, 'value': day.getMonthName() }, # Month
{'type': table.TYPE_MINUTES, 'value': year[day.getMonth()]['actual'] }, # Work hours
{'type': table.TYPE_MINUTES_DIFFERENCE, 'value': year[day.getMonth()]['actual'] - year[day.getMonth()]['due']}, # Overtime (can be negative as well)
{'type': table.TYPE_MINUTES_DIFFERENCE, 'value': year[day.getMonth()]['manualOT'] }, # Manual adjustment to overtime
])

tab.appendToFooter([
{'type': table.TYPE_STRING, 'value': '' },
{'type': table.TYPE_MINUTES, 'value': sum([month['actual'] for month in year]) },
{'type': table.TYPE_MINUTES_DIFFERENCE, 'value': sum([month['actual'] for month in year]) - sum([month['due'] for month in year]) + sum([month['manualOT'] for month in year])},
{'type': table.TYPE_STRING, 'value': '' },
])

print(tab)
Hi Dominique,

On 1 October 2016 at 09:46, Dominique Pellé wrote:
> Can you provide a file where it happens and a minimalistic
> vimrc, just enough to reproduce it?

Here's what I came up with.

If I type o to open a new line:
- On line 87, it's instantaneous
- On line 85, there's a noticeable lag

With :syntax off, it's instantaneous in both cases. It may have
something to do with indent as well, because turning off indent in the
.vimrc solves the issue as well.

--
--
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/d/optout.

Saturday, October 1, 2016

Re: Possible to have :e autocompletion show entries from multiple folders?

On Sat, Oct 01, 2016 at 06:33:09PM -0700, Eric Pruitt wrote:
> This is what I came up with:
>
> cabbrev E e <C-r>=$PWD<CR>/<C-r>=getchar(0) == 32 ? '' : getchar(0) == 32<CR>
>
> This will make :E+<Space> prefill :e with the value of $PWD which should
> be the folder Vim was launched in.

That attempt was horrifically broken. Here's a much better version:

cabbrev E e <C-r>=getchar(1) == 32 ? getchar(0)[9] . $PWD . "/" : ''<CR>

Eric

--
--
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/d/optout.

Re: ***sorry*** this version of netrw requires vim v7.4 with patch 213

BPJ wrote:
> This, and an empty window, is what I'm greeted by when doing `:e .`:
>
> ***sorry*** this version of netrw requires vim v7.4 with patch 213
>
> Most confused!
>
> $ vim --version
> VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 26 2016 16:41:05)
> Inkluderade patchar: 1-13
> Kompilerad av benct@Gondolin
> Enorm version med GTK2-GUI. Funktioner inkluderade (+) eller inte (-):
>
> Huge version in English, I think.
>
> BTW I wish I knew how to build a non-localized vim.

There was a problem with netrw when vim went to 8.0; patch#2 fixed
that. Also, you might want to remove netrw from your home directory if
you've put a copy there in the past: try :NetrwClean . If you wish, you
can then get your patch level up to 8.002 or higher or get the most
up-to-date netrw from my website:
http://www.drchip.org/astronaut/vim/index.html#NETRW .

Regards,
Chip 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/d/optout.

Re: Possible to have :e autocompletion show entries from multiple folders?

On Sat, Oct 01, 2016 at 11:58:54AM -0700, Eric Pruitt wrote:
> Is there some way to make command mode filename autocompletion show
> folders from multiple directories? I would like :e autocompletion to
> show files from Vim's $PWD at launch and files from paths relative to
> the current buffer. In my Vim configuration, I already have "autocmd
> BufEnter * silent! lcd %:p:h", so I just need to figure out how to also
> show files from $PWD from using :e autocompletion.

Since this feature is reminiscent of Bash's CDPATH handling, I searched
for "vim cdpath" and found https://gist.github.com/jferris/7122963 . I
began to modify this code to support file paths with :e, but after some
more searching and consideration, I decided to use a cabbrev mapping
instead. This is what I came up with:

cabbrev E e <C-r>=$PWD<CR>/<C-r>=getchar(0) == 32 ? '' : getchar(0) == 32<CR>

This will make :E+<Space> prefill :e with the value of $PWD which should
be the folder Vim was launched in.

Eric

--
--
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/d/optout.

Re: Spam on vim.org

Paul wrote:

> http://www.vim.org/scripts/script.php?script_id=5455 looks like spam to me.

Yeah, looks weird. I have deleted it.

--
Seen on the back of a biker's vest: If you can read this, my wife fell off.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
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/d/optout.