neovim: translator.vim -> translate-shell.vim

This commit is contained in:
FollieHiyuki 2021-03-15 04:07:27 +03:00
parent 70a255ad39
commit 1f81225ca4
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
5 changed files with 35 additions and 29 deletions

View File

@ -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/spaceline.vim
" source $HOME/.config/nvim/plug-config/startify.vim " source $HOME/.config/nvim/plug-config/startify.vim
source $HOME/.config/nvim/plug-config/tablemode.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/undo.vim
source $HOME/.config/nvim/plug-config/vim-buffet.vim source $HOME/.config/nvim/plug-config/vim-buffet.vim
source $HOME/.config/nvim/plug-config/vimwiki.vim source $HOME/.config/nvim/plug-config/vimwiki.vim

View File

@ -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 <silent> <leader>jt :Trans<CR>
vnoremap <silent> <leader>jt :Trans<CR>
nnoremap <silent> <leader>jd :TransSelectDirection<CR>
vnoremap <silent> <leader>jd :TransSelectDirection<CR>
nnoremap <silent> <leader>jr cw<C-R>=system('trans -brief -no-ansi', getreg(""))[:-2]<CR>
vnoremap <silent> <leader>jr c<C-R>=system('trans -brief -no-ansi', getreg(""))[:-2]<CR>
nnoremap <silent> <leader>jc cw<C-R>=system('trans -brief -no-ansi :', getreg(""))[:-2]<S-Left><S-Left><Right>
vnoremap <silent> <leader>jc c<C-R>=system('trans -brief -no-ansi :', getreg(""))[:-2]<S-Left><S-Left><Right>

View File

@ -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 <silent> <Leader>Tt <Plug>Translate
vmap <silent> <Leader>Tt <Plug>TranslateV
" Display translation in a window
nmap <silent> <Leader>Tw <Plug>TranslateW
vmap <silent> <Leader>Tw <Plug>TranslateWV
" Replace the text with translation
nmap <silent> <Leader>Tr <Plug>TranslateR
vmap <silent> <Leader>Tr <Plug>TranslateRV
" Translate the text in clipboard
nmap <silent> <Leader>Tx <Plug>TranslateX
" Scrolling the popup window
nnoremap <silent><expr> <M-f> translator#window#float#has_scroll() ?
\ translator#window#float#scroll(1) : "\<M-f>"
nnoremap <silent><expr> <M-b> translator#window#float#has_scroll() ?
\ translator#window#float#scroll(0) : "\<M-f>"

View File

@ -238,12 +238,12 @@ let g:which_key_map.i = {
\ 'x' : [':.!toilet -f term -F border' , 'border'], \ 'x' : [':.!toilet -f term -F border' , 'border'],
\ } \ }
let g:which_key_map.T = { let g:which_key_map.j = {
\ 'name' : '+Translate' , \ 'name' : '+Translate' ,
\ 't' : 'to cmdline', \ 't' : 'default',
\ 'w' : 'to popup', \ 'd' : 'direction',
\ 'r' : 'replace text', \ 'r' : 'replace',
\ 'x' : 'to clipboard', \ 'c' : 'custom replace',
\ } \ }
" Table mode " Table mode

View File

@ -97,7 +97,7 @@ Plug 'psliwka/vim-smoothie'
" Alternative w,b,e " Alternative w,b,e
" Plug 'bkad/CamelCaseMotion' " Plug 'bkad/CamelCaseMotion'
" Spelling, dictionary " Spelling, dictionary
Plug 'voldikss/vim-translator' Plug 'echuraev/translate-shell.vim'
" Plug 'reedes/vim-lexical' " Plug 'reedes/vim-lexical'
" Plug 'ron89/thesaurus_query.vim' " Plug 'ron89/thesaurus_query.vim'
" Align text " Align text