# 📂 nav 📂
The interactive and stylish replacement for ls & cd!
![nav demo](media/screenshot2.png)
![nav demo filter](media/screenshot3.png)
---
Ever tried to find that one config file hidden deep in your directory tree?
Or maybe you just want to quickly jump to a directory and inspect some files on the way?
✨ **nav** is here to help! ✨
Written in Kotlin/Native, nav provides a modern and intuitive terminal UI to navigate your filesystem.
- ➡️ Use arrow keys to navigate everywhere
- ⌨️ Type to filter entries, press `Tab` to autocomplete
- ✏️ Instantly edit files with your favorite editor
- 📈 Create files and directories or run commands everywhere
- ✅ Press `Enter` to move your shell to the current directory
## 🚀 Installation
### 1. Install **nav**
Select your operating system
Linux
Install (or update) nav with the [installer script](install/install.sh):
```sh
curl -sS https://raw.githubusercontent.com/Jojo4GH/nav/master/install/install.sh | sh
```
Or install with any of the following package managers:
| Distribution | Repository | Instructions |
| ------------ | ---------- | ------------------------------------------ |
| Arch Linux | [AUR] | `pacman -S nav-cli`
`yay -S nav-cli` |
[AUR]: https://aur.archlinux.org/packages/nav-cli
Or manually download the [latest release](https://github.com/Jojo4GH/nav/releases/latest).
Windows
On Windows, you can use [scoop](https://scoop.sh) to install nav:
```powershell
scoop bucket add JojoIV "https://github.com/Jojo4GH/scoop-JojoIV"
scoop install nav
```
Or without adding the bucket:
```powershell
scoop install "https://raw.githubusercontent.com/Jojo4GH/scoop-JojoIV/master/bucket/nav.json"
```
### 2. Set up your shell
Configure your shell to initialize nav. This is required for the *cd* part of nav's functionality.
Bash
Add the following to the end of `~/.bashrc`:
```sh
eval "$(nav --init bash)"
```
Zsh
Add the following to the end of `~/.zshrc`:
```sh
eval "$(nav --init zsh)"
```
Powershell
Add one of the following to the end of your PowerShell configuration (find it by running `$PROFILE`):
```powershell
Invoke-Expression (& nav --init powershell | Out-String)
```
```powershell
Invoke-Expression (& nav --init pwsh | Out-String)
```
## 🔧 Configuration
The default location for the configuration file is `~/.config/nav.toml`.
You can change this by setting the `NAV_CONFIG` environment variable:
Linux
```sh
export NAV_CONFIG=~/some/other/path/nav.toml
```
Powershell
```powershell
$ENV:NAV_CONFIG = "$HOME\some\other\path\nav.toml"
```
The default configuration looks as follows:
```toml
editor = "nano"
hideHints = false
clearOnExit = true
limitToTerminalHeight = true
maxVisibleEntries = 20 # Set to 0 for unlimited entries
maxVisiblePathElements = 6
# Used to distinguish escape sequences on Linux terminals
inputTimeoutMillis = 4 # Set to 0 for no timeout
suppressInitCheck = false
[keys]
submit = "Enter"
cancel = "Escape"
cursor.up = "ArrowUp"
cursor.down = "ArrowDown"
cursor.home = "Home"
cursor.end = "End"
nav.up = "ArrowLeft"
nav.into = "ArrowRight"
nav.open = "ArrowRight"
menu.up = "PageUp"
menu.down = "PageDown"
filter.autocomplete = "Tab"
filter.clear = "Escape"
[colors]
path = "00DBB7"
filter = "00DBB7"
filterMarker = "00DBB7"
keyHints = "FFFFFF"
permissionRead = "F71674"
permissionWrite = "F5741D"
permissionExecute = "009FFD"
entrySize = "F5741D"
modificationTime = "009FFD"
directory = "F71674"
file = "F5741D"
link = "009FFD"
[modificationTime]
minimumBrightness = 0.4
halfBrightnessAtHours = 12.0
```
For valid key names see [web keyboard event values](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
## Known Issues
- On Linux terminals the *escape* key is send as `ESC` which can also be the start of escape sequences to define other keys (e.g. arrow keys).
This has the effect that the escape key can not be distinguished and will not work as intended on those platforms (may get resolved with [this issue](https://github.com/ajalt/mordant/issues/193)).
Escape keys must therefore be recognized with a small timeout leading to a small delay.
- Symbolic link destinations are not shown and handled weirdly.
## ❤️ Powered by
- UI: [Mordant](https://github.com/ajalt/mordant)
- CLI: [Clikt](https://github.com/ajalt/clikt)
- Commands: [Kommand](https://github.com/kgit2/kommand)
- Config file: [ktoml](https://github.com/orchestr7/ktoml)
- Kotlin/Native