相关疑难解决方法(0)

从vim执行的命令无法识别bash命令别名

我在mac上使用bash,其中一个别名是这样的

alias gitlog='git --no-pager  log -n 20 --pretty=format:%h%x09%an%x09%ad%x09%s --date=short --no-merges'
Run Code Online (Sandbox Code Playgroud)

但是,当我这样做

 :! gitlog
Run Code Online (Sandbox Code Playgroud)

我明白了

/bin/bash: gitlog: command not found 
Run Code Online (Sandbox Code Playgroud)

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

[alias]
    co = checkout
    st = status
    ci = commit
    br = branch
    df = diff
Run Code Online (Sandbox Code Playgroud)

但是,我不想将所有bash别名添加到.gitconfig.那不是干.

有更好的解决方案吗?

vim bash alias

92
推荐指数
4
解决办法
2万
查看次数

在shell中导出函数

请告诉我如何在父shell(bash,sh或ksh)中导出函数,以便该函数可用于从父进程启动的所有子进程?

shell export function

85
推荐指数
3
解决办法
5万
查看次数

标签 统计

alias ×1

bash ×1

export ×1

function ×1

shell ×1

vim ×1