Skip to content

Commit a5cc5f1

Browse files
committed
Added support for php, erlang, racket, elixir languages
1 parent e9538e6 commit a5cc5f1

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

autoload/leetcode.vim

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,10 @@ let s:file_type_to_ext = {
662662
\ 'scala': 'scala',
663663
\ 'kotlin': 'kt',
664664
\ 'rust': 'rs',
665+
\ 'racket': 'pp',
666+
\ 'php': 'php',
667+
\ 'erlang': 'erl',
668+
\ 'elixir': 'exs',
665669
\ }
666670

667671
function! s:SolutionFileExt(filetype) abort
@@ -745,38 +749,48 @@ endfunction
745749

746750
function! s:CommentStart(filetype, title) abort
747751
if index(['java', 'c', 'javascript', 'typescript', 'cpp', 'csharp', 'swift', 'scala',
748-
\ 'kotlin', 'rust'], a:filetype) >= 0
752+
\ 'kotlin', 'rust', 'php',], a:filetype) >= 0
749753
return '/* ' . a:title
750-
elseif index(['python', 'python3', 'ruby'], a:filetype) >= 0
754+
elseif index(['python', 'python3', 'ruby', "elixir"], a:filetype) >= 0
751755
return '# ' . a:title
752756
elseif index(['golang'], a:filetype) >= 0
753757
return '// ' . a:title
758+
elseif index(['erlang'], a:filetype) >= 0
759+
return '% ' . a:title
760+
elseif index(['racket'], a:filetype) >= 0
761+
return '#| ' . a:title
754762
else
755763
return a:title
756764
endif
757765
endfunction
758766

759767
function! s:CommentLine(filetype, line) abort
760768
if index(['java', 'c', 'javascript', 'typescript', 'cpp', 'csharp', 'swift', 'scala',
761-
\ 'kotlin', 'rust'], a:filetype) >= 0
769+
\ 'kotlin', 'rust', 'php'], a:filetype) >= 0
762770
return ' * ' . a:line
763-
elseif index(['python', 'python3', 'ruby'], a:filetype) >= 0
771+
elseif index(['python', 'python3', 'ruby', 'racket', 'elixir'], a:filetype) >= 0
764772
return '# '.a:line
765773
elseif index(['golang'], a:filetype) >= 0
766774
return '// '.a:line
775+
elseif index(['erlang'], a:filetype) >= 0
776+
return '% '.a:line
767777
else
768778
return a:line
769779
endif
770780
endfunction
771781

772782
function! s:CommentEnd(filetype) abort
773783
if index(['java', 'c', 'javascript', 'typescript', 'cpp', 'csharp', 'swift', 'scala',
774-
\ 'kotlin', 'rust'], a:filetype) >= 0
784+
\ 'kotlin', 'rust', 'php'], a:filetype) >= 0
775785
return ' * [End of Description] */'
776-
elseif index(['python', 'python3', 'ruby'], a:filetype) >= 0
786+
elseif index(['python', 'python3', 'ruby', 'elixir'], a:filetype) >= 0
777787
return '# [End of Description]:'
778788
elseif index(['golang'], a:filetype) >= 0
779789
return '// [End of Description]'
790+
elseif index(['erlang'], a:filetype) >= 0
791+
return '% [End of Description]'
792+
elseif index(['racket'], a:filetype) >= 0
793+
return '# [End of Description] |#'
780794
else
781795
return ''
782796
endif

0 commit comments

Comments
 (0)