Skip to content

Instantly share code, notes, and snippets.

@maguroguma
Created October 16, 2022 06:30
Show Gist options
  • Save maguroguma/3a36eeb34e796930b55ffb4a95a5212a to your computer and use it in GitHub Desktop.
Save maguroguma/3a36eeb34e796930b55ffb4a95a5212a to your computer and use it in GitHub Desktop.
行Visualで指定した範囲に対して `nkf -Z0` を適用(全角英数字・記号→半角に変換)を行う
if executable('nkf')
function! s:nkf(has_bang, ...) abort range
execute 'silent' a:firstline ',' a:lastline '!nkf -Z0'
endfunction
command! -bar -bang -range=% -nargs=? Nkf <line1>,<line2>call s:nkf(<bang>0, <f-args>)
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment