Vi-like editing in Wolfram Notebooks
-
Vilfram supports most of the standard Vi-like movement, selection, and deletion commands.
-
Vilfram works in any file type that can be opened by the Wolfram front end, including: .nb, .wl, .wls, .wlt, and more.
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.
The following Command-mode sequences are supported:
i
,a
— enter Insert modeEsc
— enter Command mode
Character-oriented:
h
— move single character leftl
— move single character rightj
— move single line downk
— move single line up
Word-oriented:
e
— move to next wordb
— move to previous word
Line-oriented:
^
— move to beginning of line$
— move to end of lineo
— insert new line belowO
— insert new line above
Document-oriented:
G
— move to top of notebookgg
— move to end of notebook
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
-
de
— delete to next worddb
— delete to previous wordd^
— delete to beginning of lined$
— delete to end of line
u
— undo:w
— save current notebook:x
— save and close current notebook
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 inuitive structural selection mechanism whereby the current selection can be expanded in steps that are each an enclosing syntactical structure.
vi
— expands the selection each timei
is presseddi+
— expands the selection each timei
is pressed; deletes when theReturn
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.
"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:
This will persistently disable Vilfram in the current and future sessions.
Use Edit > Enable Vilfram to re-enable Vilfram.