zoukankan      html  css  js  c++  java
  • sublime text 3-right click context menu

    dd a system wide windows explorer button " Edit with Sublime" similar to how Notepad++ does it or some other editors?
    See attached screenshot.

    (I know this is an old thread, but since I dropped by looking for the same information and found it elsewhere, so here goes.)
    If you've installed Sublime from the zip, follow the instructions from
    http://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/
    Scroll down to 'chapter' by the name 'All file types'.
    Taking the above page's guide as an example, you can add a shortcut key to the context menu item by adding the text you like to 'Open with Nodepad' -key's (Default) string.
    Here's my setup as exported from regedit:

    Windows Registry Editor Version 5.00
    [HKEY_CLASSES_ROOT*shellOpen with Sublime Text 2]
    @="Open with S&ublime Text 2"
    [HKEY_CLASSES_ROOT*shellOpen with Sublime Text 2command]
    @="c:\apps\tools\sublime_text.exe "%1""

    batch fie from this site:https://gist.github.com/jcppkkk/8330314

    @echo off
    @rem ==================
    @rem Source:  
    @rem     https://gist.github.com/jcppkkk/8330314
    @rem Description: 
    @rem     Install context menu to allow user opens file with Sublime Text as User or Admin, or Open Folder with Sublime Text.
    @rem Usage:
    @rem     Download this .bat file to in Sublime Text's installation folder.
    @rem     Execute this batch file. It will download elevate codes and setup context menu.
    @rem ==================
    @rem "%stPath%"   : Path to Sublime Text installation dir.
    @rem %entryName%: Key name for the registry entry.
    @rem %menuText% : Context menu text. Set your preferred menu text (e.g.: translate to your language).
    @rem %entryNameAsAdmin%: Key name for the registry entry.
    @rem %menuTextAsAdmin% : Context menu text. Set your preferred menu text for administrator privilege (e.g.: translate to your language).
     
    SET stPath=%~dp0sublime_text.exe
    SET entryName=Sublime Text
    SET menuText=Open with Sublime Text
    SET entryNameAsAdmin=Sublime Text As Admin
    SET menuTextAsAdmin=Open with Sublime Text As Admin
    SET elevate.CmdPath=%~dp0__elevate.cmd
    SET elevate.VbsPath=%~dp0__elevate.vbs
     
    echo # Administrative permissions required. Detecting permissions...
    call :check_Permissions
     
    echo # add it for all file types
    reg add "HKEY_CLASSES_ROOT*shell\%entryName%"         /t REG_SZ /v "" /d "%menuText%"   /f
    reg add "HKEY_CLASSES_ROOT*shell\%entryName%"         /t REG_EXPAND_SZ /v "Icon" /d ""%stPath%",0" /f
    reg add "HKEY_CLASSES_ROOT*shell\%entryName%command" /t REG_SZ /v "" /d ""%stPath%" "%%1"" /f
     
    echo # Download elevate scripts
    call :download "https://gist.github.com/jcppkkk/8330314/raw/3d863b0d5de7b47cb177f0571ffa232d27a3869e/__elevate.cmd" "%elevate.CmdPath%"
    call :download "https://gist.github.com/jcppkkk/8330314/raw/2b89b316d6af469db513a02d156c9a315d684fd0/__elevate.vbs" "%elevate.VbsPath%"
     
    echo # add it for all file types as admin
    reg add "HKEY_CLASSES_ROOT*shell\%entryNameAsAdmin%"         /t REG_SZ /v "" /d "%menuTextAsAdmin%"   /f
    reg add "HKEY_CLASSES_ROOT*shell\%entryNameAsAdmin%"         /t REG_EXPAND_SZ /v "Icon" /d ""%stPath%",0" /f
    reg add "HKEY_CLASSES_ROOT*shell\%entryNameAsAdmin%command" /t REG_SZ /v "" /d ""%elevate.CmdPath%" "%stPath%" "%%1"" /f
     
    echo # add it for folders
    reg add "HKEY_CLASSES_ROOTFoldershell\%entryName%"         /t REG_SZ /v "" /d "%menuText%" /f
    reg add "HKEY_CLASSES_ROOTFoldershell\%entryName%"         /t REG_EXPAND_SZ /v "Icon" /d ""%stPath%",0" /f
    reg add "HKEY_CLASSES_ROOTFoldershell\%entryName%command" /t REG_SZ /v "" /d ""%stPath%" "%%1"" /f
    pause
    goto :EOF
     
     
    :check_Permissions
    net session >nul 2>&1
    if %errorLevel% == 0 (
        echo Administrative permissions confirmed.
        goto :EOF
    ) else (
        echo Failure: Current permissions inadequate.
        echo You will need to "Run as Administrator" if using Vista/Win7/Win8.
        pause >nul
        exit
    )
    goto :EOF
     
     
    :download 
    @"C:WindowsSystem32WindowsPowerShellv1.0powershell" "$wc = New-Object System.Net.WebClient;$wc.DownloadFile('%1', '%2')"
    @echo %2
    @goto :EOF
  • 相关阅读:
    [ASP.NET Core 3框架揭秘] Options[6]: 扩展与定制
    [ASP.NET Core 3框架揭秘] Options[5]: 依赖注入
    [ASP.NET Core 3框架揭秘] Options[4]: Options模型[下篇]
    [ASP.NET Core 3框架揭秘] Options[3]: Options模型[上篇]
    [ASP.NET Core 3框架揭秘] Options[2]: 配置选项的正确使用方式[下篇]
    [ASP.NET Core 3框架揭秘] Options[1]: 配置选项的正确使用方式[上篇]
    [ASP.NET Core 3框架揭秘] 配置[9]:自定义配置源
    ASP.NET Core 3框架揭秘] 配置[8]:多样化的配置源[下篇]
    [ASP.NET Core 3框架揭秘] 配置[7]:多样化的配置源[中篇]
    [ASP.NET Core 3框架揭秘] 配置[6]:多样化的配置源[上篇]
  • 原文地址:https://www.cnblogs.com/seniortestingdev/p/3986781.html
Copyright © 2011-2022 走看看