从VIM执行命令不认识bash命令别名 [英] Commands executed from vim are not recognizing bash command aliases
本文介绍了从VIM执行命令不认识bash命令别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对MAC bash和别名之一是这样的。
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
我得到
/bin/bash: gitlog: command not found
我知道我可以在我的.gitconfig添加这个别名
I know I can add aliases like this in my .gitconfig
[alias]
co = checkout
st = status
ci = commit
br = branch
df = diff
不过,我不想加我的所有的bash别名的.gitconfig。这是不干燥。
However I don't want to add all my bash aliases to .gitconfig. That is not DRY.
有没有更好的解决办法?
Is there a better solution?
推荐答案
除非它的互动击不加载你的.bashrc。使用
Bash doesn’t load your .bashrc unless it’s interactive. Use
:set shellcmdflag=-ic
使Vim的:
壳行为像命令提示符
这篇关于从VIM执行命令不认识bash命令别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文