How can I write a non-breaking space?

Once upon a time I told my debian fairy that I want compose instead of caps lock and typing compose space space now gives me the super solid unbreakable space:

compose space space ! compose space space ! compose space space ! compose space space ! compose space space ! compose space space ! compose space space ! compose space space !

For debianish systems have a look into /etc/default/keyboard, I have the following assigment there: XKBOPTIONS="compose:caps".

Alternatively, if you're using KDE, the "advanced" tab, of the kcmshell4 kcm_keyboard command lets you configure what key to map to compose.

This setting affects the text terminals too... at least in debian...


Try Shift-space. If this doesn't work with your configuration, you can modify it by specifying

key <SPCE> { [ space, nobreakspace ] };

in XKB symbol settings.

My explanations on how to change XKB settings.

Note also that applications should not do line breaking under certain conditions, such as before a question mark, even after a normal space (as described in the Unicode Line Breaking Algorithm), so that the non-breaking space could be unnecessary; unfortunately, most applications do not follow this behavior. The non-breaking space U+00A0 is just an explicit non-breaking space; it doesn't mean that a normal space character is always breaking.