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 "$cmd[2]" != commit commandline -C 4 commandline -i "commit" commandline -C (math $cursor + 10) else commandline -r (string sub --start=11 (commandline -p)) commandline -C -- (math $cursor - 10) end end