![Screenshot of Vilfram example](https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2023-05-14at2.47.55PM.png&userId=2456537)
Hey everyone, I'm excited to announce the MVP release of ConnorGray/Vilfram, a new paclet I've been working on that adds a Vi-like editing experience to Wolfram Notebooks.
This is just a short post to get the word out to anyone who might be interested in trying it out.
More details can be found in the Vilfram GitHub repository:
>> https://github.com/ConnorGray/Vilfram <<
Getting Started
The ConnorGray/Vilfram paclet can be installed from paclets.com by evaluating:
PacletInstall["ConnorGray/Vilfram"]
Once installed, Vilfram will automatically be available and enabled in any opened notebook.
Check the section "Disabling Vilfram" below for instructions of disabling Vilfram.
Examples
Use h
, j
, k
, and l
keys for basic movement:
![enter image description here](https://community.wolfram.com//c/portal/getImageAttachment?filename=vilfram-E1-basic-movement.gif&userId=20103)
Switch between Insert and Command mode:
![enter image description here](https://community.wolfram.com//c/portal/getImageAttachment?filename=vilfram-E2-switch-modes.gif&userId=20103)
Use $
, ^
, e
, and b
to jump to the beginning and end of lines and words
![enter image description here](https://community.wolfram.com//c/portal/getImageAttachment?filename=vilfram-E3-line-and-word-movement.gif&userId=20103)
Use visual selection to quickly copy, cut, and delete
![enter image description here](https://community.wolfram.com//c/portal/getImageAttachment?filename=vilfram-E4-visual-selection.gif&userId=20103)
Smart selection expansion to efficiently select the right subexpression
![enter image description here](https://community.wolfram.com//c/portal/getImageAttachment?filename=vilfram-E5-smart-selection-expansion.gif&userId=20103)
All Supported Commands
The following Command-mode sequences are supported:
Mode switching
i
, a
— enter Insert mode
Esc
— enter Command mode
Movement
Character-oriented:
h
— move single character left
l
— move single character right
j
— move single line down
k
— move single line up
Word-oriented:
e
— move to next word
b
— move to previous word
Line-oriented:
^
— move to beginning of line
$
— move to end of line
o
— insert new line below
O
— insert new line above
Document-oriented:
G
— move to top of notebook
gg
— move to end of notebook
Visual Selection
v
— begin visual selection
h
— change selection single character left
l
— change selection single character right
j
— change selection single line down
k
— change selection single line up
e
— extend selection to next word
b
— extend selection to previous word
^
— extend selection to beginning of line
$
— extend selection to end of line
y
— copy ("yank") current selection
x
— cut current selection
Deletion
de
— delete to next word
db
— delete to previous word
d^
— delete to beginning of line
d$
— delete to end of line
Other
u
— undo
:w
— save current notebook
:x
— save and close current notebook
Notable differences from Vi
Wolfram Notebooks are different in structure and supported functionality from traditional character-based editors. Some Vi commands have Vilfram analogues with slightly different behavior that is better suited to the features of the notebook environment.
- Structured selection commands
Notebooks support a powerful and intuitive structural selection mechanism whereby the current selection can be expanded in steps that are each an enclosing syntactical structure.
vi
— expands the selection each time i
is pressed
di+
— expands the selection each time i
is pressed; deletes when the Return
key is pressed
No block caret
Vi often distinguishes between Insert and Command mode by, respectively, changing the input caret between a block which is placed on a particular character, and a vertical bar which is placed in-between characters.
Disabling Vilfram
"Help! I installed Vilfram and now I'm stuck!"
Don't panic. You're not the first to get stuck in Vi.
To disable Vilfram, use your mouse to select the Edit > Disable Vilfram menu item:
![enter image description here](https://community.wolfram.com//c/portal/getImageAttachment?filename=enable-disable-menu-items.png&userId=20103)
This will persistently disable Vilfram in the current and future sessions.
Use Edit > Enable Vilfram to re-enable Vilfram.
Enjoy!
Connor