# Set up Sublime Text 4 for Julia

**URL:** <https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039>\
**Category:** Tooling\
**Tags:** sublime-text\
**Created:** [November 30, 2022, 9:39am UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039 "2022-11-30T09:39:44Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [November 30, 2022, 9:39am UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/1 "2022-11-30T09:39:44Z")

</div>

I found a thread about setting up [Sublime Text 3](https://discourse.julialang.org/t/set-up-sublime-text-3-for-julia/11702/21?page=2) now I am struggling to setting up correctly Sublime-Text 4 for Julia.  
First great thing I found was the language-sever support:  
[LSP-julia](https://github.com/sublimelsp/LSP-julia)  
And at that point I struggle already, Julia is not in the %PATH% and I do not know how and in which configuration file I should specify the full-path.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [November 30, 2022, 10:36am UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/2 "2022-11-30T10:36:18Z")

</div>

As the GitHub readme explains:

> If the `julia` executable is not in your PATH, you need to provide the full path to the executable in the LSP-julia package settings.

So go to the command palette, type “LSP-julia settings” and you’ll see:

![image](https://global.discourse-cdn.com/julialang/original/3X/9/f/9f3b350a48cef8703f329bd140c3b5c20f4c7e10.png)

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [November 30, 2022, 11:50am UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/3 "2022-11-30T11:50:05Z")

</div>

Ok, what is missing is a hint, how to install the `LSP-julia` package.  
I tried to install via package manager:  
 ![sublime_text_package_manager](https://global.discourse-cdn.com/julialang/original/3X/b/e/be935526edde7f9f61ccd224afcf9fd5fa7915f5.png)  
But the ``LSP-julia` package is not listed ☹  
 ![sublime_text_package_manager_install_package](https://global.discourse-cdn.com/julialang/original/3X/4/5/45decbd4ba45846653d13b2ab9097224cb27a54d.png)

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [November 30, 2022, 12:10pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/4 "2022-11-30T12:10:33Z")

</div>

If you face the same situation, the reason might be that `LSP-julia` is already present.  
My error was, I had installed `LSP-julia`, but was not aware of it. In a previous attempt to install the package, there was no success-message, e.g. “Installation was successful!”.  
I restarted `Sublime Text` and was not able to find a hint that the package is now present.  
The entry-point for the configuration of the package is hidden:

 ![2022-11-30 13_09_16-C__bin_sublime_text_Data_Packages_User_LSP-julia.sublime-settings](https://global.discourse-cdn.com/julialang/original/3X/c/0/c09df39fa074bac10eb7b564a91b6e14f9dad1e9.png)

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [November 30, 2022, 12:30pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/5 "2022-11-30T12:30:34Z")

</div>

Nothing’s hidden from the command palette:

![image](https://global.discourse-cdn.com/julialang/original/3X/6/8/68582f914f76a02575e4a0a8ec21ad654b7ac925.png)

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [November 30, 2022, 12:31pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/6 "2022-11-30T12:31:56Z")

</div>

As far as I understand are there two configuration files for the package, one is read only and is part of the package itself. And user configuration should be added in a user specific configuration file.  
As the backslash is special character it must be masked, in this by the same char. Spaces in the file path must be masked also be a backslash.

Another detail might be the variable: `"JULIA_SSL_CA_ROOTS_PATH"`.  
Is it helpful to define this variable via `startup.jl`?  
See: [updating-julia-packages-from-sublime-text](https://discourse.julialang.org/t/updating-julia-packages-from-sublime-text-terminus/68120/8)

And now come two other questions:  
Is there Julia-REPL inside `sublime text 4`?  
How to execute a Julia-script from inside `sublime text 4`?  
P.S.:  
Meanwhile I found:  
[HowToUseJuliaWithSublimeText3](https://github.com/PetrKryslUCSD/HowToUseJuliaWithSublimeText3)  
But this might be outdated, is there something similar to get started with `sublime text 4`?

---

<div class="post-metadata">

**Author:** ![stephenll](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stephenll/32/28751_2.png) [@stephenll](https://discourse.julialang.org/u/stephenll)\
**Post date:** [November 30, 2022, 2:15pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/7 "2022-11-30T14:15:01Z")

</div>

> [@ellocco](#):
>
> Is there Julia-REPL inside `sublime text 4`?

Yes, [Terminus - Packages - Package Control](https://packagecontrol.io/packages/Terminus). I also use SendCode, [SendCode - Packages - Package Control](https://packagecontrol.io/packages/SendCode) to execute code in the REPL.

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [November 30, 2022, 3:51pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/8 "2022-11-30T15:51:13Z")

</div>

This is still not very clear to me which steps I need to go. E.g. what do you put here:

```julia
[
    {
        "keys": ["ctrl+shift+enter"], "command": "send_code",
        "args": {"cmd": "\n", "prog": "tmux"}
    }
]

```

![SendCode_Prog](https://global.discourse-cdn.com/julialang/original/3X/3/2/32933d890fd7bc92f36bb73c6761f6d46f3a3eb5.png)  
If I select `Terminus` and send e.g. one code line, I see the following error:

```julia
ERROR: syntax: extra token "201" after end of expression                                                                                                                                                                           
Stacktrace:                                                                                                                                                                                                                        
 [1] top-level scope                                                                                                                                                                                                               
   @ none:1                                                                                                                                                                                                                        

```

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [November 30, 2022, 4:13pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/9 "2022-11-30T16:13:15Z")

</div>

> [@ellocco](#):
>
> `ERROR: syntax: extra token "201" after end of expression`

I found something:  
[bracketed\_paste\_mode](https://forum.sublimetext.com/t/undesired-tokens-when-using-send-code-terminus-julia-repl/47424/3)  
Now my personal configuration for `SendCode` contains:

```julia
{
	"julia":
	{
		"bracketed_paste_mode": false,
		"prog": "terminus",
	},
	"prog": "terminus",
}

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 30, 2022, 4:23pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/10 "2022-11-30T16:23:53Z")

</div>

The instructions for ST3 still hold. I use them with ST4 (these days also known as ST).

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [November 30, 2022, 4:31pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/11 "2022-11-30T16:31:19Z")

</div>

And what about this command definition:

```julia
[
    {
        "keys": ["ctrl+shift+enter"], "command": "send_code",
        "args": {"cmd": "cd(\"$file_path\")"},
        "context": [
            { "key": "selector", "operator": "equal", "operand": "source.julia" }
        ]
    },	
]

```

There must be something wrong, but what?  
I would like to perform the command: `PSP-julia: Run Code Cell` and it seems as if  
the keystroke combination is assigned to this command:  
 ![run_code_cell](https://global.discourse-cdn.com/julialang/original/3X/c/0/c02e47d457d4303f17c9ed2608fd35da244d1fac.png)

But something goes wrong, if I send the command via LSP-julia-menu (`Ctrl+Shift+p`) it works as expected, but if I use the assigned keystroke the folder of the current script combined with `cd()` is send to `Terminus`, e.g.:

```julia
julia> cd("C:\\data\\julia_scripts\\examples\\strings")

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 30, 2022, 4:35pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/12 "2022-11-30T16:35:27Z")

</div>

Isn’t your command “ctrl+shift+enter” instead of “alt+shift+enter” ?

```julia

```

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [November 30, 2022, 4:39pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/13 "2022-11-30T16:39:49Z")

</div>

Yes, you are right, but where and how to configure (`ctrl+shift+enter`) to execute the command `PSP-julia: Run Code Cell`.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 30, 2022, 4:41pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/14 "2022-11-30T16:41:51Z")

</div>

I see, you want an alias for “alt+shift+enter”?

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [November 30, 2022, 4:53pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/15 "2022-11-30T16:53:40Z")

</div>

> [@ellocco](#):
>
> ```julia
> [
> {
> "keys": ["ctrl+shift+enter"], "command": "send_code",
> "args": {"cmd": "cd(\"$file_path\")"},
> "context": [
> { "key": "selector", "operator": "equal", "operand": "source.julia" }
> ]
> },	
> ]
> 
> ```

Ok, I see my mistake, this is the result of copy-and-paste:

```julia
"args": {"cmd": "cd(\"$file_path\")"},

```

Now it is obvious, why this happens, but the question is still there,  
how to bind the `Run Code Cell`-command to the keystroke (`ctrl+shift+enter`)?

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [November 30, 2022, 8:40pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/16 "2022-11-30T20:40:42Z")

</div>

@[jwortmann · GitHub](https://github.com/jwortmann)  
informed me how to bind the `Run Code Cell` to a user defined keystroke:

```julia
 { 
     "keys": ["alt+shift+j"], 
     "command": "julia_run_code_cell", 
     "context": [ 
         {"key": "selector", "operand": "source.julia"}, 
         {"key": "setting.lsp_active"} 
     ] 
 }, 

```

And he gave me an advice, to benefit from all features from the [ST](https://www.sublimetext.com/) `LSP-julia`-package, it makes sense to open the root folder of the Pkg-Julia-Environment where the environment configuration file `Project.toml` is located as project folder.  
P.S.:  
To run code inside the Terminus REPL-window, it is not necessary to install the `SendCode` [ST](https://www.sublimetext.com/) package.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 30, 2022, 10:45pm UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/17 "2022-11-30T22:45:51Z")

</div>

I would be interested to find out how much better LSP is compared to the auto complete (if at all) .

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [March 1, 2023, 7:56am UTC](https://discourse.julialang.org/t/set-up-sublime-text-4-for-julia/91039/19 "2023-03-01T07:56:38Z")

</div>

see also related thread:

> [@Build system for Sublime Text running Julia in Terminus](https://discourse.julialang.org/t/build-system-for-sublime-text-running-julia-in-terminus/95362):
>
> This PA is intended for Sublime Text users who would like to run Julia in Terminus within the editor. Save this into the file Julia-REPL.sublime-build in the folder Data/Packages/User. { // This build system simply opens a new interactive Julia REPL // 2023 Petr Krysl "title": "Julia REPL", "target": "terminus\_open", "auto\_close": false, "shell\_cmd": "julia -t4", // Assume that PATH is set before invoking the editor "cwd": "${file\_path:${folder}}", // "selector": "…
