diff options
author | Dylan Araps <dylan.araps@gmail.com> | 2018-10-21 15:54:48 +1100 |
---|---|---|
committer | Dylan Araps <dylan.araps@gmail.com> | 2018-10-21 15:54:48 +1100 |
commit | ba5b4c4a648e019773904309d5b4c1bc47d5f6e8 (patch) | |
tree | 86607d35b2554ae6e3df7caa3a38b3e576aec204 | |
parent | 2a75b45f1d1fdc2cf3e3b7fb79bd9a3baf33e1ab (diff) |
docs: update
-rw-r--r-- | CONTRIBUTING.md | 32 | ||||
-rwxr-xr-x | fff | 2 |
2 files changed, 33 insertions, 1 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..270072e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,32 @@ +# CONTRIBUTING + +# Variables + +| var | meaning | +| ------- | ------- | +| LINES | total lines in terminal. | +| PWD | current directory. +| REPLY | user input. +| f[@] | every dir item. | +| c | total number of dir items. | +| g | previous dir when navigating to a bookmark. | +| j | last dir item that fits on the screen. | +| k | first dir item that fits on the screen. | +| l | cursor position. | +| l2[@] | history of parent dirs (used to remember previous location). | +| m | number of lines that fit on the screen. | +| n | directory nest level. | + +# Functions + +| func | meaning | +| --------- | ------- | +| refresh() | clear the screen and calculate window size. | +| get_dir() | get the list of dir items from `$PWD`. | +| f_print() | print the dir items to the terminal. | +| path() | get the absolute path of a path. | +| hist() | add a cursor position to the location history. | +| open() | navigate to a dir or open a file. | +| prompt() | handle user input. | +| key() | handle key-presses. | +| main() | set traps and start loop. | @@ -5,7 +5,7 @@ refresh() { printf '\e[?7l\e[?25l\e[2J\e[H' shopt -s checkwinsize; (:;:) - ((LINES==0)) && read -r LINES COLUMNS < <(stty size) + ((LINES==0)) && read -r LINES _ < <(stty size) ((m=LINES-3,j=l>m/2?l>=c-m/2?c+1:l+m/2+1:m,k=k>=0?j-m:k,l=l>c?k:l)) } |