Skip to content

Instantly share code, notes, and snippets.

function! s:hoge(xs)
let top = get(a:xs,0,[])
let rest = a:xs[1:]
let i = 0
while i < len(rest)
for e in top
if -1 < index(get(rest,i,[]), e)
let top = uniq(sort(top + rest[i]))
call remove(rest,i)
scriptencoding utf-8
let s:suite = themis#suite('Test for string.vim')
let s:assert = themis#helper('assert')
function! s:suite.string_split_0()
let float = -1
let width = 0
call s:assert.equals(string#split('あaいbうcえdおe', width, float, 1), [''])
call s:assert.equals(string#split('あaいbうcえdおe', width, float, 0), [''])
function! s:echo_line_with_hl(lnum, sep)
let line = getline(a:lnum)
let cs = split(line, '\zs')
let xs = []
for c in range(1, len(line))
if diff_hlID(a:lnum, c) isnot 0
let name = synIDattr(synIDtrans(diff_hlID(a:lnum, c)), 'name')
else
let name = synIDattr(synIDtrans(synID(a:lnum, c, 1)), 'name')
endif
function! s:CloseCLW()
if bufname('%') is '[Command Line]'
quit
endif
enew
endfunction
command! CloseCLW :call <sid>CloseCLW()
using System;
using System.Threading.Tasks;
namespace test01
{
class Program
{
static void Main(string[] args)
{
@rbtnn
rbtnn / gist:ddab3be83c2ec8f176e5
Created May 10, 2014 15:52
「3で割り切れる2進数を表す正規表現」※ Vim正規表現
\%(0*\%(\|1\%(00\|11\)*01\%(00\|11\)*01\|1\%(00\|11\)*01\%(00\|11\)*10\%(00\|11\)*10\|1\%(00\|11\)*01\%(00\|11\)*10\%(00\|11\)*01\%(00\|11\)*01\|1\%(00\|11\)*10\|01\%(00\|11\)*01\%(00\|11\)*01\|01\%(00\|11\)*01\%(00\|11\)*10\%(00\|11\)*10\|01\%(00\|11\)*01\%(00\|11\)*10\%(00\|11\)*01\%(00\|11\)*01\|01\%(00\|11\)*10\|10\%(00\|11\)*01\|10\%(00\|11\)*10\%(00\|11\)*01\%(00\|11\)*01\|10\%(00\|11\)*10\%(00\|11\)*10\|11\)\)\+$
function! s:get_archive() " {{{
let archive = []
let format = {
\ 'layout' : '^layout: \(.*\)$',
\ 'id' : '^title: 第\(\d\+\)回 vimrc読書会$',
\ 'category' : '^category: \(.*\)$',
\ 'date' : '^\(\d\{4,4}/\d\{2,2}/\d\{2,2}\)\%(.*\)\( \d\{2,2}:\d\{2,2}\)-$',
\ 'author/name' : '^\(.*\) さんの vimrc を読みました。$',
\ 'vimrcs/name' : '^- \[\(.*\)](.*) (\[ダウンロード](\%(.*\)))$',
@rbtnn
rbtnn / gist:8540338
Created January 21, 2014 13:46
augroup auto_comment_off
augroup auto_comment_off
autocmd!
autocmd BufEnter * setlocal formatoptions-=ro
augroup END
@rbtnn
rbtnn / Assertion.vim
Created January 13, 2014 05:17
call s:S.define('Assert',expand("<sfile>"),1)
let s:save_cpo = &cpo
set cpo&vim
function! s:_vital_loaded(V)
let s:assert_config = {
\ 'equal_separator' : ['<=>','<=>'],
\ 'not_equal_separator' : ['<!>','<!>'],
\ 'enable' : 1,
\ }
@rbtnn
rbtnn / Assertion
Last active January 2, 2016 00:28
Vital.Assertion
let s:V = vital#of('vital')
let s:S = s:V.import('Assertion')
call s:S.define('Assert',1)
function! s:hoge(x)
return a:x * 3
endfunction
Assert 3 <!> s:hoge(4)