diff options
author | Akshay <[email protected]> | 2021-10-26 16:52:41 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-10-27 12:39:38 +0100 |
commit | bfc720bf4d8adbb3b1eaff4f3556bc6d1e00849a (patch) | |
tree | d70767a31f3fb1978c2b2e932f7a83ea1eb87386 /vim-plugin | |
parent | 20d195988de1014517ff1a1c8c1041cff5f88e05 (diff) |
allow stdin input to statix-singlevim-plugin
Diffstat (limited to 'vim-plugin')
-rw-r--r-- | vim-plugin/ftplugin/nix.vim | 8 | ||||
-rw-r--r-- | vim-plugin/plugin/statix.vim | 14 |
2 files changed, 22 insertions, 0 deletions
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 @@ | |||
1 | setlocal makeprg=statix\ check\ -o\ errfmt\ % | ||
2 | setlocal errorformat=%f>%l:%c:%t:%n:%m | ||
3 | |||
4 | augroup StatixCheck | ||
5 | autocmd! | ||
6 | autocmd! BufWritePost *.nix | silent make! | silent redraw! | ||
7 | autocmd QuickFixCmdPost [^l]* cwindow | ||
8 | 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 @@ | |||
1 | function! ApplyStatixSuggestion() | ||
2 | let l:l = line('.') | ||
3 | let l:c = col('.') | ||
4 | let l:filter = "%!statix single -p " . l . "," . c . "" | ||
5 | execute l:filter | ||
6 | |||
7 | silent if v:shell_error == 1 | ||
8 | undo | ||
9 | endif | ||
10 | |||
11 | call cursor(l, c) | ||
12 | endfunction | ||
13 | |||
14 | nnoremap gf :call ApplyStatixSuggestion()<cr> | ||