Skip to content

Instantly share code, notes, and snippets.

@kamichidu
Created August 4, 2014 15:52
Show Gist options
  • Select an option

  • Save kamichidu/fb56c51fa6df6030825d to your computer and use it in GitHub Desktop.

Select an option

Save kamichidu/fb56c51fa6df6030825d to your computer and use it in GitHub Desktop.
function! s:curtext(expr)
let line= getline('.')
let pos= col('.')
let s= 0
while s < pos
let [s, e]= [match(line, a:expr, s), matchend(line, a:expr, s)]
if s < 0
break
elseif s < pos && pos <= e
return line[s : e - 1]
endif
let s+= 1
endwhile
return ''
endfunction
let s:sequences= {
\ 'ロリ': '幼女',
\ '幼女': '少女',
\ '少女': '姉',
\ '姉': 'OL',
\ 'OL': '人妻',
\ '人妻': 'ロリ',
\}
function! s:increase() abort
let expr= '\C\%(' . join(keys(s:sequences), '\|') . '\)'
let word= s:curtext(expr)
if empty(word)
return
endif
let [pos, s]= [col('.'), 0]
while s < pos
let [s, e]= [match(getline('.'), expr, s), matchend(getline('.'), expr, s)]
if s < pos && pos <= e
let line= getline('.')
let line= strpart(line, 0, s) . s:sequences[word] . strpart(line, e + 1)
call setline('.', line)
endif
let s+= 1
endwhile
endfunction
function! s:decrease() abort
endfunction
nnoremap <silent><C-A> :<C-U>call<Space><SID>increase()<CR>
nnoremap <silent><C-X> :<C-U>call<Space><SID>decrease()<CR>
finish
今日私は乙女を見た。そう、ロリータだ。
そのロリータは人妻でもあり、私の妻でもあり、そして幼女でもある。
さらに、夜はOLとしての顔も持っている。
何を隠そう私の姉である。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment