This is a custom spacemacs configuration, optimized for C/C++ development.
To install, git clone the repository:
git clone https://github.com/dp12/spacemacs.git ~/.spacemacs.d
Name | Description |
---|---|
keymap | Adds special keymappings, using key-chord and hydra. |
progconfig | Configurations for programming modes and related packages. |
Setup for using mu4e as a mail client in emacs. | |
search | Initializes packages for search and navigation, e.g. dumb-jump, treemacs, and dired. |
text-editing | Useful snippets and packages for text manipulation. |
custom | Personal packages and configurations. Comment out in dotspacemacs-configuration-layers if unused. |
This is a non-comprehensive list of some useful keybindings in this spacemacs configuration.
The following are some of my favorite built-in spacemacs commands:
Keybinding | Description |
---|---|
SPC a u | Open undo-tree visualizer. |
SPC c h | Toggle hiding all comments. |
SPC f E | Edit file as sudo. |
SPC g h t | Launch smeargle (shows newer hunks with lighter background). |
SPC g s | Launch magit (emacs git interface). |
SPC h k | Show the high-level keymap. |
SPC k s | Slurp forward. |
SPC t - | Toggle centered point. |
SPC t d | Toggle hungry delete. |
SPC t f | Show fill column. |
SPC t n | Toggle line numbers. |
SPC t r | Toggle relative line numbers. |
SPC t w | Toggle whitespace mode. |
SPC x a c | Align the current region. |
SPC x d w | Delete trailing whitespace. |
SPC x l s | Sort lines. |
vio | Select current symbol (Spacemacs special text object). |
Custom keybindings, vanilla emacs-style:
Keybinding | Description |
---|---|
vv | other-window. Key-chord for switching to the other window; a much faster and ergonomic way of doing C-x o . |
qr | query-replace. Lets you enter a string and the string to replace it with. Press y to do replace on the current selection and go to next instance, n to skip replacing and go to next instance, and , to replace, but stay at the current location. |
M-; | comment-or-uncomment-region-or-line. A saner way of commenting code in emacs. |
M-. | ggtags-find-tag-dwim. If the cursor is over a function call, jump to its definition. Pop back to your original cursor location with M-* (it's a stack, so you can pop out repeatedly). If the cursor is over a function definition, it finds the first reference (place where function is used). Use M-n and M-p to navigate between multiple references. Requires GNU Global to be installed. |
qw | pop-tag-mark. Key-chord to pop a tag from the taglist after doing a find-tag invocation to jump back to the previous location. |
M-z | zop-to-char. Kills text up to a character of your choice. |
M-n | dired-narrow. Allows you to type in a pattern to filter out dired results. Press g to revert-buffer and restore the original dired listing. |
a | ag. In a dired buffer, press this key to ag search recursively in all files under that directory. |
W | wdired-change-to-wdired-mode. Use this to treat your filesystem like ordinary text and rename files in dired! |
C-c g | counsel-git. Fast fuzzy file finder like Vim's ctrl-p or Sublime Text's Cmd-T. |
C-x f | recentf-open-files. Lists your most recent files opened. Press a number from 0-9 to open the file you want. |
C-c n | hydra-git-gutter+. Go to the next git-gutter+ hunk. Very useful for viewing and staging your unstaged changes in a file. Use i to show hunks inline, s to stage hunks, and v to revert hunks. |
M-0 | corral-parentheses-forward. Wrap whatever symbol your cursor is on in parentheses. To "wrap-at-point" from your cursor position to the end of the word, use C-M-0 . |
Custom keybindings for evil:
Keybinding | Description |
---|---|
n | avy. With avy, press any character that you want your cursor jump to on the screen and then press the corresponding character that shows up. Once activated, lets you jump anywhere on your screen in usually two keystrokes. |
s | evil-snipe-s. Lets you jump to any location, as selected by two consecutive characters. Keep pressing s to get to the next match. |
SPC b x | ace-swap-window. If you have two buffers, use this to exchange their positions. |
SPC d o | dired-jump-other-window. Opens up dired for the current directory in another window. Pro tip: if you want to open up the same file in the other window, just do SPC d o RET . |
SPC D D | kill-dired-buffers. Custom function to kill all dired buffers. |
SPC e d | ediff-buffers. With two buffers open, you can diff them easily with this command. |
SPC b k | hydra-buffer-kill. Launch a special hydra for killing buffers quickly. |