【问题标题】:Add Aliases to Bash Terminal from inside of VSC从 VSC 内部向 Bash 终端添加别名
【发布时间】:2022-01-12 22:18:52
【问题描述】:

在 Visual Studio Code 中使用 bash 终端时,有没有办法为它添加别名?

【问题讨论】:

  • 你找到解决办法了吗?
  • 没有人回答 Linux 系统吗?好奇...

标签: visual-studio-code


【解决方案1】:

我在这里找到了答案 https://gist.github.com/wzup/36b5159d8c580b827384

作为灵感

# create a file C:\Users\[user]\.bashrc
# add this content
# add your onw aliases or changes these ones as you like
# to make a dot (.bashrs) file in windows, create a file ".bashrs." (without extention) and save. windows will save it as ".bashrc"

alias ls='ls -alh'
alias cdnginx='cd /c/nginx && ls'
alias cdmcga='cd /c/Users/[user]/sbox/node/mcga && ls'
alias cdfood9='cd /c/Users/[user]/sbox/node/food9 && ls'
alias cdmysql='cd /c/nginx/mysql/bin && ls'
alias cdsbox='cd /c/Users/[user]/sbox && ls'
alias cdangular='cd /c/Users/[user]/sbox/angularjs && ls'
alias cdmongobin='cd "/c/Program Files/MongoDB/Server/3.0/bin" && ls'
alias cdmongodata='cd /c/mongodb/data/db && ls'
alias sbrc='cd ~ && source .bashrc'
alias mydocs='cd ~/Documents'

【讨论】:

  • 至少“我发现”了这种正确的做法。谢谢!
【解决方案2】:

我正在使用带有 zsh 的 MAC,并且在同一个地方(您的用户文件夹)并且文件的名称为 .zshrc

查看MAC中的隐藏文件:Cmd + shift + .

别名 ball="npm run build-all"

【讨论】:

    猜你喜欢
    • 2015-07-01
    • 2011-11-15
    • 2012-04-11
    • 1970-01-01
    • 1970-01-01
    • 2018-10-23
    • 2021-11-24
    • 2020-10-22
    • 2019-04-15
    相关资源
    最近更新 更多