How do I change the default program for text files?

When I double-click a file from my project window, Unity will open up many of these with a given program, like it will open C# scripts in Visual Studio. Nice.

But when I double click a text file, this also opens up in Visual Studio.
Yeah I don’t want that.

Can I pick a different program to open text files WITHOUT changing what program opens scripts? If so, how?

You can use this editor script.

using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class OpenByExtension : MonoBehaviour
{
    [MenuItem("Assets/Open with default program")]
    private static void OpenAssetByDefaultProgram()
    {
        var selected = Selection.activeObject;
        Application.OpenURL("File:" + AssetDatabase.GetAssetPath(selected));
    }
}

Just put this in an editor folder. Right click on the item you want to open via it’s default program (provided you have set up a default program for that file’s extension type), then select ‘Open with default program’ inside the right click menu.

Go to “Preferences->External Tools”

Remove “txt” from “Extensions Handled”