Skip to content

Commit cea3713

Browse files
committed
Remove using markdown syntax
1 parent c59b0cc commit cea3713

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

autoload/leetcode.vim

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,26 @@ function! s:CheckSignIn() abort
6161
return v:true
6262
endfunction
6363

64+
function! s:SetupBasicSyntax() abort
65+
syn match lcHeader /\v^#{1,7} .*/
66+
67+
hi! link lcHeader Title
68+
endfunction
69+
6470
function! s:SetupProblemListBuffer() abort
6571
setlocal buftype=nofile
6672
setlocal noswapfile
6773
setlocal nobackup
6874
setlocal nonumber
6975
setlocal norelativenumber
7076
setlocal nospell
71-
setlocal filetype=markdown
7277
setlocal bufhidden=hide
7378
nnoremap <silent> <buffer> <return> :call <SID>HandleProblemListCR()<cr>
7479
nnoremap <silent> <buffer> s :call <SID>HandleProblemListS()<cr>
7580
nnoremap <silent> <buffer> r :call <SID>HandleProblemListR()<cr>
7681
82+
call s:SetupBasicSyntax()
83+
7784
syn match lcEasy /| Easy /hs=s+2
7885
syn match lcMedium /| Medium /hs=s+2
7986
syn match lcHard /| Hard /hs=s+2
@@ -106,12 +113,12 @@ function! s:PrintProblemList(problems) abort
106113
call append('$', ['## Problem List',
107114
\ '',
108115
\ '### Keys',
109-
\ ' - <cr> open the problem/go to the topic or company',
110-
\ ' - s view the submissions',
111-
\ ' - r refresh',
116+
\ ' <cr> open the problem/go to the topic or company',
117+
\ ' s view the submissions',
118+
\ ' r refresh',
112119
\ '',
113120
\ '### Indicators',
114-
\ ' - [P] = paid-only problems',
121+
\ ' [P] paid-only problems',
115122
\ ''])
116123

117124
let format = '|%1S| %-' . id_width . 'S | %-' . title_width .
@@ -613,7 +620,6 @@ function! s:ShowRunResultInPreview(result) abort
613620
setlocal norelativenumber
614621
setlocal nocursorline
615622
setlocal nobuflisted
616-
setlocal filetype=markdown
617623
setlocal modifiable
618624

619625
let output = s:FormatResult(a:result)
@@ -625,6 +631,8 @@ function! s:ShowRunResultInPreview(result) abort
625631
setlocal nomodifiable
626632
setlocal nomodified
627633

634+
call s:SetupBasicSyntax()
635+
628636
" add custom syntax rules
629637
syn keyword lcAccepted Accepted
630638
syn match lcFailure /Wrong Answer/
@@ -703,10 +711,11 @@ function! s:ListSubmissions(slug, refresh) abort
703711
setlocal nospell
704712
setlocal nonumber
705713
setlocal norelativenumber
706-
setlocal filetype=markdown
707714
nnoremap <silent> <buffer> <return> :call <SID>HandleSubmissionsCR()<cr>
708715
nnoremap <silent> <buffer> r :call <SID>HandleSubmissionsRefresh()<cr>
709716
717+
call s:SetupBasicSyntax()
718+
710719
syn keyword lcAccepted Accepted
711720
syn match lcFailure /Wrong Answer/
712721
syn match lcFailure /Memory Limit Exceeded/
@@ -747,8 +756,8 @@ function! s:ListSubmissions(slug, refresh) abort
747756
call add(output, '# '.problem['title'])
748757
call add(output, '')
749758
call add(output, '## Submissions')
750-
call add(output, ' - <cr> view submission')
751-
call add(output, ' - r refresh')
759+
call add(output, ' <cr> view submission')
760+
call add(output, ' r refresh')
752761
call add(output, '')
753762
let format = '| %-' . id_width . 'S | %-' . time_width .
754763
\ 'S | %-21S | %-' . runtime_width . 'S |'

0 commit comments

Comments
 (0)