/ls-interactive

Interactive ls command

Primary LanguageRustMIT LicenseMIT

ls-interactive 💻

Version License: MIT Maintenance

Interactive ls command made in rust

image

⚡ Features

🌟 Navigate between folders/files using arrow keys

🌟 Browse folders / Open files with native apps using using Enter

🌟 Open folder in terminal (CD to folder) using Shift+Enter or Alt+Enter

🌟 Open folder in file manager using Ctrl+Enter

🌟 Type anything to filter current folder content using fuzzy search

🌟 Top button (📁 ..) opens the parent directory (LeftArrow can also be used when fuzzy text field is empty)

🌟 Press Esc to exit

on Linux/Mac Shift+Enter or Ctrl+Enter might not work

see crossterm-rs/crossterm#669

🛠 Installation

  1. Download zip package from releases page

  2. Extract its content into a folder in PATH (guide)

  3. Follow shell specific instructions:

Bash (Linux/Mac) or Zsh
Batch (Windows CMD)
  • Copy scripts/lsi.bat into a folder that is in your %PATH% environment variable

    @echo off
    for /f "tokens=*" %%i in ('%~dp0\ls-interactive.exe "%*"') do set output=%%i
    IF DEFINED output cd %output%

    you can open you environment variables settings using the command below: (or by searching for env in the start menu)

    rundll32.exe sysdm.cpl,EditEnvironmentVariables
Fish Shell
  • Copy scripts/lsi.fish into ~/.config/fish/functions/

    OR copy the function inside into your ~/.config/fish/config.fish file

    function lsi
    set -l output (ls-interactive "$argv")
    if test $status -eq 0
    and test -n "$output"
    cd $output
    end
    end

Powershell
  • Copy the lsi function from scripts/lsi.ps1 to your Microsoft.PowerShell_profile.ps1

    function lsi {
    $output = (ls-interactive "$args")
    if ($output) { Set-Location $output }
    }

    you can open your profile using one of the following commands:

    notepad $profile

    gedit $profile
Nushell
  • Copy the lsi function from scripts/lsi.nu to your env.nu

    def-env lsi [...path: string] {
    let output = (ls-interactive ($path | str join ' '))
    cd (
    if ($output | is-empty) { $env.PWD }
    else { $output }
    )
    }

    you can open your environment file using the following command:

    config env

💻 How to run it

lsi

or

lsi some_relative_path

⚙️ Build it yourself

(Releases are automatically built by github actions)

  • install rust

  • clone/download the repo

  • run in project directory:

    • cargo run: to run in dev mode
    • cargo build --release: to build locally,
      • executable will be in /target/release and named ls_interactive
      • launch script will be in the /scripts directory

🤝Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Before submitting a Pull Request, verify your changes with all following commands:

cargo check
cargo fmt --all --check
cargo clippy --all-targets --all-features -- -W clippy::pedantic -W clippy::cargo -W clippy::nursery

❤️ Show your support

Give a ⭐ if this package helped you!

📜 License

MIT. See LICENSE file for details.