Search code examples
sublimetext3sublimetext

How to exclude files without an extension in Sublime Text 3?


I know there is an easy way to do it for known extensions, adding it in excluded patterns in preferences like "*.jpg", but how can I do it for the binary files without any extension at all?

In example, my c compiled files are named with just "name", not "name.o" etc, so is there any trick to exclude them?


Solution

  • To exclude a file with no extension then you must manually add the exact filename for each file that you want excluded.

    Using your example, to exclude a file which is called name then add "name" to your file_exclude_patterns list like this:

    "file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", ..., "name"],
    


    Since you mention C compiled files then to avoid having to do this regularly with all your compiled executable files you can do one of several things or some combination or variation of them.

    1) Consistently use the same executable file name, for example run, regardless of what you are compiling.

    gcc example.c -o run
    
    "file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", ..., "run"],
    

    2) Choose a consistent prefix for the executable file names, for example run_.

    gcc example.c -o run_example
    gcc program.c -o run_program
    
    "file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", ..., "run_*"],
    

    3) Choose a file extension for your executables and use that consistently.

    gcc example.c -o example.out
    
    "file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", ..., "*.out"],