focus
- Description
- Dim the font color of text in surrounding sections
- Latest
- focus-1.0.1.0.20241029.150652.tar (.sig), 2024-Oct-30, 30.0 KiB
- Maintainer
- Lars Tveito <larstvei@ifi.uio.no>
- Website
- http://github.com/larstvei/Focus
- Browse ELPA's repository
- CGit or Gitweb
- Badge
To install this package from Emacs, use package-install
or list-packages
.
Full description
1. Focus
This is Focus, a package that dims surrounding text. It works with any theme and can be configured to focus in on different regions like sentences, paragraphs or code-blocks.
2. Installation
It's available on MELPA and MELPA Stable:
M-x package-install focus
3. Usage
Enable focus-mode
with M-x focus-mode
.
A few interactive functions are provided:
Function | Description |
---|---|
focus-change-thing |
Adjust the narrowness of the focused section for the current buffer |
focus-pin |
Pin the focused section to its current location or the region, if active |
focus-unpin |
Unpin the focused section |
focus-next-thing |
Move the point to the middle of the Nth next thing |
focus-prev-thing |
Move the point to the middle of the Nth previous thing |
Focus relies on Thing At Point, which can retrieve a thing surrounding the
point. These things may be a symbol, list, S-expression (sexp), function
definition (defun), sentence, line, page and others. Calling M-x
focus-change-thing
allows you to interactively change the kind of region
which should be in focus.
3.1. Focus read-only mode
Enable focus-read-only-mode
with M-x focus-read-only-mode
. It inhibits
changes in a buffer, hides the cursor and provides bindings for moving
between things.
Some bindings for simple navigation and exiting `focus-read-only-mode` are provided.
Keybinding | Description |
---|---|
n |
Jump to next thing |
SPC |
Jump to next thing |
p |
Jump to previous thing |
S-SPC |
Jump to previous thing |
i |
Exit focus-read-only-mode |
q |
Exit focus-read-only-mode |
4. Customization
The choice of what thing is suitable for a mode may be configured by
setting the variable focus-mode-to-thing
. The default is
'((prog-mode . defun) (text-mode . sentence))
For modes inheriting prog-mode
(which are most programming modes), the
default is the function-body, and for modes inheriting text-mode
, the
default is a sentence.
For instance, adding the following to your .emacs
-file:
(add-to-list 'focus-mode-to-thing '(python-mode . paragraph))
changes python-mode
to focus in on code-blocks with no blank lines rather
than the entire function.
According to this reddit post, Focus plays nice with lsp-mode
.
4.1. Faces
Focus offers two faces, one for the focused- and unfocused area. By default,
the focus-focused
is the empty face, meaning there is no change, and
focus-unfocused
inherits the comment face (which is usually subtle). The
faces can easily be customized via M-x list-faces-display
.
Old versions
focus-1.0.1.0.20240528.90117.tar.lz | 2024-May-28 | 5.28 KiB |
focus-1.0.1.0.20221016.184639.tar.lz | 2024-Mar-31 | 4.95 KiB |
focus-1.0.0.0.20220910.130020.tar.lz | 2022-Sep-10 | 4.99 KiB |
focus-1.0.0.0.20220906.213020.tar.lz | 2022-Sep-07 | 4.91 KiB |
focus-1.0.0.0.20220906.60621.tar.lz | 2022-Sep-06 | 4.88 KiB |