Skip to content

Instantly share code, notes, and snippets.

@anyakichi
anyakichi / reorganaizetabs.vim
Created April 23, 2011 23:20
Close duplicate tabs and show hidden buffers in tabs.
function! ReorganizeTabs(only)
let tablists = []
let bufs = {}
tabfirst
let tabnr = 1
while type(tabpagebuflist(tabnr)) == type([])
let tablist = tabpagebuflist(tabnr)
@anyakichi
anyakichi / factorize-last-two-args
Created April 29, 2011 09:21
Factorize last two arguments of command line.
# Factorize last two arguments of command line.
#
# Example:
# % a.zsh b.zsh
# (factorize-last-two-args)
# % {a,b}.zsh
#
# To use this:
# autoload -U factorize-last-two-args
# zle -N factorize-last-two-args
@anyakichi
anyakichi / tabutil.vim
Created May 7, 2011 04:03
Tab management utility.
" Tab management utility.
let s:save_cpo = &cpo
set cpo&vim
function! s:any(list, item)
for i in a:list
if type(i) == type(a:item) && i == a:item
return 1
endif
@anyakichi
anyakichi / vimrc-ref.vim
Created May 7, 2011 08:51
Search vim help with K.
let g:ref_no_default_key_mappings = 1
nnoremap <silent> K :<C-u>call Ref('normal')<CR>
vnoremap <silent> K :<C-u>call Ref('visual')<CR>
function! Ref(mode)
if &filetype ==# 'vim'
execute 'silent! help ' . expand("<cword>")
"execute 'help index| tj /' . expand("<cword>")
if &filetype !=# 'help'
echo 'No entry'
@anyakichi
anyakichi / histsearch.vim
Created July 28, 2011 15:31
history search plugin for vim
" History search plugin
if exists("g:loaded_histsearch")
finish
endif
let g:loaded_histsearch = 1
let s:cpo_save = &cpo
set cpo&vim
@anyakichi
anyakichi / uim-skk-sticky-key.patch
Created September 26, 2011 03:16
sticky key support for uim-skk
diff -ur uim-1.7.0.orig/scm/skk-key-custom.scm uim-1.7.0/scm/skk-key-custom.scm
--- uim-1.7.0.orig/scm/skk-key-custom.scm 2011-09-26 12:13:46.000000000 +0900
+++ uim-1.7.0/scm/skk-key-custom.scm 2011-09-26 11:27:53.000000000 +0900
@@ -140,6 +140,12 @@
(N_ "[SKK] cancel")
(N_ "long description will be here"))
+(define-custom 'skk-sticky-key '()
+ '(skk-keys1)
+ '(key)
@anyakichi
anyakichi / aquaskk-sticky-key.patch
Created September 26, 2011 15:43
sticky key support for AquaSKK
Index: src/engine/state/SKKEvent.h
===================================================================
--- src/engine/state/SKKEvent.h (revision 157)
+++ src/engine/state/SKKEvent.h (working copy)
@@ -71,7 +71,8 @@
PrevCandidate = (1 << 11),
RemoveTrigger = (1 << 12),
InputChars = (1 << 13),
- CompConversion = (1 << 14)
+ CompConversion = (1 << 14),
diff -ur multiskkserv-20100128-ac.orig/src/multiskkserv.c multiskkserv-20100128-ac/src/multiskkserv.c
--- multiskkserv-20100128-ac.orig/src/multiskkserv.c 2011-10-02 13:28:12.000000000 +0900
+++ multiskkserv-20100128-ac/src/multiskkserv.c 2011-10-02 13:28:21.000000000 +0900
@@ -263,6 +263,128 @@
#endif
}
+static int
+join(char *buf, int maxlen, char *sep, char **list)
+{
@anyakichi
anyakichi / flowchart.diag
Created January 9, 2012 11:30
flowchart sample
blockdiag {
orientation = portrait
A [label = "cond", shape = "diamond"];
A -> B [label = "yes"];
A -> C [label = "no"];
}
@anyakichi
anyakichi / gist:2982373
Created June 24, 2012 08:01
Show differences to be committed for hg and svn
nnoremap <Space>D :<C-u>call <SID>commit_diff()<CR>
function! s:commit_diff(...)
let mod = a:0 > 0 ? a:1 : '' " 'vertical' or 'tab'
if bufname('%') =~ 'hg-editor-\w\+.txt'
call s:hg_commit_diff(mod)
elseif bufname('%') =~ 'svn-commit\%(\.\d\+\)\?\.tmp$'
call s:svn_commit_diff(mod)
else