Skip to content

Instantly share code, notes, and snippets.

View itchyny's full-sized avatar
🏠
Working from home

itchyny itchyny

🏠
Working from home
  • Cybozu, Inc.
  • Kyoto, Japan
View GitHub Profile
@itchyny
itchyny / natural.hs
Created January 17, 2012 00:11
Arrow style natural numbers
import Prelude hiding (succ, pred, and, or, not, const, flip, curry)
import Control.Arrow
-- Arrow style natural numbers by itchyny
toint = ($ ((1+), 0))
tobool = ($ (True, False))
fromint 0 = zero
fromint n = succ (fromint (n - 1))
diff --git a/autoload/calendar.vim b/autoload/calendar.vim
index 8d3abab..ad99409 100644
--- a/autoload/calendar.vim
+++ b/autoload/calendar.vim
@@ -214,12 +214,14 @@ function! calendar#show(...)
let vmnth_org = vmnth
let vyear_org = vyear
+ if dir != 2
" start with last month
diff --git a/autoload/vimfiler/view.vim b/autoload/vimfiler/view.vim
index 42139e2..d7c5eb0 100644
--- a/autoload/vimfiler/view.vim
+++ b/autoload/vimfiler/view.vim
@@ -225,6 +225,20 @@ function! s:redraw_prompt() "{{{
let &l:modifiable = modifiable_save
endfunction"}}}
+
+function! vimfiler#view#_get_column(columns, file)
@itchyny
itchyny / strwidthpart_strwidthpart_reverse.vim
Last active August 29, 2015 13:56
Binary search in strwidthpart, strwidthpart_reverse
function! s:new_strwidthpart(str, width)
if a:width <= 0
return ''
endif
" Split into array
let strarr = split(a:str, '\zs')
let width = s:wcswidth(a:str)
" Start binary search
let index = len(strarr)
#!/bin/zsh
dotfile=mikutter.dot
outfile=mikutter.png
mikutterdir=../mikutter/core
echo "digraph mikutter {" > "$dotfile"
for file in $mikutterdir/*.rb; do
name=$(basename "$file" | sed 's/\.rb//')
for dependon in $(grep "^miquire :core" "$file" | sed 's/miquire.*:[a-z]*, //' | tr ',' '\n' | tr -d " '\""); do
FUNCTION vimshell#terminal#get_col()
Called 1253 times
Total time: 40.185621
Self time: 24.927843
count total (s) self (s)
" is_virtual -> a:col : real col.
" not -> a:col : virtual col.
1253 0.006099 let col = 1
1253 0.005154 let real_col = 0
FUNCTIONS SORTED ON TOTAL TIME
count total (s) self (s) function
2000 34.890824 0.153159 neocomplete#handler#_on_insert_char_pre()
1001 34.474891 0.101379 <SNR>98_make_cache_current_line()
1001 33.387978 0.052042 neocomplete#sources#buffer#make_cache_current_line()
1002 33.356230 32.772526 <SNR>80_make_cache_current_buffer()
2016 0.965097 0.178434 neocomplete#helper#is_enabled_source()
1016 0.749196 0.056853 neocomplete#helper#ftdictionary2list()
1020 0.694174 0.020297 neocomplete#get_source_filetypes()
This is a test from gist.vim.
@itchyny
itchyny / test.vim
Last active August 29, 2015 14:13
profile start profile.log
profile func *strwidth*
set rtp+=/path/to/vital.vim/
let s:V = vital#of('vital')
let s:P = s:V.import('Prelude')
function! Error_strwidthpart()
endfunction
FUNCTION <SNR>4_new_strwidthpart_reverse()
Called 3843 times
Total time: 10.562034
Self time: 9.863578
count total (s) self (s)
3843 0.028234 if a:width <= 0
63 0.001507 return ''
endif
" Split into array