Skip to content

Instantly share code, notes, and snippets.

" textobj-template - Text objects for WAF template engine.
" Version: 0.0.1
" Author: Kazuhito Hokamura
" License: MIT license (see <http://www.opensource.org/licenses/mit-license>)
if exists('g:loaded_textobj_template')
finish
endif
call textobj#user#plugin('template', {
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
" こういうHTMLがあったときに
" <div id="hoge" class="fuga">
" ...
" </div>
"
" 実行するとこうなる
" <div id="hoge" class="fuga">
" ...
" <!-- /div#hoge.fuga --></div>
@uasi
uasi / vim.rb
Created November 30, 2010 16:46
Vim formula for Homebrew (EDIT: recent versions of official Homebrew distribution includes one)
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end
@kwatch
kwatch / gist:2814940
Created May 27, 2012 16:18
Rubyの特殊変数一覧
$! raise された例外オブジェクト
$" require で読み込まれたファイルの配列
$#
$$ 現在のプロセス ID
$%
$& 正規表現にマッチした箇所の文字列
$' 正規表現にマッチした箇所より後ろの文字列
$(
$)
$* Ruby スクリプトに指定された引数。ARGV と同じ
@udzura
udzura / fgcs.git.sh
Last active October 7, 2015 10:17
Fxcking git cheet sheet
# stage の操作
git add . # stage に加える
git add -p # stage にインタラクティブに加える
git add -N . # stage にファイルだけ加える
git rm hoge/hoge.rb # stage から消す
git rm -f hoge/hoge.rb # stage から無理矢理消す、先にファイルを消してしまった場合
git mv hoge/hoge.rb hoge/hoge2.rb # ファイル名変える
# 差とか状態を確認する系
git diff # HEADとunstagedの差分を確認する
@thinca
thinca / neobundle
Created August 22, 2012 02:14
neobundle command
#!/bin/sh
if [ -z "$1" ]; then
echo Usage: $0 {config-file}
exit
fi
vim -N -u NONE -i NONE -V1 -e -s --cmd "source $1" --cmd NeoBundleInstall! --cmd qall!
@mochiz
mochiz / gist:4736183
Last active April 16, 2023 03:56
rbenvとruby-buildでRuby環境を最新に保つ

rbenvとruby-buildでRuby環境を最新に保つ

更新日:2014/11/19

rbenv, ruby-buildを更新

$ cd ~/.rbenv
$ git pull origin master
$ cd ~/.rbenv/plugins/ruby-build
$ git pull origin master
@DeaR
DeaR / maplist.vim
Last active December 17, 2015 05:38
Sorted, Collected, Fix to <M-...>.
" Sorted, Collected, Fix to <M-...>.
"
" Maintainer: DeaR <nayuri@kuonn.mydns.jp>
" Last Change: 13-Aug-2013.
" License: MIT License {{{
" Copyright (c) 2013 DeaR <nayuri@kuonn.mydns.jp>
"
" Permission is hereby granted, free of charge, to any person obtaining a
" copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
@DeaR
DeaR / map-alt-keys.vim
Last active December 17, 2015 05:49
Mapping Alt-keys for Terminal
" Mapping Alt-keys for Terminal
"
" Maintainer: DeaR <nayuri@kuonn.mydns.jp>
" Last Change: 01-Oct-2013.
" License: MIT License {{{
" Copyright (c) 2013 DeaR <nayuri@kuonn.mydns.jp>
"
" Permission is hereby granted, free of charge, to any person obtaining a
" copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including