Skip to content

Commit 9369d5c

Browse files
Hitesh Paulianding1
authored andcommitted
Add basic support for vertical problem splitting
1 parent 91f774c commit 9369d5c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

autoload/leetcode.vim

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ function! s:HandleProblemListCR() abort
527527
let problem = s:GetProblem(problem_id)
528528
let problem_slug = problem['slug']
529529
let problem_ext = s:SolutionFileExt(g:leetcode_solution_filetype)
530-
let problem_file_name = printf('%s.%s.%s', problem_id,
530+
let problem_file_name = printf('[DESC] %s.%s.%s', problem_id,
531531
\ s:SlugToFileName(problem_slug),
532532
\ problem_ext)
533533

@@ -720,9 +720,19 @@ function! leetcode#ResetSolution(with_latest_submission) abort
720720
endfor
721721
call add(output, s:CommentEnd(filetype))
722722
call append('$', output)
723-
724723
silent! normal! gggqG
725724

725+
let problem_ext = s:SolutionFileExt(g:leetcode_solution_filetype)
726+
" TODO avoid recalculation of problem_ext twice
727+
let problem_new_file_name = printf('%s.%s.%s', problem['id'], problem_slug, problem_ext)
728+
if buflisted(problem_file_name)
729+
execute bufnr(problem_new_file_name) . 'buffer'
730+
return
731+
endif
732+
733+
execute 'rightbelow new ' . problem_new_file_name
734+
735+
726736
call append('$', code)
727737

728738
silent! normal! ggdd

0 commit comments

Comments
 (0)