Skip to content

Instantly share code, notes, and snippets.

@h14i
h14i / test.rb
Created April 16, 2013 11:41
test
class C
def hello
puts 'Hello!'
end
end
C.new.hello
@h14i
h14i / config.vim
Created October 6, 2013 22:51
quickrun.vim with tsc 0.9.1.1.
" Fedora 19, npm 1.3.11, tsc 0.9.1.1
let g:quickrun_config['typescript/base'] = {
\ 'cmdopt': '',
\ 'exec': ['tsc %o %s --out %s:p:r.js', '%c %s:p:r.js', 'rm -f %s:p:r.js'],
\ 'temp': '%{tempname()}.ts',
\ }
let g:quickrun_config['typescript/nodejs'] = {
\ 'type': 'typescript/base',
\ 'command': 'node',
\ }
@h14i
h14i / contextual
Last active December 29, 2015 14:39
contextual rails wrapper script for zsh.
# contextual - wrapper of (spring|bundle exec) commands.
# usage:
# # in zshrc
# source /path/to/contextual
# alias rails=contextual-rails
# alias rake=contextual-rake
# alias rspec=contextual-rspec
# completion:
# # in zshrc
# # require https://github.com/zsh-users/zsh-completions/src/_rails
@h14i
h14i / godoc.vim
Created November 29, 2013 17:11 — forked from mattn/godoc.vim
autoload/ref/godoc.vim with completion.
" A ref source for godoc.
" Version: 0.0.1
" Author : mattn <[email protected]>
" License: Creative Commons Attribution 2.1 Japan License
" <http://creativecommons.org/licenses/by/2.1/jp/deed.en>
let s:save_cpo = &cpo
set cpo&vim
@h14i
h14i / d_include.vim
Last active January 3, 2016 12:49
FileType d
" For gf, [I, i_CTRL-X_CTRL-I
" There is a need to modify path because it is suit my environment.
setlocal suffixesadd=.d,.di
let &l:include = '^\s*\%(\%(public\|static\)\s\+\)\?\<import'
" let &l:path = '.,' . g:V.system('denv prefix')[:-2] . '/src/*,' . &l:path . ',,'
setlocal path=.,/path/to/dmd/src/**,,
let &l:includeexpr = 'substitute(substitute(v:fname, "\\.", "/", "g"), "$", ".d", "")'
@h14i
h14i / _direnv
Created February 24, 2014 07:26
direnv sub-commands completion for zsh. inspired https://gist.github.com/yonchu/5005758
#compdef direnv
# setopt -eu
function _direnv {
local direnv
local -a comp_list
direnv="\
allow[Grants direnv to load the given .envrc]
@h14i
h14i / ruby_include.vim
Last active August 29, 2015 13:56
yet another ruby include configs.
" support rack app?
let &l:include = '^\s*\<\%(load\|autoload\|require_relative\|require\|include\|use\|register\)\>\s*:\=["'']\=\(\h\w*\)["'']\=,\='
let &l:includeexpr = "substitute(substitute(tolower(substitute(substitute(v:fname,'\\(\\u\\+\\)\\(\\u\\l\\)','\\1_\\2','g'),'\\(\\l\\|\\d\\)\\(\\u\\)','\\1_\\2','g')),'::','/','g'),'$','.rb','')"
" setlocal path=/to/your/...
@h14i
h14i / autoload-ocamlspot.lua
Created March 28, 2014 20:11
ocamlspot.vim with lua
-- ocamlspot.lua
--[[
example:
parse_loc("l100c20b3") -> 100, 20
parse_loc("abcdefghi") -> nil, nil
--]]
function parse_loc(str)
local _, _, line, col = string.find(str, "^l(%d+)c(%d+)b%d+$")
# tmux-mouse-toggle
# via http://qiita.com/kawaz/items/7b15e18ca8e072c1dc57
if [[ -n $TMUX ]]; then
if [[ -z "$(tmux show-options -gw mode-mouse | grep off)" ]]; then
tmux set-option -gq mouse-utf8 off
tmux set-option -gq mouse-resize-pane off
tmux set-option -gq mouse-select-pane off
tmux set-option -gq mouse-select-window off
tmux set-window-option -gq mode-mouse off
@h14i
h14i / vim_build.zsh
Last active August 29, 2015 14:01
building vim with rbenv ruby, pyenv python and plenv perl.
#!/usr/bin/zsh
plenv local system
pyenv local 2.7.6
rbenv local 2.1.2
plenv rehash
pyenv rehash
rbenv rehash