diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim index 45c2f46..cb66f02 100644 --- a/home/.config/nvim/init.vim +++ b/home/.config/nvim/init.vim @@ -37,7 +37,7 @@ source $HOME/.config/nvim/plug-config/rooter.vim source $HOME/.config/nvim/plug-config/spaceline.vim " source $HOME/.config/nvim/plug-config/startify.vim source $HOME/.config/nvim/plug-config/tablemode.vim -source $HOME/.config/nvim/plug-config/translator.vim +source $HOME/.config/nvim/plug-config/translate-shell.vim source $HOME/.config/nvim/plug-config/undo.vim source $HOME/.config/nvim/plug-config/vim-buffet.vim source $HOME/.config/nvim/plug-config/vimwiki.vim diff --git a/home/.config/nvim/plug-config/translate-shell.vim b/home/.config/nvim/plug-config/translate-shell.vim new file mode 100644 index 0000000..d4e0c46 --- /dev/null +++ b/home/.config/nvim/plug-config/translate-shell.vim @@ -0,0 +1,28 @@ +" Basics +let g:trans_join_lines = 1 +let g:trans_win_height = 15 + +" Directions +" let g:trans_interactive_full_list = 1 +let g:trans_default_direction = ":ja" +let g:trans_directions_list = [ + \ ['', 'en'], + \ ['', 'ja'], + \ ['', 'de'], + \ ['', 'ru'], + \ ['', 'fr'], + \ ['', 'nl'], + \ ['', 'la'], + \ ['', 'es'], + \ ['', 'zh-CN'], + \ ['', 'zh-TW'], + \ ] + +nnoremap jt :Trans +vnoremap jt :Trans +nnoremap jd :TransSelectDirection +vnoremap jd :TransSelectDirection +nnoremap jr cw=system('trans -brief -no-ansi', getreg(""))[:-2] +vnoremap jr c=system('trans -brief -no-ansi', getreg(""))[:-2] +nnoremap jc cw=system('trans -brief -no-ansi :', getreg(""))[:-2] +vnoremap jc c=system('trans -brief -no-ansi :', getreg(""))[:-2] diff --git a/home/.config/nvim/plug-config/translator.vim b/home/.config/nvim/plug-config/translator.vim deleted file mode 100644 index f1211a9..0000000 --- a/home/.config/nvim/plug-config/translator.vim +++ /dev/null @@ -1,22 +0,0 @@ -let g:translator_target_lang = 'ja' -let g:translator_source_lang = 'auto' -let g:translator_default_engines = ['trans'] -let g:translator_history_enable = v:false - -" Echo translation in the cmdline -nmap Tt Translate -vmap Tt TranslateV -" Display translation in a window -nmap Tw TranslateW -vmap Tw TranslateWV -" Replace the text with translation -nmap Tr TranslateR -vmap Tr TranslateRV -" Translate the text in clipboard -nmap Tx TranslateX - -" Scrolling the popup window -nnoremap translator#window#float#has_scroll() ? - \ translator#window#float#scroll(1) : "\" -nnoremap translator#window#float#has_scroll() ? - \ translator#window#float#scroll(0) : "\" diff --git a/home/.config/nvim/plug-config/which-key.vim b/home/.config/nvim/plug-config/which-key.vim index c0cee1f..0c24ba5 100644 --- a/home/.config/nvim/plug-config/which-key.vim +++ b/home/.config/nvim/plug-config/which-key.vim @@ -238,12 +238,12 @@ let g:which_key_map.i = { \ 'x' : [':.!toilet -f term -F border' , 'border'], \ } -let g:which_key_map.T = { +let g:which_key_map.j = { \ 'name' : '+Translate' , - \ 't' : 'to cmdline', - \ 'w' : 'to popup', - \ 'r' : 'replace text', - \ 'x' : 'to clipboard', + \ 't' : 'default', + \ 'd' : 'direction', + \ 'r' : 'replace', + \ 'c' : 'custom replace', \ } " Table mode diff --git a/home/.config/nvim/vim-plug/vim-plug.vim b/home/.config/nvim/vim-plug/vim-plug.vim index def5773..15d52c7 100644 --- a/home/.config/nvim/vim-plug/vim-plug.vim +++ b/home/.config/nvim/vim-plug/vim-plug.vim @@ -97,7 +97,7 @@ Plug 'psliwka/vim-smoothie' " Alternative w,b,e " Plug 'bkad/CamelCaseMotion' " Spelling, dictionary -Plug 'voldikss/vim-translator' +Plug 'echuraev/translate-shell.vim' " Plug 'reedes/vim-lexical' " Plug 'ron89/thesaurus_query.vim' " Align text