Skip to content

Zellij and Yazi adding a File Tree to Helix & helix-friendly keybindigs for Zellij

Notifications You must be signed in to change notification settings

luccahuguet/zellij

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Yazelix v3: Helix with a File Tree!

Overview

Yazelix v3 integrates yazi, zellij and helix, hence the name, get it?

  • Zellij orchestrates everything, with yazi as a sidebar and helix as the editor
  • You can open and close the sidebar by switching zellij layouts (press alt ] and alt [)
  • Every keybinding from zellij that conflicts with helix is remapped (see them at the bottom)
  • Helix is called when you hit enter on a file in the "sidebar", opening as a new pane in zellij
    • If helix is called like that, that pane will be closed as well when you quit helix
    • Note: I recommend running zellij from your shell (nu -c "zellij -l welcome" for nushell). This way you can load your enviroment variables like EDITOR and HELIX_RUNTIME
  • This project holds my config files for zellij and yazi, almost like a plugin or something, but it's just a glorified config!

Base Layout

The initial layout includes one usable pane (actually 4, counting the tab-bar, status-bar and sidebar): image

  • Tab-bar at the top
  • Status-bar at the bottom
  • Yazi pane (20% width) acting as a sidebar on the left
  • Empty pane on the right

Swap Layouts Behavior

  • Open and close the sidebar by switching layouts (you need at least two panes open to do that).
  • New panes will be appearing to the left, stacked, but this won't change the layout.
  • You can add more swap layouts as needed, using the KDL files in layouts.

Two or more panes open with the sidebar open: Sidebar Open

Two or more panes open with the sidebar closed: Sidebar Closed


Improvements Over v2

  • Before, the yazi config files were in a separate repo, now its all integrated here!
    • Thanks to Zykino from Zellij's discord for that tip!
  • Yazi's maintainer (what an honor!) added a init.lua file that makes the status-bar in yazi look really good in the small width it has
  • The project's got a name! Yazelix. It simply had no name before and that was a mistake.
  • This one is great: I've remapped 6 keybindings from zellij to avoid conflicts with helix
    • use alt m for new panes and the rest is in zellij's status-bar
    • this is configured in the layouts/yazelix.kdl file, if you want to change something

Instructions to set it up

  1. Make sure yazi, zellij and helix are installed and in your path
  2. Remove (or rename) your old ~/.config/zellij folder, and just clone this repo in your ~/.config dir
  3. You can open this layout either from zellij -l welcome or directly zellij -l ~/.config/zellij/layouts/yazelix
  • I just set my terminal config to open zellij on startup, so I never leave zellij (my alacritty files here)

That's it, and feel free to open issues and PRs 😉


Why use this project?

  • I think one of the main things is just how dead simple to configure this project is. No shell scripting magic
  • Easy to configure and make it yours
  • I daily drive this, and will change it according to my needs, keeping it updated and improving it
  • Even if you don't care about the sidebar, the keybindings may be helpful

Possible Improvements

  • Be able to close the sidebar with only one pane besides the sidebar open (see the problem here
  • Full Yazi pane: Integrate a full Yazi pane in another swap layout showing parents and preview, not just the current dir
    • this is already implemented, but has a few kinks to iron out.
    • To test, uncomment the yazi_full swap layout and panes, and increase the panes constraints by one
    • Problem 1: some panes swap with others when they shouldn't, like the sidebar and a normal pane
    • Problem 2: you have to "walk" through the closed pane, which isn't great
    • Big thanks to zellij's maintainer and other people for helping with this
  • Higher Helix Integration: Currently, selected files in Yazi open as a new pane in Zellij, running Helix. It would be nice to open them as a split or a buffer inside Helix (though this might be complex to code).
  • Rename the repo to yazelix: I did try that but using a custom path to the layout folder just didn't work with ~ or $HOME (see some issues here and here

Keybinding remaps

New Zellij Keybinding Previous Keybinding Helix Action that uses that previous key Zellij Action remaped
Ctrl e Ctrl o jump_backward SwitchToMode "Session"
Ctrl y Ctrl s save_selection SwitchToMode "Scroll"
Alt w Alt i shrink_selection MoveTab "Left"
Alt q Alt o expand_selection MoveTab "Right"
Alt m Alt n select_next_sibling NewPane
Alt 2 Ctrl b move_page_up SwitchToMode "Tmux"

If you find a conflict, please open an issue. Keep in mind, though, that compatibility with tmux mode is not a goal of this project.


Notes

  • I recommend using alacritty as your terminal
    • because it's a "dumb" terminal, it has no panes, no tabs. This means less keybindings conflicts to worry about, less feature overlap
    • very performant
    • but I do want to explore more modern options, so long as they have a "plain mode", like this
    • you can check out my alacritty files here (they include all alacritty themes)
  • Use nushell, it's a great shell, it's fast and beautiful and a proper programming language. Why wouldn't you?
  • If you test this with nvim and it works, let me know (see the issue here)
  • Special thanks to yazi's and zellij's maintainer (and discord members) for their help with some stuff. Also shoutout to helix's contributors!

Similar projects

  • Shelix: Shelix does intent to maximize the hidden power of Tmux as an IDE, enhance capabilities of the incredibly efficient Helix editor, around an interactive menu that performs IDE related actions
  • Helix-Wezterm:Turning Helix into an IDE with the help of WezTerm and CLI tools
  • File tree picker in Helix with Zellij: Yazi can be used as a file picker to browse and open file(s) in your current Helix instance (running in a Zellij session)

About

Zellij and Yazi adding a File Tree to Helix & helix-friendly keybindigs for Zellij

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages