Skip to content

Instantly share code, notes, and snippets.

@tpope
tpope / .inputrc
Created September 8, 2011 16:43
Basic amenities for vi readline bindings
set keymap vi-insert
Control-a: beginning-of-line
Control-b: backward-char
Control-d: delete-char
Control-e: end-of-line
Control-f: forward-char
Control-k: kill-line
Control-n: next-history
Control-p: previous-history
set keymap emacs-ctlx
@tpope
tpope / _gem
Created August 27, 2011 18:58 — forked from alexvollmer/_gem
zsh completion for rubygems
#compdef gem gem1.9
gem_general_flags=("(-h --help)"{-h,--help}"[Get help on this command]"
"(-V --verbose)"{-V,--verbose}"[Set the verbose level of output]"
"(-q --quiet)"{-q,--quiet}"[Silence commands]"
"--config-file[Use this config file instead of default]:file:_files"
"--backtrace[Show stack backtrace on errors]"
"--debug[Turn on Ruby debugging]"
$nul_arg
)
ActiveRecord::Base.connection.select_all(scope.arel).tap do |result|
result.map do |attrs|
attrs.each do |k, v|
attrs[k] = result.column_types[k].type_cast(v)
end
end
end 
if !exists('s:path')
if type(get(g:, 'lua_path')) == type([])
let s:path = g:lua_path
else
let s:path = split(system('lua -e "print(package.path)"')[0:-2], ';')
if v:shell_error
let path = []
endif
endif
endif
@tpope
tpope / speeddating.vim
Created October 16, 2011 05:04
Increment keywords with speeddating.vim
" Place in ~/.vim/after/plugin/speeddating.vim
" In Vim, -4 % 3 == -1. Let's return 2 instead.
function! s:mod(a,b)
if (a:a < 0 && a:b > 0 || a:a > 0 && a:b < 0) && a:a % a:b != 0
return (a:a % a:b) + a:b
else
return a:a % a:b
endif
endfunction
@tpope
tpope / DefaultKeyBinding.dict
Created September 23, 2011 21:07
Place in ~/Library/KeyBindings/DefaultKeyBinding.dict
/* vim: set ft=c sw=4 et: */
{
"^u" = "deleteToBeginningOfParagraph:";
"^v" = "pageDown:";
"^w" = "deleteWordBackward:";
"~/" = "complete:";
"~<" = "moveToBeginningOfDocument:";
"~>" = "moveToEndOfDocument:";
"~b" = "moveWordBackward:";
"~d" = "deleteWordForward:";
@tpope
tpope / foremux
Last active August 11, 2016 16:42
#!/usr/bin/env ruby
# Install in PATH as foremux
if %w(help --help -h).include?(ARGV.first)
$stderr.puts <<-help
Usage:
foremux [PROCESS]
Options:
-e, [--env=ENV] # Specify an env file to load, defaults to .env
@tpope
tpope / ctags.sh
Created May 5, 2016 17:48
Ctags git hook
#!/bin/sh
set -e
if [ -d doc -a \( -d autoload -o -d ftdetect -o -d plugin \) ]; then
nohup vim -u NONE -c 'helptags doc' -cq >/dev/null 2>&1 </dev/null &
fi
optfiles=`git ls-files -oc --directory -- .ctags '*/.ctags'`

Keybase proof

I hereby claim:

  • I am tpope on github.
  • I am tpope (https://keybase.io/tpope) on keybase.
  • I have a public key whose fingerprint is 8818 04A5 DA54 1152 FA12 C105 E09E 474A 404A 3A45

To claim this, I am signing this object:

[extensions]
color =