# Navigating within Julia REPL?

**URL:** https://discourse.julialang.org/t/navigating-within-julia-repl/107978
**Category:** New to Julia
**Tags:** package, repl
**Created:** [December 23, 2023, 4:27pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978 "2023-12-23T16:27:43Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![benslinux](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@benslinux](https://discourse.julialang.org/u/benslinux)
#### Post date: [December 23, 2023, 4:27pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/1 "2023-12-23T16:27:43Z")

</div>

```julia
"/home/grimm"

julia> 
julia> using Pkg

julia> Pkg.generate("HelloWorld")
  Generating project HelloWorld:
    HelloWorld/Project.toml
    HelloWorld/src/HelloWorld.jl
Dict{String, Base.UUID} with 1 entry:
  "HelloWorld" => UUID("0f36ea27-3fa5-45e8-8aed-a1573f2015cd")

(HelloWorld) pkg> activate ~/HelloWorld
  Activating project at `~/HelloWorld`

(HelloWorld) pkg> instantiate
  No Changes to `~/HelloWorld/Project.toml`
  No Changes to `~/HelloWorld/Manifest.toml`
Precompiling project...
  1 dependency successfully precompiled in 1 seconds

```

I’m learning to navigate within the Julia REPL (using Linux Mint) - for ex - creating a simple pkg above works fine. I know to use pwd() to be sure I’m in the right directory and cd(“path to files”) - but if I want to say, change the text inside the HelloWorld.jl file(located in the src directory) I have to exit REPL, back to Linux file system, open HelloWorld.jl file with my text editor, then re-enter Julia REPL. This all works, but wondering if it’s possible to somehow edit that .jl file without leaving the REPL? I imagine I would need a text editor or vim or nano - is there anything like that actually IN the REPL? Or can I switch to shell and get into Linux file sys that way? Thanks for your time guys.

---

<div class="post-metadata">

### Author: ![John\_Gibson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/john_gibson/32/5321_2.png) [@John\_Gibson](https://discourse.julialang.org/u/John_Gibson)
#### Post date: [December 23, 2023, 5:01pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/2 "2023-12-23T17:01:48Z")

</div>

Can you not run a text editor on the HelloWorld.jl file as a separate process, and just move your mouse to switch focus between the two? Or are you not running a windowing system?

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [December 23, 2023, 5:16pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/3 "2023-12-23T17:16:20Z")

</div>

VSCode is recommended by many and me.  
Of course it has its own learning curve. Perhaps it’s better to start as you do, you may use multiple terminals, one with Julia, another with your editor, another for commands,… and when you feel good you may start again with VSCode.

Another important recommendation is to use Revise.jl , this is to overcome most of the problems if you need to reload a Julia file in the REPL which you have changed.

---

<div class="post-metadata">

### Author: ![benslinux](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@benslinux](https://discourse.julialang.org/u/benslinux)
#### Post date: [December 23, 2023, 5:30pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/4 "2023-12-23T17:30:09Z")

</div>

Not interested in using VS Code, but will look into Revise.jl - thanks.

---

<div class="post-metadata">

### Author: ![benslinux](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@benslinux](https://discourse.julialang.org/u/benslinux)
#### Post date: [December 23, 2023, 5:43pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/5 "2023-12-23T17:43:31Z")

</div>

There are ways to get it done with multiple terminals / windows. But I don’t like going to the mouse and prefer doing everything from the terminal. REPL is running in the terminal and using Linux commands like pwd and cd, and hitting the semicolon opens my actual Linux shell - I think I can get in and out of nano or vim that way. Thanks for your suggestion though.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [December 23, 2023, 6:05pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/6 "2023-12-23T18:05:01Z")

</div>

Julia does have a configurable `edit` function.

```julia
help?> edit
search: edit @edit timedwait endswith redirect_stdio

  edit(path::AbstractString, line::Integer=0, column::Integer=0)

  Edit a file or directory optionally providing a line number to
  edit the file at. Return to the julia prompt when you quit the
  editor. The editor can be changed by setting JULIA_EDITOR,
  VISUAL or EDITOR as an environment variable.

  See also define_editor.

  ──────────────────────────────────────────────────────────────

  edit(function, [types])
  edit(module)

  Edit the definition of a function, optionally specifying a
  tuple of types to indicate which method to edit. For modules,
  open the main source file. The module needs to be loaded with
  using or import first.

  │ Julia 1.1
  │
  │ edit on modules requires at least Julia 1.1.

  To ensure that the file can be opened at the given line, you
  may need to call define_editor first.

```

Also in a Linux terminal you can press Ctrl-z to suspend Julia. Then edit your file or do whatever. Then type `fg` to foreground your Julia process again. Also see the Bash `jobs` command. Combined with `Revise.jl` this creates a nice workflow.

Also check out the Unix utilities `screen` and `tmux`.

What text editor do you use?

---

<div class="post-metadata">

### Author: ![benslinux](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@benslinux](https://discourse.julialang.org/u/benslinux)
#### Post date: [December 23, 2023, 6:28pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/7 "2023-12-23T18:28:35Z")

</div>

I like to use really simple text editors like xed or nano, rather than something like VS Code so I’m focused on learning the language and not distracted by using a mouse or IDE. Since asking this question I see how easy it is to hit the semicolon key and get into the my Linux file system to use those editors. But thanks - you gave me a lot of other options to try out!

---

<div class="post-metadata">

### Author: ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)
#### Post date: [December 23, 2023, 7:16pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/8 "2023-12-23T19:16:43Z")

</div>

On most OSs you can use `ALT+TAB` to switch between windows, so need for a mouse and you can just open a second terminal and edit your code in whatever editor you like there.

---

<div class="post-metadata">

### Author: ![benslinux](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@benslinux](https://discourse.julialang.org/u/benslinux)
#### Post date: [December 23, 2023, 7:55pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/9 "2023-12-23T19:55:55Z")

</div>

Thanks - good shortcut, but I’ve figured out since posting this question that when in REPL, if I just open shell with semicolon key I can navigate between Linux file system and REPL without windows. Great feature from the Julia team - works with Linux OS anyway.

---

<div class="post-metadata">

### Author: ![Fliks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fliks/32/2494_2.png) [@Fliks](https://discourse.julialang.org/u/Fliks)
#### Post date: [December 24, 2023, 12:03am UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/10 "2023-12-24T00:03:22Z")

</div>

I highly recommend this workshop to learn nice tips and tricks for working in the REPL. **https://github.com/miguelraz/REPLMasteryWorkshop**

There is also a recording available on youtube.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [December 24, 2023, 2:59am UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/11 "2023-12-24T02:59:41Z")

</div>

How about vim?

---

<div class="post-metadata">

### Author: ![benslinux](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@benslinux](https://discourse.julialang.org/u/benslinux)
#### Post date: [December 24, 2023, 9:57am UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/12 "2023-12-24T09:57:47Z")

</div>

Thanks Miguel - will do. Also - just listened to your talk from April 2022 on Talk Julia.

---

<div class="post-metadata">

### Author: ![benslinux](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@benslinux](https://discourse.julialang.org/u/benslinux)
#### Post date: [December 24, 2023, 10:04am UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/13 "2023-12-24T10:04:39Z")

</div>

You’re absolutely right to recommend Vim to me - I know that for those who like doing as much in the terminal as possible, Vim is the way. I just haven’t been able to fight the learning curve and stay with it enough to get proficient - but I’m going to learn it. Thanks for the push,

---

<div class="post-metadata">

### Author: ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)
#### Post date: [December 24, 2023, 10:47am UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/14 "2023-12-24T10:47:07Z")

</div>

> [@mkitti](#):
>
> Also check out the Unix utilities `screen` and `tmux`.

For someone who wants to stay as log as possible in the terminal, I’d really second this recommendation.

The idea is that you’d launch the multiplexer in your terminal (either `screen` or `tmux`; the latter seems more popular these days), and then you get something akin to multiple “tabs” or “panes”. You’d open your editor (`xed` or `nano` if you’re used to them) in one tab/pane, and the Julia REPL in another. The multiplexer lets you easily switching between tabs/panes.

  

More advanced editors, such as Emacs (but maybe vim can as well; I just don’t know) can act as sort of a multiplexer in themselves. That is to say you can open a terminal within Emacs, and switch between editing files or interacting with the terminal seamlessly, only using builtin commands. Of course this again is something to learn, but there are many collateral benefits. For example, the ability to interactively select code from a source file and evaluate it inside the Julia REPL (like you’d do in VScode)

---

<div class="post-metadata">

### Author: ![benslinux](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@benslinux](https://discourse.julialang.org/u/benslinux)
#### Post date: [December 24, 2023, 12:37pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/15 "2023-12-24T12:37:59Z")

</div>

Going to experiment with Revise.jl - thanks. Really, there are so many great Julia packages I’m still unaware of and learning about here.

---

<div class="post-metadata">

### Author: ![martin.auer](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@martin.auer](https://discourse.julialang.org/u/martin.auer)
#### Post date: [December 24, 2023, 1:19pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/16 "2023-12-24T13:19:08Z")

</div>

Also possibly check out our [Shelly.jl](https://github.com/umlet/Shelly.jl) - no semicolon required…

---

<div class="post-metadata">

### Author: ![benslinux](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@benslinux](https://discourse.julialang.org/u/benslinux)
#### Post date: [December 24, 2023, 2:26pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/17 "2023-12-24T14:26:18Z")

</div>

That’s great - out of habit I kept trying to us ‘ls’ - now I’ll be able to.

---

<div class="post-metadata">

### Author: ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)
#### Post date: [December 24, 2023, 3:03pm UTC](https://discourse.julialang.org/t/navigating-within-julia-repl/107978/18 "2023-12-24T15:03:00Z")

</div>

Why is `lsa` and `lla` not activated yet? It seems to work fine (on windows).
