Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zk-phi/phi-rectangle
Another rectangle-mark command
https://github.com/zk-phi/phi-rectangle
emacs
Last synced: 3 months ago
JSON representation
Another rectangle-mark command
- Host: GitHub
- URL: https://github.com/zk-phi/phi-rectangle
- Owner: zk-phi
- Created: 2013-09-09T07:27:51.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-09-11T02:13:19.000Z (over 4 years ago)
- Last Synced: 2024-08-05T06:06:00.915Z (6 months ago)
- Topics: emacs
- Language: Emacs Lisp
- Homepage:
- Size: 1.01 MB
- Stars: 12
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.org
Awesome Lists containing this project
README
* phi-rectangle.el
another rectangle-mark command (rewrite of rect-mark)
矩形選択コマンド
** Screencast
[[imgs/top.gif]]
** Background
There are several previous works such as "rect-mark", "cua-mode",
etc. The motivation to write this command is as follows:- cua-mode has many functionalities such as "delete-selection",
"shift-region", and "rectangle-mark", but it seems too complex when
we just want to use "rectangle-mark".- cua-mode has also "mark-multiple"-like feature as a part of
"rectangle-mark". But we'd better use multiple-cursors.- rect-mark seems simple and clean, but too simple for me. For
example, to duplicate rectangle we must call following commands:1. rm-set-mark [C-x r C-SPC]
2. rm-kill-ring-save [C-x r C-w]
3. yank-rectangle [C-x r y]On the other hands, cua-mode can do it with:
1. cua-set-rectangle-mark [C-RET]
2. cua-copy-region [C-w]
3. cua-paste [C-y]cua-mode unifies "copy" and "copy-rectangle", "paste" and
"paste-rectangle", etc. Very easy.- "force" option in rect-mark is somewhat annoying, Because we need to
delete trailing whitespaces manually.- rect-mark does not work perfectly with delete-selection-mode.
"phi-rectangle" is based on rect-mark, but as easy-to-use as cua, and
is also integrated with multiple-cursors.** Usage
Require this script
: (require 'phi-rectangle)
and call function =phi-rectangle-mode=. Then following commands are
available- [C-RET] phi-rectangle-set-mark-command
Activate the rectangle mark.
- phi-rectangle-kill-region (replaces "kill-region")
A dwim version of "kill-region". If the rectangle mark is active,
kill rectangle. If the normal mark is active, kill region as usual.
Otherwise, kill whole line.- phi-rectangle-kill-ring-save (replaces "kill-ring-save")
A dwim version of "kill-ring-save" like "phi-rectangle-kill-region".
- phi-rectangle-yank (replaces "yank")
A dwim version of "yank". If the last killed object is a rectangle,
yank rectangle. Otherwise yank a kill-ring item as usual.** multiple-cursors Integration
When multiple-cursors is installed in your system, phi-rectangle does
more.- Convert killed-rectangle and fake cursors' kill-ring if proper.
[[imgs/mc1.gif]]
- Invoke multiple-cursors-mode on delete-selection-mode to edit
multiple lines.[[imgs/mc2.gif]]