Question

I know there are some threads about this on stackoverflow but when i write ":set list" in the editor, it seems to display hidden characters but it doesnt display the hidden characters in the code we are having problems with.

Some times now we have had some invisible symbols in our code making if loops break, i dont know how the symbols get there except from that some wierd keyboard combination much have been accidentally typed in. The code itself looks correct but the invisible symbol breaks it.

I have searched online about this but all i can find seems to be the ":set list" command in vim in addition to have to change the color of the hidden characters, but while this seems to display some hidden characters it doesnt display the problematic ones. We are getting two symbols which looks like a cross and one looks like a pistol. We have also tried to add the "draw_white_space" setting in sublime text but this only seems to display, well, whitspace like it says but the result was shown on google for showing hiden characters so i gave it a try.

The only way we have been able to see where the symbols are is with the DiffMerge tool, we have not been able to see these symbols in any other editor but we have actually been able to copy the sign to its own file and grep through all the files with the -f grep option which works, but it would be easier to display the characters in vim but using a keybinding.

Does someone have any suggestions? This is causing us to use a lot more time debugging the code when the problems is an invisible symbol.

Was it helpful?

Solution

Try the following search command:

/[^ -~<09>]

(you get the <09> by pressing the tab key). Or if you want to get rid of those nasty tabs, just:

/[^ -~]

That will find and highlight any non-ASCII or control-ASCII character.

If you still have hidden characters out there, you can try this command before the search:

:set enc=latin1

That will prevent any weird Unicode character to show up in your code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top