(1) Bookmark keys: See \fINNN_BMS\fR under \fIENVIORNMENT\fR section on how to
set bookmark keys.
.Pp
-(2) Symlinked bookmarks: Symlinked bookmarks can be created at runtime
- with the \fIB\fR key. They can also be manually created by adding symlinks
- to bookmarked locations under the bookmarks directory in the nnn config
- directory (~/.config/nnn/bookmarks).
+(2) Symlinked bookmarks: A symlinked bookmark to the current directory can be
+ created with the \fIB\fR key.
+ Add prefix \fBn_\fR to the names to open the targets instead of the symlinks.
+
+ Symlinks can also be created manually under the "bookmarks" directory in
+ the nnn config directory (~/.config/nnn/bookmarks).
+
+ Pressing 'Enter' at the bookmarks prompt takes to this directory.
+ If \fINNN_BMS\fR is not set, it happens directly on select bookmark key.
.Pp
Pressing \fIb\fR will list all the bookmark keys set in NNN_BMS. Pressing
\fIEnter\fR at this prompt will take to the symlink bookmark directory, if
#define MSGWAIT '$'
#define SELECT ' '
#define PROMPT ">>> "
+#define BM_PREFIX "n_"
+#define BM_PREFIX_LEN (sizeof BM_PREFIX - 1)
#define REGEX_MAX 48
#define ENTRY_INCR 64 /* Number of dir 'entry' structures to allocate per shot */
#define NAMEBUF_INCR 0x800 /* 64 dir entries at once, avg. 32 chars per file name = 64*32B = 2KB */
#define MSG_INVALID_KEY 40
#define MSG_NOCHANGE 41
#define MSG_DIR_CHANGED 42
+#define MSG_BM_NAME 43
static const char * const messages[] = {
"",
"too few cols!",
"'s'shfs / 'r'clone?",
"refresh if slow",
- "app name: ",
+ "app: ",
"'o'pen / e'x'tract / 'l's / 'm'nt?",
"keys:",
"invalid regex",
"invalid key",
"unchanged",
"dir changed, range sel off",
+ "name (prefix n_ to identify): ",
};
/* Supported configuration environment variables */
{
char *dir = xbasename(path);
- dir = xreadline(dir[0] ? dir : NULL, "name: ");
+ dir = xreadline(dir[0] ? dir : NULL, messages[MSG_BM_NAME]);
if (dir && *dir) {
size_t r = mkpath(cfgpath, toks[TOK_BM], newpath);
}
pent = &pdents[cur];
- mkpath(path, pent->name, newpath);
+ r = FALSE;
+ /* Check if it's a symlinked boookmark */
+ (S_ISLNK(pent->mode) && is_prefix(pent->name, BM_PREFIX, BM_PREFIX_LEN))
+ ? (realpath(pent->name, newpath) && xstrsncpy(path, lastdir, PATH_MAX))
+ : mkpath(path, pent->name, newpath);
DPRINTF_S(newpath);
/* Visit directory */