function git_write_keyword --description 'Write git in terminal prompt' set -l cmd (commandline -po) set -l cursor (commandline -C) 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 .' commandline -r '' commandline -C 0 else commandline -r (string sub --start=5 (commandline -p)) commandline -C -- (math $cursor - 4) end end