Skip to content

Instantly share code, notes, and snippets.

let s:bm = benchmark#new("List is empty?")
let s:N = 100000
let s:lists = [range(0), range(100), range(10000)]
function! s:bm.empty()
let i = 0
for s in s:lists
while i < s:N
let s:bm = benchmark#new("String is empty?")
let s:N = 100000
let s:str = ["hello", ""]
function! s:bm.empty()
let i = 0
for s in s:str
while i < s:N
has("+relativenumber")
has("autocmd")
has("balloon_multiline")
has("browse")
has("conceal")
has("dos16")
has("dos32")
has("float")
has("folding")
has("gui")
call expand("#")
call expand("$DISPLAY")
call expand("$HOME")
call expand("$USER")
call expand("$USERNAME")
call expand("$VIMRUNTIME/doc/options.txt")
call expand("%")
call expand("%:e")
call expand("%:h")
call expand("%:p")
scriptencoding utf-8
let s:save_cpo = &cpo
set cpo&vim
let s:v = vital#of("vital")
let s:m = s:v.import("Math")
let s:R = s:v.import("Random").new()
" math utilities.
let s:save_cpo = &cpo
set cpo&vim
" TODO Simpler way?
function! s:modulo(m, n)
let d = a:m * a:n < 0 ? 1 : 0
return a:m + (-(a:m + (0 < a:n ? d : -d)) / a:n + d) * a:n
endfunction
@syngan
syngan / vimlparser.vim
Created August 27, 2014 00:12
comple() のif文を list に置き換え。でも改善されず。
" vim:set ts=8 sts=2 sw=2 tw=0 et:
"
" VimL parser - Vim Script Parser
"
" License: This file is placed in the public domain.
function! vimlparser#import()
return s:
endfunction
@syngan
syngan / listvsdict.vim
Last active August 29, 2015 14:05
リストと辞書へのランダムアクセス
let s:R = vital#of("vital").import("Random")
" @param n: length of list/dict
" @param m: # of loop
function! g:Go(n, m)
let list = range(a:n)
let a = s:R.shuffle(list)
let dict = {}
for i in list
@syngan
syngan / gist:5cc59a5c30b3b996f34c
Created August 11, 2014 00:44
無駄になった。
  • Problems summary insert モードで int と入力しようとすると、 i または in の入力で固まって、C-c を入力するまで何もできなくなります。

  • Expected

  • Environment Information

  • OS: ubuntu32

  • Vim version: 7.4.347

  • Minimal vimrc less than 50 lines

@syngan
syngan / gist:8d39d410eb51f200d14b
Created May 20, 2014 21:30
チケットゴブル.vim
scriptencoding utf-8
let s:save_cpo = &cpo
set cpo&vim
let s:V = vital#of('vital')
let s:L = s:V.import('Data.List')
function! s:parse_line(line)
let s = substitute(a:line, '[-/]', ' ', 'g')