Skip to content

About

Interactive ls command

Topics

Resources

Stars

31 stars

Watchers

1 watching

Forks

Latest commit

 

History

195 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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 the package for your platform from the releases page

    Platform Asset
    Linux x86_64 (any distro, including Alpine) lsi_<version>_x86_64-unknown-linux-musl.tar.gz
    Linux ARM64 (Raspberry Pi, ARM servers) lsi_<version>_aarch64-unknown-linux-musl.tar.gz
    macOS (Apple Silicon and Intel) lsi_<version>_universal-apple-darwin.tar.gz
    Windows x86_64 lsi_<version>_x86_64-pc-windows-msvc.zip
    Windows ARM64 lsi_<version>_aarch64-pc-windows-msvc.zip

    The Linux builds are statically linked, so they don't depend on your system's libc.

    Releases also include lsi_<version>_linux.tar.gz, lsi_<version>_macos.tar.gz and lsi_<version>_windows.zip. These are copies of the x86_64 Linux, macOS and x86_64 Windows packages above, kept so older download links still work. Prefer the names in the table, because the old names will be removed in a future release.

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

  3. Choose variation and follow shell specific instructions:

Open files with your chosen editor
Bash (Linux/Mac) or Zsh
  • Copy the lsi function from scripts/lsi.sh to your ~/.bashrc or ~/.zshrc file:

lsi() {
local output
if output=$(ls-interactive "$@" -x) && [[ $output ]]; then
if [ -f "$output" ]; then
micro "$output"
else
cd "$output"
fi
fi
}

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 "%*" -x') do set output=%%i
IF DEFINED output CALL :exec %output%
GOTO :EOF
:exec
SET file_attribute=%~a1
if "%file_attribute:~0,1%"=="d" (
cd %1
) else (
micro %1
)

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

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

function lsi
set -l output
if output=(ls-interactive $argv -x); and [ -n "$output" ]
if test -f "$output"
micro "$output"
else
cd "$output"
end
end
end

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

function lsi {
$output = (ls-interactive "$args" -x)
if (!$output) { return }
if (Test-Path -Path $output -PathType leaf) { micro $output }
else { Set-Location $output }
}

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

notepad $profile

gedit $profile
Nushell

def --env lsi [...path: string] {
let output = (ls-interactive ($path | str join ' ') -x)
if ($output | is-empty) { return }
if (($output | path type) == 'file') {
micro $output # replace with your preferred editor
} else { cd $output }
}

you can open your environment file using the following command:

config env
Open files with operating system
Bash (Linux/Mac) or Zsh
  • Copy the lsi function from scripts/lsi.sh to your ~/.bashrc or ~/.zshrc file:

lsi() {
local output
if output=$(ls-interactive "$@") && [[ $output ]] ; then
cd "$output"
fi
}

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

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

def --env lsi [...path: string] {
let output = (ls-interactive ($path | str join ' '))
if ($output | is-empty) { return }
if (($output | path type) == 'file') {
start $output # replace with your preferred editor
} else { cd $output }
}

you can open your environment file using the following command:

config env

💻 How to run it

lsi

or

lsi some_relative_or_absolute_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.

About

Interactive ls command

Topics

Resources

Stars

31 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages