Is There A Command For Show Invisibles?


#1

Is there a command available to key mapping for toggling the display of invisibles in the editor. A Show/Hide Invisibles command?

Where would I go to look for such a command?


#2

There is a setting, but no command to my knowledge. Though, since settings are live-reloaded … it wouldn’t be too hard to create a command for this, I would think.


#3

I whipped together a package that creates the command toggle-invisibles:toggle. You can map it to whatever key you like:

https://atom.io/packages/toggle-invisibles


#4

Cool! And Thank You!

I set up a keybinding like this:

'.editor':
  'ctrl-i': 'toggle-invisibles:toggle'

And the Key Binding Resolver shows that it fired. But it didn’t show/hide invisibles. Should the scope have been ‘.workspace’ instead of ‘.editor’?


#5

Does it work from the command palette?


#6

No. Not for me. It’s there, and I can select it, but it doesn’t work.


#7

It appears to show/hide the tab indent markers, but not such things as tabs, spaces or returns.


#8

Perhaps you have some other package that is showing the invisibles in a different manner. All I’m doing is toggling the editor.showInvisibles setting.


#9

Try adding this to your stylesheet …

.editor {
  .invisible-character {
    color: #c5c8c6;
    opacity: 0.3;
  }
}

#10

That was the problem. Thanks!


#11

If anybody else has key-bindings issues (like I did), be sure to use the more specific selector:

'.editor:not(.mini)':
    'ctrl-a': 'toggle-invisibles:toggle'

#12

I solved this by creating a custom command and adding the appropriate keybinding…

In init.cofee add

atom.commands.add 'atom-text-editor',
  'settings:toggle-show-invisibles': (event) ->
    invisibles = atom.config.get('editor.showInvisibles')
    atom.config.set('editor.showInvisibles', !invisibles)

In keymap.cson add

'.workspace .editor:not(.mini), .workspace, .platform-darwin, .platform-win32, .platform-linux':
  'cmd-i': 'settings:toggle-show-invisibles'

#13

What happened to this package?


#14

See the README:

Since the functionality provided by this package is now available in Atom proper, I have unpublished it. I’m leaving it publicly available as an example of a simple package.


#15

I still don’t see a command for toggling invisibles in the command pallet, though.


#16


#17

Ah. I was searching for “show invisibles”. Thanks.


#18

I wasn’t able to find this panel. If anyone else has this problem just press:
Cmd + Shift + P if you are mac or Ctrl + Shift + P in Windows


#19

Yes, it is called the Command Palette and it is discussed here in the Atom Flight Manual:

http://flight-manual.atom.io/getting-started/sections/atom-basics/#command-palette


#20
'cmd-i': 'toggle-invisibles:toggle'

Is not working for me; I can find Window: Toggle Invisibles via the Command Palette but I am unable to tie it into the keymap. What am I missing?