@@ -399,24 +399,28 @@ function! leetcode#ListProblems(refresh) abort
399399 let topics = s: topics_and_companies [' topics' ]
400400 let companies = s: topics_and_companies [' companies' ]
401401
402- " concatenate the topics into a string
403- let topic_slugs = map (copy (topics), ' v:val["topic_slug"] . ":" . v:val["num_problems"]' )
404- let topic_lines = s: FormatIntoColumns (topic_slugs)
402+ if g: leetcode_hide_topics == 0
403+ " concatenate the topics into a string
404+ let topic_slugs = map (copy (topics), ' v:val["topic_slug"] . ":" . v:val["num_problems"]' )
405+ let topic_lines = s: FormatIntoColumns (topic_slugs)
405406
406- call append (' $' , [' # LeetCode' , ' ' , ' ## Topics' , ' ' ])
407+ call append (' $' , [' # LeetCode' , ' ' , ' ## Topics' , ' ' ])
407408
408- let b: leetcode_topic_start_line = line (' $' )
409- call append (' $' , topic_lines)
410- let b: leetcode_topic_end_line = line (' $' )
409+ let b: leetcode_topic_start_line = line (' $' )
410+ call append (' $' , topic_lines)
411+ let b: leetcode_topic_end_line = line (' $' )
412+ endif
411413
412- let company_slugs = map (copy (companies), ' v:val["company_slug"] . ":" . v:val["num_problems"]' )
413- let company_lines = s: FormatIntoColumns (company_slugs)
414+ if g: leetcode_hide_companies == 0
415+ let company_slugs = map (copy (companies), ' v:val["company_slug"] . ":" . v:val["num_problems"]' )
416+ let company_lines = s: FormatIntoColumns (company_slugs)
414417
415- call append (' $' , [' ' , ' ## Companies' , ' ' ])
418+ call append (' $' , [' ' , ' ## Companies' , ' ' ])
416419
417- let b: leetcode_company_start_line = line (' $' )
418- call append (' $' , company_lines)
419- let b: leetcode_company_end_line = line (' $' )
420+ let b: leetcode_company_start_line = line (' $' )
421+ call append (' $' , company_lines)
422+ let b: leetcode_company_end_line = line (' $' )
423+ endif
420424
421425 call append (' $' , ' ' )
422426 call s: PrintProblemList ()
@@ -461,8 +465,8 @@ function! s:HandleProblemListCR() abort
461465 " Parse the problem number from the line
462466 let line_nr = line (' .' )
463467
464- if line_nr >= b: leetcode_topic_start_line &&
465- \ line_nr < b: leetcode_topic_end_line
468+ if line_nr >= get ( b: , ' leetcode_topic_start_line' , 0 ) &&
469+ \ line_nr < get ( b: , ' leetcode_topic_end_line' , 0 )
466470 let topic_slug = expand (' <cWORD>' )
467471 let topic_slug = s: TagName (topic_slug)
468472 if topic_slug != ' '
@@ -471,8 +475,8 @@ function! s:HandleProblemListCR() abort
471475 return
472476 endif
473477
474- if line_nr >= b: leetcode_company_start_line &&
475- \ line_nr < b: leetcode_company_end_line
478+ if line_nr >= get ( b: , ' leetcode_company_start_line' , 0 ) &&
479+ \ line_nr < get ( b: , ' leetcode_company_end_line' , 0 )
476480 let company_slug = expand (' <cWORD>' )
477481 let company_slug = s: TagName (company_slug)
478482 if company_slug != ' '
0 commit comments