This is a (mostly complete) list of the custom live templates I use in JetBrains IDEs. I mainly use this for Rails development in RubyMine, but I'm sure that these have usage beyond RubyMine and Rails. Variable names can be configured via "Edit variables", or whatever constructs are available within your IDE of choice.
- binding.irb:
require "irb" binding.irb
- defi:
def initialize$END$ end
- frozen:
# frozen_string_literal: true
- hell:
raise "a little hell"
- ifcli:
if __FILE__ == $PROGRAM_NAME $STATEMENT$ end
- pp:
puts "########## $HEADER$ ##########" p $EXPRESSION$
- rloge:
Rails.logger.error "### $HEADER$: #{$EXPRESSION} ###"
- rlogi:
Rails.logger.info "### $HEADER$: #{$EXPRESSION} ###"
- rlogw:
Rails.logger.warn "### $HEADER$: #{$EXPRESSION} ###"
- rubocop: (
RUBOCOP_RULE
=clipboard()
)# rubocop:disable $RUBOCOP_RULE$ # rubocop:enable $RUBOCOP_RULE$
Make sure that the TypeScript context is added alongside JavaScript, if you work on TypeScript projects.
- clog:
console.log("$HEADER$", $EXPRESSION$)
- eslint-block: (
RULE
=clipboard()
)/* eslint-disable $RULE$ */ /* eslint-enable $RULE$ */
- eslint-next-line:
// eslint-disable-next-line $RULE$
(RULE
=clipboard()
) - lodash:
import $package$ from "lodash/$package$"
(PACKAGE
is empty) - react:
import React from "react"
- bash_boilerplate:
#!/usr/bin/env bash ( set -euo pipefail IFS=$'\n\t' )