加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

从vim执行的命令不能识别bash命令别名

发布时间:2020-12-15 16:44:07 所属栏目:安全 来源:网络整理
导读:我在mac上使用bash,其中一个别名是这样的 alias gitlog='git --no-pager log -n 20 --pretty=format:%h%x09%an%x09%ad%x09%s --date=short --no-merges' 但是当我这样做 :! gitlog 我得到 /bin/bash: gitlog: command not found 我知道我可以在我的.gitconf
我在mac上使用bash,其中一个别名是这样的
alias gitlog='git --no-pager  log -n 20 --pretty=format:%h%x09%an%x09%ad%x09%s --date=short --no-merges'

但是当我这样做

:! gitlog

我得到

/bin/bash: gitlog: command not found

我知道我可以在我的.gitconfig中添加这样的别名

[alias]
    co = checkout
    st = status
    ci = commit
    br = branch
    df = diff

但是我不想将所有的bash别名添加到.gitconfig。这不是干的。

有更好的解决方案吗?

Bash不加载你的.bashrc,除非它是交互式的。使用
:set shellcmdflag=-ic

使Vim的:! shell的行为就像你的命令提示符。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读