Created
September 24, 2013 10:15
-
-
Save slimane/6682815 to your computer and use it in GitHub Desktop.
全角文字は死ね
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command! FullToHalf call s:full_to_half.substitute() | |
let s:full_to_half = {} | |
let s:full_to_half.table = { | |
\ ' ' : ' ' | |
\ , '(' : '(' | |
\ , ')' : ')' | |
\ , ':' : ':' | |
\ , '0' : '0' | |
\ , '1' : '1' | |
\ , '2' : '2' | |
\ , '3' : '3' | |
\ , '4' : '4' | |
\ , '5' : '5' | |
\ , '6' : '6' | |
\ , '7' : '7' | |
\ , '8' : '8' | |
\ , '9' : '9' | |
\ } | |
function! s:full_to_half.substitute() dict | |
let substitute_list = | |
\ values(map(deepcopy(self.table) | |
\ , '":silent %s/" . v:key . "/" . v:val . "/ge"')) | |
call s:bleiben_execute(substitute_list) | |
endfunction | |
function! s:bleiben_execute(cmd_list) | |
let l:pos = getpos('.') | |
for cmd in a:cmd_list | |
execute cmd | |
endfor | |
call setpos('.', l:pos) | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment