From f909b20c540ea99dddfd04b8439ee35b8dd703b8 Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 27 Oct 2021 17:10:42 +0530 Subject: allow stdin input to statix-single, vim plugin --- vim-plugin/ftplugin/nix.vim | 8 ++++++++ vim-plugin/plugin/statix.vim | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 vim-plugin/ftplugin/nix.vim create mode 100644 vim-plugin/plugin/statix.vim (limited to 'vim-plugin') diff --git a/vim-plugin/ftplugin/nix.vim b/vim-plugin/ftplugin/nix.vim new file mode 100644 index 0000000..885857f --- /dev/null +++ b/vim-plugin/ftplugin/nix.vim @@ -0,0 +1,8 @@ +setlocal makeprg=statix\ check\ -o\ errfmt\ % +setlocal errorformat=%f>%l:%c:%t:%n:%m + +augroup StatixCheck + autocmd! + autocmd! BufWritePost *.nix | silent make! | silent redraw! + autocmd QuickFixCmdPost [^l]* cwindow +augroup END diff --git a/vim-plugin/plugin/statix.vim b/vim-plugin/plugin/statix.vim new file mode 100644 index 0000000..736cce2 --- /dev/null +++ b/vim-plugin/plugin/statix.vim @@ -0,0 +1,14 @@ +function! ApplyStatixSuggestion() + let l:l = line('.') + let l:c = col('.') + let l:filter = "%!statix single -p " . l . "," . c . "" + execute l:filter + + silent if v:shell_error == 1 + undo + endif + + call cursor(l, c) +endfunction + +nnoremap gf :call ApplyStatixSuggestion() -- cgit v1.2.3