Development Workflow for Persistent Julia Sessions

UPDATE: NEW BLOG POST AND VIDEO!

By popular demand, I have written up a more formal blog post on this workflow which you can visit here. Furthermore, I also created a companion video which you can see in the blog post or separately on my channel here. Have fun and I hope this spurs you all on to even better workflows! :deciduous_tree:

NOTE: For future readers, I shall endeavor to keep this link up to date on my website and to not change the url so you will always have a reference to my most recent workflow iteration.

Background on This Workflow :wave:

I am @TheCedarPrince and am involved with the Julia community as a Twitch Streamer and am co-creator of Javis.jl and the creator of NeuriViz. I have had several people over the last couple months both in my streams and in the community ask me about my toolchain for development. Without further ado, here is a brief explanation of my workflow to manage persistent Julia sessions! There should be something in here for everyone - beginner to expert alike!

Tools of Choice :wrench:

I use Alacritty as my terminal, zsh and oh-my-zsh as my shell and plugin manager respectively, tmux as my multiplexer, lsd as my list command with fun icons, Fantasque Sans Mono as my typeface font, vim for my editor, and gruvbox-dark as my general color palette.

Here are gists to the relevant config files I use to modify my interface and user experience:

Here is a picture of what that looks like altogether:

Workflow in Action :clapper:

Persistent Julia Sessions :julia:

tmux_restore

Though it is a little hard to see, I close my terminal completely. The sessions are gone for everything! Oh no! But have no fear, tmux is here!

I use resurrect and continuum to have tmux remember all my layouts and current sessions. This includes the Julia REPL! Also, my config allows vim to remember what was its last layout as well and to instantly open you back to its properly layout out thanks to obsession. This is great for when your computer unexpectedly dies or crashes as everything is backed up thanks to tmux!

Vim-Slime for Rapid Julia Evaluation :100:

vim_slime

Here, I target the Julia REPL in a tmux panel and use the vim-slime plugin to send code from my Julia script to the Julia REPL for rapid evaluation. Also works for code chunks such as functions or loops! (Note: this works for more than just Julia - I use it for my Python work too! :snake:)

Mouse Mode :mouse:

mouse_mode

tmux also supports mouse mode and interactivity! I can quickly jump all over the place with my mouse if I so choose or just easily resize a tmux pane. :slight_smile:

Fuzzy Finding for Files and Citation :mag_right:

vim_fzf

I use my vim editor for all my writing and research so being able to search up files and explore things is imperative! I use FZF with ripgrep to find files I search for and pandoc to enable citations in pandoc-markdown or TeX files.

Conclusion :books:

I hope you find my workflow useful and possibly helpful to any new Julian or individual finding their way around the REPL and terminal! If you have any questions, feel free to post and I will try to get back to you!

~ TCP

22 Likes

Mouse Mode would have saved me a ton of trouble back when I used to use a setup like this. Nice documentation of a tmux workflow.

1 Like

Nice write up! tmux has floating window support too [1], so you can get that fzf preview functionality in tmux too :slight_smile:

[1] https://github.com/tmux/tmux/issues/1842

2 Likes

This is an awesome use of the #workflow tag - I hope more people start submitting their setups!

2 Likes

how to make tmux remember to re-open Julia REPL after reboot? I can see the history of Julia in the restored panel but it doesn’t really re-start automatically.

Hey @jling, I haven’t had a chance to test it out just yet, but if you add

set -g @resurrect-process '~julia'

to your .tmux.conf, I think it should work. I didn’t realize that resurrect wouldn’t bring it back without being told explicitly to bring back the process. Also, if that doesn’t work, maybe check out this: https://github.com/tmux-plugins/tmux-resurrect/issues/224

1 Like

not working for some reason, I suspect maybe has something to do with escape sequence, because every time it restores with a lot of lines above the last save position. And vim would glitch out (double status bar etc.), not drawing correctly

Hunh. If you have the ability, could you open this issue over at https://github.com/tmux-plugins/tmux-resurrect/issues/ ? I have not encountered issues in these areas before. Could you please tag me on GH (same tag: @thecedarprince)? Thanks!

Hey @kdheepak - didn’t know that! That is wicked! Just curious tho - what would be the use case for this feature? I have difficulty seeing what utility it offers that I could incorporate into my workflow/toolchain. Thanks!

Opened an issue on this here: https://github.com/tmux-plugins/tmux-resurrect/issues/366

Hopefully we get some answers soon! :crossed_fingers:

1 Like

I tend to use floating windows / pop ups for temporary information. Checking git status is probably my most common use case. I use lazygit for git operations from inside nvim (using lazygit.nvim). I have a shortcut in nvim to open a floating terminal window that I do a lot of stuff in. I think you’ll find more similar use cases when you continue experiment with it :slight_smile:

Do you have a stream / video of doing all of this stuff? Hard to tell exactly what’s going on, but looks nice!

Great idea. I’ll make a video demonstrating everything mentioned here. I am formalizing this post into an actual blog post on my website. I will include a video of my workflow in it as well. :smile:

3 Likes

@kevbonham, @Olivier_Merchiers, and @cuihantao - blog post and video made! Please check out my initial post for the update and links to relevant post and video! Hope this helps. Feel free to comment on my blog post or here if you have any questions.

1 Like

This is a goldmine!
I will give it a try.
Thanks again!

1 Like

Thanks to @jling, the tmux-resurrect dilemma has been solved! Please refer to https://github.com/tmux-plugins/tmux-resurrect/issues/366 for more in-depth answers, but my tmux config will be updated to reflect this solution going forward.