back-to-indentation bound to M-u.
When I hold Shift with M-u I'm unable to select the text because M-U (note the capital 'U') is bound to
So I disabled that bind by putting:
(global-set-key (kbd "M-U") 'ignore) in my init file.
But by doing so, holding Shift with M-u now does nothing.
So how can I disable a keybind getting in the way of shift selecting with my custom cursor moving keybind?
As noted by @Maxim Kim, it should be as simple as
(global-set-key (kbd "M-u") 'back-to-indentation)
The fact that it's not that simple implies there is a collision happening somewhere in your configuration.
Here's how we can tell if it's a collision: start Emacs using
emacs -q. That loads Emacs without loading
init.el. Run the above code. If things work as you expect, then there's something in your configuration that's overriding the desired behavior.
Finding where the problem is exactly can be tricky. I find it helpful to select half of my
init.el and then do
eval-region. If the problem occurs, then we know the conflict is introduced in the first half of the code. I then select half of the first half of the code and do
eval-region again. Eventually, you find the offending line(s) and can begin researching the specific cause.
Sometimes when there's a collision, the simplest solution is to find an alternative. While I don't think that's necessary in your case, here are a few options that provide identical/similar functionality.
It seems like
back-to-indentation does the same thing as
^ does in
evil-mode, namely placing point at the first non-white character.
Alternatively, here's a script from my
init.el, garnered from some kind soul on the Internet:
(defun smart-beginning-of-line () "Move point to first non-whitespace character or beginning-of-line. Move point to the first non-whitespace character on this line. If point was already at that position, move point to beginning of line." (interactive) (let ((oldpos (point))) (back-to-indentation) (and (= oldpos (point)) (beginning-of-line)))) (global-set-key [home] 'smart-beginning-of-line) (global-set-key "\C-a" 'smart-beginning-of-line)
(global-unset-key (kbd "M-U"))? (It is equivalent to
(global-set-key (kbd "M-U") nil).)