- Easy to use: Run
zs
orCtrl+f
in your shell select your project fromZoxide
list usingfzf
orskim
, select preferable layout; - Usage inside zellij session: It will create a new tab with the selected layout;
- Attach to the session: Will not ask for layout when the session was previously created;
- Layout config preview: Layout config preview will be shown using
bat
if installed orcat
as a fallback
-
Install all dependencies
-
Clone the repo
git clone https://github.com/demestoss/zellij-smart-sessionizer
cd zellij-smart-sessionizer
- Place zellij-smart-sessionizer script in your
PATH
. One of the ways:
sudo chmod +x ./zellij-smart-sessionizer
sudo ln -s $(echo "$(pwd)/zellij-smart-sessionizer") /usr/bin/zellij-smart-sessionizer
-
Populate your
Zoxide
database by simply going into the directories that you want to start the session from. CheckZoxide
docs for more info. -
(Recommended) I like to create alias for the script to have an ability to easily execute it. Place it into your shell's
.rc
file:
alias zs="zellij-smart-sessionizer"
- (Optional) Create an alias to call this script in your shells
.rs
config
bindkey -s ^f "zellij-smart-sessionizer^M"
You just need to type this command in your shell to start a new session
zellij-smart-sessionizer
# or just this command if you have done (5) step of installation process
zs
Or Ctrl+f
if you've set up an optional keybinding step
Next will be provided different types of scenarios of the script execution.
You will be offered paths from Zoxide
. After selection, it will give you a layout selection for the session if your layout directory is not empty. It uses the LAYOUT DIR
path provided to Zellij
setup.
After that, it will open a session with a zoxide path's basename
and selected layout.
You will be offered paths from Zoxide
. After selecting a path, the layout step will be skipped and you will be attached to Zellij
session.
If you run this script inside Zellij
you will be offered the same selection steps. But after selection, it will open a new tab with the selected session basename
and Layout
Note: Not all layouts will be provided in this case, It's kinda smart and will not provide layouts that contain tabs
options inside it, because you cannot create tabs inside the tab.
I like to have this keymap in my Neovim config to run sessionizer inside floating pane:
vim.keymap.set("n", "<C-f>", ":silent !zellij action new-pane -f -c -- zellij-smart-sessionizer<CR>", { silent = true })
By pressing Ctrl+f
inside Neovim you will open floting window with sessionizer script
Also, you can provide optional arguments to the script
zellij-smart-sessionizer session-name
# or
zs session-name
It will pick up this argument and will init session with this name instead of the path's basename
. It's very useful if you want to have several different sessions that were initialized from the same directory
I was always strugling with removing directories from Zoxide DB, so I finally found the right solution and want to share it here :)
If you want to remove some paths from your Zoxide
DB you can use this simple command:
zoxide remove $(zoxide query -l | fzf -m)
Select options that you want to remove by pressing Tab
and they will be deleted from DB
Special thanks to this repos: