README.md | 2 ++ nnn.1 | 1 + nnn.c | 8 +++++++- diff --git a/README.md b/README.md index 5ddce609dc5e1a427c4a38682325b546929012a9..105481a65465c5e0d21bc2c5ad03eae73535fdf4 100644 --- a/README.md +++ b/README.md @@ -340,6 +340,8 @@ Set environment variable `NNN_BMS` as a string of `key:location` pairs (max 10) separated by semicolons (`;`): export NNN_BMS='doc:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/' +The bookmark prompt also understands the ~ (HOME), - (last visited directory) and & (start directory) shortcuts. + #### use cd ..... To jump to the nth level parent, with PWD at level 0, use `n + 1` dots. For example, to jump to the 6 parent of the current directory, use 7 dots. If the number of dots would take you *beyond* `/` (which isn't possible), you'll be placed at `/`. diff --git a/nnn.1 b/nnn.1 index 72cf97f4bc7d2b299b8ac81dcc8e0f458f8b8386..533f70dd4f204c9b6e1f4bacc2418c1f26289beb 100644 --- a/nnn.1 +++ b/nnn.1 @@ -220,6 +220,7 @@ \fI;\fR: .Bd -literal export NNN_BMS='doc:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/' .Ed +The bookmark prompt also understands the \fI~\fR (HOME), \fI-\fR (last visited directory) and \fI&\fR shortcuts. .Pp \fBNNN_USE_EDITOR:\fR use EDITOR (preferably CLI, fallback vi) to handle text files. diff --git a/nnn.c b/nnn.c index 291c11967ea97f3da28d5d340a54ef7f38afec4a..3f186ebc932ecab2ccccc2f3ffe82b6c794ffc23 100644 --- a/nnn.c +++ b/nnn.c @@ -2726,8 +2726,14 @@ case SEL_CDBM: printprompt("key: "); tmp = readinput(); clearprompt(); - if (tmp == NULL) + if (tmp == NULL || tmp[0] == '\0') break; + + /* Interpret ~, - and & keys */ + if ((tmp[1] == '\0') && (tmp[0] == '~' || tmp[0] == '-' || tmp[0] == '&')) { + presel = tmp[0]; + goto begin; + } if (get_bm_loc(tmp, newpath) == NULL) { printmsg(messages[STR_INVBM_ID]);