Skip to content

Commit b05ee73

Browse files
committed
doc: bookmarks
1 parent a9002a8 commit b05ee73

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

content/en/usage/usage.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,64 @@ and in vi-mode:
352352
(define-key lem-vi-mode:*insert-keymap* "C-n" 'lem/abbrev:abbrev-with-pop-up-window)
353353
~~~
354354

355+
## Bookmarks
356+
357+
Bookmarks are paths to files or directories that make it easy to open them. Each
358+
bookmark has a name and possibly a position associated with it.
359+
360+
They are not persisted automatically, so you can set temporary bookmarks for a work session.
361+
362+
The interactive commands are the following.
363+
364+
- `bookmark-set RET name RET`, used to **create a new bookmark**, which points to the file
365+
of the current buffer and the current cursor position. The name of the bookmark will be
366+
prompted for.
367+
- If you wish to not associate a position with the bookmark, you can use `bookmark-set-no-position`. This might be useful, if another package is managing file positions for you.
368+
- see also: `bookmark-rename`, `bookmark-relocate`, `bookmark-set-no-position-no-overwrite`, `bookmark-set-no-overwrite`.
369+
- `bookmark-save` is used to save the bookmarks to disk.
370+
- they are not saved automatically, so that you can set temporary bookmarks for a work session. To do so, see below.
371+
- `bookmark-jump`: open a previously set bookmark.
372+
- `bookmark-load` loads the bookmarks from disk.
373+
- the variable `*file*` configures from which file the bookmark information is read from/saved to:
374+
375+
```lisp
376+
(defvar *file* #P"bookmarks.lisp-expr"
377+
"File in which bookmarks are saved.
378+
If the file is a relative path, it is relative to LEM-HOME.")
379+
```
380+
381+
- `bookmark-delete` prompts for a bookmark name and deletes it from memory.
382+
- `bookmark-delete-all` prompts for confirmation and deletes all loaded bookmarks.
383+
384+
The keymap `*keymap*` has some pre-defined mappings for most of the available commands:
385+
386+
```lisp
387+
(define-key *keymap* "x" 'bookmark-set)
388+
(define-key *keymap* "X" 'bookmark-set-no-overwrite)
389+
(define-key *keymap* "m" 'bookmark-set)
390+
(define-key *keymap* "M" 'bookmark-set-no-overwrite)
391+
(define-key *keymap* "j" 'bookmark-jump)
392+
(define-key *keymap* "g" 'bookmark-jump)
393+
(define-key *keymap* "l" 'bookmark-load)
394+
(define-key *keymap* "s" 'bookmark-save)
395+
(define-key *keymap* "d" 'bookmark-delete)
396+
(define-key *keymap* "D" 'bookmark-delete-all)
397+
(define-key *keymap* "r" 'bookmark-rename)
398+
(define-key *keymap* "R" 'bookmark-rename-no-overwrite)
399+
(define-key *keymap* "h" 'bookmark-relocate)
400+
```
401+
402+
This keymap is not bound globally, you can do so like this:
403+
404+
~~~lisp
405+
(define-key *global-keymap* "C-x b" lem-bookmark:*keymap*)
406+
~~~
407+
408+
409+
Bookmarks are defined in the `:lem-bookmark` package.
410+
411+
Use `(describe (find-package \"lem-bookmark\"))` to find all available commands.
412+
355413

356414
## Describe keys
357415

0 commit comments

Comments
 (0)