• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Emacs Lisp
  • Created over 11 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Another incremental search command, compatible with “multiple-cursors”

phi-search.el

multiple-cursors.el対応のインクリメンタルサーチ

another incremental search & replace, compatible with “multiple-cursors”

Screencast

img/search.gif

Usage

Require this script

(require 'phi-search)

then command “phi-search” and “phi-search-backward” are available. You may bind a key to the command.

(global-set-key (kbd "C-s") 'phi-search)
(global-set-key (kbd "C-r") 'phi-search-backward)

While searching, following commands are available.

  • [C-s] phi-search-again-or-next

    Move to the next matching item. If query is blank, use the last query.

  • [C-r] phi-search-again-or-previous

    Similar to phi-search-again-or-next, but move to the previous item.

  • [C-v] phi-search-scroll-up

    Scroll the target window up, to check candidates.

  • [M-v] phi-search-scroll-down

    Scroll the target window down.

  • [C-l] phi-search-recenter

    Recenter the target window.

  • [M-c] phi-search-case-toggle

    Toggle `phi-search-case-sensitive` on-the-fly.

  • [C-w] phi-search-yank-word

    Expand query by yanking one word from the target buffer.

  • [RET] phi-search-complete

    Finish searching.

  • [C-RET] phi-search-complete-at-beginning

    Finish searching at the beginning of the match.

  • [C-c C-c] phi-search-unlimit

    Force update results regardless of “phi-search-limit”

  • [C-g] phi-search-abort

    Finish searching, and move back to the original position.

Working with Regions

(in following examples, assume “[” as mark, and “|” as point)

When phi-search is called with an active region, then the substring is used as the default query.

[region| another region   |region another region   region another |region
_______________________   ______________________   ______________________
                          query: region            query: region

Or, if phi-search is called with an active mark but no region there, mark stays active until phi-search ends. So you may use this command to expand region.

[|mark me !   [|mark me !   [mark |me !
___________   ___________   ___________
              query:        query: me

Working with multiple-cursors.el

phi-search is available even when multiple-cursors-mode is active. Here are some examples.

|foo bar baz   |foo bar baz   foo bar |baz
|foo bar baz   |foo bar baz   foo bar |baz
____________   ____________   ____________
               query:         query: baz
[|mark us !                 [|mark us !                 [mark |us !
[|mark us with a region !   [|mark us with a region !   [mark |us with a region !
_________________________   _________________________   _________________________
                            query:                      query: us
[foo| ABC foo       |foo ABC foo       foo ABC |foo
[bar| EFGHIJK bar   |bar EFGHIJK bar   bar EFGHIJK |bar
_________________   ________________   ________________
                    query: foo         query: foo

phi-replace.el

“phi-replace” and “phi-replace-query” in “phi-replace.el” are interactive replace commands, that use the same interface as “phi-search”.

img/replace.gif

To use these commands, require

(require 'phi-replace)

and bind a key.

(global-set-key (kbd "M-%") 'phi-replace-query)

Keybinds are basically the same as phi-search, by default.

Customization

Keybinds

You may change keybindings by changing “phi-search-default-map”.

(define-key phi-search-default-map (kbd "<") 'phi-search-again-or-previous)
(define-key phi-search-default-map (kbd ">") 'phi-search-again-or-next)

This will affect all commands based on phi-search. If you want to add commands only for a specific command, you may use variables below.

phi-search-default-map
the phi-search common keymap
phi-search-additional-keybinds
list of (KEY . COMMAND) used in “phi-search(-backward)” command
phi-replace-additional-keybinds
list of (KEY . COMMAND) used in “phi-replace(-query)” command
(push '((kbd "<app>") . 'phi-search-complete-at-beginning)
      phi-search-additional-keybinds)

Searching

You may change limit of search by setting “phi-search-limit”, and case-sensitivity by “phi-search(replace)-case-sensitive”.

(setq phi-search-limit           10000
      phi-search-case-sensitive  t)

You may also set “phi-search-case-sensitive” to ‘guess, to make phi-search case sensitive only when some upcase letters are in the query.

Hooks

Hooks “phi-search-init-hook” and “phi-replace-init-hook” are hooks run after initializing the minibuffer.

Faces

Matching items are propertized with “phi-search-match-face”, and the selected item is propertized with “phi-search-selection-face”. If they look not pretty in your colorscheme, you may modify them.

(set-face-attribute 'phi-search-selection-face nil
                    :background "orange")

Notes

This command uses “multiple-cursors” variables and behavior that are not documented. Therefore, after you update “multiple-cursors”, it is good idea to test if this command works still correctly, before you actually use this command.

More Repositories

1

sublimity

Smooth-scrolling and minimap like sublime editor
Emacs Lisp
483
star
2

indent-guide

Show vertical lines to guide indentation
Emacs Lisp
348
star
3

MEGAMOJI

Create animoji easily
Vue
312
star
4

symon

Tiny graphical system monitor
Emacs Lisp
292
star
5

magic-latex-buffer

Magical syntax highlighting for LaTeX-mode buffers
Emacs Lisp
152
star
6

togetherly

Allow multiple clients to edit a single file on-line
Emacs Lisp
143
star
7

sky-color-clock

A clock widget for modelines with real-time sky color and moonphase/weather icon
Emacs Lisp
108
star
8

git-complete

Yet another completion engine powered by "git grep"
Emacs Lisp
66
star
9

ewow

Use Emacs command (almost) everywhere
AutoHotkey
60
star
10

electric-align

Insert a certain amout of spaces at once to easily align columns
Emacs Lisp
52
star
11

scad-preview

Preview SCAD models in real-time in Emacs
Emacs Lisp
43
star
12

setup

Helper macros to write faster, portable and robust init script
Emacs Lisp
40
star
13

bfbuilder

A brainfuck development environment with interactive debugger
Emacs Lisp
39
star
14

lenlen-theme

A solarized-based kawaii light theme
Emacs Lisp
31
star
15

phi-grep

Interactively-editable recursive grep implementation in elisp
Emacs Lisp
30
star
16

electric-case

Insert camelCase, snake_case words without "Shift"ing
Emacs Lisp
26
star
17

ac-c-headers

auto-complete source for C headers and symbols in headers
Emacs Lisp
25
star
18

spray

[Emacs] An elisp implementation of OpenSpritz
Emacs Lisp
24
star
19

jaword

Minor-mode for handling Japanese words better
Emacs Lisp
23
star
20

cedit

paredit-like commands for C-like languages
Emacs Lisp
22
star
21

highlight-stages

Highlight staged (quasi-quoted) expressions
Emacs Lisp
21
star
22

elemental-theme

WIP An elemental theme
Emacs Lisp
20
star
23

download-region

Simple in-buffer download manager for Emacs
Emacs Lisp
15
star
24

rpn-calc

Handy RPN calculator for hackers
Emacs Lisp
12
star
25

1x2x3-keyboard

DIY keyboard for everyone
OpenSCAD
12
star
26

company-anywhere

enable company in middle of symbols
Emacs Lisp
11
star
27

CHUNITHMRateAnalyzer

[Game]
JavaScript
11
star
28

dotfiles

Emacs Lisp
11
star
29

phi-rectangle

Another rectangle-mark command
Emacs Lisp
11
star
30

scratch-pop

Popup scratch buffer
Emacs Lisp
9
star
31

switch42-keyboard

My first DIY keyboard / 3x6+3 split ortho
OpenSCAD
9
star
32

automargin

[Emacs] Automatically add margins to windows
Emacs Lisp
8
star
33

gemini-keyboard

My endgame split ergo of this month
Shell
7
star
34

key-chord

zk-phi's fork of key-chord with `safety-interval'
Emacs Lisp
6
star
35

company-dwim

company port of ac-dwim
Emacs Lisp
6
star
36

scratch-palette

Add notes on each files
Emacs Lisp
6
star
37

electric-spacing

Insert spaces automatically between user-defined patterns
Emacs Lisp
5
star
38

composition-keyboard

A ChocV2 ortho
Shell
5
star
39

pollux-keyboard

A row staggered narrow-pitched 3 x 6 + 2 split
OpenSCAD
5
star
40

CHUNITHMRateAnalyzerSTAR

[Game] I am a star
JavaScript
5
star
41

phi-kbd-library

zk-phi's keyboard library for KiCAD
OpenSCAD
4
star
42

philisp

WIP zk_phi's experiment towards a simple, happy-hacking language
C
4
star
43

git-context-switch

context switch for git
Emacs Lisp
4
star
44

company-same-mode-buffers

Company backend like `ac-source-words-in-same-mode-buffers'
Emacs Lisp
4
star
45

phi-autopair

Anohter simple-minded autopiar
Emacs Lisp
3
star
46

phi-search-migemo

migemo extension for phi-search
Emacs Lisp
3
star
47

outlined-elisp-mode

outline-minor-mode settings for emacs lisp
Emacs Lisp
3
star
48

kastor-keyboard

3 rows keyboard with thumb keys
OpenSCAD
3
star
49

equilibrium-keyboard

A compact transparent keyboard
Shell
3
star
50

gitmole

WIP Interactive recursive blame tool for digging into git repos
Emacs Lisp
3
star
51

ewow-evil

A vim's normal-mode implementation for EWOW
AutoHotkey
3
star
52

code8903

A coding font based on JISZ8903
Makefile
2
star
53

zombie

Major mode for editing ZOMBIE programs
Emacs Lisp
2
star
54

KP-19

A 'meishi'-sized experimental 4-keypad with audio-sync lightshow
Shell
2
star
55

ewow-autopair

An autopair extension for EWOW
AutoHotkey
2
star
56

keyboard-acrylic-case-tutorial

Materials for tutorial
OpenSCAD
2
star
57

symon-lingr

A notification-based Lingr client powered by symon.el
Emacs Lisp
2
star
58

cssdebug

Simple css layout debugger in pure js
JavaScript
2
star
59

smallworld-visualizer

[Web] Visualizer for building a deck with the card smallworld
TypeScript
2
star
60

kusocolla-republic

背景抜き太郎
JavaScript
1
star
61

negaposi-slicer

Slice images with pixel value
JavaScript
1
star
62

dired-explore

MS Explorer-like incremental search for dired
Emacs Lisp
1
star
63

parametric-key-layout-model

A parametric OpenSCAD model for previewing keyboard layouts
OpenSCAD
1
star
64

git-submodule-update-checker

[Git] Command-line tool for checking submodule updates in batch mode
Emacs Lisp
1
star
65

lambda_to_lazyk

A Lambda Calculus to Lazy K translator
1
star
66

phi-search-dired

Interactive filtering for dired powered by phi-search
Emacs Lisp
1
star
67

slack-to-gcal

Slack slash command to manage Google Calendar events and tasks
JavaScript
1
star
68

affinity-keyboard

A 4x4 macro-pad with a spectrum analyzer IC
Shell
1
star
69

ewow-stickyshift

A stickyshift-key for EWOW
AutoHotkey
1
star
70

glcdfont-tracer

[Keyboard/WIP] glcdfont editor
JavaScript
1
star
71

shingengo-font

[Font] Shingengo font daisuki!!
1
star
72

keyboard-buildguide-common

tips for building diy keyboards
1
star
73

ewow-keychord

A keychord extension for EWOW
AutoHotkey
1
star
74

git-complete-company

git-complete backend for company
Emacs Lisp
1
star
75

ewow-mouse

A mouse control extension based on binary-search, for EWOW.
AutoHotkey
1
star
76

trance-vibrator-resuscitator

Drive ASCII trance vibrator in sync with audio
JavaScript
1
star
77

include-anywhere

Include from anywhere
Emacs Lisp
1
star
78

MJ-4PP-9-breakout

MJ-4PP-9 breakout for breadboards
Shell
1
star
79

morpho-keyboard

An experimental keyboard for tasting multiple layouts with hot-swapping sockets
Shell
1
star
80

commentize-conflict

Minor mode to treat git conflict markers and their changes as comment
Emacs Lisp
1
star
81

acrylic-block-hikaruino

Hikaruino!
Shell
1
star
82

git-multiple-stashes

[Git] Multiple stashes for git
1
star
83

key-combo-web

Per-language key(-combo) bindings for web-mode
Emacs Lisp
1
star
84

shuffle-simulator

WIP Deck shuffle simulator
HTML
1
star
85

alc-tracker

Track drinking activity from within a slack channel
JavaScript
1
star
86

auto-pr

GitHub Action which automatically creates PR to keep a branch in sync with another
JavaScript
1
star
87

show-eof-mode

[Emacs] Minor mode to show [EOF] indicator
Emacs Lisp
1
star