Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/larstvei/Focus
Dim the font color of text in surrounding paragraphs
https://github.com/larstvei/Focus
Last synced: 2 days ago
JSON representation
Dim the font color of text in surrounding paragraphs
- Host: GitHub
- URL: https://github.com/larstvei/Focus
- Owner: larstvei
- Created: 2015-05-12T20:46:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T23:40:49.000Z (10 days ago)
- Last Synced: 2024-10-30T01:53:21.528Z (10 days ago)
- Language: Emacs Lisp
- Size: 2.27 MB
- Stars: 479
- Watchers: 9
- Forks: 16
- Open Issues: 4
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
- my-awesome-github-stars - larstvei/Focus - Dim the font color of text in surrounding paragraphs (Emacs Lisp)
README
[[https://melpa.org/#/focus][file:https://melpa.org/packages/focus-badge.svg]]
[[https://stable.melpa.org/#/focus][file:https://stable.melpa.org/packages/focus-badge.svg]]* Focus
[[./focus-demo.gif]]
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.* Installation
It's available on [[https://melpa.org/#/focus][MELPA]] and [[https://stable.melpa.org/#/focus][MELPA Stable]]:
#+BEGIN_EXAMPLE
M-x package-install focus
#+END_EXAMPLE* 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 [[https://www.emacswiki.org/emacs/ThingAtPoint][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.** 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~ |* 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#+BEGIN_EXAMPLE
'((prog-mode . defun) (text-mode . sentence))
#+END_EXAMPLEFor 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:
#+BEGIN_SRC emacs-lisp
(add-to-list 'focus-mode-to-thing '(python-mode . paragraph))
#+END_SRCchanges ~python-mode~ to focus in on code-blocks with no blank lines rather
than the entire function.According to [[https://www.reddit.com/r/emacs/comments/b1vrar/lsp_support_for_focusel_using_lspmode/][this reddit post]], Focus plays nice with ~lsp-mode~.
** 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~.