For what it’s worth I’ve never had Spacemacs highlight do..end
properly and it was a long time since I had “jump to matching delimiter” work with do..end
as well. It’s not a showstopper, but if someone has an easy fix that’d be cool. Even better would be if do..end
could be rainbow highlighted so you don’t even need to have the cursor on either of them to see which one matches.
Is there combination for formatting code?
How do you format?
If it’s indenting, you can auto-indent a region with =
on visual mode. In normal mode, ==
auto-indent the line your cursor is on. For indenting all lines from normal mode I use ggVG=
. There might be simpler way though.
Note: gg
(go to first line), V
(block line, to visual mode), G
(go to last line), =
(indent).
Let’s save one more keystroke gg=G
\s
Thanks, I found one more SPC j =
And I guess it does same as ggVG=
The recommended way to install emacs/spacemacs has been changed in the Spacemacs repo. I don’t think it matters that much, but anyway
$ brew tap d12frosted/emacs-plus
$ brew install emacs-plus
$ brew linkapps emacs-plus
Thanks, added to the wiki
Would love to see some Spacemacs course, similar to Spacemacs ABC where someone shows how to master it.
I would watch it if it’s short and to the point
note: brew link apps is/will be deprecated
Yes, and sadly practically all Emacs installation tutorials still have this. I personally don’t use Spotlight or Dock to launch Emacs and only use the Terminal so I always skip the linkapps step.
How are you all pasting into SpaceMacs from other apps?
So I copy say a Hex code from my design software, go to Spacemacs and double click the hex code I want to replace… then press Command V and… nothing
When ‘into’ spacemacs ‘from’ the system clipboard I just make sure in insert mode and hit Shift+Insert. ^.^
Otherwise if you want to copy or paste into or out of buffers in general, all the usual interaction (and more powerful than traditional copy/paste) hotkeys are listed at (just search copy
or paste
): spacemacs/doc/DOCUMENTATION.org at master · syl20bnr/spacemacs · GitHub
In Vim mode …
In Emacs mode you use “yank”:
- Ctrl-y (Cmd-y if you have modified your configuration to have Cmd act as Ctrl ‡)
- By default yank doesn’t replace selected text. To change that behavior you need to configure
delete-selection-mode
Look forward to having lots of Cmd-v/Cmd-y confusion in your future.
‡ (setq mac-command-modifier 'control)
Thanks both. Looks like I need this:
2.12 Prevent the visual selection overriding my system clipboard?
On some operating systems, there is only one clipboard for both copied and selected texts. This has the consequence that visual selection – which should normally be saved to the PRIMARY clipboard – overrides the SYSTEM clipboard, where normally goes the copied text. This can be corrected by adding the following code to the dotspacemacs/user-config of your .spacemacs:
(fset 'evil-visual-update-x-selection 'ignore)
How do you repeat the last command? Or even better how do you re-run a task?
I keep mix phoenix.server
running but many times I need to restart it. What I do so far is
- find the buffer where the command is running and kill that buffer
-
, m :
to run alchemist-mix - wait for the list of available mix tasks
- select or type
phoenix.server
- if error repeat
Is there any better way?
UPDATE: I made some progress with this. looking from alchemist source and trying to understand spacemac’s documentation I came up with this in my user config. It is a shortcut to run “mix phoenix.server”.
(defun alchemist-phoenix-server ()
(interactive)
"Run the Mix task 'phoenix.server'"
(alchemist-mix-execute '("phoenix.server")))
(spacemacs/set-leader-keys-for-minor-mode 'alchemist-phoenix-mode (kbd "n S") 'alchemist-phoenix-server)
Heck, it even restarts the phoenix.server by killing the previous mix task. The problem I have now is that it runs by typing Spc n S
instead of C-c a n S
like the rest of the phoenix-mode commands.
I try to figure it from the documentation but I don’t understand exactly how to register it there. I tried “C-c n S” but it doesn’t work. It insists on prefixing with space.
Try:
(global-set-key (kbd "C-c a n S") 'alchemist-phoenix-server)
That said, fwiw, most of the alchemist commands are bound under ,
(assuming vim mode) while in elixir files in spacemacs. You could use spacemacs/set-leader-keys-for-major-mode
to put it there, I think.
Have you enabled 256 color mode? This is how my emacs looks when I use a boring 16 color terminal!
If you use PuTTY, then be sure to tick “Allow terminal to use xterm 256-color mode” under Settings → Window → Colours
http://www.robmeerman.co.uk/unix/256colours#so_does_terminal_insert_name_here_do_256_colours
I did that and now I get
Error in dotspacemacs/user-config: Key sequence C-c a n S starts with non-prefix key C-c a
For now I have settled with these lines
(spacemacs/set-leader-keys-for-minor-mode 'alchemist-phoenix-mode "o p" 'alchemist-phoenix-server)
(spacemacs/set-leader-keys-for-major-mode 'mode-run "o p" 'alchemist-phoenix-server)
and I can run phoenix server when on a phoenix project with -o-p.
Sorry, I should have tested. This should work:
(with-eval-after-load 'alchemist
(define-key alchemist-mode-keymap (kbd "n S") 'alchemist-phoenix-server))
Two things, you need the with-eval-after-load
to ensure that you’re running that code after alchemist is loaded. The second is that you need to add to the alchemist-mode-keymap
to get it under C-c a
.