# Vscode run file in repl terminal

**URL:** <https://discourse.julialang.org/t/vscode-run-file-in-repl-terminal/45656>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 28, 2020, 4:19am UTC](https://discourse.julialang.org/t/vscode-run-file-in-repl-terminal/45656 "2020-08-28T04:19:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaulDurand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rauldurand/32/2044_2.png) [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Post date:** [August 28, 2020, 4:19am UTC](https://discourse.julialang.org/t/vscode-run-file-in-repl-terminal/45656/1 "2020-08-28T04:19:11Z")

</div>

Is there a way to run the current file in the current REPL terminal?  
Something that does \> include(“$currentfile”) in the REPL.  
I am aware of the command Run File, but it reloads packages each time and becomes slow.  
Doing ctrl+A ctrl+Enter does the job but in prints a lot of clutter in the terminal.

Thanks

---

<div class="post-metadata">

**Author:** ![anon37204545](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@anon37204545](https://discourse.julialang.org/u/anon37204545)\
**Post date:** [August 28, 2020, 8:22am UTC](https://discourse.julialang.org/t/vscode-run-file-in-repl-terminal/45656/2 "2020-08-28T08:22:08Z")

</div>

The open terminals in VS Code are independent of the open files, since a terminal is opened with an associated directory, not file.

You can also use Alt+Enter instead of Ctrl+A / Ctrl+Enter. I don’t see any clutter with it, what do you mean by that?

---

<div class="post-metadata">

**Author:** ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Post date:** [August 28, 2020, 10:56am UTC](https://discourse.julialang.org/t/vscode-run-file-in-repl-terminal/45656/3 "2020-08-28T10:56:43Z")

</div>

I think he was referring to the difference of CTRL + Enter and ALT + Enter. Clutter being the lines which the terminal shows for the ctrl version.

What I personally would like to better understand is why CTRL + Enter tends to be very slow in Windows. I think tis may be related to the terminal which is used. I wonder why the default terminal is not able to print stuff “fast”.

---

<div class="post-metadata">

**Author:** ![RaulDurand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rauldurand/32/2044_2.png) [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Post date:** [August 28, 2020, 8:44pm UTC](https://discourse.julialang.org/t/vscode-run-file-in-repl-terminal/45656/4 "2020-08-28T20:44:09Z")

</div>

ctrl+A ctrl+Enter prints each line of code before running so the program output get mixed with those lines.

I managed to run the whole file in the current REPL terminal by defining the following hotkey

```julia
{
        "command": "language-julia.executeCell",
        "key": "shift+enter",
        "when": "editorTextFocus"
},

```

It prints the whole file before running though.

---

<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:** [August 28, 2020, 8:47pm UTC](https://discourse.julialang.org/t/vscode-run-file-in-repl-terminal/45656/5 "2020-08-28T20:47:54Z")

</div>

Julia: Execute File is the command you want.  
I have it mapped to alt+ctrl+enter.

---

<div class="post-metadata">

**Author:** ![RaulDurand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rauldurand/32/2044_2.png) [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Post date:** [August 28, 2020, 9:39pm UTC](https://discourse.julialang.org/t/vscode-run-file-in-repl-terminal/45656/6 "2020-08-28T21:39:23Z")

</div>

I ended up with the following hotkey:

```julia
    {
        "key": "ctrl+enter",
        "command": "workbench.action.terminal.sendSequence",
        "args": {
          "text": "include(\"${file}\")\n"
        },
        "when": "editorTextFocus"
    },

```

but your solution is better.
