I use bash on mac and one of the aliases is like this
alias gitlog='git --no-pager log -n 20 --pretty=format:%h%x09%an%x09%ad%x09%s --date=short --no-merges'
However when I do
:! gitlog
I get
/bin/bash: gitlog: command not found
I know I can add aliases like this in my .gitconfig
[alias]
co = checkout
st = status
ci = commit
br = branch
df = diff
However I don’t want to add all my bash aliases to .gitconfig. That is not DRY.
Is there a better solution?
Bash doesn’t load your
.bashrcunless it’s interactive.Run
:set shellcmdflag=-icto set it to interactive for the current session.To make the setting permanent, add set
set shellcmdflag=-icto the end of your.vimrcfile.Use a bang (
!) before sending a command to shell. For example::! cd folder/.