Skip to content

Commit

Permalink
🐞fix: リファクタリング
Browse files Browse the repository at this point in the history
  • Loading branch information
utubo committed Oct 2, 2023
1 parent 1fb02f1 commit 4faad09
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,15 @@ chdir(expand('%:p:h'))
echoh MoreMsg
ec 'git add --dry-run ' .. a
const c = system('git add --dry-run ' .. a)
if !c
ec 'none.'
elseif !!v:shell_error
if !!v:shell_error
echoh ErrorMsg
ec c
echoh Normal
return
else
endif
if !c
ec 'none.'
return
endif
for d in split(c, '\n')
exe 'echoh' (d =~# '^remove' ? 'DiffDelete' : 'DiffAdd')
ec d
Expand All @@ -276,9 +277,8 @@ echoh Question
if input('execute ? (y/n) > ', 'y') ==# 'y'
system('git add ' .. a)
endif
endif
echoh Normal
finally
echoh Normal
chdir(b)
endtry
enddef
Expand Down
28 changes: 14 additions & 14 deletions src/.vimrc.src.vim
Original file line number Diff line number Diff line change
Expand Up @@ -339,25 +339,25 @@ def GitAdd(args: string)
echoh MoreMsg
echo 'git add --dry-run ' .. args
const list = system('git add --dry-run ' .. args)
if !list
echo 'none.'
elseif !!v:shell_error
if !!v:shell_error
echoh ErrorMsg
echo list
echoh Normal
return
else
for item in split(list, '\n')
execute 'echoh' (item =~# '^remove' ? 'DiffDelete' : 'DiffAdd')
echo item
endfor
echoh Question
if input('execute ? (y/n) > ', 'y') ==# 'y'
system('git add ' .. args)
endif
endif
echoh Normal
if !list
echo 'none.'
return
endif
for item in split(list, '\n')
execute 'echoh' (item =~# '^remove' ? 'DiffDelete' : 'DiffAdd')
echo item
endfor
echoh Question
if input('execute ? (y/n) > ', 'y') ==# 'y'
system('git add ' .. args)
endif
finally
echoh Normal
chdir(current_dir)
endtry
enddef
Expand Down

0 comments on commit 4faad09

Please sign in to comment.