Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 3 - Open CMD prompt at current or project directory (Windows)

Solution for Sublime Text 2 is here Sublime Text 2 - Open CMD prompt at current or project directory (Windows) .But this script is not working in ST3.

like image 430
Vikrant Singh Avatar asked Aug 23 '13 10:08

Vikrant Singh


People also ask

How do I open command prompt in Sublime Text 3?

Open any program file in the sublime editor and Right-click (context menu). You can see the Cmd menu in the Context menu options. Click on it. The command prompt will be opened through which you can compile and run your program.

How do I open command prompt anywhere in Windows?

That's all for adding the WIndows 10 open command prompt. When you press shift and right-click anywhere on your windows background, you will have an option of 'Open command window here' as shown in the following screenshot from Windows 10.

How do I open the console in Sublime Text?

Use Ctrl + ' to open the console. When Ctrl + ` is pressed, Sublime Text does not receive anything.


1 Answers

A simpler solution is to install SublimeREPL, there is a shell REPL. You can add keymap to your user config. However this open the shell inside Sublime.

If your prefer, the old script is still working. Instead of put them(cmd.py & Context.sublime-menu) in a cmd directory, you put them under Cmd directory, which should be capitalized.

And I simplified the script, here:

import os, sublime_plugin

class CmdCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        path, _ = os.path.split(self.view.file_name())
        os.chdir(path)
        os.system('cmd')
like image 173
Kabie Avatar answered Jan 04 '23 10:01

Kabie