Labs/Bespin/Tips
We want to make Bespin as discoverable as possible, but there are already lots of little tips and tricks, so we wanted a place to hold them:
Ctrl-J: Jumping from Editor to Command Line
We love using the keyboard to navigate and often find ourselves jumping from the editor to the command line and back. To do this easily, simple use Control-J.
Ctrl-L: Center selected line
Fancy centering up? Ctrl-L and you the current selected line will be put front and center
Ctrl-K: Kill line
Remember the pico vs. vi wars? Ctrl-K to nuke the line away.
Work with projects
As of 0.1.2 "Narky Nimbus", you can run some new commands such as:
- createproject projectName
- deleteproject projectName
- renameproject currentName newName
- mkdir path projectname
Open in a new tab
If you are in the dashboard and want to open a file from the Open Sessions, or from the file chooser, just SHIFT+DOUBLE+CLICK.
How can I tie my own code into the editor? How can I extend it?
One way yo inject your own code to change the experience is via the special BespinSettings/config.js file.
You can read more at the config integration area.
The key pieces are:
- config.js: This file exists in your special BespinSettings directory
- editconfig: This command will open the file up for tweaking
- runconfig: This command will load up the config.js and run it
- set autoconfig on: Now runconfig will be called everytime the editor is loaded
Want custom keybindings?
You have the power. In your config.js (run: editconfig) simply add in the keybindings you know and love.
E.g. Fancy having Ctrl+U to nuke an entire line?
Simple add:
// equiv of the command line: bindkey ctrl u killLine document.fire("bespin:editor:bindkey", { modifiers: "ctrl", key: "u", action: "killLine" });
Like Emacs keybindings?
We have some emacs keybindings available if you type in "set keybindings emacs" on the command line:
document.fire("bespin:editor:bindkey", { modifiers: "ctrl", key: "b", action: "moveCursorLeft" });
document.fire("bespin:editor:bindkey", { modifiers: "ctrl", key: "f", action: "moveCursorRight" });
document.fire("bespin:editor:bindkey", { modifiers: "ctrl", key: "p", action: "moveCursorUp" });
document.fire("bespin:editor:bindkey", { modifiers: "ctrl", key: "n", action: "moveCursorDown" });
document.fire("bespin:editor:bindkey", { modifiers: "ctrl", key: "a", action: "moveToLineStart" });
document.fire("bespin:editor:bindkey", { modifiers: "ctrl", key: "e", action: "moveToLineEnd" });
Virtual vs. Physical lines, what do you prefer? set strictlines on
By default, you can click the mouse on any area in the editor and you will be allowed to start typing there. If at the end of a line and you hit the right arrow, you will go right anyway. This is the virtual mode that is default.
Many people (Dion included) prefer a physical approach where if you click too far to the right the cursor is placed on the last character. If you move to the right at the end of a line you go to the beginning of the next line. Etc.
To get this mode, simple type: "set strictlines on"
Match indentation from the previous line? set autoindent on
When you are coding, when you hit return, you often want the cursor to match your indentation level. By default this isn't turned on yet, but to get this mode, simply type: "set autoindent on"