从windows git bash打开崇高的文本 [英] opening sublime text from windows git bash
问题描述
如何在Windows中从Git Bash打开Sublime文本?我尝试在〜/ .bashrc文件中添加别名,但没有任何工作。我正在寻找一些非常简单的东西,但我无法在互联网上找到它。
我要回答我自己的问题。首先,我在/ Users / username目录下创建了一个.bash_profile文件。我在这里复制了所有的git别名。为了访问崇高文本,我添加了这个别名: alias subl =/ c / Program \ Files / Sublime \ Text \\ \\ 2 / sublime_text.exe
我认为反斜线后的空格对于格式化非常重要。如果这不起作用,你将不得不查看你的sublime_text.exe文件位于哪里,并将格式化后的路径放在上面。现在在git bash命令行中输入
subl。
打开Sublime Text中的当前目录或文件名称
subl readme.md
在Sublime Text中打开它。我还在.bash_profile文件中添加了其他有用的别名,如:
别名gc =git commit -m
别名ga =git add。
别名gl =git log
别名gs =git status
所以在你的git bash命令提示符中,你可以简单地键入
gs ## for git status
gl ## for git log等
我希望这可以帮助别人。
How do I open Sublime text from Git Bash in Windows? I tried adding the alias at the ~/.bashrc file but nothing worked. I was looking for something very easy but I could not find in the internet.
I am going to answer my own question. First, I created a .bash_profile file under /Users/username directory. I have copied all my git aliases here. To access sublime text I added this alias:
alias subl="/c/Program\ Files/Sublime\ Text\ 2/sublime_text.exe"
I think the spaces after the backward slashes are important for formatting. If this doesn't work you will have to look where your sublime_text.exe file situated at and put the path after formatting as above. Now in the git bash command line just type
subl .
to open the current directory in Sublime Text or the name of the file as
subl readme.md
to open it in Sublime Text. I also added other useful aliases in the .bash_profile file like:
alias gc="git commit -m"
alias ga="git add ."
alias gl="git log"
alias gs="git status"
So in your git bash command prompt you can simply type
gs ##for git status
gl ##for git log, etc
I hope this will help someone.
这篇关于从windows git bash打开崇高的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!