Skip to content

Quickly jump into your development directories using a simple command that acts as a smart cd with recursive autocompletion. It also supports additional options to extend its functionality, such as integrating with external tools or performing common project tasks directly from the terminal.

License

Notifications You must be signed in to change notification settings

dvigo/zsh-dev-navigator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

zsh-dev-navigator

A minimal Zsh plugin that lets you quickly jump into your development directories with a single command.
dev acts as a smart replacement for cd, allowing you to navigate into project folders instantly with recursive autocompletion β€” and even open them directly in VS Code.


⚑ Quick Start

dev api-server
# β†’ cd ~/dev/api-server

Or open the project in your configured editor:

dev -o api-server
# β†’ Opens ~/dev/api-server in your configured editor (default: VS Code)

Create a new project directory:

dev -c new-project
# β†’ Creates ~/dev/new-project and navigates to it

Create a new project with git repository:

dev -cg new-project
# β†’ Creates ~/dev/new-project, initializes git, and navigates to it

Execute a file (with confirmation):

dev script.sh
# β†’ Asks for confirmation, then executes ~/dev/script.sh

Execute a file with arguments:

dev test.sh -ac --verbose
# β†’ Target is a file: ~/dev/test.sh
# β†’ With arguments: -ac --verbose
# β†’ Do you want to execute this file? [y/N]: y
# β†’ Executes: ~/dev/test.sh -ac --verbose

# Or interactively:
dev test.sh
# β†’ Do you want to execute this file? [y/N]: y
# β†’ Enter arguments (or press Enter for none): -ac --verbose
# β†’ Executing with arguments: -ac --verbose

Open a file in editor:

dev -o config.json
# β†’ Opens ~/dev/config.json in your configured editor

✨ Features

  • ⚑ Quickly cd into any development project with a simple command.
  • πŸ“ Smart recursive autocompletion for subfolders.
  • 🧭 Defaults to your base development folder when no argument is provided.
  • πŸͺ„ Optional flags to extend functionality β€” e.g., open projects directly in your preferred editor.
  • πŸ†• Create new project directories on-the-fly with the -c flag.
  • πŸ”§ Initialize git repositories automatically with the -cg flag.
  • βš™οΈ Configurable base directory and default editor via configuration file.
  • πŸ€– Auto git init option to initialize git repositories with -c flag automatically.
  • πŸ“„ File execution support with confirmation prompts for executable files.
  • πŸ“ File editing with -o flag to open files directly in your configured editor.
  • 🧠 Intelligent file/directory detection based on file extensions.
  • πŸ†• File creation with automatic parent directory creation.
  • πŸ”„ Fallback mode for users without fzf installed.
  • πŸ” Fuzzy finder integration (fzf) for interactive project selection when no argument is provided.
  • 🎯 Support for multiple editors: VS Code, Cursor, Windsurf, Sublime Text, Vim, and more.

πŸ“¦ Installation

Oh My Zsh

  1. Clone the plugin into your Oh My Zsh custom plugins folder:

    git clone https://github.com/dvigo/zsh-dev-navigator.git ~/.oh-my-zsh/custom/plugins/zsh-dev-navigator
  2. Enable it in your ~/.zshrc:

    plugins=(... zsh-dev-navigator)
  3. Reload Zsh:

    source ~/.zshrc

πŸŽ₯ Demo

Basic usage:

dev api-server

Result:

πŸ“‚ Moved to: ~/dev/api-server

Autocompletion:
Start typing and press <TAB> to explore all projects and subfolders:

dev fr<TAB>
# frontend-app
# frontend-utils
# frontend-tests

Open in your preferred editor:

dev -o frontend-app
# β†’ Opens ~/dev/frontend-app in your configured editor (e.g., Cursor, VS Code, etc.)

Interactive project selection with fuzzy finder:

dev
# β†’ Opens fzf interface to select from available projects
# β†’ Press ESC to navigate to the root dev folder

Create new project:

dev -c new-project
# β†’ Creates ~/dev/new-project and navigates to it

Create new project with git:

dev -cg new-project
# β†’ Creates ~/dev/new-project, initializes git, and navigates to it

βš™οΈ Configuration

The plugin uses a configuration file located in the plugin directory. You can customize the following settings:

Configuration File

The plugin includes a config file with the following options:

# Development directory - where your projects are located
# This can be an absolute path or use ~ for home directory
dev_directory = ~/dev

# Default editor to use with the -o flag
# Supported editors: code, cursor, windsurf, subl, vim, nvim, emacs, atom, webstorm, idea, pycharm
editor = code

# Automatically initialize git repository when creating new directories with -c flag
# Set to true to enable automatic git init, false to disable
auto_git_init = false

Customizing Settings

  1. Development Directory: Change the dev_directory setting to point to your projects folder:

    dev_directory = ~/Development
    dev_directory = /path/to/your/projects
  2. Default Editor: Set your preferred editor for the -o flag:

    editor = cursor        # Cursor editor
    editor = windsurf      # Windsurf editor  
    editor = code          # VS Code
    editor = subl          # Sublime Text
    editor = vim           # Vim
    editor = nvim          # Neovim
  3. Custom Editor Path: You can also specify a full path to a custom editor:

    editor = /usr/local/bin/my-custom-editor
  4. Automatic Git Initialization: Enable automatic git init when creating directories with -c:

    auto_git_init = true   # Always initialize git with -c flag
    auto_git_init = false  # Only initialize git with -cg flag (default)

πŸ–ŠοΈ Usage

Basic syntax:

dev <project-name>

Examples:

dev dashboard-ui
# β†’ cd ~/dev/dashboard-ui

dev api-server/routes
# β†’ cd ~/dev/api-server/routes

dev
# β†’ cd ~/dev

Open a project in your configured editor:

dev -o api-server
# β†’ Opens the project in your configured editor (Cursor, VS Code, etc.)

Create a new project directory:

dev -c new-project
# β†’ Creates ~/dev/new-project and navigates to it

Create a new project with git repository:

dev -cg new-project
# β†’ Creates ~/dev/new-project, initializes git, and navigates to it

Note: If you have auto_git_init = true in your config, then dev -c new-project will also initialize git automatically.

Combine flags:

dev -c -o new-app
# β†’ Creates ~/dev/new-app and opens it in your configured editor

dev -cg -o new-git-project
# β†’ Creates ~/dev/new-git-project, initializes git, and opens it in your editor

πŸ“„ File Handling

The plugin now supports working with files in addition to directories:

File Execution

When targeting a file, the plugin will ask for confirmation before execution:

dev script.sh
# β†’ Target is a file: ~/dev/script.sh
# β†’ Do you want to execute this file? [y/N]: y
# β†’ Executes the file and navigates to its directory

With arguments:

dev deploy.sh --env production --force
# β†’ Target is a file: ~/dev/deploy.sh
# β†’ With arguments: --env production --force
# β†’ Do you want to execute this file? [y/N]: y
# β†’ Executes: ./deploy.sh --env production --force

Interactive argument input:

dev script.sh
# β†’ Target is a file: ~/dev/script.sh
# β†’ Do you want to execute this file? [y/N]: y
# β†’ Enter arguments (or press Enter for none): -v --debug
# β†’ Executing with arguments: -v --debug
# β†’ Executes: ./script.sh -v --debug

Use cases:

  • Run scripts with flags: dev test.sh -v
  • Pass configuration: dev build.sh --config prod
  • Multiple arguments: dev script.sh arg1 arg2 arg3
  • Interactive mode: dev script.sh β†’ then enter arguments when prompted

File Editing

Use the -o flag to open files directly in your configured editor:

dev -o config.json
# β†’ Opens ~/dev/config.json in your editor
# β†’ Navigates terminal to ~/dev/ directory

Creating New Files

The plugin intelligently detects when you're trying to work with files and offers to create them:

With -o flag (create and edit):

dev -o new-config.json
# β†’ File does not exist: ~/dev/new-config.json
# β†’ Do you want to create this file? [y/N]: y
# β†’ Created and opened file in your editor

Without flags (create and optionally execute):

dev new-script.sh
# β†’ File does not exist: ~/dev/new-script.sh
# β†’ Do you want to create this file? [y/N]: y
# β†’ File created: ~/dev/new-script.sh
# β†’ Do you want to execute this file? [y/N]: n

Files in Subdirectories

The plugin automatically creates parent directories when needed:

dev -o src/components/Header.jsx
# β†’ Creates src/components/ directory if it doesn't exist
# β†’ Creates and opens Header.jsx in your editor

Intelligent Detection

The plugin automatically detects whether you're working with files or directories:

Files (with extensions):

  • script.sh, config.json, README.md β†’ Treated as files
  • Offers creation, execution, or editing options

Directories (without extensions):

  • my-project, frontend-app, api-server β†’ Treated as directories
  • Suggests using -c flag for creation

Restrictions

  • Creation flags (-c, -cg) cannot be used with files
  • fzf selection with -c/-cg shows only directories
  • Autocompletion with -c/-cg shows only directories

πŸ“Œ Autocompletion

The dev command includes powerful autocompletion for all subdirectories inside your base development folder.

Just type part of a project name and press <TAB> to complete it.

πŸ” Fuzzy Finder Integration

When you run dev without any arguments, the plugin provides different interfaces based on availability:

With fzf (Enhanced Experience)

If fzf is installed, you get an interactive selection interface:

  • Browse through all your projects with fuzzy search
  • Use arrow keys or type to filter projects
  • Press Enter to navigate to the selected project
  • Press ESC to navigate to the root development folder instead

Without fzf (Fallback Mode)

If fzf is not available, the plugin shows a list and prompts for input:

dev
# β†’ Available projects in ~/dev:
# β†’ api-server
# β†’ config.json
# β†’ frontend-app
# β†’ script.sh
# β†’ Enter project/file name (or press Enter for root directory): new-file.txt

Smart Filtering

The interface adapts based on the flags used:

  • Regular navigation: Shows both files and directories
  • With -c or -cg: Shows only directories (prevents file creation conflicts)

πŸ”§ Roadmap

  • Add flag to create new project directories.
  • Add flag to open projects directly in editors.
  • Add support for multiple editors (VS Code, Cursor, Windsurf, Sublime, Vim, etc.).
  • Add fuzzy search for project names with fzf integration.
  • Add configuration file system for customizable settings.
  • Add aliases or shortcuts per project.
  • Add project templates for new directory creation.

πŸ“œ License

GNU General Public License v3.0 β€” See LICENSE for details.

About

Quickly jump into your development directories using a simple command that acts as a smart cd with recursive autocompletion. It also supports additional options to extend its functionality, such as integrating with external tools or performing common project tasks directly from the terminal.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages