dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 3b8ef41fadc8e9d4a830a73edd486aac84028c0f
parent e14a29613af4ac58d14cb504011d204fb14c82d4
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu,  6 Jun 2019 15:31:10 +0200

Run languagetool from vim with external process

Diffstat:
A.local/bin/languagetool-vim | 13+++++++++++++
M.vim/plugin/keybinds.vim | 4+++-
M.vim/plugins.vim | 6+-----
3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/.local/bin/languagetool-vim b/.local/bin/languagetool-vim @@ -0,0 +1,13 @@ +#!/bin/sh +set -eu + +if [ "$#" -lt 1 ]; then + f="$(mktemp)" + cat > "$f" +else + f="$1" +fi + +languagetool -l en-US \ + --languagemodel /usr/share/ngrams --word2vecmodel /usr/share/word2vec \ + "$f" 2>/dev/null diff --git a/.vim/plugin/keybinds.vim b/.vim/plugin/keybinds.vim @@ -106,7 +106,6 @@ augroup FzfBinds \ exe "nnoremap <leader>f :Files<cr>" | \ exe "nnoremap <leader>F :GFiles<cr>" | \ exe "nnoremap <leader>l :Lines<cr>" | - \ exe "nnoremap <leader>L :BLines<cr>" | \ exe "nnoremap <leader>t :Tags<cr>" | \ endif augroup end @@ -140,3 +139,6 @@ nnoremap <silent><F7> :w!<cr>:Start! sent <c-r>%<cr><cr> " save current session " (open with `vim -S <sessionname>.vim` or :source <sessionname> nnoremap <leader>S :mksession! <c-r>%.session.vim + +" analyze written text with statistics and neural network +nnoremap <leader>L :w<cr>:cexpr system('languagetool-vim ' . shellescape(expand('%')))<cr> diff --git a/.vim/plugins.vim b/.vim/plugins.vim @@ -14,12 +14,11 @@ Plug 'tpope/vim-eunuch' " :SudoWrite, :Rename, :Move, etc """""" Syntax checking """""" Plug 'w0rp/ale' " asynchronous syntax check Plug 'lukhio/adVIMsor', { 'on': 'AdVIMsorEnable' } " checks with :AdVIMsor* -Plug 'Eluminae/vim-LanguageTool' " grammar check, :LanguageToolCheck """""" Buffer motion """""" Plug 'justinmk/vim-sneak' " move cursor s{char}{char}, use cl for sub -" """""" Text editing """""" +""""""" Text editing """""" Plug 'tpope/vim-surround' " modify surrounding symbols Plug 'tpope/vim-repeat' " repeat plugin bindings with . Plug 'tomtom/tcomment_vim' " comment line with gcc, motion with gc @@ -73,6 +72,3 @@ let g:markdown_syntax_conceal = 0 " ignore .gitignore files from ctags let g:gutentags_file_list_command = 'rg --files' - -" use languagetool binary instead of calling jar file -let g:languagetool_cmd = '/usr/bin/languagetool --languagemodel /usr/share/ngrams --word2vecmodel /usr/share/word2vec'