Last active
October 16, 2022 07:04
-
-
Save maguroguma/322fb142eb2f1c8e4c1afe8ace89c119 to your computer and use it in GitHub Desktop.
https://github.com/soimort/translate-shell を用いて単語レベルでサクッと意味を調べたい時用の和英・英和のvim wrapper
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
if executable('trans') | |
function! s:printToTempBuffer(exe_command) | |
execute 'botright' 10 'new' | |
setlocal nobuflisted bufhidden=unload buftype=nofile | |
execute a:exe_command | |
norm gg | |
setlocal nomodified | |
endfunction | |
function! s:engToJapa(arg) | |
let l:com = 'read !trans en:ja -no-ansi ' . "'" . a:arg . "'" | |
call s:printToTempBuffer(l:com) | |
endfunction | |
function! s:japaToEng(arg) | |
let l:com = 'read !trans ja:en -no-ansi ' . "'" . a:arg . "'" | |
call s:printToTempBuffer(l:com) | |
endfunction | |
" 英和 - :Enja <english word> | |
command! -nargs=1 Enja :call s:engToJapa(<f-args>) | |
" 和英 - :Jaen <日本語の単語> | |
command! -nargs=1 Jaen :call s:japaToEng(<f-args>) | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment