Moved config.h -> bb.h and did some cleanup, moving function
declarations and constants out of bb.c and into bb.h. Also re-alphabetized the functions and updated the docs.
This commit is contained in:
parent
f0c32a9047
commit
3daa54df98
17
API.md
17
API.md
@ -1,4 +1,5 @@
|
||||
# BB's API
|
||||
|
||||
In `bb`, all interaction (more or less) occurs through binding keypresses
|
||||
(and mouse events) to shell scripts. These shell scripts can perform external
|
||||
actions (like moving files around) or internal actions (like changing the
|
||||
@ -7,6 +8,7 @@ temporary file, and scripts may write commands to this file to modify `bb`'s
|
||||
internal state.
|
||||
|
||||
## Helper Functions
|
||||
|
||||
- `bb`: used for modifying `bb`'s internal state (see BB Commands).
|
||||
- `ask`: get user input in a standardized and customizable way. The first
|
||||
argument is a variable where the value is stored. The second argument is
|
||||
@ -21,6 +23,7 @@ internal state.
|
||||
(e.g. `spin sleep 5`).
|
||||
|
||||
## Environment Variables
|
||||
|
||||
For startup commands and key bindings, the following values are provided as
|
||||
environment variables:
|
||||
|
||||
@ -32,6 +35,7 @@ environment variables:
|
||||
- `$BBCMD`: a file to which `bb` commands can be written (used internally)
|
||||
|
||||
## BB Internal State Commands
|
||||
|
||||
In order to modify bb's internal state, you can call `bb +cmd`, where "cmd"
|
||||
is one of the following commands (or a unique prefix of one):
|
||||
|
||||
@ -63,7 +67,14 @@ absolute value or a relative value (starting with `+` or `-`), and/or a percent
|
||||
and `%n` means percent of number of files (e.g. `+50%` means half a screen
|
||||
height down, and `100%n` means the last file)
|
||||
|
||||
Internally, `bb` will write the commands (NUL terminated) to a file whose path
|
||||
is in`$BBCMD` and read the file when `bb` resumes. These commands can also be
|
||||
passed to bb at startup, and will run immediately. E.g. `bb '+col:n'
|
||||
## Final Notes
|
||||
|
||||
Internally, `bb` writes the commands (NUL terminated) to a file whose path is
|
||||
in`$BBCMD` and reads from that file when `bb` resumes. These commands can also
|
||||
be passed to bb at startup, and will run immediately. E.g. `bb '+col:n'
|
||||
'+sort:+r' .` will launch `bb` only showing the name column, randomly sorted.
|
||||
|
||||
`bb` also optimizes any scripts that only contain just a `bb` command and no
|
||||
shell variables, other commands, etc. (e.g. `bb +move:+1`) These
|
||||
`bb`-command-only scripts directly modify `bb`'s internal state without
|
||||
spawning a shell, so they're much faster and avoid flickering the screen.
|
||||
|
2
Makefile
2
Makefile
@ -57,7 +57,7 @@ all: $(NAME)
|
||||
clean:
|
||||
rm -f $(NAME)
|
||||
|
||||
$(NAME): $(NAME).c bterm.h config.h
|
||||
$(NAME): $(NAME).c bterm.h bb.h
|
||||
$(CC) $(NAME).c $(CFLAGS) $(CWARN) $(G) $(O) -o $(NAME)
|
||||
|
||||
install: $(NAME)
|
||||
|
46
README.md
46
README.md
@ -11,6 +11,7 @@
|
||||

|
||||
|
||||
## Building
|
||||
|
||||
No dependencies besides `make` and a C compiler, just:
|
||||
|
||||
make
|
||||
@ -41,46 +42,39 @@ Pressing `Ctrl-c` will cause `bb` to exit with a failure status and without
|
||||
printing anything.
|
||||
|
||||
## bb's Philosophy
|
||||
|
||||
The core idea behind `bb` is that `bb` is a file **browser**, not a file
|
||||
**manager**, which means `bb` uses shell scripts to perform all modifications
|
||||
to the filesystem (passing selected files as arguments), rather than
|
||||
reinventing the wheel by hard-coding operations like `rm`, `mv`, `cp`, `touch`,
|
||||
and so on. Shell scripts can be bound to keypresses in config.h (the user's
|
||||
version of [the defaults in config.def.h](config.def.h)). For example, `p` is
|
||||
bound to `$PAGER "$@"`, which means selecting `file1` and `file2`, then
|
||||
pressing `p` will cause `bb` to run the shell command `$PAGER file1 file2`.
|
||||
and so on. Shell scripts can be bound to keypresses in
|
||||
`~/.config/bb/bindings.bb`. For example, `p` is bound to `$PAGER "$@"`, which
|
||||
means selecting `file1` and `file2`, then pressing `p` will cause `bb` to run
|
||||
the shell command `$PAGER file1 file2`.
|
||||
|
||||
## Customizing bb
|
||||
|
||||
`bb` comes with a bunch of pre-defined bindings for basic actions in
|
||||
[config.def.h](config.def.h) (within `bb`, press `?` to see descriptions of the
|
||||
bindings), but it's very easy to add new bindings for whatever custom scripts
|
||||
you want to run, just add a new entry in `bindings` in config.h with the form
|
||||
`{{keys...}, "<shell command>", "<description>"}` (The description is shown when
|
||||
pressing `?` within `bb`.)
|
||||
|
||||
### User Input in Scripts
|
||||
If you need user input in a binding, you can use the `ASK(var, prompt,
|
||||
initial)` macro, which internally uses the `read` shell function (`initial` is
|
||||
discarded). Optionally, `bb` can use `ask` or `dmenu` by passing `ASKER=ask` or
|
||||
`ASKER=dmenu` to `make` during the build process. This is used in a few key
|
||||
bindings by default, including `Ctrl-n` and `:`.
|
||||
|
||||
### Fuzzy Finding
|
||||
To select from a list of options with a fuzzy finder in a binding, you can use
|
||||
the `PICK` macro. During the `make` process, you can use `PICKER=fzy`,
|
||||
`PICKER=fzf`, `PICKER=dmenu`, or `PICKER=ask` to choose which fuzzy finder
|
||||
program `bb` will use. This is used in the `/` and `Ctrl-f` key bindings by
|
||||
default.
|
||||
[bindings.bb](bindings.bb) (installed to `/etc/xdg/bb/bindings.bb`) (within
|
||||
`bb`, press `?` to see descriptions of the bindings), but it's very easy to add
|
||||
new bindings for whatever custom scripts you want to run, just `mkdir -p
|
||||
~/.config/bb && cp -n /etc/xdg/bb/bindings.bb ~/.config/bb/` and edit
|
||||
`~/.config/bb/bindings.bb` to have your new bindings. You can also create
|
||||
bindings at runtime by hitting `Ctrl-b` (in case you want to set up an easy way
|
||||
to repeat some custom workflow).
|
||||
|
||||
### API
|
||||
|
||||
`bb` also exposes an API that allows shell scripts to modify `bb`'s internal
|
||||
state. To do this, call `bb +<your command>` from within `bb`. For example, by
|
||||
default, `j` is bound to `bb +move:+1`, which has the effect of moving `bb`'s
|
||||
cursor down one item. More details about the API can be found in [the config
|
||||
file](config.def.h).
|
||||
cursor down one item. More details about the API can be found in [the API
|
||||
documentation](API.md).
|
||||
|
||||
## FAQ
|
||||
|
||||
### Using bb to Change Directory
|
||||
|
||||
Applications cannot change the shell's working directory on their own, but you
|
||||
can define a shell function that uses the shell's builtin `cd` function on the
|
||||
output of `bb -d` (print directory on exit). For bash (sh, zsh, etc.), you can
|
||||
@ -98,6 +92,7 @@ In both versions, the directory will not change if `bb` exits with failure
|
||||
(e.g. by pressing `Ctrl-c`).
|
||||
|
||||
### Launching bb with a Keyboard Shortcut
|
||||
|
||||
Using a keyboard shortcut to launch `bb` from the shell is something that is
|
||||
handled by your shell. Here are some examples for binding `Ctrl-b` to launch
|
||||
`bb` and change directory to `bb`'s directory (using the `bcd` function defined
|
||||
@ -110,4 +105,5 @@ For fish, put this in your `~/.config/fish/functions/fish_user_key_bindings.fish
|
||||
bind \cB 'bcd; commandline -f repaint'
|
||||
|
||||
## License
|
||||
|
||||
`bb` is released under the MIT license. See the `LICENSE` file for full details.
|
||||
|
301
bb.h
Normal file
301
bb.h
Normal file
@ -0,0 +1,301 @@
|
||||
/*
|
||||
* Bitty Browser (bb)
|
||||
* Copyright 2019 Bruce Hill
|
||||
* Released under the MIT license
|
||||
*
|
||||
* This file contains definitions and customization for `bb`.
|
||||
*/
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/dir.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "bterm.h"
|
||||
|
||||
// Macros:
|
||||
#define BB_VERSION "0.16.0"
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#define MAX_COLS 12
|
||||
#define MAX_SORT (2*MAX_COLS)
|
||||
#define HASH_SIZE 1024
|
||||
#define HASH_MASK (HASH_SIZE - 1)
|
||||
#define MAX(a,b) ((a) < (b) ? (b) : (a))
|
||||
#define MIN(a,b) ((a) > (b) ? (b) : (a))
|
||||
#define IS_SELECTED(p) (((p)->selected.atme) != NULL)
|
||||
#define IS_VIEWED(p) ((p)->index >= 0)
|
||||
#define LOWERCASE(c) ('A' <= (c) && (c) <= 'Z' ? ((c) + 'a' - 'A') : (c))
|
||||
#define E_ISDIR(e) (S_ISDIR(S_ISLNK((e)->info.st_mode) ? (e)->linkedmode : (e)->info.st_mode))
|
||||
#define ONSCREEN (termheight - 3)
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define mtime(s) (s).st_mtimespec
|
||||
#define atime(s) (s).st_atimespec
|
||||
#define ctime(s) (s).st_ctimespec
|
||||
#else
|
||||
#define mtime(s) (s).st_mtim
|
||||
#define atime(s) (s).st_atim
|
||||
#define ctime(s) (s).st_ctim
|
||||
#endif
|
||||
|
||||
#define err(...) do { \
|
||||
cleanup(); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
if (errno) fprintf(stderr, "\n%s", strerror(errno)); \
|
||||
fprintf(stderr, "\n"); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} while (0)
|
||||
|
||||
// Types:
|
||||
typedef struct {
|
||||
int key;
|
||||
char *script;
|
||||
char *description;
|
||||
} binding_t;
|
||||
|
||||
typedef struct {
|
||||
int width;
|
||||
const char *name;
|
||||
} column_t;
|
||||
|
||||
typedef enum {
|
||||
COL_NONE = 0,
|
||||
COL_NAME = 'n',
|
||||
COL_SIZE = 's',
|
||||
COL_PERM = 'p',
|
||||
COL_MTIME = 'm',
|
||||
COL_CTIME = 'c',
|
||||
COL_ATIME = 'a',
|
||||
COL_RANDOM = 'r',
|
||||
COL_SELECTED = '*',
|
||||
} column_e;
|
||||
|
||||
/* entry_t uses intrusive linked lists. This means entries can only belong to
|
||||
* one list at a time, in this case the list of selected entries. 'atme' is an
|
||||
* indirect pointer to either the 'next' field of the previous list member, or
|
||||
* the variable that points to the first list member. In other words,
|
||||
* item->next->atme == &item->next and firstitem->atme == &firstitem.
|
||||
*/
|
||||
typedef struct {
|
||||
struct entry_s *next, **atme;
|
||||
} llnode_t;
|
||||
|
||||
typedef struct entry_s {
|
||||
llnode_t selected, hash;
|
||||
char *name, *linkname;
|
||||
struct stat info;
|
||||
mode_t linkedmode;
|
||||
int no_esc : 1;
|
||||
int link_no_esc : 1;
|
||||
int shufflepos;
|
||||
int index;
|
||||
char fullname[1];
|
||||
// ------- fullname must be last! --------------
|
||||
// When entries are allocated, extra space on the end is reserved to fill
|
||||
// in fullname.
|
||||
} entry_t;
|
||||
|
||||
typedef struct bb_s {
|
||||
entry_t *hash[HASH_SIZE];
|
||||
entry_t **files;
|
||||
entry_t *firstselected;
|
||||
char path[PATH_MAX];
|
||||
char prev_path[PATH_MAX];
|
||||
int nfiles;
|
||||
int scroll, cursor;
|
||||
|
||||
char sort[MAX_SORT+1];
|
||||
char columns[MAX_COLS+1];
|
||||
unsigned int dirty : 1;
|
||||
unsigned int show_dotdot : 1;
|
||||
unsigned int show_dot : 1;
|
||||
unsigned int show_dotfiles : 1;
|
||||
unsigned int interleave_dirs : 1;
|
||||
unsigned int should_quit : 1;
|
||||
} bb_t;
|
||||
|
||||
typedef enum { BB_OK = 0, BB_INVALID, BB_QUIT } bb_result_t;
|
||||
|
||||
// Configurable options:
|
||||
#define SCROLLOFF MIN(5, (termheight-4)/2)
|
||||
#define CMDFILE_FORMAT "/tmp/bb.XXXXXX"
|
||||
#define SORT_INDICATOR "↓"
|
||||
#define RSORT_INDICATOR "↑"
|
||||
#define SELECTED_INDICATOR " \033[31;7m \033[0m"
|
||||
#define NOT_SELECTED_INDICATOR " "
|
||||
// Colors (using ANSI escape sequences):
|
||||
#define TITLE_COLOR "\033[37;1m"
|
||||
#define NORMAL_COLOR "\033[37m"
|
||||
#define CURSOR_COLOR "\033[43;30;1m"
|
||||
#define LINK_COLOR "\033[35m"
|
||||
#define DIR_COLOR "\033[34m"
|
||||
#define EXECUTABLE_COLOR "\033[31m"
|
||||
|
||||
#define MAX_BINDINGS 1024
|
||||
|
||||
binding_t bindings[MAX_BINDINGS];
|
||||
|
||||
// Column widths and titles:
|
||||
const column_t columns[] = {
|
||||
['*'] = {2, "*"},
|
||||
['a'] = {21, " Accessed"},
|
||||
['c'] = {21, " Created"},
|
||||
['m'] = {21, " Modified"},
|
||||
['n'] = {40, "Name"},
|
||||
['p'] = {5, "Permissions"},
|
||||
['r'] = {2, "Random"},
|
||||
['s'] = {9, " Size"},
|
||||
};
|
||||
|
||||
// Functions
|
||||
void bb_browse(bb_t *bb, const char *path);
|
||||
static int cd_to(bb_t *bb, const char *path);
|
||||
static void cleanup(void);
|
||||
static void cleanup_and_exit(int sig);
|
||||
static const char* color_of(mode_t mode);
|
||||
#ifdef __APPLE__
|
||||
static int compare_files(void *v, const void *v1, const void *v2);
|
||||
#else
|
||||
static int compare_files(const void *v1, const void *v2, void *v);
|
||||
#endif
|
||||
static int fputs_escaped(FILE *f, const char *str, const char *color);
|
||||
static void init_term(void);
|
||||
static int is_simple_bbcmd(const char *s);
|
||||
static entry_t* load_entry(bb_t *bb, const char *path, int clear_dots);
|
||||
static void* memcheck(void *p);
|
||||
static void normalize_path(const char *root, const char *path, char *pbuf, int clear_dots);
|
||||
static void populate_files(bb_t *bb, int samedir);
|
||||
static void print_bindings(int fd);
|
||||
static bb_result_t process_cmd(bb_t *bb, const char *cmd);
|
||||
static void render(bb_t *bb);
|
||||
static void restore_term(const struct termios *term);
|
||||
static int run_script(bb_t *bb, const char *cmd);
|
||||
static void set_cursor(bb_t *bb, int i);
|
||||
static void set_selected(bb_t *bb, entry_t *e, int selected);
|
||||
static void set_scroll(bb_t *bb, int i);
|
||||
static void set_sort(bb_t *bb, const char *sort);
|
||||
static void sort_files(bb_t *bb);
|
||||
static char *trim(char *s);
|
||||
static int try_free_entry(entry_t *e);
|
||||
static void update_term_size(int sig);
|
||||
|
||||
// Constants
|
||||
static const char *T_ENTER_BBMODE = T_OFF(T_SHOW_CURSOR ";" T_WRAP) T_ON(T_ALT_SCREEN ";" T_MOUSE_XY ";" T_MOUSE_CELL ";" T_MOUSE_SGR);
|
||||
static const char *T_LEAVE_BBMODE = T_OFF(T_MOUSE_XY ";" T_MOUSE_CELL ";" T_MOUSE_SGR ";" T_ALT_SCREEN) T_ON(T_SHOW_CURSOR ";" T_WRAP);
|
||||
static const char *T_LEAVE_BBMODE_PARTIAL = T_OFF(T_MOUSE_XY ";" T_MOUSE_CELL ";" T_MOUSE_SGR) T_ON(T_WRAP);
|
||||
static const struct termios default_termios = {
|
||||
.c_iflag = ICRNL,
|
||||
.c_oflag = OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0,
|
||||
.c_lflag = ISIG | ICANON | IEXTEN | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE,
|
||||
.c_cflag = CS8 | CREAD,
|
||||
.c_cc[VINTR] = '',
|
||||
.c_cc[VQUIT] = '',
|
||||
.c_cc[VERASE] = 127,
|
||||
.c_cc[VKILL] = '',
|
||||
.c_cc[VEOF] = '',
|
||||
.c_cc[VSTART] = '',
|
||||
.c_cc[VSTOP] = '',
|
||||
.c_cc[VSUSP] = '',
|
||||
.c_cc[VREPRINT] = '',
|
||||
.c_cc[VWERASE] = '',
|
||||
.c_cc[VLNEXT] = '',
|
||||
.c_cc[VDISCARD] = '',
|
||||
.c_cc[VMIN] = 1,
|
||||
.c_cc[VTIME] = 0,
|
||||
};
|
||||
|
||||
// Shell functions
|
||||
static const char *bbcmdfn = "bb() {\n"
|
||||
" if test $# -eq 0; then cat >> $BBCMD; return; fi\n"
|
||||
" for arg; do\n"
|
||||
" shift;\n"
|
||||
" if echo \"$arg\" | grep \"^+[^:]*:$\" >/dev/null 2>/dev/null; then\n"
|
||||
" if test $# -gt 0; then printf \"%s\\0\" \"$arg\" \"$@\" >> $BBCMD\n"
|
||||
" else sed \"s/\\([^\\x00]\\+\\)/$arg\\1/g\" >> $BBCMD; fi\n"
|
||||
" return\n"
|
||||
" fi\n"
|
||||
" printf \"%s\\0\" \"$arg\" >> $BBCMD\n"
|
||||
" done\n"
|
||||
"}\n"
|
||||
"ask() {\n"
|
||||
#ifdef ASK
|
||||
ASK ";\n"
|
||||
#else
|
||||
" printf \"\033[1m%s\033[0m\" \"$2\" >/dev/tty;\n"
|
||||
" read $1 </dev/tty >/dev/tty\n"
|
||||
#endif
|
||||
"}\n"
|
||||
"ask1() {\n"
|
||||
#ifdef ASK1
|
||||
ASK1 ";\n"
|
||||
#else
|
||||
" printf \"\033[?25l\" >/dev/tty;\n"
|
||||
" printf \"\033[1m%s\033[0m\" \"$2\" >/dev/tty;\n"
|
||||
" stty -icanon -echo >/dev/tty;\n"
|
||||
" eval \"$1=\\$(dd bs=1 count=1 2>/dev/null </dev/tty)\";\n"
|
||||
" stty icanon echo >/dev/tty;\n"
|
||||
" printf \"\033[?25h\" >/dev/tty;\n"
|
||||
#endif
|
||||
"}\n"
|
||||
"confirm() {\n"
|
||||
#ifdef CONFIRM
|
||||
CONFIRM ";\n"
|
||||
#else
|
||||
" ask1 REPLY \"\033[1mIs that okay? [y/N] \" && [ \"$REPLY\" = 'y' ];\n"
|
||||
#endif
|
||||
"}\n"
|
||||
"pause() {\n"
|
||||
#ifdef PAUSE
|
||||
PAUSE ";\n"
|
||||
#else
|
||||
" ask1 REPLY \"\033[2mPress any key to continue...\033[0m\";"
|
||||
#endif
|
||||
"}\n"
|
||||
"pick() {\n"
|
||||
#ifdef PICK
|
||||
PICK ";\n"
|
||||
#else
|
||||
" ask query \"$1\" && awk '{print length, $1}' | sort -n | cut -d' ' -f2- |\n"
|
||||
" grep -i -m1 \"$(echo \"$query\" | sed 's;.;[^/&]*[&];g')\";\n"
|
||||
#endif
|
||||
"}\n"
|
||||
"spin() {\n"
|
||||
#ifdef SPIN
|
||||
SPIN ";\n"
|
||||
#else
|
||||
" eval \"$@\" &\n"
|
||||
" pid=$!;\n"
|
||||
" spinner='-\\|/';\n"
|
||||
" sleep 0.01;\n"
|
||||
" while kill -0 $pid 2>/dev/null; do\n"
|
||||
" printf '%c\\033[D' \"$spinner\" >/dev/tty;\n"
|
||||
" spinner=\"$(echo $spinner | sed 's/\\(.\\)\\(.*\\)/\\2\\1/')\";\n"
|
||||
" sleep 0.1;\n"
|
||||
" done;\n"
|
||||
" wait $pid;\n"
|
||||
#endif
|
||||
"}\n"
|
||||
#ifdef SH
|
||||
"alias sh=" SH";\n"
|
||||
#else
|
||||
#define SH "sh"
|
||||
#endif
|
||||
;
|
||||
|
||||
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1
|
74
config.h
74
config.h
@ -1,74 +0,0 @@
|
||||
/*
|
||||
BB Configuration, Startup Commands, and Key Bindings
|
||||
|
||||
User customization goes in config.h, which is created by running `make`
|
||||
(config.def.h is for keeping the defaults around, just in case)
|
||||
|
||||
This file contains:
|
||||
- Global options, like which colors are used
|
||||
- Column formatting (width and title)
|
||||
|
||||
*/
|
||||
#include "bterm.h"
|
||||
|
||||
// Types:
|
||||
typedef struct {
|
||||
int key;
|
||||
char *script;
|
||||
char *description;
|
||||
} binding_t;
|
||||
|
||||
typedef struct {
|
||||
int width;
|
||||
const char *name;
|
||||
} column_t;
|
||||
|
||||
// Configurable options:
|
||||
#define SCROLLOFF MIN(5, (termheight-4)/2)
|
||||
#define CMDFILE_FORMAT "/tmp/bb.XXXXXX"
|
||||
#define SORT_INDICATOR "↓"
|
||||
#define RSORT_INDICATOR "↑"
|
||||
#define SELECTED_INDICATOR " \033[31;7m \033[0m"
|
||||
#define NOT_SELECTED_INDICATOR " "
|
||||
// Colors (using ANSI escape sequences):
|
||||
#define TITLE_COLOR "\033[37;1m"
|
||||
#define NORMAL_COLOR "\033[37m"
|
||||
#define CURSOR_COLOR "\033[43;30;1m"
|
||||
#define LINK_COLOR "\033[35m"
|
||||
#define DIR_COLOR "\033[34m"
|
||||
#define EXECUTABLE_COLOR "\033[31m"
|
||||
|
||||
#ifndef SH
|
||||
#define SH "sh"
|
||||
#endif
|
||||
|
||||
// These commands will run at startup (before command-line arguments)
|
||||
extern const column_t columns[128];
|
||||
extern binding_t bindings[1024];
|
||||
|
||||
// Column widths and titles:
|
||||
const column_t columns[128] = {
|
||||
['*'] = {2, "*"},
|
||||
['a'] = {21, " Accessed"},
|
||||
['c'] = {21, " Created"},
|
||||
['m'] = {21, " Modified"},
|
||||
['n'] = {40, "Name"},
|
||||
['p'] = {5, "Permissions"},
|
||||
['r'] = {2, "Random"},
|
||||
['s'] = {9, " Size"},
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* These are all the key bindings for bb.
|
||||
* The format is: {{keys,...}, "<script>", "<description>"}
|
||||
*
|
||||
* Please note that these are sh scripts, not bash scripts, so bash-isms
|
||||
* won't work unless you make your script use `bash -c "<your bash script>"`
|
||||
*
|
||||
* If your editor is vim (and not neovim), you can replace `$EDITOR` below with
|
||||
* `vim -c 'set t_ti= t_te=' "$@"` to prevent momentarily seeing the shell
|
||||
* after editing.
|
||||
*****************************************************************************/
|
||||
binding_t bindings[1024];
|
||||
|
||||
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1
|
Loading…
Reference in New Issue
Block a user