vim-python / python-syntax

Python syntax highlighting for Vim
MIT License
438 stars 84 forks source link

newline delay #29

Closed KiYugadgeter closed 5 years ago

KiYugadgeter commented 7 years ago

delaying newline when this plugin enable. syntax off has remove delaying of newline.

OS: macOS 10.12.5 vim 8.0.648

The following is syntime on my environment. time of 10 times newline


  TOTAL      COUNT  MATCH   SLOWEST     AVERAGE   NAME               PATTERN                                                                                                              
  0.819285   11996  0       0.000639    0.000068  pythonError        [$?]\|\([-+@%&|^~]\)\1\{1,}\|\([=*/<>]\)\2\{2,}\|\([+@/%&|^~<>]\)\3\@![-+*@/%&|^~<>]\|\*\*[*@/%&|^<>]\|=[*@/%&|^<>]\|-[+*@/%&|^~<]\|[<
  0.817784   29630  23438   0.000123    0.000028  pythonNumber       \<\d\>
  0.753679   12006  0       0.000501    0.000063  pythonBuiltinObj   \v\.@
  0.691795   12006  0       0.000202    0.000058  pythonRawFString   \%([fF][rR]\|[rR][fF]\)'
  0.686025   12006  0       0.000178    0.000057  pythonRawBytes     \%([bB][rR]\|[rR][bB]\)'
  0.684235   12006  0       0.000275    0.000057  pythonRawFString   \%([fF][rR]\|[rR][fF]\)"
  0.682016   12006  0       0.000210    0.000057  pythonRawFString   \%([fF][rR]\|[rR][fF]\)"""
  0.680987   12006  0       0.000269    0.000057  pythonRawBytes     \%([bB][rR]\|[rR][bB]\)"
  0.678611   12006  0       0.000222    0.000057  pythonRawBytes     \%([bB][rR]\|[rR][bB]\)"""
  0.676308   12006  0       0.000249    0.000056  pythonRawBytes     \%([bB][rR]\|[rR][bB]\)'''
  0.671002   12006  0       0.000160    0.000056  pythonRawFString   \%([fF][rR]\|[rR][fF]\)'''
  0.515513   12006  0       0.000167    0.000043  pythonStatement    \v\.@
  0.364002   11996  0       0.000136    0.000030  pythonFloat        \<\d\%([_0-9]*\d\)\=[eE][+-]\=\d\%([_0-9]*\d\)\=[jJ]\=\>
  0.360106   11996  0       0.000139    0.000030  pythonNumber       \<[1-9][_0-9]*\d\>
  0.356433   11996  0       0.000101    0.000030  pythonNumberError  \<\d[_0-9]*\D\>
  0.355913   11996  0       0.000136    0.000030  pythonFloat        \<\d\%([_0-9]*\d\)\=\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=
  0.354540   11996  0       0.000119    0.000030  pythonNumber       \<\d[jJ]\>
  0.353304   11996  0       0.000085    0.000029  pythonError        \<\d\+[^0-9[:space:]]\+\>
  0.348086   11996  0       0.000124    0.000029  pythonNumber       \<[1-9][_0-9]*\d[jJ]\>
  0.341373   11996  0       0.000095    0.000028  pythonNumberError  \<\d[_0-9]*_\>
  0.337073   12006  0       0.000068    0.000028  pythonBytes        [bB]"
  0.335773   12006  0       0.000221    0.000028  pythonRawString    [rR]'
  0.334479   12006  0       0.000130    0.000028  pythonFString      [fF]'''
  0.334453   12006  0       0.000108    0.000028  pythonBytes        [bB]"""
  0.333616   12006  0       0.000624    0.000028  pythonRawString    [rR]'''
  0.333267   12006  0       0.000084    0.000028  pythonFString      [fF]"
  0.331618   12006  0       0.000076    0.000028  pythonRawString    [rR]"
  0.328148   12006  0       0.000115    0.000027  pythonFString      [fF]"""
  0.327392   12006  0       0.000085    0.000027  pythonBytes        [bB]'
  0.327190   12006  0       0.000071    0.000027  pythonRawString    [rR]"""
  0.326874   12006  0       0.000183    0.000027  pythonFString      [fF]'
  0.316021   12006  0       0.000101    0.000026  pythonBytes        [bB]'''
  0.108732   12006  0       0.000046    0.000009  pythonImport       ^\s*\zsfrom\>
  0.092719   11996  0       0.000041    0.000008  pythonDecorator    ^\s*\zs@
  0.061592   12006  0       0.000028    0.000005  pythonStatement    \
  0.039693   12006  0       0.000018    0.000003  pythonStatement    \
  0.038589   11996  0       0.000034    0.000003  pythonFloat        \.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=\>
  0.033351   12006  0       0.000017    0.000003  pythonCoding       \%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$
  0.016517   12256  520     0.000649    0.000001  pythonComment      #.*$
  0.015556   12006  0       0.000016    0.000001  pythonRaiseFromStatement \
  0.014932   12006  0       0.000016    0.000001  pythonStatement    \
  0.008733   1146   1146    0.000023    0.000008  pythonFunction     \%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*
  0.008377   37476  30337   0.000002    0.000000  pythonDot          \.
  0.004791   11996  0       0.000020    0.000000  pythonNumberError  \<0[bBxXoO][_0-9a-fA-F]*_\>
  0.004767   12006  0       0.000009    0.000000  pythonString       """
  0.004714   11996  0       0.000009    0.000000  pythonBinNumber    \<0[bB][_01]*[01]\>
  0.004631   12006  0       0.000010    0.000000  pythonRun          \%^#!.*$
  0.004540   11996  0       0.000010    0.000000  pythonBinError     \<0[bB][01]*[2-9]\d*\>
  0.004321   12006  0       0.000019    0.000000  pythonBytesEscape  \\$
  0.004185   11996  0       0.000003    0.000000  pythonHexNumber    \<0[xX][_0-9a-fA-F]*\x\>
  0.004170   11996  0       0.000001    0.000000  pythonNumberError  \<0_x\S*\>
  0.004165   11996  0       0.000009    0.000000  pythonOctError     \<0[oO]\=\o*\D\+\d*\>
  0.004164   12006  0       0.000009    0.000000  pythonString       "
  0.004153   12006  0       0.000009    0.000000  pythonString       '''
  0.004139   11996  0       0.000010    0.000000  pythonHexError     \<0[xX]\x*[g-zG-Z]\x*\>
  0.004126   11996  0       0.000009    0.000000  pythonOctNumber    \<0[oO][_0-7]*\o\>
  0.004120   12006  0       0.000010    0.000000  pythonString       '
  0.004064   11996  0       0.000004    0.000000  pythonBinError     \<0[bB][01]*\D\+\d*\>
  0.004063   11996  0       0.000009    0.000000  pythonNumberError  \<0[_0-9]\+\>
  0.003967   11996  0       0.000011    0.000000  pythonOctError     \<0[oO]\=\o*[8-9]\d*\>

15.668772   752624


nfnty commented 7 years ago

Can't reproduce. Could you do some more testing and see if you can pinpoint the issue?

KiYugadgeter commented 7 years ago

Would you mind copying following code into your computer, then open with vim? Maybe newline delaying is able to reproduce.

I think the bug occur in case of present many slice expressions include long expression.


from random import randint
x = list(range(random.randint(200, 300)))

random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
random_p_minmax = min(x[100-randint(0, 99) / 2:]) + max(x[100-randint(0, 99) / 2:])
t = [{v: (v - 100 / 2 + 3 -randint(1, 10))} for v in x]
m = 10


nfnty commented 7 years ago

Still can't reproduce. Have you tried using Neovim?

KiYugadgeter commented 7 years ago

How do I install this plugin in neovim?

gordio commented 6 years ago

@KiYugadgeter it's simple: mkdir -p ~/.config/nvim/syntax && curl https://github.com/vim-python/python-syntax/raw/master/syntax/python.vim -o ~/.config/nvim/syntax/python.vim

P.S. My syntime report after Ctrl-L and 2 type of newline (with o and with O) - https://bpaste.net/show/4b7930a022a5