Sublime as default editor

前端 未结 11 1996
误落风尘
误落风尘 2021-01-29 18:05

Is there a way to set Sublime Text as the default text editor for file formats on Windows 7?

Also, if anyone knew a Sublime Text Tutorial or Wiki that would be really he

相关标签:
11条回答
  • 2021-01-29 18:42

    Actually it is not my answer, I have just googled it:

    1. Open regedit (Win+R, type "regedit", select OK).
    2. Navigate to HKEY_CLASSES_ROOT\Applications\sublime_text.exe\shell\open\command
    3. Verify that the path is accurate, correct it if it is not. Exit regedit.
    4. Open task manager via Ctrl+Alt+Del (or Ctrl+Shift+Esc for later versions of Windows), kill explorer.exe, go to run (Win+R) and type "explorer.exe" (or skip this step and simply reboot).
    5. Now attempt the same thing, right click a text file, open with, navigate to sublime, and it should now appear in the list of available applications.

    For me that value pointed to the Desktop where portable version previously was placed. Thus it just didn't work.

    P.S. And for me the reboot or logout were not necessary (WinXP).

    0 讨论(0)
  • 2021-01-29 18:44

    Edit on Nov 21, 2014

    Tim Lewis pointed out in the comment that there is a more generic version at http://www.binaryfortress.com/NotepadReplacer/, which works better.

    Original Answer

    Try this: https://github.com/grumpydev/Sublime-Notepad-Replacement

    0 讨论(0)
  • 2021-01-29 18:44

    Try this,

    @echo off
    
    SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
    
    rem add it for all file types
    @reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2"         /t REG_SZ /v "" /d "Open with Sublime Text 2"   /f
    @reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2"         /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
    @reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
    
    rem add it for folders
    @reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2"         /t REG_SZ /v "" /d "Open with Sublime Text 2"   /f
    @reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2"         /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
    @reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
    
    pause
    

    I tested this for SublimeText 3(Portable) also and working fine. Create a .bat file with the above code and run it as administrator.

    Reference : https://gist.github.com/mrchief/5628677

    0 讨论(0)
  • 2021-01-29 18:45

    1: You can also set your associations in Control Panel:

    Control Panel > Default Programs > Associate a file or protocol with a specific program:

    enter image description here

    2: Or, call it from code via IApplicationAssociationRegistrationUI::LaunchAdvancedAssociationUI ;)

    HRESULT LaunchAdvancedAssociationUI(
       [in]  LPCWSTR pszAppRegName
    );
    
    0 讨论(0)
  • 2021-01-29 18:46

    I was facing the same problem. the only solution was correct it manually --> open regedit and navigate to Computer\HKEY_CLASSES_ROOT\Applications\, find the sublime_text.exe entry, and delete it. You should now be able to set Sublime Text 3 as the default editor for anything you want.

    i found this solution in this post:https://forum.sublimetext.com/t/cant-make-default-editor-in-windows/10747/14

    0 讨论(0)
  • sublime can be set as the default text editor by following these steps:

    1. right-click on the .txt file and select properties.
    2. then in Open with: option click on Change.
    3. if the sublime is listed in the list of apps then select it, if not scroll down and click on the look for another app on this PC and select the sublime app file
    0 讨论(0)
提交回复
热议问题