sublime

prevent debug info in output window on build

in run-script.sublime-build

{
    "shell_cmd": "./build.sh",
    "quiet": true
}

scope info

Option+Cmd+P

Select all text between quotes/brackets?

(multiline select until next quote) Ctrl+Shift+Space !!!!!

use specific python version for running python script

make a custom my_build.sublime-build file in the 'User' folder that can be accessed through 'Browse Packages...'

{
   "cmd": ["/Users/rickcompanje/.pyenv/shims/python3", "$file", ""]
}

config files including build-system OSX

escaped: ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User
not escaped: ~/Library/Application Support/Sublime Text 3/Packages/User

undo on all open files

len([v.run_command("revert") for v in window.views()])

Javascript Intenter

  • install formatjs
  • set shortcut in user key bindings: { "keys":["super+shift+r"], "command": "js_format"}

subl:// protocol handler

https://support.shotgunsoftware.com/hc/en-us/articles/219031308-Launching-applications-using-custom-browser-protocols

met de Apple Script Editor -> Export as .app:

on open location this_URL
  do shell script "~/bin/sublimeTextLauncher.sh '" & this_URL & "'"
end open location

Show Package Contents -> add to info.plist:

<key>CFBundleIdentifier</key>
<string>nl.companje.SublimeTextLauncher</string>
<key>CFBundleURLTypes</key>
<array>
  <dict>
  <key>CFBundleURLName</key>
  <string>SublimeText Launcher</string>
  <key>CFBundleURLSchemes</key>
  <array>
    <string>subl</string>
  </array>
</dict>
</array>

build system

{
   "cmd": ["make"],
   "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
   "working_dir": "${project_path:${folder:${file_path)}",
   "selector": "source.makefile",
   "variants":
    [
      {
        "name": "Run",
        "cmd": ["make", "run"]
      }
    ]
}

Disable Hex view for binary filesAdd to settings:

"enable_hexadecimal_encoding": false

On Linux

  • Alt+O: toggle Header/Source
  • Ctrl+P: jump to anything

Keyboard shortcuts

shortcut for reindent

in Preferences->User [ { "keys": ["super+alt+enter"], "command": "reindent" , "args": { "single_line": false } } ]

don't open new window

In Preferences->Settings User change add:

    "open_files_in_new_window": false,

tips

formatting code

use sublime from terminal in osx

See [[http://www.sublimetext.com/docs/2/osx_command_line.html|this page]]

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

and add ~/bin to your path for example:

# ~/.bash_profile
export PATH=~/bin:$PATH

compile c++ files

see https://gist.github.com/1566100

Splitting the Selection into Lines

Select a block of lines, and then split it into many selections, one per line, using Ctrl+Shift+L, or Command+Shift+L on OS X. [[http://www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html|source]]

Build using makefile and getting this error: No targets specified and no makefile found. Stop.

the current directory might be wrong.

openscad

see [[openscad]]