Sublime Text from Command Line

前端 未结 27 2216
时光说笑
时光说笑 2020-11-27 08:37

I installed Sublime Text and wanted to know how to open rb files in it from the terminal. I saw What is the command to make Sublime Text my core editor? and I s

27条回答
  •  悲&欢浪女
    2020-11-27 09:33

    This powershell allows me to pipe to the edit function (or to use it in the normal way)

    function edit
    {
        param( [Parameter(ValueFromPipeline=$true,Position=0)] $file )
        begin { set-alias EDITOR 'W:\tools\sublime_text.bat' }
        process { EDITOR $file }
    }
    

    here is the sublime_text.bat which for some reason seems necessary (anyone know why?)

    START "Sublime Text 2" "C:\Program Files\Sublime Text 2\sublime_text.exe" %*
    

提交回复
热议问题