TODO: Expand following content into sections
||Lowercase word (no keybinding in Spacemacs)|
Escaping Insert state and commands
fd takes me out of insert state. What is going on?
This is a feature of Spacemacs, enabling you to easily escape from a lot of situations, like escaping from insert state to normal state.
The sequence of characters used can be customized. See the documentation for more information.
If you don't like this feature, you can Deactivate it by adding evil-escape to dotspacemacs-excluded-packages in your init file.
You can select text from Vim normal state by entering the visual state
|Spacemacs||Major mode||Emacs||Evil normal||Command||Description|
||Toggle visual mode / selection|
Add comment / Toggle comment
In Vim normal mode you can comment out a single line using
g c c.
To comment multiple lines you can use the repeat command style, especially if you are using relative line numbers. So using
g c 3 j will comment out the current line and the following two lines below. You can comment out in reverse using
g c 3 k.
In Visual state,
v, select the lines you wish to comment and use
g c to comment all the marked lines. Partially marked lines are not commented.
|Spacemacs||Visual State||Emacs||Evil Normal||Command||Description|
||Comment marked region|
||Comment 5 lines forward from current|
||Comment 5 lines backward from current|
As you are typing in any(?) buffer then Spacemacs is checking your spelling as you type. If you type a word that Spacemacs does not recognise then that word is underscored in red. To correct a spelling:
- Move to the word that is incorrectly spelt
SPC S cto change the word and show a list of suggested words
- Either type in a new spelling or use
C-kkeys to move down and back up the list of words, using
RETto select that word.
in vim command mode you can scroll just the text using the classic vi bindings. This does not scroll the cursor unless the cursor hist the top or bottom of the window, in which case the cursor stays at that window boundry.
C-y - scroll down
C-e - scroll text up
Inserting a character multiple times
In Vim normal mode (yellow) type the number of times to repeat the character followed immediately followed by
i, then the character or word you want to reapeat. Then press
fd and the character will be printed repeatedly
redrum redrum redrum redrum redrum redrum redrum redrum redrum redrum
SPC j i shows imenu that lists all the def and defn expressions in the current buffer, allowing you to jump to one of these definitions directly by typing its name or using
C-k to select the name and pressing
RET to jump to the name in the buffer
SPC j l labels each line of the buffer with a short, unique character code. By entering the character code you are taken directly to the specific line. This is the
avy goto line function and this works on all visible buffers by default, although it can be just shown on the current buffer (TODO: how is this set).
Matching only within a boundary by wrapping your search term with
So if you want to match
or and not word, then you would do
SPC / \bor\b
getting stuff done - vim basics
changing escape sequence for vim
(setq evil-escape-key-sequence "jk")
Working with Buffers
To work with files in Emacs, they are first loaded into a Buffer.
So when you open a file with
M-x find file or
SPC f f a new buffer is created so you can manage that file.
Buffers are displayed in a window and you can change the window to show any of the current buffers.
Here are the most commonly used buffer commands
||helm-mini||List current buffers|
||kill-this-buffer||Kill current buffer|
||home||Switch to Spacemacs home page|
||next-buffer||Switch to next buffer|
||previous-buffer||Switch to previous buffer|
||switch-to-scratch-buffer||Switch to the scratch buffer|
||copy-whole-buffer-to-clipboard||Copy current buffer contents to kill ring|
See the full buffer menu via
Also consider using:
Editing text (especially in Evil mode)
See Vim section
Working with Windows
||Close current window|
||Vertically split current window|
||Horizontally split current window|
||Jump to window number|
You can also create layouts that are a collection of windows