]> code.delx.au - gnu-emacs-elpa/blob - packages/loccur/README.md
Merge commit '0cda39255827f283e7578cd469ae42daad9556a2' from js2-mode
[gnu-emacs-elpa] / packages / loccur / README.md
1 # Loccur
2 ## Introduction
3 **Loccur** is an amazing tool to quickly navigate in a file. It is a minor mode for Emacs acting like **occur** but w/o creating a new window. It just hides all the text excepting lines containing matches.
4 ## Installation
5 Add to your `.emacs` or `.emacs.d/init.el` following lines:
6
7 ```scheme
8 (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
9 ("melpa" . "http://melpa.milkbox.net/packages/")))
10 ```
11
12 Press `M-x` in GNU Emacs and write `list-packages`. Find the `loccur` in the list of packages and press `i` to select this package, `x` to install the package.
13
14
15 ## Screenshots
16 Better to see it once:
17
18 ![loccur_gui](https://github.com/fourier/loccur/raw/screenshots/gui_emacs_with_loccur.gif "GUI Emacs with loccur")
19 ![loccur_term](https://github.com/fourier/loccur/raw/screenshots/emacs_with_loccur.gif "Emacs in terminal with loccur")
20
21
22 ## Usage
23
24 To use it, add the following to your .emacs file:
25
26 ```scheme
27 (require 'loccur)
28 ;; defines shortcut for loccur of the current word
29 (define-key global-map [(control o)] 'loccur-current)
30 ;; defines shortcut for the interactive loccur command
31 (define-key global-map [(control meta o)] 'loccur)
32 ;; defines shortcut for the loccur of the previously found word
33 (define-key global-map [(control shift o)] 'loccur-previous-match)
34 ```
35
36 Now you can point the cursor to the word and press `Ctrl+o` to hide all lines except those containing this word. Moving cursor to the required line and pressing `Ctrl+o` again will shows all the text. The good thing about this mode is what you can navigate through the buffer easily. `Ctrl+Shift+o` will repeat last search.
37
38 ### Available commands
39 Below is the list of interactive commands available for user:
40
41 * `loccur` interactively asks user for regexp to search or toggle search off (if `loccur-mode` is already enabled)
42 * `loccur-current` searches for the current word under the cursor
43 * `loccur-previous-match` repeat previous `loccur` command
44 * `loccur-no-highlight` is the same as `loccur` but not highlighting matches
45 * `loccur-toggle-highlight` toggles highlighting of matches
46
47 ### Customization
48 * `loccur-jump-beginning-of-line` variable specifies if move the cursor to the beginning of the matching line. Default `nil`
49 * `loccur-highlight-matching-regexp` variable whenever `loccur` should highlight matching words. Default `t`.
50 * `loccur-face` face to be used while highlighting. Default points to `isearch` face.