An open API service indexing awesome lists of open source software.

https://github.com/jdtsmith/comint-fold

Fold input + output blocks in Emacs comint shells
https://github.com/jdtsmith/comint-fold

Last synced: 10 months ago
JSON representation

Fold input + output blocks in Emacs comint shells

Awesome Lists containing this project

README

          

# comint-fold: Fold input + output blocks in Emacs shells

`comint-fold` is a small Emacs global minor-mode which configures `hideshow` mode in comint buffers to allow *folding* (hiding and unhiding) blocks of input and associated output.

It can optionally bind the `Tab` key to fold such blocks (when prior to the prompt), and add a fringe indicator for folded blocks.

comint-fold with folded input blocks

## Using

Use normal `hideshow` commands (like `hs-show-all`), or `Tab`, if `comint-fold-remap-tab` is set.

## Install/configure

Not in a package repo. Simply `package-vc-install` or clone and:

```elisp
(use-package comint-fold
:load-path "~/path/to/comint-fold/"
:config
(comint-fold-mode 1)
;; configure some modes specially; try first without this, many "just work"
(add-hook 'gdb-mode-hook
(comint-fold-configure-hook 0 (rx bol "(gdb)" (+ space))))
(add-hook 'ipy-mode-hook
(comint-fold-configure-hook 1 'ipy-prompt-regexp)))
```

Normally it should *just work* for comint-derived shells. Prompts are identified using `comint-prompt-regexp`. Some comint-based modes do not configure this variable. See `comint-fold-prompt-regexp` for configuring these.

Some shells add an extra line or more before the prompt, and it can be nice to leave this line unhidden. See `comint-fold-blank-lines`. These two variables can be locally configured for a given mode at the same time by using the convenience function `comint-fold-configure-hook` to add to their hooks:

```elisp
(add-hook 'some-comint-derived-mode-hook
(comint-fold-configure-hook num-extra-blanks 'prompt-regexp-var))
```

Two additional custom variables control `Tab` rebinding and fringe indicators:

- `comint-fold-remap-tab [t]`: if non-nil, remap the `Tab` key to toggle fold of the enclosing block when point is before the current active prompt position.
- `comint-fold-fringe-indicator [top-left-angle]`: an indicator bitmap (symbol) to place in the fringe when folded (if non-nil).