This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! g:Hatena(arg, line1, line2) | |
perl << EOF | |
use Text::Hatena; | |
my ($success, $firstline) = VIM::Eval('a:line1'); | |
my ($success, $lastline) = VIM::Eval('a:line2'); | |
my $base_text = join "\n", $curbuf->Get($firstline .. $lastline); | |
my $parse_text = Text::Hatena->parse($base_text); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! VisualCurrentIndentBlock() | |
let current_indent = indent('.') | |
let current_line = line('.') | |
let current_col = col('.') | |
let last_line = line('$') | |
let start_line = current_line | |
while start_line != 1 && current_indent == indent(start_line - 1) | |
let start_line = start_line - 1 | |
endwhile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" HTMLとかでドキュメントルートからの絶対パスのファイルを開く(gfみたいな感じで) | |
" 絶対パスじゃなかったら(/で始まってなかったら)gfと同じ | |
" ドキュメントルートのディレクトリは配列で複数指定できる。 | |
let s:root_dirs = [$HOME.'/dev/site/localhost/test'] | |
function! GotoAbsFile() | |
let filename = expand('<cfile>') | |
let filepath = filename | |
if (match(filename, '^/') != -1) | |
for dir in s:root_dirs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! ZoomToggle() | |
let normal_font = 'Monaco:h12' | |
let zoom_font = 'Monaco:h25' | |
if &guifont == normal_font | |
let font = zoom_font | |
let columns = 78 | |
let lines = 22 | |
else | |
let font = normal_font | |
let columns = 180 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Macでクリップボードにコピーするoperator | |
if has('mac') | |
function! Pbcopy(type, ...) | |
let reg_save = @@ | |
if a:0 | |
silent execute "normal! `<" . a:type . "`>y" | |
elseif a:type == 'line' | |
silent execute "normal! '[V']y" | |
elseif a:type == 'block' | |
silent execute "normal! `[\<C-V>`]y" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ウインドウ単位で開いたファイルの履歴をたどる | |
function! FileJumpPush() | |
if !exists('w:histories') | |
let w:histories = [] | |
endif | |
let buf = bufnr('%') | |
if count(w:histories, buf) == 0 | |
call add(w:histories, buf) | |
endif | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" snipMate再読み込み。xxx.snippetを開いているときに:call SnipMateReload()すればOK | |
function! SnipMateReload() | |
if &ft == 'snippet' | |
let ft = substitute(expand('%'), '.snippets', '', '') | |
if has_key(g:did_ft, ft) | |
unlet g:did_ft[ft] | |
endif | |
silent! call GetSnippets(g:snippets_dir, ft) | |
endif | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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', { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" textobj-camelcase - Text objects for camel case. | |
" Version: 0.0.1 | |
" Author: Kazuhito Hokamura | |
" License: MIT license (see <http://www.opensource.org/licenses/mit-license>) | |
if exists('g:loaded_textobj_camelcase') | |
finish | |
endif | |
call textobj#user#plugin('camelcase', { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use AnyEvent::Twitter::Stream; | |
use AnyEvent::HTTP; | |
use HTTP::Request::Common; | |
my $done = AnyEvent->condvar; |