EzDevInfo.com

sublime-text-2 interview questions

Top sublime-text-2 frequently asked interview questions

Hide build results window in Sublime Text 2

After a build command (control + b) a window with results appear. Is there any way (not automatically but by shortcut or using another command) to hide it?


Source: (StackOverflow)

How to have Sublime Text 2 show git folders and files in the sidebar?

When adding a folder to a Sublime Text 2 project, it doesn't seem to show .git subfolders. It also seems these files cannot be opened by Ctrl-P.

I disabled the Git plugin but that didn't help.


Source: (StackOverflow)

Advertisements

How do I assign a keyboard shortcut to recorded macro in Sublime Text

I have a bunch of macros which I have recorded and saved in Sublime Text 2. I'm trying to assign keyboard shortcuts to each of those, but I'm kind of lost as to how to go about doing this,

I had a look at

but that explains how to set Key bindings for existing commands.

What should I set to have it run a macro?


Source: (StackOverflow)

Opposite of CTRL+D in Sublime Text 2

In Sublime Text 2, one may extend selection to include the next occurence of the current selection with CTRL+D.

I often find myself pressing this one too many times, necessitating I clear selection and start again, albeit more carefully.

Is there an opposite shortcut that removes the most recently added selection from the current selection?


Source: (StackOverflow)

Can I right-click a folder in Windows 7 and choose "Open with Sublime Text"?

In Windows 7, I can do this at the command line:

"c:\Program Files\Sublime Text 2\sublime_text.exe" samplefolder

This launches a Sublime Text window, with the contents of samplefolder loaded in Sublime's sidebar.

While this works as needed, it's inconvenient to open a command prompt every single time. Is there any way I can add this behavior to Windows Explorer's right-click menu? I'd like to be able to right-click a folder and "Open with Sublime" just like I can right-click a folder and "Scan for viruses".


Source: (StackOverflow)

Turn Off Parenthesis Matching in Sublime Text 2

I have questions about turn off parenthesis matching. Does anyone know how to turn off parenthesis matching?

example:

When I type a (, it will automatically add ), becomes ().

It's pretty nice for editing plain text. But quite annoying while editing clojure files.


Source: (StackOverflow)

Search and replace with TAB character in Sublime Text 2

In Sublime Text 2, I want search and replace by the TAB character.

I tried replacing with \t char but it's not working.

How can I do it?


Source: (StackOverflow)

How to open file using only keyboard in Sublime Text?

How do I open a file using only keyboard in Sublime Text 2/3?

Looking for equivalent of <Esc>:e /path/to/file from Vim.


Source: (StackOverflow)

Sublime Text 2: Disable cursor position overwriting characters (like vim replace mode)

I'm not sure how, but I managed to get Sublime Text into a 'Replace Mode' which at whatever position the cursor is at, it overwrites the next character with whatever you press instead of inserting it.

How do return back to 'Insert' mode?

I couldn't see any option for it in the menu and searching on Google yielded completely irrelevant results.

For the record, I'm using OS X Mountain Lion, and I have the non-extended keyboard (without the number pad).


Source: (StackOverflow)

Autoindentation in Sublime 2 text editor

Is there an auto indentation option in Sublime 2?

In Visual Studio I can press Ctrl+K+D to indent everything so the code is structured nicely. Is there a shortcut in Sublime 2 to do the same?


Source: (StackOverflow)

Is there an HTML auto-indentation feature or plugin for Sublime Text (aka prettify/beautify/format)?

For example, something to change:

<section><article><h1></h1><p></p></article></section>

to:

<section>
  <article>
    <h1></h1>
    <p></p>
  </article>
</section>

...that works on full pages and snippets.

  • The built in Edit > Line > Reindent setting doesn't do this
  • The plugin HTMLTidy adds head and body tags, so it doesn't work for partials, it also has various other issues
  • The plugin Tag has various issues, enough that it essentially doesn't work
  • The plugin HTMLPrettify has various issues, requires node.js, and hasn't been updated in months
  • gist.github.com/mcdonc/3898894 claims to do it, but requires Emacs

(Notepad++ had auto-indent, Dreamweaver had Apply Source Formatting, Aptana has Format, etc.)

The Tag plugin handles inline tags incorrectly, for example using it on this snippet:

<p>foo<a>bar<span>baz<span>qux</span></span></a></p>

results in:

<p>
    foo
    <a>
        bar
        <span>
            baz
            <span>qux</span>
        </span>
    </a>
</p>

Source: (StackOverflow)

Set current language without saving file in Sublime Text

I have recently started using Sublime Text 2 after getting tired with Notepad++. Now, if I wanted to set what language I am currently programming in in Notepad++, I would go to the Language menu, and select whichever language I wanted. But in Sublime, the only way I have found out how to do that is to save the file in the file format of the language, and then all the colouring and other syntax helpers are loaded. So, is there any way I can change the language I am writing in without saving? If so, how?

This is mainly because I want to play around with test scripts which don't need saving.


Source: (StackOverflow)

How to prevent ST2 from searching in excluded folders?

I've got a sublime-project like this:

{
   "folders":
   [
      {
         "path": ".",
         "folder_exclude_patterns": ["_doc", "cache", "logs", "_release"],
         "file_exclude_patterns": ["*.sublime-workspace"]
      }
   ]
}

In particular I'm excluding _doc, _release, etc. from the project. They seem to be excluded fine since they don't show up in the side bar. However, when I do a search, ST also searches in these folders and returns all kind of unrelated results.

For instance, if I do this search:

I get results such as this, even though the file is in the _doc folder, which has been excluded:

Any idea how to avoid this?


Source: (StackOverflow)

How to make Sublime Text 2 spell check comments only?

The built-in spell check feature seems to be running over the whole code, underlining lots of text that is supposed to be that way i.e. the code itself.

Any way to limit it to just comments (//)?


Source: (StackOverflow)