Scamx is an experimental modal editing mechanism designed for Emacs. It introduces a modularized, multi-layered approach that integrates seamlessly with default Emacs keybindings, avoiding modifier keys and focusing solely on essential commands. Scamx is crafted to deliver a streamlined and functional modal editing experience within the Emacs environment. As mathematical principles dictate, only mapping matters and those powerful functions are just out there.
- Install dependencies
meow
,multiple-cursors
withpackage-install
- Copy the files to your
.emacs.d
directory:
git clone https://github.com/MagiFeeney/scamx.git && mv scamx ~/.emacs.d
- Load the package with
use-package
in either.emacs
orinit.el
:
(use-package scamx
:load-path "~/.emacs.d/scamx/"
:config
(electric-pair-mode) ; produce balanced expressions upon selected region
(delete-selection-mode) ; act without delete or kill
(multiple-cursors-mode) ; multiple-cursors integration
There are four major modes: normal, X, convert, and visit, where some minor modes, such as isearch, are wrapped into them. The normal mode serves as a base for basic navigation and modes invoking. And X mode is sequence commands with a prefix "x". Convert mode "c" is bolder compared to normal mode, and visit mode "v" navigates, views and manages buffer or window.
x f
open a file.x w
write filex s
save bufferx c
save and close emacsx z
minimize windowx h
select whole bufferx 0
delete current windowx 1
delete other windowx 2
split window verticallyx 3
split window horizontallyx o
move forward to other windowx O
move backward to other windowx <tab>
indent regionx (
start macrox )
end macrox e
call macrox [
backward pagex ]
forward pagex *
calculatorx b
switch to bufferx l
list all buffersx k
kill bufferx i
insert filex j
dired jumpx x
exchange point and markx ;
comment linex '
comment or uncomment regionx SPC
pop to mark commandx n
duplicate linex ESC
repeat complex commandx .
eval last sexpx :
eval expressionx =
adjust text scalex <mouse-1>
previous bufferx <mouse-3>
next bufferx \
copy current file path to kill ring
x
X modec
convert modev
visit mode`
motion mode?
help modeg
cancel selection or exit minibuffera
move beginning of linee
move end of lined
delete forward one char or delete region if selectedh
delete backward one char or delete region if selectedi
inserto
open belowO
open aboven
next linep
previous linef
forward charb
backward charj
newline (a.k.a <return>)m
back to indentations
isearch forward minor modek
kill line at point or kill region if selectedw
copyy
yanku
undo/
redot
select to charz
zap up to charZ
zap to charq
quit current bufferQ
goto linel
recenter top bottom\
delete horizontal space=
mark wordSPC
set mark command!
shell command$
ispell word%
query replace
g
back to normal moden
forward paragraphp
backward paragraphf
forward wordb
backward wordd
kill word or delete region if selectedh
backward kill word or delete region if selectede
forward kill sexpa
backward kill sexpk
kill paragraph or kill region if selectedl
kill whole linew
copyy
yanku
undo/
redoa
backward kill sexpe
kill sexp(
backward list)
forward list[
backward sexp]
forward sexp{
backward up list}
forward up list<
move beginning of defun>
move end of defun=
mark sexp,
mark defuns
allow one key in Normal mode be executed
g
back to normal model
last buffern
next bufferp
previous bufferf
other windowb
previous window any framec
clone buffers
scratch bufferd
scroll page downD
scroll other page downu
scroll page upU
scroll other page upe
scroll line downa
scroll line upr
revert buffer0
balance windowsm
minimize windowM
maximize window+
bold enlarge window horizontally-
bold shrink window horizontallyw
swap window(
tear off window)
delete frame- If you have installed package
ace-window
, then you can further have:t
select window
[
mc/mark-previous-like-this]
mc/mark-next-like-this<
mc/skip-to-previous-like-this>
mc/skip-to-next-like-this;
mc/mark-all-dwim:
mc/mark-all-like-this'
mc/edit-lines@
mc/mark-all-words-like-this#
mc/mark-all-in-region
gg
back to normal mode
? k
describe key? c
describe key briefly? f
describe function? m
describe mode? \
describe input method? b
describe bindings? p
describe package? t
tutorial? d
debugging tutorial? e
view *Messages* buffer? r
find manual? i
info overview? s
search for command? v
search by keyword? C-q
quick toggle? ?
further options? q
quit help
To view commands from X mode, you can type x
followed by ?
.
When enter into the minibuffer, it is by default at the insert mode. Once you have finished typing, you can call gg
to leave insert mode, then use the regular navigation commands such as n
or p
to select the candidates. If you have finished selection, you can use <return>
to abort the minibuffer, or just use g
to leave if it needs to be stopped.
If you want to loop through the history, you can use n
or p
in convert mode instead.
Visit mode also applies to the minibuffer, which means you can move back-and-forth between buffers and the minibuffer.
Isearch forward is wrapped into an additional layer. Once it is invoked with the s
key, it prompts at the minibuffer to enter the string to be searched. Hitting return
then marks the finish of the input process. After that, you can use the familiar navigation commands n
or p
to loop through all candidate in the buffer. When s
is pressed again, you can enter a new string to search. Otherwise, you can go back to the normal state with g
. You can also simply leave the input string blank followed by the return
. With g
, you can directly leave.
Please check the full set up in scamx-anchor.el
.
- You can hit
SPC
twice to set mark, and then usex SPC
to return back to the position. - The convert mode can be invoked on top of the current mark, use whatever commands needed, then revert back to normal mode while keeping the mark.
-
can be combined with directional commands, i.e.- t
select backward to a char,- k
kill backward a line.
- In visit mode, it may occasionally not handle the buffer
*Messages*
properly when navigating previous or next buffer at first attempt. - Command conflicts would be observed in one-key oriented mode i.e. dired-mode, image-mode and magit-mode etc.
Now you can switch between those modes and scamx, by entering into the normal mode with g
and reverting back with `
. When g
conflicts with revert buffer
, you can alternatively use r
in visit mode.
- Add more functions to convert mode (i.e. up-list, kill-sexp).
- Integrate with multiple-cursors.
- Merge meow of things command series into generalized zap command in a dwim style.
- Allow one command in the normal mode be excuted in the convert mode (like
ctrl-o
in vim).
- Motion mode as buffer-wise.
- Improve selection of inside and outside of balanced expressions.