An open API service indexing awesome lists of open source software.

https://github.com/vigo/textmate2-power-tools

Some useful TextMate2 snippets, commands etc...
https://github.com/vigo/textmate2-power-tools

textmate

Last synced: 2 months ago
JSON representation

Some useful TextMate2 snippets, commands etc...

Awesome Lists containing this project

README

          

![Version](https://img.shields.io/badge/version-3.0.4-orange.svg)
![Plaftorm](https://img.shields.io/badge/platform-TextMate_2_-blue.svg)
![Powered by Rake](https://img.shields.io/badge/powered_by-rake-blue?logo=ruby)

# TextMate2 - Power Tools

This bundle includes most used commands (*on a daily basis*) of me!...

## Installation

```bash
cd ~/Library/Application\ Support/TextMate/Bundles/
git clone https://github.com/vigo/textmate2-power-tools.git PowerTools.tmbundle

# Restart your TextMate2
```

Shellcheck feature requires `shellcheck` binary;

```bash
$ brew install shellcheck
```

You need to add your **brew/bin** path to `PATH` variable too:

```bash
$ command -v shellcheck
/opt/homebrew/bin/shellcheck # my brew/bin is: /opt/homebrew/bin

# add to TextMate variable
PATH /opt/homebrew/bin:${PATH}
```

Other bundle dependencies (*not required but nice to have*)

- https://github.com/blahed/Vue.tmbundle
- https://github.com/michaeledgar/protobuf-tmbundle

For `go` related functionality, visit:

https://github.com/vigo/textmate2-golang

---

## News

**2026-05-03**

- Auto-save / format with prettier

Set your `TM_PRETTIER_CONFIG` in `.tm_properties` or main environment settings.
When you save your jsx / js file, prettier will be applied..

```toml
# example tm_properties
PATH="${TM_PROJECT_DIRECTORY}/node_modules/.bin:${PATH}"
TM_PRETTIER_CONFIG="${TM_PROJECT_DIRECTORY}/.prettierrc"
```

**2025-03-02**

- Go related bundles functionality removed, now you can install:
https://github.com/vigo/textmate2-golang

**2024-05-28**

- Add `uuid` generator
- Improve JavaScript runner, Bash Script Template

**2023-12-23**

- Remove old django related snippets
- Add new django related snippets (4+)

**2023-06-27**

- Yeah, I’m still developing this bundle
- Add `-` + create dynamic comment till your wrap column size!

**2023-04-18**

- Add shellcheck disable comment via `dis` + TAB

**2023-01-01**

- Add error tool tip max line length via `TM_ERROR_TOOLTIP_MAX_LINE`

**2022-07-14**

- `golangci-lint` runner checks for `TM_GOLANGCI_LINT_LOG_LEVEL` environment
variable. Due to `go 1.18`, `golangci-lint` produces some warnings. You can
bypass those warnings via setting `TM_GOLANGCI_LINT_LOG_LEVEL`. Default is set
to `error` (no more warnings).

**2022-07-13**

- add `fprf` + , golang `fmt.Fprintf` snippet.

**2022-06-03**

- `golint` removed, now using `golangci-lint`’s `revive`. (*golint has been archived by the owner*)

---

## Available Items

1. [TextMate](#textMate-helpers)
1. [Django](#django)
1. [Python](#python)
1. [Ruby](#ruby)
1. [Rake](#rake)
1. [Bash](#bash)
1. [Markdown](#markdown)
1. [jQuery](#jquery)
1. [HTML](#html)
1. [Javascript](#javascript)
1. [Swift](#swift)
1. [Lisp](#lisp)
1. [Elixir](#elixir)
1. [Git](#git)
1. [General](#general)
1. [Templates](#templates)

---

### TextMate Helpers

Scopes:

- `text.xml.plist`
- `source.tm-properties`

- `folder` + : Add folder for `info.plist`
- `-` + : Add delimeter for `info.plist`
- `prop` + : Add properties for `.tm_properties`
- excludes: `excludeInFolderSearch` / `excludeInFileChooser`
- includes: `include`
- spelling: `spellingLanguage`
- "Show Environment Variables" for better, sorted and grouped env-var list

---

### Django

**Update**

- Improve Django snippets/helpers
- Add Django REST generics and viewsets

#### Django Snippets

| TAB completion | Description |
|----------------|:------------|
| `admin` + | ![Screenshot of: admin](Screens/django-admin-1.png?1 "admin+TAB") |
| `admin` + | ![Screenshot of: admin](Screens/django-admin-2.png?1 "admin+TAB") |
| `model` + | ![Screenshot of: model](Screens/django-model.png?1 "model+TAB") |
| `meta` + (*Model meta options*) | ![Screenshot of: opt](Screens/django-model-meta.png?1 "meta+TAB") |
| `fld` + (*For fields...*) | ![Screenshot of: fld](Screens/django-fld.png?1 "fld+TAB") |
| `opt` + (*For field options...*) | ![Screenshot of: opt](Screens/django-opt.png?2 "opt+TAB") |
| `hlp` + (*Helpers*) | ![Screenshot of: hlp](Screens/django-hlp.png?2 "hlp+TAB") |
| `str` + | Injects `def __str__(self):` |
| `save` + | Injects model save `def save(self, *args, **kwargs):` |
| `does` + | `Model.DoesNotExist` |
| `wr` + (*Management commands*) | `self.stdout.write` |
| `ws` + (*Management commands*) | `self.style` |
| `=` + (*Template*) | `{{ variable }}` |
| `==` + (*Template*) | `{% tag %}` |
| `ase` + (*Test*) | `self.assertQuerysetEqual` |

#### Django Scope

You have a scope called: **Python Django (Extended)**.
Press + + + P for selecting
this scope.

---

### Python

You can prettify any kind of Python `list` or `dict` via +
+ P in any scope!

#### Python Snippets

| TAB completion | Description |
|----------------|:------------|
| `ase` + | ![Screenshot of: ase](Screens/python-ase.png?1 "ase+TAB") |
| `utf` + | `# -*- coding: utf-8 -*-` |
| `p` + | Print with format: `print(CURSOR.format())` |
| `pp` + | `pp = pprint.PrettyPrinter(indent=4)` |
| `pr` + | Pretty Print with format: `pp.pprint(CURSOR.format())` |
| `tern` + | Ternary expression helper |
| `pdbg` + | Injects Python Debugger |
| `ipdbg` + | Injects IPython Debugger |
| `logger` + | Injects `logger` snippet |
| `loggerbc` + | Injects `logger` snippet with basic config |
| + ' | Docstring |
| `init` + (*Class*) | Injects `def __init__ ...` |
| `@sm` + (*Class*) | Injects `@staticmethod` |
| `@cm` + (*Class*) | Injects `@classmethod` |
| `@pr` + (*Class*) | Injects `@property` |
| `__` + (*Class*) | Injects `__str__` or `__repr__` |
| `imp` + (*import*) | Injects `import` with some predefined package names |
| `inject` + (*apped*) | Injects `TM_PYTHON_FMT_VIRTUAL_ENV` related appends to `sys.path` |
| `=` + (*python*) | Injects python placeholder `{}` |
| `.` + (*doctest*) | Injects `>>> ` |
| + + i | Create `__init__.py` |

`hlp` +

from __future__ import unicode_literals
print_function
division
absolute_imports

---

## Ruby

You need to add **Ruby on Rails** bundle from Preferences/Bundles.

### Ruby Snippets for ERB

Scope: `text.html.erb`

| TAB completion | Description |
|---------------|:-------------|
| `=` + | `<%= CURSOR %>` |
| `if` + | ERB compatible `if` |
| `each` + | ERB compatible `each` and `each_with_index` |

---

## Rake

### Rake Snippets

`tas` +

* Task with args
* Task with args and dependecies
* Task w/o description

* `tasr` + : Creates remote-task skel
* `tasd` + : Creates default task code
* `inv` + : Creates `Rake::Task...invoke` + params
* `des` + : `desc "...."` only
* `args` + : `args.with_defaults(...)`

---

## Bash

Added [shellcheck](https://github.com/koalaman/shellcheck) linter/checker support.
Use `TM_SHELLCHECK_DISABLE` to disable it! You need to install `shellcheck` via;

```bash
brew install shellcheck
```

If you already have `shellcheck`, set binary path to `TM_SHELLCHECK`:

```bash
# custom shellcheck path
defaults write com.macromates.textmate environmentVariables -array-add \
'{ name = "TM_SHELLCHECK"; enabled = 1; value = "/path/to/shellcheck"; }'

# disable shellcheck
defaults write com.macromates.textmate environmentVariables -array-add \
'{ name = "TM_SHELLCHECK_DISABLE"; enabled = 1; value = "1"; }'
```

You can disable shellcheck feature on your scripts via `dis` + TAB, this
adds:

```bash
# shellcheck disable=all
```

comment.

You need to restart TextMate after these settings...

### Bash Snippets

* `if` + : `if` / `else` / `elif` template.
* `for` + : Array iteration template
* `for` + : Range iteration template
* `envi` + : Inject some environment variables.

---

### Markdown

### Markdown Snippets

* `badge` + : Adds **img.shields.io** badge!
* + (: Fixes Parenthesis behavior.

---

### jQuery

### jQuery Snippets

* `each` + : jQuery `each` code template
* `ready` + : jQuery `$(document).ready()` code template
* `plug` + : jQuery plugin skel.

---

## HTML

### HTML Snippets

* `more` + : `’`
* + + S: Wrap selection with smart quotes.
* + C: Wrap/unwrap code Inline
* `p` + : `

carret

`
* `li` + : `

  • carret
  • `

    ---

    ### Javascript

    ### Javascript Snippets

    * `con` + : Generates `console.log`, `console.dir`,
    `console.warn`, `console.error`, `console.group`, `console.groupEnd` skel
    * `if` + : `if` related code.
    * `fun` + : `function` related code.
    * `for` + : `for` related code.
    * `swi` + : `switch` related code.
    * `load` + : Injects `window.addEventListener(...)`

    ### Javascript Commands

    You need to install `node` locally and must define `TM_NODE` variable and set
    the executable path for node:

    ```bash
    # example
    defaults write com.macromates.textmate environmentVariables -array-add \
    '{enabled = 1; value = "/path/to/node"; name = "TM_NODE"; }'
    ```

    * + R: Runs javascript.

    ---

    ## Swift

    You need to install/activate **Swift Bundle** from: TextMate > Preferences >
    Bundles.

    ### Swift Snippets

    * `p` + : Print statement
    * `typ` + : Type of object
    * `=` + : Variable safe print
    * `des` + : Describe object

    ---

    ## Lisp

    You need to install/activate **Lisp Bundle** from: TextMate > Preferences >
    Bundles. Please set `TM_CLISP` variable for executer. You can install from
    brew: `brew install clisp`

    ```bash
    # example
    defaults write com.macromates.textmate environmentVariables -array-add \
    '{enabled = 1; value = "/usr/local/bin/clisp"; name = "TM_CLISP"; }'
    ```

    ### Lisp Snippets

    * `p` + : Print

    ### Lisp Commands

    * + R: Run.

    ---

    ## Elixir

    You need to install/activate **Elixir Bundle**:

    ```bash
    cd ~/Library/Application\ Support/TextMate/Bundles/
    git clone https://github.com/elixir-lang/elixir-tmbundle.git Elixir.tmbundle
    ```

    ### Elixir Snippets

    * `p` + : Print or Inspect
    * `#`: Select text in quotes then press `#` (*Ruby’s string interpolation-ish*)

    ---

    ## Git

    Press + + B for;

    1. Git blame current line
    1. Git blame current line for last N commit

    ---

    ## General

    | TAB completion | Description |
    |----------------|:------------|
    | `dateT` + | ![Screenshot of: dateT](Screens/general-datet.png?1 "dateT+TAB") |
    | `lorem` + | ![Screenshot of: lorem](Screens/general-lorem.png?1 "lorem+TAB") |
    | + ' | Single smart apostrophe. (*Works in html, text, markdown, yaml*) |
    | `applek` + | Generate apple symbols like: ⌘ ⎋ more... |
    | `applek` + | Generate apple symbols inside of `` tags. |
    | `-` + | Dynamic comment. Fills remaning line with `-` |
    | `--` + | Line delimeter, 80 charts comment `# ---- ...` |
    | `---` + | Dynamic tilda. Fills remaning line with `~` |
    | + + `B` | Shows `git blame` for current line |

    ---

    ## Templates

    | Language | Scope | TAB Completion |
    |:----------------|:----------------------|:--------------------------------|
    | BASH | source.shell | `temp` + |
    | Python | source.python | `temp` + |
    | Python | source.python | `temp` + with Doctests |
    | Python | source.python | `temp` + with Logging |
    | HTML | -no scope required- | `html5` + |
    | HTML with Bulma | -no scope required- | `html5` + with Bulma.io CSS |
    | Vue Component | text.html.vue | `temp` + |

    ---

    ## Contributor(s)

    * [Uğur "vigo" Özyılmazel][contributer-01] - Creator, maintainer

    ## License

    This project is licensed under MIT.

    [contributer-01]: https://github.com/vigo