소스 검색

Remove arguments from git hot commands

DricomDragon 3 년 전
부모
커밋
7f65fc0b98
1개의 변경된 파일8개의 추가작업 그리고 7개의 파일을 삭제
  1. 8 7
      Install/Templates/home/config/fish/functions/git_write_keyword.fish

+ 8 - 7
Install/Templates/home/config/fish/functions/git_write_keyword.fish

@@ -1,17 +1,18 @@
 function git_write_keyword --description 'Write git in terminal prompt'
     set -l cmd (commandline -po)
     set -l cursor (commandline -C)
+    set -l keywords 'git commit' 'git add'
     if test "$cmd[1]" != 'git'
         commandline -C 0
         commandline -i 'git '
         commandline -C (math $cursor + 4)
-	else if test (commandline -p) = 'git '
-        commandline -r 'git commit -a'
-        commandline -C 13
-	else if test (commandline -p) = 'git commit -a'
-        commandline -r 'git add .'
-        commandline -C 9
-	else if test (commandline -p) = 'git add .'
+    else if test (commandline -p) = 'git '
+        commandline -r $keywords[1]
+        commandline -C (string length $keywords[1])
+    else if test (commandline -p) = $keywords[1]
+        commandline -r $keywords[2]
+        commandline -C (string length $keywords[2])
+    else if test (commandline -p) = $keywords[2]
         commandline -r ''
         commandline -C 0
     else