Introduction
Insh is a graphical, interactive, terminal environment.
Install
To install the latest version of insh and inshd run:
cargo install --git https://github.com/AustinScola/insh --tag latest insh inshd
Usage
By default, Insh starts out in a file browser. Insh has two other main components as well: a file finder and a file contents searcher.
Universal commands
Some commands work from all components:
| Command | Description |
|---|---|
<Ctrl>-x | Exit Insh. |
r | Refresh. |
Input Bar Commands
Several components use the input bar which has the following commands:
| Command | Description |
|---|---|
<Ctrl>-q | Exit the file finder |
| Any character | Append the character to the current input. |
<Enter> | Search for files matching the input. |
<Backspace> | Remove the last character from the input. |
<Tab> | Fill in the input with the suggestion. |
Browser
The file browser shows the current directory at the top, and lists the entries of the directory below. The currently selected entry is highlighed in yellow.
| Command | Description |
|---|---|
j | <Down> | Move the selection down by one entry. |
k | <Up> | Move the selection up by one entry. |
J | <End> | Move the selection to the last entry. |
K | <Home> | Move the selection to the first entry. |
l | <Enter> | If the currently selected entry is a file, then open it in vim. Else, if the currently selected entry is a directory, then change the current directory to the selected directory. |
h | <Backspace> | Change directories to the parent of the current directory (if the current directory is not the root directory). |
b | Run bash with the working directory set to the current directory. |
c | Open the file creator for creating a file. |
C | Open the file creator for creating a directory. |
f | Open the file finder. |
s | Open the file contents searcher. |
m | Toggle showing the metadata of the entries. |
yE | Yank the selected entry filename to the clipboard. |
yy | Yank the selected entry file path to the clipboard. |
Y | Yank the selected entry file contents to the clipboard. |
File Creator
The file creator can be used to create a file in a directory.
The file creator shows the directory at the top, then an input bar, then any error from attempting to create a new file.
Finder
The file finder shows the directory at the top, then an input bar, then the found files. The finder starts out with the input bar focused. The input can be any valid regular expression.
The finder finds files in the current directory (recursively) for which the regex pattern matches the file name.
Found Files Commands:
| Command | Description |
|---|---|
<Ctrl>-q | Return focus to the input bar. |
j | <Down> | Move the selection down by one hit. |
k | <Up> | Move the selection up by one hit. |
J | <End> | Move the selection to the last hit. |
K | <Home> | Move the selection to the first hit. |
l | <Enter> | Open the hit in vim. |
g | Go to the hit in the file browser. |
G | Go to the hit in the file browser and select it. |
yE | Yank the hit filename to the clipboard. |
yy | Yank the hit file path to the clipboard. |
Y | Yank the hit file contents to the clipboard. |
Searcher
The file contents searcher searches all files in the current directory recursively for a given input string.
The searcher displays the directory at the top, then an input bar, and then the hits. For each hit, the file name is displayed, then a line for each occurance of the string with the line number.
The commands for the input bar are the same as those for the Finder.
Searcher Contents Commands
| Command | Description |
|---|---|
<Ctrl>-q | Return focus to the input bar. |
j | <Down> | Move the selection down. |
k | <Up> | Move the selection up. |
J | <End> | Move the selection to the last file hit. |
K | <Home> | Move the selection to the first file hit. |
<Ctrl>-j | Move the view down. |
<Ctrl>-k | Move the view up. |
l | <Enter> | Open the hit in vim. If the file path of a hit is selected, then open vim at the start of the file. Else, if an occurrence of the string is selected, then open vim at the line of the occurrence. |
g | Go to the hit in the file browser. |
G | Go to the hit in the file browser and select it. |
yE | Yank the hit to the end. If the file path of a hit is selected, yank the relative file path. Else, if an occurence of the string is selected, yank that line. |
yy | Yank the hit line. If the file path of a hit is selected, yank the full file path. Else, if an occurence of the string is selected, yank that line. |
Y | Yank the hit file contents to the clipboard. |
Configuration
Insh Configuration
Insh can be configured by the file ~/.insh-config.yaml.
general.tab_width (usize): The width of the <Tab> character (default=4).
general.bell (bool): Whether or not the bell sound should be made (default=true).
browser.sort (map|null): How files are sorted alphabetically. If null, then files are not sorted (default={}).
browser.sort.case_insensitive (bool): Whether or not the filename case is ignored when sorting files (default=true).
browser.sort.hidden (first|last|mixed): How hidden files (files with a leading .) are sorted. If mixed, then the leading . is ignored when sorting files (default=last).
browser.metadata (bool): Whether or not to show metadata (default=false).
Inshd Configuration
Inshd can be configured by the file ~/.inshd-config.yaml.
server.request_handlers.num (usize): The number of request handlers (default=8).
database.pool.size (usize): The size of the database pool (default=8).
finder.history.length (usize): The number of file finds to store (default=1000).
searcher.history.length (usize): The number of searches to store (default=1000).