Spacemacs Reference Document
A general reference for getting into spacemacs from vim. Mostly derivative of other guides.
Table of Contents
This does not have all sections listed, just main sections and popular reference areas.
Reference
Useful Sequences
- See all active
minor-modes
andmajor mode
:C-h m
- another get major-mode:
C-h v major-mode
- another get minor-mode:
C-h v minor-mode-list
- spacemacs minor-mode stuff
- another get major-mode:
- Reload stuff/settings:
SPC f e R
- Load up non-GUI mode:
$ emacs -nw
- Insert any character:
C-q
- Increment by q (q=1 by default):
q SPC n -
- has some sort of minor mode where you can keep pressing stuff, try it
- Clear search highlighting:
SPC s c
- Navigate buffers:
SPC b b
- Check out the
Messages
buffer - kill buffer:
SPC b d
- next or prev buffer:
SPC b n
orSPC b p
- Check out the
- Jump between matched tags:
%
- Exit insert mode (evil-escape):
fd
- note that this should take you to
evil normal mode
from anywhere - this may work identically to
C-g
- note that this should take you to
- Find a file and open in a new buffer:
SPC f f
- "help describe":
SPC h d
- "help describe function"
SPC h d f
- "help describe key"
SPC h d k
- "help describe function"
- guide-key, a menu of stuff:
SPC
- Insert lorem ipsum:
SPC i l l
- (lorem-ipsum) has several nice insert options
SPC i l
- (lorem-ipsum) has several nice insert options
- Note that the vim
.
repeater works onSPC
-leader macros..- try
SPC i l l . . . . .
- try
- Using
evil-nerd-commenter
- comment or uncomment a block of lines
SPC c l
- toggle comment on each line in a block of lines
SPC c ;
- can be used to simultaneously uncomment and comment neighboring lines
- comment or uncomment a block of lines
SPC m
is aliased to,
and accesses the currentmajor-mode
menu
Interesting Sequences
- Incremental Search:
C-s stuff
- Note:
/ style
search is already incremental in spacemacs.
- Note:
- Learn emacs lisp:
SPC h i elisp RET
Future
- Mess with
iedit
andiedit-insert
states - Try out the other
SPC s
search options - Test out spacemacs regex
SPC x
which usespcre2el
package - editing lisp code & lisp keybindings
- managing projects
- compiling code
External References
- Spacemacs documentation
- Migrating from Vim
- guide-key
- learn elisp in 15 minutes
- GNU emacs manual
- Configuration "Tutorial" Orientation for contributing layers
- Chaotic Migration Guide
Subreddits:
Notes (From References)
Each note should have a ####
header and be included in the TOC.
What is setq
?
Set Quoted. (set (quote scroll-margin) 5)
is equivalent to (setq scroll-margin 5)
.
Spacemacs State Color Codes
There are 10 states.
The state table is from the Spacemacs documentation.
State | Default Color | Description |
---|---|---|
normal | orange | like the =normal mode of Vim=, used to execute and combine commands |
insert | green | like the =insert mode of Vim=, used to actually insert text |
visual | gray | like the =visual mode of Vim=, used to make text selection |
motion | purple | exclusive to =Evil=, used to navigate read only buffers |
emacs | blue | exclusive to =Evil=, using this state is like using a regular Emacs without Vim |
replace | chocolate | exclusive to =Evil=, overwrites the character under point instead of inserting a new one |
hybrid | blue | exclusive to Spacemacs, this is like the insert state except that all the emacs key bindings are available |
evilified | light brown | exclusive to Spacemacs, this is an =emacs state= modified to bring Vim navigation, selection and search. |
lisp | pink | exclusive to Spacemacs, used to navigate Lisp code and modify it (more [[#editing-lisp-code][info]]) |
iedit | red | exclusive to Spacemacs, used to navigate between multiple regions of text using =iedit= (more [[#replacing-text-with-iedit][info]]) |
iedit-insert | red | exclusive to Spacemacs, used to replace multiple regions of text using =iedit= (more [[#replacing-text-with-iedit][info]]) |
Spacemacs Fixes
Things I think need fixed.
Identified as needs fixed for spacemacs
- Make default colors the same as default terminal colors...
- not sure how to let these pass through, spacemacs has magic colors
- Consider moving my hotkeys to a helm menu or something, with a space leader instead of C-
pattern. Also includes vim functions. - Rewrite vim functions for spacemacs
- Consider alias for bash for spacemacs nongui as default
emacs -nw
- Also, consider installing the emacs-plus package from homebrew cask on mac
- The emacs-plus package is apparently the recommended package by spacemacs, no idea why
- Store undo history between sessions for all edited files.
- manage branching undo history better? may just need training...
- C-c should exit insert mode
- Fix ridiculous html indentation
- Disable the mouse... try the (disable-mouse) package?
Needs Deeper Research
- tabs->spaces
- looks like highlight and <|> indent by 4 spaces in html extension files... not sure how it varies by file extension
- we want this to be 2 spaces by default and 4 spaces in the .py file extension
-
indentation with the tab also does not always work, it seems to try to force a style from somewhere, tab does not always have an effect
-
html specific
- tab seems to add spaces when it allows input... this should not follow complex rules, tab should just put 2 spaces in regardless
- in html when exiting insert mode, it seems to do some postprocessing on my editing, visual mode gets weird
- things in html mode are generally not working, especially with regards to
and similar
-
Esc (1/2 second pause or less) followed by a key is a meta-key leader... need it to be dead key from now on
- this is related: https://github.com/syl20bnr/spacemacs/issues/2756
- this seems to have abated, i think i toggled a mode
- i do not know why it would have abated but i did restart my computer
-
still reloading emacs settings should be enough, mysterious
-
How do I drill down to my packages? How do I learn about my evil mode configuration and contribute to the evil mode emacs plugin?
-
i have been reading the elisp in the .spacemacs.d layers
-
How do I manage undo branches?
Done
- line numbers on startup, line number toggle?
- note taken - How do i search for tabs, e.g. \t
- scroll-margin set to 5
- C-l should redraw the screen - redraw does not clear search highlighting in emacs...
- Clear a search with
SPC s c
- Turn off auto add closing quotes, braces, brackets, tildes, etc.
- in init.el: put smartparens in dotspacemacs-excluded-packages
Optional
- redraw screen with some key combo? - https://www.gnu.org/software/emacs/manual/html_node/elisp/Refresh-Screen.html
- May already be in spacemacs, check around
Greg's elisp notes
I'm starting by reading An Introduction to Programming in Emacs Lisp.
To get to this, open emacs with no arguments, hit ctrl-h i
C-h is for help. i is for the info reader, which lets you browse manuals.
Then you're presented with a long menu.
Hit m for menu, then type Emacs Lisp Intro into the mini buffer. Then hit enter.
That gets you to the elisp intro.
Lisp stands for LISt Processing.
A list:
'(rose
violet
daisy
buttercup)
Awesome and beautiful quote from the book: "The elements of this list are the names of the four different flowers, separated from each other by whitespace and surrounded by parentheses, like flowers in a field with a stone wall around them."
Text between double quotation marks is also an atom.
If there is no apostraphe before a preceding list then the first item of the list is a function. If there is an apostophe then the list is just taken as is.
Why I switched to Spacemacs
I wrote these out for someone. I prefer to see spacemacs as a vim featureset expansion.
- Vimscript sucks and vim isn't really great wrt extendability, extensions are all over the place.
- I like scheme/lisp and am writing a lot of C this year, emacs seems much better suited for working in both.
- Spacemacs provides most common keys in vim (but not all!).
- For example
C-a
in vim isSPC n +
in spacemacs. It drops chording, a net positive.
- For example
- Vim promises leader keys but you effectively chord enough of your actions that it's a fake claim. Spacemacs uses a space leader for most things.
- Vim feels stagnant, even if it isn't.
- The
core featureset
of vim doesn't really needvim the application
anymore