Do you have to press shift+3 on UK keyboards to get #?
If so you probably need to use (kbd "M-#") and Alt+Shift+3. In Emacs land chords involving characters requiring a shift key don’t explicitly mention Shift.
You can also check what key chord Emacs registers by pressing C-h k and then the key chord you want to verify. This also tells you what commands, if any, are currently bound to the chord.
No, Shift+3 gives us the pound symbol £
Alt+3 gives us the # - well usually
Running C-h k gives me:
M-3 runs the command select-window-3 (found in window-numbering-keymap), which
is an interactive Lisp function in ‘window-numbering.el’.
It is bound to SPC 3, M-m 3, M-3.
(select-window-3 &optional ARG)
Select the window with number 3.
Which is what I am getting. However I just want Alt+3 to give me the # key.
Apparently the code in my previous post works - which makes me think I am putting it in the wrong place?
I’m still getting up to speed with Spacemacs configuration conventions (just started using it), but you might want to try putting it in ~/.spacemacs.d/init.el. Create the directory if it doesn’t already exist.
There isn’t a spacemacs directory just a .spacemacs file…
I did put it in .emacs.d/init.el (also other things I have been trying as well) and nothing I’ve put in there has worked either.
From the docs:
7.5.1 Configuration functions
Three special functions in the ~/.spacemacs file can be used to perform configuration at the beginning and end of Spacemacs loading process:
dotspacemacs/layers is called at the very startup of Spacemacs initilialization, this is where you set the Spacemacs distribution and declare layers to be used in your configuration. You can also add or excluded packages of your choice and tweak some behavior of Spacemacs loading.
dotspacemacs/init is called at the very startup of Spacemacs initialization before layers configuration. You should not put any user code in there besides modifying the Spacemacs variable values prefixed with dotspacemacs-.
dotspacemacs/user-init is called immediately after dotspacemacs/init, before layer configuration. This function is mostly useful for variables that need to be set before packages are loaded.
dotspacemacs/user-config is called at the very end of Spacemacs initialization after layers configuration. This is the place where most of your configurations should be done. Unless it is explicitly specified that a variable should be set before a package is loaded, you should place your code here.
I went in their Gitter chat and they told me that emacs keybindings are hierarchical and there are many active at once - generally speaking the ones that are more broadly active have lower priority, so global will have the lowest priority for instance. It starts with highest priority, checks for key, then it goes through the next, and so on.
So the code I actually needed was this:
;; Allow hash to be entered
(define-key window-numbering-keymap (kbd "M-3") nil)
(global-set-key (kbd "M-3") (lambda () (interactive) (insert "#")))
The first line unbinds the higher priority keymap
The second binds what I want in the global keymap
it is the only working solution for me, and it has good on-the-fly checking, means that i don’t need to save the file to see the change/diff. It is working well with flycheck as well.
Thanks for this thread! I have been using spacemacs for probably close to a year and I had never seen the words NeoTree before. Wow!
Also, I hadn’t installed Ag on this computer yet. spc s p is much faster now!
There are a few posts here about commenting lines. I usually comment lines by:
Highlighting in visual (line) mode (shift v)
spc ;
–
page up and page down are ctrl-b and ctrl-f
But I think I should get more used to using Swoop (spc-s-s) and Avy (spc-j)
VS Code has better js support and also I like markup edit in split window view. Working with markup in space macswas not so pleasant. But I use both editors with pleasure.
Has anyone been able to configure smartparens to highlight do-end blocks on cursor? My setup seems to only highlight def*-end block, which comes out ugly:
Not a showstopper, but annoying nonetheless. Somehow the auto-completion works fine (doRET inserts end).
Uh, no, you’re not actually misinterpreting me I wanted it to highlight do-end blocks instead of def*-end blocks, but as it is now the def*-end block highlighting is not even correct. I suppose it is derived from Ruby’s highlighting and broken with Elixir.