Skip to content

Latest commit

 

History

History
67 lines (45 loc) · 1.46 KB

README.md

File metadata and controls

67 lines (45 loc) · 1.46 KB

Cloak-mode

MELPA

Minor mode to cloak sensitive data

Motivation

I used to use hidepw package but it only supports a plain list of regexs and also use font locking which have some conflicts with other packages, cloak-mode allows to setup a regex by major mode, which fits betters for my use case.

Demo

demo

Installation

Cloning the repo

Clone this repo somewhere, and add this to your config:

(add-to-list 'load-path "path where the repo was cloned")

;; for example we load it for envrc files
(require 'cloak-mode)
(setq cloak-mode-patterns '((envrc-file-mode . "[a-zA-Z0-9_]+[ \t]*=[ \t]*\\(.*+\\)$")))
(global-cloak-mode)

Using use-package

(use-package cloak-mode
  :ensure t
  :config
  (global-cloak-mode))

Using straight.el

(use-package cloak-mode
  :straight (cloak-mode
             :type git
             :host github
             :repo "erickgnavar/cloak-mode")
  :config
  (global-cloak-mode))

Examples

Single pattern per mode

In case we need just one pattern we can define directly as a string

(setq cloak-mode-patterns '((envrc-file-mode . "[a-zA-Z0-9_]+[ \t]*=[ \t]*\\(.*+\\)$")))

Many patterns per mode

In case we need many patterns we can define a list of strings

(setq cloak-mode-patterns '((envrc-file-mode . ("first-pattern" "second pattern"))))