Effortless navigation to any file/directory from anywhere in an instant, and Tmuxify every directory you navigate to. ie; Make your dev workflow superfast..
(Preview videos in the midsection)
Whenever I start my system, I want to open a tmux session for one of my frequently used project directories (usually 1–4 of them) with a single key press from the bash shell. And whenever I needed to jump to a random project directory, I wanted it to open in a tmux session as fast as possible. This was the main trigger.
Second, whenever I’m inside Neovim (in a project directory) within a tmux session and I need to jump to another project directory in a new tmux window, I currently have to create a new window and then cd into that directory.I wanted this too to happen with just a single key press from inside Neovim.
thus.. superflow :))
- Bash
- FZF (Fuzzy finder)
- Tmux
- Nvim
- Connected Fzf, Tmux and Nvim using Bash scripts so that anyone can just copy-paste these scripts and implement 'superflow' workflow in their linux/wsl machine quickly.
- Learnings :
- Bash scripting
- Creating a user friendly linux CLI tool
- Cross process communications
- Bash Child processes, Forking, Environment variables inheritance
An fzf-shell-tmux-nvim integration for programmers who need 'superflow' (read: 'instant') navigations between directories & for tmuxifying every directory you navigate to.
Opinionated for one specific context: superflow doesn't allow you to jump to a tmuxified directory from an nvim editor if the nvim was not opened inside a tmux environment
(ie; you can't jump by pressing 'C-f' if you're inside nvim but not in a tmux session). Because, you shouldn't open nvim outside a tmux environment.
2 reasons :
1. If it is allowed to jump to a tmux session from nvim (which is not opened in a tmux session) by pressing 'C-f', then the unsaved file edits (buffer) in nvim will not be transferred to tmux. Thus causing you to lose the edits you made.
2. This would deprive you of tmux advantages.
1. While either outside or inside tmux :
To goto high frequent project directories (Ranked according to priority):-
(Ctrl-Space = Prefix key for both Bash and Tmux)
Ctrl-Space + h = Open high frequent (rank 1) project directory in tmux session
Ctrl-Space + j = Open high frequent (rank 2) project directory in tmux session
Ctrl-Space + k = Open high frequent (rank 3) project directory in tmux session
Ctrl-Space + l = Open high frequent (rank 4) project directory in tmux session
Video Demo 1 (Audio On):
superflow.1.mp4
2. While outside tmux (ie; You have just started the system, and you are in a shell not spawned by tmux) :
To goto a random project directory :-
Ctrl-f = Shows up fzf (fuzzy finder); search the project directory - opens the directory in a tmux session
Video Demo 2 (Audio On):
superflow.2.mp4
3. While inside nvim in tmux Or inside a tmux session/tmux environment (Well, you shouldn't open nvim outside a tmux environment if you are a developer (& you won't need to.. if you are using 'superflow':)) ) :
To goto a random project directory :-
Ctrl-f + s = Shows up fzf (fuzzy finder); search the project directory - opens up the directory in a tmux session
Ctrl-f + f = Shows up fzf (fuzzy finder); search the project directory - opens up the directory in a tmux window in the same session
TIP : If you are using Qwerty keyboard, remap CTRL functionality to 'CAPSLOCK' key for better hand comfort & speed. You don't need CAPSLOCK.. well... do you ?
3. Put the below instructions into ~/.config/nvim/after/plugin/keymaps.lua file (Create the directories & file if not already exists)
if vim.env.TMUX ~= nil and vim.env.TMUX ~= "" then
vim.keymap.set("n", "<C-f>f", "<cmd>silent !tmux neww ~/.scripts/nvimfzf-script.sh 'w'<CR>")
vim.keymap.set("n", "<C-f>s", "<cmd>silent !tmux neww ~/.scripts/nvimfzf-script.sh 's'<CR>")
endset-option -g prefix 'C-@'
bind-key h run-shell "bash ~/.scripts/tmux-script.sh 'h'"
bind-key j run-shell "bash ~/.scripts/tmux-script.sh 'j'"
bind-key k run-shell "bash ~/.scripts/tmux-script.sh 'k'"
bind-key l run-shell "bash ~/.scripts/tmux-script.sh 'l'"# scripts
source ~/.scripts/tmux-script.sh
source ~/.scripts/fzf-script.sh5. Specify the High frequency directories, & custom session names for each directory by following the instruction below
#HIGH FREQUENCY DIRECTORIES : CHANGE THESE
HIGH_FREQ_DIR0="$HOME/edit-path-to-high-freq-directory0"
HIGH_FREQ_DIR1="$HOME/edit-path-to-high-freq-directory1"
HIGH_FREQ_DIR2="$HOME/edit-path-to-high-freq-directory2"
HIGH_FREQ_DIR3="$HOME/edit-path-to-high-freq-directory3"
HIGH_FREQ_DIR0_NAME="edit_here"
HIGH_FREQ_DIR1_NAME="edit_here"
HIGH_FREQ_DIR2_NAME="edit_here"
HIGH_FREQ_DIR3_NAME="edit_here"Eg:
HIGH_FREQ_DIR0="$HOME/edit-path-to-high-freq-directory0"
is changed to
HIGH_FREQ_DIR0="$HOME/projects/draw-code"
- Until now, i don't have any problems with it in my workflow. Tell me if there is any..
All contributions are welcome! Just open a pull request.