TextMate2 - Power Tools
This bundle includes most used commands (on a daily basis) of me!...
Installation
cd ~/Library/Application\ Support/TextMate/Bundles/
git clone https://github.com/vigo/textmate2-power-tools.git PowerTools.tmbundle
# Restart your TextMate2
You need to install extra tools for Golang helper. You need to enable default Go Bundle from TextMate first...
$ go install golang.org/x/tools/cmd/goimports@latest
$ go install mvdan.cc/gofumpt@latest
$ go install github.com/segmentio/golines@latest
$ go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
$ go install honnef.co/go/tools/cmd/staticcheck@latest
$ brew install golangci-lint
Shellcheck feature requires shellcheck
binary;
$ brew install shellcheck
You need to add your brew/bin path to PATH
variable too:
$ command -v golangci-lint
/opt/homebrew/bin/golangci-lint # my brew/bin is: /opt/homebrew/bin
# add to TextMate variable
PATH /opt/homebrew/bin:${PATH}
and you need to set:
TM_GOPATH
andGOPATH
get the value of$ go env GOPATH
TM_GO
get the value of$ command -v go
GOMODCACHE
get the value of$ go env GOMODCACHE
$ go env GOPATH # (example) for TM_GOPATH and GOPATH => /Users/vigo/.local/go
$ go env GOMODCACHE # (example) for GOMODCACHE => /Users/vigo/.local/go/pkg/mod
$ command -v go # (example) for TM_GO => /opt/homebrew/opt/go/libexec/bin/go
$ defaults write com.macromates.TextMate environmentVariables \
-array-add "{enabled = 1; value = \"$(command -v go)\"; name = \"TM_GO\"; }"
$ defaults write com.macromates.TextMate environmentVariables \
-array-add "{enabled = 1; value = \"$(go env GOPATH)\"; name = \"TM_GOPATH\"; }"
$ defaults write com.macromates.TextMate environmentVariables \
-array-add "{enabled = 1; value = \"$(go env GOPATH)\"; name = \"GOPATH\"; }"
$ defaults write com.macromates.TextMate environmentVariables \
-array-add "{enabled = 1; value = \"$(go env GOMODCACHE)\"; name = \"GOMODCACHE\"; }"
Other bundle dependencies (not required but nice to have)
News
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 forTM_GOLANGCI_LINT_LOG_LEVEL
environment variable. Due togo 1.18
,golangci-lint
produces some warnings. You can bypass those warnings via settingTM_GOLANGCI_LINT_LOG_LEVEL
. Default is set toerror
(no more warnings).
2022-07-13
- add
fprf
+ ⇥, golangfmt.Fprintf
snippet.
2022-06-03
golint
removed, now usinggolangci-lint
’srevive
. (golint has been archived by the owner)
Available Items
- TextMate
- Django
- Python
- Ruby
- Rake
- Bash
- Markdown
- jQuery
- HTML
- Javascript
- Go
- Swift
- Lisp
- Elixir
- Git
- General
- Templates
TextMate Helpers
Scopes:
-
text.xml.plist
-
source.tm-properties
-
folder
+ ⇥ : Add folder forinfo.plist
-
-
+ ⇥ : Add delimeter forinfo.plist
-
prop
+ ⇥ : Add properties for.tm_properties
- excludes:
excludeInFolderSearch
/excludeInFileChooser
- includes:
include
- spelling:
spellingLanguage
- excludes:
-
"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
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
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
+ ⇥: CreatesRake::Task...invoke
+ params -
des
+ ⇥:desc "...."
only -
args
+ ⇥:args.with_defaults(...)
Bash
Added shellcheck linter/checker support.
Use TM_SHELLCHECK_DISABLE
to disable it! You need to install shellcheck
via;
brew install shellcheck
If you already have shellcheck
, set binary path to TM_SHELLCHECK
:
# 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:
# shellcheck disable=all
comment.
You need to restart TextMate after these settings...
Bash Snippets
if
+ ⇥:if
/else
/elif
template.for
+ ⇥: Array iteration templatefor
+ ⇥: Range iteration templateenvi
+ ⇥: Inject some environment variables.
Markdown
Markdown Snippets
badge
+ ⇥: Adds img.shields.io badge!- ⌥ + (: Fixes Parenthesis behavior.
jQuery
jQuery Snippets
each
+ ⇥: jQueryeach
code templateready
+ ⇥: jQuery$(document).ready()
code templateplug
+ ⇥: jQuery plugin skel.
HTML
HTML Snippets
more
+ ⇥:’
- ⌃ + ⌘ + S: Wrap selection with smart quotes.
- ⌃ + C: Wrap/unwrap code Inline
p
+ ⇥:<p>carret<p>
li
+ ⇥:<li>carret<li>
Javascript
Javascript Snippets
con
+ ⇥: Generatesconsole.log
,console.dir
,console.warn
,console.error
,console.group
,console.groupEnd
skelif
+ ⇥:if
related code.fun
+ ⇥:function
related code.for
+ ⇥:for
related code.swi
+ ⇥:switch
related code.load
+ ⇥: Injectswindow.addEventListener(...)
Javascript Commands
You need to install node
locally and must define TM_NODE
variable and set
the executable path for node:
# example
defaults write com.macromates.textmate environmentVariables -array-add \
'{enabled = 1; value = "/path/to/node"; name = "TM_NODE"; }'
- ⌘ + R: Runs javascript.
Go
When you hit ⌘ + S, TextMate runs unless disabler environment variable(s) is/are set:
gofumpt
gofmt
goimports
golines
go vet
+ shadowgolangci-lint
staticcheck
You can disable format/lint feature (all of them) via setting
TM_DISABLE_GO_LINTER
environment variable.
You can disable linters piece by piece;
-
TM_DISABLE_GOFUMPT
-
TM_DISABLE_GOFMT
-
TM_DISABLE_GOIMPORTS
-
TM_DISABLE_GOLINES
-
TM_DISABLE_GOVET
-
TM_DISABLE_GOVET_SHADOW
-
TM_DISABLE_GOLANGCI_LINT
-
TM_DISABLE_STATIC_CHECK
Also you can configure golines
via;
TM_GOLINES_MAX_LEN
: Default value is100
TM_GOLINES_TAB_LEN
: Default value is4
environment variables.
Use TM_GOLANGCI_LINT_LOG_LEVEL
to by-pass linter warnings (go 1.18
issue):
TM_GOLANGCI_LINT_LOG_LEVEL
toerror
shows only errorsTM_GOLANGCI_LINT_LOG_LEVEL
towarning
shows warnings tooTM_GOLANGCI_LINT_LOG_LEVEL
toinfo
show info level logs
Error tool tip had some issues, due to TextMate’s limit, lines > 150 chars
was broken. Now it’s fixed. Use TM_ERROR_TOOLTIP_MAX_LINE
environment
variable to set your desired amount. Maximum is 150
.
Go Commands
- ⌥ + R : Runs
gofmt
+goimports
without save!
Go Snippets
fmt
+ ⇥:fmt.METHOD
spr
+ ⇥:fmt.Sprintf
prl
+ ⇥:fmt.Println
prf
+ ⇥:fmt.Printf
errf
+ ⇥:fmt.Errorf
tof
+ ⇥:reflect.TypeOf
log
+ ⇥:log.METHOD
if
+ ⇥:if
conditions orobj, ok
conditionfor
+ ⇥:for
conditionsstr
+ ⇥: Definestruct
fld
+ ⇥: Definestruct
fieldctp
+ ⇥: Inserts compile time proof fill place holders ofvar _ interface = (*struct)(nil)
seed
+ ⇥: Inserts random seedergcil
+ ⇥: Creates.golangci.yml
under current working directory.fprf
+ ⇥:fmt.Fprintf
.golangci.yml
default config:
run:
concurrency: 4
timeout: 1m
linters-settings:
revive:
ignore-generated-header: true
severity: warning
rules:
- name: exported
severity: warning
arguments:
- "checkPrivateReceivers"
- "sayRepetitiveInsteadOfStutters"
- name: error-return
severity: warning
- name: error-naming
severity: warning
- name: if-return
severity: warning
- name: var-naming
severity: warning
- name: var-declaration
severity: warning
- name: receiver-naming
severity: warning
- name: errorf
severity: warning
- name: empty-block
severity: warning
- name: unused-parameter
severity: warning
- name: unreachable-code
severity: warning
- name: redefines-builtin-id
severity: warning
- name: superfluous-else
severity: warning
- name: unexported-return
severity: warning
- name: indent-error-flow
severity: warning
- name: blank-imports
severity: warning
- name: range
severity: warning
- name: time-naming
severity: warning
- name: context-as-argument
severity: warning
- name: context-keys-type
severity: warning
- name: indent-error-flow
severity: warning
- name: waitgroup-by-value
severity: warning
- name: useless-break
severity: warning
- name: struct-tag
severity: warning
linters:
disable-all: true
enable:
- asciicheck
- durationcheck
- errcheck
- errorlint
- exhaustive
- gosec
- govet
- makezero
- nilerr
- rowserrcheck
- exportloopref
- sqlclosecheck
- staticcheck
- typecheck
- bodyclose
- noctx
- prealloc
- gosimple
presets:
- comment
- error
- format
- metalinter
- unused
issues:
exclude-use-default: false
You can configure golangci via setting TM_GOLANGCI_LINT_MANUAL
environment
variable manually w/o config file. Example variable and value:
TM_GOLANGCI_LINT_MANUAL -p comment -p error -p format -p metalinter -p unused -E gosimple -E asciicheck -E durationcheck -E errcheck -E errorlint -E exhaustive -E gosec -E govet -E makezero -E nilerr -E rowserrcheck -E exportloopref -E sqlclosecheck -E staticcheck -E typecheck -E bodyclose -E noctx -E prealloc
This works only if any of these file(s) is/are unset/not-exists in the project root:
.golangci.yml
.golangci.yaml
.golangci.toml
.golangci.json
Swift
You need to install/activate Swift Bundle from: TextMate > Preferences > Bundles.
Swift Snippets
p
+ ⇥: Print statementtyp
+ ⇥: Type of object=
+ ⇥: Variable safe printdes
+ ⇥: 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
# 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:
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;
- Git blame current line
- Git blame current line for last N commit
General
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 |
Golang | source.go | temp + ⇥ |
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 - Creator, maintainer
License
This project is licensed under MIT.