# Associate terminals with files

**URL:** <https://discourse.julialang.org/t/associate-terminals-with-files/69208>\
**Category:** VS Code\
**Created:** [October 4, 2021, 8:21pm UTC](https://discourse.julialang.org/t/associate-terminals-with-files/69208 "2021-10-04T20:21:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [October 4, 2021, 8:21pm UTC](https://discourse.julialang.org/t/associate-terminals-with-files/69208/1 "2021-10-04T20:21:15Z")

</div>

I created a repl in a file and now I’m trying to run some commands from a different file but it keeps opening a different terminal. How can I specify that these two files share the same terminal?

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [October 5, 2021, 2:18am UTC](https://discourse.julialang.org/t/associate-terminals-with-files/69208/2 "2021-10-05T02:18:09Z")

</div>

Can you post the code you’re trying to run, or some sort of minimum working example?

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [October 5, 2021, 2:21am UTC](https://discourse.julialang.org/t/associate-terminals-with-files/69208/3 "2021-10-05T02:21:36Z")

</div>

I don’t know how to reproduce the problem, just that it happens sometimes.

Is there a known way to associate certain files with certain terminals?

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [October 5, 2021, 2:29am UTC](https://discourse.julialang.org/t/associate-terminals-with-files/69208/4 "2021-10-05T02:29:18Z")

</div>

So you’re in VS Code and you are running some code from one file in an already-open REPL? And then you want to run code from a different file in the _same_ REPL, but it opens a new REPL instead?

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [October 5, 2021, 4:58am UTC](https://discourse.julialang.org/t/associate-terminals-with-files/69208/5 "2021-10-05T04:58:49Z")

</div>

> [@jd-foster](#):
>
> you’re in VS Code and you are running some code from one file in an already-open REPL? And then you want to run code from a different file in the _same_ REPL, but it opens a new REPL instead?

Yep.

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [October 5, 2021, 9:19am UTC](https://discourse.julialang.org/t/associate-terminals-with-files/69208/6 "2021-10-05T09:19:38Z")

</div>

You can press `ctrl+z` in a terminal to put the current task in the background, and then spawn a new instance of Julia with `julia`. Then `ctrl+z` and `fg` will let you switch between them. I can’t imagine why you would want to do this, though.

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [October 5, 2021, 11:32am UTC](https://discourse.julialang.org/t/associate-terminals-with-files/69208/7 "2021-10-05T11:32:35Z")

</div>

My only advice is to open the “Keyboard Shortcuts” preferences pane (`ctrl+k ctrl+s` on Windows) in VS Code and search “julia repl”. You will see a range of possible Commands, and hopefully at least one will work for your use case.

---

<div class="post-metadata">

**Author:** ![yha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yha/32/3502_2.png) [@yha](https://discourse.julialang.org/u/yha)\
**Post date:** [October 5, 2021, 2:43pm UTC](https://discourse.julialang.org/t/associate-terminals-with-files/69208/8 "2021-10-05T14:43:02Z")

</div>

How are you running your code?  
All of these VSCode commands normally run in the current REPL and don’t open a new one, regardless of what file the code comes from:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/2/3221a039b045a1e4854e98a4f0c007ff9020354d.png)  
(this menu is opened with ctrl+shift+p)

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [October 5, 2021, 5:27pm UTC](https://discourse.julialang.org/t/associate-terminals-with-files/69208/9 "2021-10-05T17:27:51Z")

</div>

> [@yha](#):
>
> How are you running your code?

I tried ctrl+enter and alt+enter, which both exhibited the issue.
