Thumbnail

rani/cscroll.git

Clone URL: https://git.buni.party/rani/cscroll.git

commit ab74d4298e6d0070e34be922103102a9d448fc4f Author: Daniel <steew0x8@protonmail.com> Date: Tue Oct 12 18:24:38 2021 +0000 handle partial sequences for emacs bindings add emacs keys to readme diff --git a/README.md b/README.md index 45a002c..580b713 100644 --- a/README.md +++ b/README.md @@ -716 +731 @@ A small file manager written in C.    If an argument is provided, cscroll will open the path supplied. Otherwise it will open on the current working directory.   +Files will be highlighted and shown with an identifier in correspondence to the file type. + +#### Colors & Identifiers: + +* Red, `?`: Unknown File +* Yellow, `#`: Block or char device +* Yellow, `|`: FIFO (named pipe) +* Green, `*`: File is executable +* Blue, `/`: Directory +* Cyan, `@`: Symbolic link +* Magenta, `=`: Unix socket +* White, No identifier: Regular file + +Files that are are executable but have another identifier will keep the identifier but be colored green. Symbolic links that point to directories will be suffixed with `@ => /` and may be entered as a normal directory. Otherwise, deletion of a symbolic link will not delete whatever the link points to; only the link itself and opening one will open what the link points to. +  ### Options    * `-p`: Print the path cscroll ends in. Useful for commands like `cd $(cscroll -p)` to cd into the last directory.    ### Commands   -* `j` or `down arrow key`: Move the cursor down -* `k` or `up arrow key`: Move the cursor up -* `h` or `left arrow key`: Enter the previous directory -* `l`, `right arrow key`, or `enter key`: If the file the cursor is on is a directory, enter that directory. Otherwise open the file with `xdg-open` +* `j`, `Ctrl+n` or `down arrow key`: Move the cursor down +* `k`, `Ctrl+p` or `up arrow key`: Move the cursor up +* `h`, `Ctrl+b` or `left arrow key`: Enter the previous directory +* `l`, `Ctrl+f`, `right arrow key`, or `enter key`: If the file the cursor is on is a directory, enter that directory. Otherwise open the file with `xdg-open`  * `g`: Place cursor on first file  * `G`: Place cursor on last file  * `.`: Toggle whether or not to show dot files diff --git a/include/main.h b/include/main.h index e29ea09..8f2d87c 100644 --- a/include/main.h +++ b/include/main.h @@ -34 +34 @@  #endif    #define LAST_F (n_dir_entries > ((unsigned)LINES - 6) ? LINES - 6 : n_dir_entries) - +#define CTRL_KCOMB(key) (key&0x1f) diff --git a/src/main.c b/src/main.c index 0e3ebdd..eddc7c5 100644 --- a/src/main.c +++ b/src/main.c @@ -7710 +7712 @@ int main(int argc, char ** argv) {   char c = curses_getch();   switch (c) {   case ARROW_UP: - case 'k': + case CTRL_KCOMB('p'): + case 'k':   if (cursor > 1) cursor--;   break;   case ARROW_DOWN: + case CTRL_KCOMB('n'):   case 'j':   if (cursor < n_dir_entries) cursor++;   break; @@ -946 +967 @@ int main(int argc, char ** argv) {   last_f = LAST_F;   break;   case ARROW_RIGHT: + case CTRL_KCOMB('f'):   case 'l':   case '\n':   if (!n_dir_entries) break;