Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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)