Skip to content

Commit e4f04ae

Browse files
Hitesh Paulianding1
authored andcommitted
Fix error, make split horizontal
1 parent 9369d5c commit e4f04ae

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

autoload/leetcode.vim

Lines changed: 9 additions & 9 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('[DESC] %s.%s.%s', problem_id,
530+
let problem_file_name = printf('%s.%s.%s', problem_id,
531531
\ s:SlugToFileName(problem_slug),
532532
\ problem_ext)
533533

@@ -719,23 +719,23 @@ function! leetcode#ResetSolution(with_latest_submission) abort
719719
call add(output, s:CommentLine(filetype, line))
720720
endfor
721721
call add(output, s:CommentEnd(filetype))
722-
call append('$', output)
722+
call append('$', code)
723723
silent! normal! gggqG
724724

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'
725+
let problem_desc_file_name = printf('[DESCRIPTION] %s.%s', problem['id'], problem_slug)
726+
if buflisted(problem_desc_file_name)
727+
execute bufnr(problem_desc_file_name) . 'buffer'
730728
return
731729
endif
732730

733-
execute 'rightbelow new ' . problem_new_file_name
731+
execute 'leftabove '. len(output). 'new ' . problem_desc_file_name
734732

735733

736-
call append('$', code)
734+
call append('$', output)
735+
setlocal nomodifiable
737736

738737
silent! normal! ggdd
738+
execute 'wincmd j'
739739
endfunction
740740

741741
function! s:CommentStart(filetype, title) abort

0 commit comments

Comments
 (0)