OLD | NEW |
(Empty) | |
| 1 # Linux Sublime Dev |
| 2 |
| 3 Sublime Text is a fast, powerful and easily extensible code editor. Check out |
| 4 some [visual demos](http://www.sublimetext.com) for a quick demonstration. |
| 5 |
| 6 You can download and install Sublime Text 3 from the [Sublime Text |
| 7 Website](http://www.sublimetext.com/3). Assuming you have access to the right |
| 8 repositories, you can also install Sublime via apt-get on Linux. Help and |
| 9 general documentation is available in the [Sublime Text 3 |
| 10 Docs](http://www.sublimetext.com/docs/3/). |
| 11 |
| 12 Sublime can be used on Linux, Windows and Mac as an IDE for developing Chromium. |
| 13 Here's what works: |
| 14 |
| 15 * Editing code works well (especially if you're used to it and get used to the |
| 16 shortcuts). |
| 17 * Navigating around the code works well. There are multiple ways to do this (a |
| 18 full list of keyboard shortcuts is available for [Windows/Linux](http://docs |
| 19 .sublimetext.info/en/latest/reference/keyboard_shortcuts_win.html) and |
| 20 [Mac](http://docs.sublimetext.info/en/latest/reference/keyboard_shortcuts_os
x.html)). |
| 21 * Building works fairly well and it does a decent job of parsing errors so |
| 22 that you can click and jump to the problem spot. |
| 23 |
| 24 [TOC] |
| 25 |
| 26 ## Setup |
| 27 |
| 28 ### Configuring Sublime |
| 29 |
| 30 All global configuration for Sublime (including installed packages) is stored in |
| 31 `~/.config/sublime-text-3` (or `%APPDATA\Sublime Text 3` on Windows, or |
| 32 `~/Library/Application Support/Sublime Text 3` on Mac). We will reference the |
| 33 Linux folder for the rest of this tutorial, but replace with your own path if |
| 34 using a different OS. If you ever want a clean install, just remove this folder. |
| 35 |
| 36 **Warning**: If you have installed a license key for a paid version Sublime |
| 37 Text, removing this folder will delete the license key, too. |
| 38 |
| 39 Most of the packages you will install will be placed in `~/.config/sublime- |
| 40 text-3/Packages/User`, where Sublime Text can detect them. You can also get to |
| 41 this folder by selecting `Preferences > Browse Packages...` (or `Sublime Text > |
| 42 Preferences > Browse Packages...` on Mac). |
| 43 |
| 44 ### A short word about paths |
| 45 |
| 46 Certain packages require executables to be on your `PATH`, but Sublime gets the |
| 47 `$PATH` variable from a login shell, not an interactive session (i.e. your path |
| 48 needs to be set in `~/.bash_profile`, `~/.zprofile`, etc, not `~/.bashrc`, |
| 49 `~/.zshrc`, etc). For more info, see |
| 50 [Debugging Path Problems](http://sublimelinter.readthedocs.io/en/latest/troubles
hooting.html#debugging-path-problems). |
| 51 |
| 52 ### Editing Preferences |
| 53 |
| 54 Sublime configuration (including project files, key bindings, etc) is done via |
| 55 JSON files. All configurations have a Default config (usually provided with the |
| 56 program or package to document the available commands) and a User config |
| 57 (overrides the default; this is where your overrides go). For example, select |
| 58 `Preferences > Settings - Default` to see all the available settings for |
| 59 Sublime. You can override any of these in `Preferences > Settings - User`. |
| 60 |
| 61 Here are some settings that help match the Chromium style guide: |
| 62 ``` |
| 63 { |
| 64 // Basic Chromium style preferences |
| 65 "rulers": [80], |
| 66 "tab_size": 2, |
| 67 "trim_trailing_white_space_on_save": true, |
| 68 "ensure_newline_at_eof_on_save": true, |
| 69 "translate_tabs_to_spaces" : true, |
| 70 |
| 71 // Optional, but also useful, preferences |
| 72 "always_show_minimap_viewport": true, |
| 73 "bold_folder_labels": true, |
| 74 "draw_white_space": "all", |
| 75 "enable_tab_scrolling": false, |
| 76 "highlight_line": true, |
| 77 } |
| 78 ``` |
| 79 |
| 80 The settings will take effect as soon as you save the file. |
| 81 |
| 82 #### Tips |
| 83 * `View > Side Bar > Show Open Files` will add a list of open files to the top |
| 84 of the sidebar |
| 85 * ``Ctrl+` `` will show the console; it shows errors and debugging output, and |
| 86 you can run Python |
| 87 * `View > Distractio-Free Mode` goes into fullscreen and removes Sublime's |
| 88 header and footer |
| 89 * `View > Layout > ...` changes the configuration of files you can open side- |
| 90 by-side |
| 91 * `Ctrl + P` (`Cmd + P` on Mac) quickly opens a search box to find a file or |
| 92 definition |
| 93 * `Alt + O` (`Alt + Cmd + Up` on Mac) switches between the source/header file |
| 94 * `Alt + PageUp`/`Alt + PageDown` (`Alt + Cmd + Left`/`Alt + Cmd + Right` on |
| 95 Mac) moves between tabs |
| 96 * `F12` (`Alt + Cmd + Down` on Mac) goes to the symbol's definition |
| 97 * With text selected, `Ctrl + D` will multi-select the next occurrance (so |
| 98 typing in one types in all of them), and `Ctrl+U` deselects |
| 99 * Similarly, after finding something with `Ctrl + F`, `Alt + Enter` will |
| 100 select all occurrances of the search query, which can be multi-edited |
| 101 * `Ctrl + X` without anything selected cuts the current line, then move to a |
| 102 different line and `Ctrl + V` pastes it below the current line |
| 103 |
| 104 ### Setting Sublime as the default Terminal editor |
| 105 |
| 106 Add `export EDITOR="subl -w"` to your `~/.bashrc` file (or similar) to open git |
| 107 commit messages, gn args, etc with Sublime Text. Since you may want to only open |
| 108 sublime when using a non-SSH session, you can wrap it in the following: |
| 109 |
| 110 ``` |
| 111 if [ "$SSH_CONNECTION" ]; then |
| 112 export EDITOR='vim' |
| 113 else |
| 114 export EDITOR='subl -w' |
| 115 fi |
| 116 ``` |
| 117 |
| 118 ### Installing the Package Manager |
| 119 |
| 120 The Sublime Package Manager is the way most Sublime packages are installed and |
| 121 configured. You can install the package manager by following in the |
| 122 [installation instructions](https://packagecontrol.io/installation) on their |
| 123 website. Once the package manager is installed, restart Sublime. |
| 124 |
| 125 To install a package, press `Ctrl + Shift + P` and select `Package Manager: |
| 126 Install Package` (the string match is fairly leniant; you can just type |
| 127 `"instp"` and it should find it). Then type or select the package you want to |
| 128 install. |
| 129 |
| 130 #### Mac Paths Fix |
| 131 |
| 132 There is a known bug on Mac where Sublime doesn't detect the current path |
| 133 correctly. If you're using Mac, install the package `SublimeFixMacPath` to find |
| 134 the path from your `~/.bashrc` file or similar. |
| 135 |
| 136 ## Making a New Project |
| 137 |
| 138 Once you have a copy of the Chromium checkout, we'll make a new Sublime project |
| 139 with the src directory as the root. |
| 140 |
| 141 To do this, create a new file `chromium.sublime-project` (or whatever name you'd |
| 142 like) in the folder above your `src/` directory, with the following contents |
| 143 (the exclude patterns are needed - Sublime can't handle indexing all of Chrome's |
| 144 files): |
| 145 |
| 146 ```json |
| 147 { |
| 148 "folders": [ |
| 149 { |
| 150 "name": "chromium", |
| 151 "path": "src", |
| 152 "file_exclude_patterns": |
| 153 [ |
| 154 "*.vcproj", |
| 155 "*.vcxproj", |
| 156 "*.sln", |
| 157 "*.gitignore", |
| 158 "*.gitmodules", |
| 159 "*.vcxproj.*", |
| 160 ], |
| 161 "folder_exclude_patterns": |
| 162 [ |
| 163 "build", |
| 164 "out", |
| 165 "third_party", |
| 166 ".git", |
| 167 ], |
| 168 }, |
| 169 { |
| 170 "name": "Generated Files", |
| 171 "path": "src/out/Debug/gen", |
| 172 }, |
| 173 ], |
| 174 } |
| 175 ``` |
| 176 |
| 177 If you are working on Blink, or any other third-party subproject, you can add it |
| 178 as a separate entry in the `folders` array: |
| 179 |
| 180 ```json |
| 181 { |
| 182 "name": "blink", |
| 183 "path": "src/third_party/WebKit", |
| 184 } |
| 185 ``` |
| 186 |
| 187 Once you've saved the file, select `Project > Switch Project` and navigate to |
| 188 the `chromium.sublime-project` file. |
| 189 |
| 190 ### Code Linting with CPPLint (Chromium only) |
| 191 |
| 192 **Note:** CPPLint enforces the Google/Chromium style guide, and hence is not |
| 193 useful on third_party projects that use another style. |
| 194 |
| 195 1. Install the SublimeLinter package (`Ctrl + Shift + P > Install Package > |
| 196 SublimeLinter`). |
| 197 1. `cpplint` should be somewhere on your path so that SublimeLinter finds it. |
| 198 depot_tools includes `cpplint.py`, but it needs to be named `cpplint`, so on |
| 199 Linux and Mac you have to make a symlink to it: |
| 200 |
| 201 ```shell |
| 202 cd /path/to/depot_tools |
| 203 ln -s cpplint.py cpplint |
| 204 chmod a+x cpplint |
| 205 ``` |
| 206 |
| 207 1. Install the SublimeLinter-cpplint package (`Ctrl + Shift + P > Install |
| 208 Package > SublimeLinter-cpplint`). |
| 209 |
| 210 Now when you save a C++ file, red dots should appear next to lines that |
| 211 invalidate the style. You can change this behavior with Choose Lint Mode (`Ctrl |
| 212 + Shift + P > "lint mode"`). |
| 213 |
| 214 You can also see and navigate all the linter errors with Show All Errors (`Ctrl |
| 215 + Shift + P > "show all"`). You can also use Next Error/Previous Error (and |
| 216 their associated shortcuts) to navigate the errors. The gutter at the bottom of |
| 217 the screen shows the message for the error on the current line. |
| 218 |
| 219 You can also change the style of dot next to the line with Choose Gutter Theme |
| 220 (`Ctrl + Shift + P > "gutter"`) |
| 221 |
| 222 For a list of all preferences, see `Preferences > Package Settings > |
| 223 SublimeLinter > Settings - Default` (or `Settings - User` to edit your |
| 224 preferences). |
| 225 |
| 226 ### Format Selection with Clang-Format (Chromium only) |
| 227 |
| 228 **Note:** Like CPPLint, Clang-format enforces the Google/Chromium style guide, |
| 229 and hence is not useful on third_party projects that use another style. |
| 230 |
| 231 1. Inside `src/`, run: |
| 232 |
| 233 ```shell |
| 234 cd /path/to/chromium/src |
| 235 cp buildtools/clang_format/script/clang-format-sublime.py ~/.config/sublime-
text-3/Packages/User/ |
| 236 ``` |
| 237 |
| 238 1. This installs a plugin that defines the command "clang\_format". You can add |
| 239 the "clang\_format" command to `Preferences > Key Bindings - User`, e.g.: |
| 240 |
| 241 ```json |
| 242 [ |
| 243 { "keys": ["ctrl+shift+c"], "command": "clang_format" }, |
| 244 ] |
| 245 ``` |
| 246 |
| 247 2. Select some text and press `Ctrl + Shift + C` to format, or select no text to |
| 248 format the entire file |
| 249 |
| 250 ## Code Completion with SublimeClang (Linux Only) |
| 251 |
| 252 SublimeClang is a powerful autocompletion plugin for Sublime that uses the Clang |
| 253 static analyzer to provide real-time type and function completion and |
| 254 compilation errors on save. It works with Chromium with a script that finds and |
| 255 parses the appropriate *.ninja files to find the necessary include paths for a |
| 256 given file. |
| 257 |
| 258 **Note**: Currently, only the Linux setup of SublimeClang is working. However, |
| 259 there are instructions below for Windows/Mac which you are welcome to try -- if |
| 260 you can get them to work, please update these instructions ^_^ |
| 261 |
| 262 More information on SublimeClang's functionality (including keyboard shortcuts) |
| 263 can be found on the [SublimeClang GitHub |
| 264 page](https://github.com/quarnster/SublimeClang). |
| 265 |
| 266 ### Mac (not working) |
| 267 |
| 268 1. Install cmake if you don't already have it |
| 269 1. Install XCode |
| 270 1. Copy libclang.dylib from XCode to the SublimeClang/internals folder: |
| 271 |
| 272 ```shell |
| 273 cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages |
| 274 git clone --recursive https://github.com/quarnster/SublimeClang SublimeClang |
| 275 cd SublimeClang |
| 276 cp /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctool
chain/usr/lib/libclang.dylib internals/libclang.dylib |
| 277 # Remove i386 from the build file since XCode's libclang.dylib is only a 64-
bit version |
| 278 sed -ie 's/CMAKE_OSX_ARCHITECTURES i386 x86_64/CMAKE_OSX_ARCHITECTURES x86_6
4/' src/CMakeLists.txt |
| 279 # Copy libclang.dylib to the internals dir |
| 280 # Make the project - should be really quick, since libclang.dylib is already
built |
| 281 cd src && mkdir build && cd build |
| 282 cmake .. |
| 283 make |
| 284 ``` |
| 285 |
| 286 1. The rest of the instructions are the same, but when adding your project |
| 287 settings, add these extra arguments to `sublimeclang_options`: |
| 288 |
| 289 ```json |
| 290 "sublimeclang_options": |
| 291 [ |
| 292 ... |
| 293 // MAC-ONLY: Include these options, replacing the paths with the correct i
nstalled SDK |
| 294 "-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.p
latform/Developer/SDKs/MacOSX10.10.sdk/usr/include/", |
| 295 "-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.p
latform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1", |
| 296 "-F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/De
veloper/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/", |
| 297 "isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.p
latform/Developer/SDKs/MacOSX10.10.sdk", |
| 298 "-mmacosx-version-min=10.7", |
| 299 "-stdlib=libc++", |
| 300 "-isystem", "/usr/include", |
| 301 "-isystem", "/usr/include/c++/*", |
| 302 ] |
| 303 ``` |
| 304 |
| 305 ### Windows (not working) |
| 306 |
| 307 You'll need cl.exe which can be installed with [the Visual C++ Build Tools |
| 308 2015](https://blogs.msdn.microsoft.com/vcblog/2016/03/31/announcing-the-official
-release-of-the-visual-c-build-tools-2015/). |
| 309 You should have cl.exe on your `$PATH`, which you can get by running `C:\Program |
| 310 Files (x86)\Microsoft Visual C++ Build Tools\Visual C++ 2015 x64 Native Build |
| 311 Tools Command Prompt`. |
| 312 |
| 313 Then you'll need a copy of libclang.so, which can be found on the [LLVM |
| 314 website](http://llvm.org/releases/download.html). The instructions should be the |
| 315 same as Linux from there. |
| 316 |
| 317 ### Linux |
| 318 |
| 319 1. Install libclang-dev to get a copy of libclang.so: |
| 320 |
| 321 ```shell |
| 322 sudo apt-get install libclang-dev |
| 323 ``` |
| 324 |
| 325 1. Build libclang.so and SublimeClang in your packages directory: |
| 326 |
| 327 ```shell |
| 328 cd ~/.config/sublime-text-3/Packages |
| 329 git clone --recursive https://github.com/quarnster/SublimeClang SublimeClang |
| 330 cd SublimeClang |
| 331 # Copy libclang.so to the internals dir |
| 332 cp $(ldconfig -p | grep libclang.so | cut -d" " -f4) internals/libclang.so |
| 333 # Make the project - should be really quick, since libclang.so is already bu
ilt |
| 334 cd src && mkdir build && cd build |
| 335 cmake .. |
| 336 make |
| 337 ``` |
| 338 |
| 339 1. Edit your project file `Project > Edit Project` to call the script above |
| 340 (replace `out/Debug` with your out directory): |
| 341 |
| 342 ``` |
| 343 { |
| 344 "folders": |
| 345 [ |
| 346 ... |
| 347 ], |
| 348 "settings": |
| 349 { |
| 350 "sublimeclang_options": |
| 351 [ |
| 352 "-Wno-attributes", |
| 353 ], |
| 354 "sublimeclang_options_script": "python ${project_path}/src/tools/sublime
/ninja_options_script.py ${project_path}/src ${project_path}/src/out/Debug", |
| 355 } |
| 356 } |
| 357 ``` |
| 358 |
| 359 1. Restart Sublime. Now when you save a file, you should see a "Reparsing…" |
| 360 message in the footer and errors will show up in the output panel. Also, |
| 361 variables and function definitions should auto-complete as you type. |
| 362 |
| 363 **Note:** If you're having issues, adding `"sublimeclang_debug_options": true` t
o |
| 364 your settings file will print more to the console (accessed with ``Ctrl + ` ``) |
| 365 which can be helpful when debugging. |
| 366 |
| 367 ## Alternative: Code Completion with Ctags |
| 368 |
| 369 For a fast way to look up symbols, we recommend installing the CTags plugin. |
| 370 |
| 371 1. Install Exuberant Ctags and make sure that ctags is in your path: |
| 372 http://ctags.sourceforge.net/ (on linux you should be able to just do `sudo |
| 373 apt-get install ctags`) |
| 374 1. Install the Ctags plugin: `Ctrl + Shift + P > Install Package > Ctags` |
| 375 |
| 376 Once installed, you'll get an entry in the context menu when you right click the |
| 377 top level folder(s) in your project that allow you to build the Ctags database. |
| 378 If you're working in a Chrome project however, do not do that at this point, |
| 379 since it will index much more than you actually want. Instead, do one of: |
| 380 |
| 381 1. Create a batch file (e.g. ctags_builder.bat) that you can run either |
| 382 manually or automatically after you do a gclient sync: |
| 383 |
| 384 ``` |
| 385 ctags --languages=C++ --exclude=third_party --exclude=.git --exclude=build -
-exclude=out -R -f .tmp_tags & ctags --languages=C++ -a -R -f .tmp_tags third_pa
rty\platformsdk_win7 & move /Y .tmp_tags .tags |
| 386 ``` |
| 387 |
| 388 This takes a couple of minutes to run, but you can work while it is indexing
. |
| 389 1. Edit the `CTags.sublime-settings` file for the ctags plugin so that it runs |
| 390 ctags with the above parameters. Note: the above is a batch file - don't |
| 391 simply copy all of it verbatim and paste it into the CTags settings file) |
| 392 |
| 393 Once installed, you can quickly look up symbols with `Ctrl+t, Ctrl+t` etc. More |
| 394 information on keyboard shortcuts can be found on the [CTags GitHub |
| 395 page](https://github.com/SublimeText/CTags). |
| 396 |
| 397 One more hint - Edit your `.gitignore` file (under `%USERPROFILE%` or `~/`) so |
| 398 that git ignores the `.tags` file. You don't want to commit it. :) |
| 399 |
| 400 If you don't have a `.gitignore` in your profile directory, you can tell git |
| 401 about it with this command: Windows: `git config --global core.excludesfile |
| 402 %USERPROFILE%\.gitignore` Mac, Linux: `git config --global core.excludesfile |
| 403 ~/.gitignore` |
| 404 |
| 405 ### Build a single file |
| 406 Copy the file `compile_current_file.py` to your Packages directory: |
| 407 |
| 408 ```shell |
| 409 cd /path/to/chromium/src |
| 410 cp tools/sublime/compile_current_file.py ~/.config/sublime-text-3/Packages/User |
| 411 ``` |
| 412 |
| 413 This will give you access to a command `"compile_current_file"`, which you can |
| 414 then add to your `Preferences > Keybindings - User` file: |
| 415 |
| 416 ```json |
| 417 [ |
| 418 { "keys": ["ctrl+f7"], "command": "compile_current_file", "args": {"target_bui
ld": "Debug"} }, |
| 419 { "keys": ["ctrl+shift+f7"], "command": "compile_current_file", "args": {"targ
et_build": "Release"} }, |
| 420 ] |
| 421 ``` |
| 422 |
| 423 You can then press those key combinations to compile the current file in the |
| 424 given target build. |
| 425 |
| 426 ## Building inside Sublime |
| 427 |
| 428 To build inside Sublime Text, we first have to create a new build system. |
| 429 |
| 430 You can add the build system to your project file (`Project > Edit Project`), |
| 431 replacing `out/Debug` with your output directory (on Windows, replace /'s with |
| 432 \s in `cmd` and `working_dir`): |
| 433 |
| 434 ```json |
| 435 { |
| 436 "folders": [ |
| 437 ... |
| 438 ], |
| 439 "build_systems": |
| 440 [ |
| 441 { |
| 442 "name": "Build Chrome", |
| 443 "cmd": ["ninja", "-C", "out/Debug", "chrome"], |
| 444 "working_dir": "${project_path}/src", |
| 445 "file_regex": "^[.\\\\/]*([a-z]?:?[\\w.\\\\/]+)[(:]([0-9]+)[):]([0-9]+)?:?
(.*)$", |
| 446 "variants": [], |
| 447 }, |
| 448 ], |
| 449 } |
| 450 ``` |
| 451 |
| 452 The file regex will allow you to click on errors to go to the error line. |
| 453 |
| 454 If you're using goma, add the -j parameter (replace out/Debug with your out dire
ctory): |
| 455 ``` |
| 456 "cmd": ["ninja", "-j", "1000", "-C", "out/Debug", "chrome"], |
| 457 ``` |
| 458 |
| 459 **Regex explanation:** Aims to capture these two error formats while respecting |
| 460 [Sublime's perl-like group matching](http://docs.sublimetext.info/en/latest/refe
rence/build_systems/configuration.html#build-capture-error-output): |
| 461 |
| 462 1. `d:\src\chrome\src\base\threading\sequenced_worker_pool.cc(670): error |
| 463 C2653: 'Foo': is not a class or namespace name` |
| 464 1. `../../base/threading/sequenced_worker_pool.cc:670:26: error: use of |
| 465 undeclared identifier 'Foo'` |
| 466 |
| 467 ``` |
| 468 "file_regex": "^[.\\\\/]*([a-z]?:?[\\w.\\\\/]+)[(:]([0-9]+)[):]([0-9]+)?:?(.*)$" |
| 469 ( 0 ) ( 1 )( 2 ) (3 ) ( 4 ) ( 5 ) ( 6 )(7)(8 ) |
| 470 |
| 471 (0) Cut relative paths (which typically are relative to the out dir and targetin
g src/ which is already the "working_dir") |
| 472 (1) Match a drive letter if any |
| 473 (2) Match the rest of the file |
| 474 (1)+(2) Capture the "filename group" |
| 475 (3) File name is followed by open bracket or colon before line number |
| 476 (4) Capture "line number group" |
| 477 (5) Line # is either followed by close bracket or another colon |
| 478 (6) Capture "column filename group" if any. |
| 479 (7) If (6) is non-empty there will be another colon (but can't put it inside bra
ckets as the "column filename group" only wants digits). |
| 480 (8) Everything else until EOL is the error message. |
| 481 ``` |
| 482 |
| 483 ### Building other targets |
| 484 |
| 485 You can add build variants to the `variants` array to have quick access to other |
| 486 build targets with `Ctrl + Shift + B`: |
| 487 |
| 488 ```json |
| 489 "variants": |
| 490 [ |
| 491 { |
| 492 "name": "Unit Tests", |
| 493 "cmd": ["ninja", "-j", "1000", "-C", "out/Debug", "unit_tests"], |
| 494 }, |
| 495 { |
| 496 "name": "Browser Tests", |
| 497 "cmd": ["ninja", "-j", "1000", "-C", "out/Debug", "browser_tests"], |
| 498 }, |
| 499 ] |
| 500 ``` |
| 501 |
| 502 You can also add a variant for running chrome, meaning you can assign a keyboard |
| 503 shortcut to run it after building: |
| 504 |
| 505 ```json |
| 506 "variants": |
| 507 [ |
| 508 ... |
| 509 { |
| 510 "cmd": ["out/Debug/chrome"], |
| 511 "name": "run_chrome", |
| 512 "shell": true, |
| 513 "env": { |
| 514 "CHROME_DEVEL_SANDBOX": "/usr/local/sbin/chrome-devel-sandbox", |
| 515 }, |
| 516 }, |
| 517 ] |
| 518 ``` |
| 519 |
| 520 ### Assigning builds to keyboard shortcuts |
| 521 |
| 522 To assign a build to a keyboard shortcut, select `Preferences > Key Bindings - |
| 523 User` (or `Key Bindings - Default` to see the current key bindings). You can add |
| 524 the build variants above with the `"build"` command, like so: |
| 525 |
| 526 ```json |
| 527 [ |
| 528 ... |
| 529 { "keys": ["ctrl+shift+u"], "command": "build", "args": {"variant": "unit_test
s"} }, |
| 530 { "keys": ["ctrl+shift+b"], "command": "build", "args": {"variant": "browser_t
ests"} }, |
| 531 { "keys": ["ctrl+shift+x"], "command": "build", "args": {"variant": "run_chrom
e"} }, |
| 532 ] |
| 533 ``` |
| 534 |
| 535 For more info on custom key bindings, see the |
| 536 [Sublime Text Key Bindings Documentation](http://docs.sublimetext.info/en/latest
/customization/key_bindings.html). |
| 537 |
| 538 ## Other useful packages |
| 539 |
| 540 Some other useful packages that improve sublime can be installed from `Ctrl+Shif
t+P > Install Package`: |
| 541 |
| 542 * Git enhancements |
| 543 * [Git](https://packagecontrol.io/packages/Git) |
| 544 * [GitCommitMsg](https://packagecontrol.io/packages/GitCommitMsg) - |
| 545 Performs a 'git blame' for one or more lines of code with `Alt + Shift + |
| 546 M` (`Command + Shift + M` on Mac) |
| 547 * [GitDiffHelper](https://packagecontrol.io/packages/GitDiffHelper) - |
| 548 `Ctrl + Alt + G` to open all files modified since the last commit |
| 549 * [GitOpenChangedFiles](https://packagecontrol.io/packages/GitOpenChangedF
iles) - |
| 550 `Ctrl + Shift + O` (`Command + Shift + O` on Mac) to open all files |
| 551 modified on the current branch |
| 552 * [Git Conflict |
| 553 Resolver](https://packagecontrol.io/packages/Git%20Conflict%20Resolver) |
| 554 - A GUI for resolving git conflicts |
| 555 * [GitGutter](https://packagecontrol.io/packages/GitGutter) - Shows an |
| 556 icon next to lines that have been inserted, modified or deleted since |
| 557 the last commit. |
| 558 * Visual enhancements |
| 559 * [SyncedSideBar](https://packagecontrol.io/packages/SyncedSideBar) - |
| 560 Syncs the currently open file with the expanded tree in the sidebar |
| 561 * [SideBarEnhancements](https://packagecontrol.io/packages/SideBarEnhancem
ents) - |
| 562 Adds more file management options to the sidebar context menu. |
| 563 * [SyncedSidebarBg](https://packagecontrol.io/packages/SyncedSidebarBg) - |
| 564 A purely aesthetic improvement that syncs the sidebar background with |
| 565 the background color for the current theme. |
| 566 * [Theme - Soda](http://buymeasoda.github.io/soda-theme/) - A global theme |
| 567 for Sublime that matches the default color scheme. Needs `"theme": "Soda |
| 568 Light 3.sublime-theme"` in your Preferences > Settings - User` file. |
| 569 * Code navigation tools |
| 570 * [AutoFileName](https://packagecontrol.io/packages/AutoFileName) - Auto- |
| 571 completes filenames in #includes |
| 572 * [Open-Include](https://packagecontrol.io/packagenavigations/Open- |
| 573 Include) - Opens the file path under the cursor with `Alt + D` |
| 574 * Text tools |
| 575 * [Case Conversion](https://packagecontrol.io/packages/Case%20Conversion)
- |
| 576 automatically changes the case of selected text, e.g. `kConstantName` to |
| 577 `CONSTANT_NAME` |
| 578 * [Text Pastry](https://packagecontrol.io/packages/Text%20Pastry) - |
| 579 Inserts incremental number sequences with multi-select |
| 580 * [Wrap Plus](https://packagecontrol.io/packages/Wrap%20Plus) - Auto-wraps |
| 581 a comment block to 80 columns with `Alt + Q` (was used to write this |
| 582 document! ;-) |
| 583 * [Diffy](https://packagecontrol.io/packages/Diffy) - With two files |
| 584 opened side-by-side, `Ctrl + k Ctrl + d` will show the differences |
OLD | NEW |