From 4c7b6751ee381993e448ab43766555bf178ae28c Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 20 Nov 2020 11:21:42 +0530 Subject: add hlint + qf integration --- nvim/.config/nvim/ftplugin/haskell.vim | 45 +++++++++++++++++----------------- nvim/.config/nvim/ftplugin/kotlin.vim | 19 ++++++++++++++ nvim/.config/nvim/ftplugin/scheme.vim | 8 ++++++ 3 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 nvim/.config/nvim/ftplugin/kotlin.vim (limited to 'nvim') diff --git a/nvim/.config/nvim/ftplugin/haskell.vim b/nvim/.config/nvim/ftplugin/haskell.vim index c389121..5bcdd4c 100644 --- a/nvim/.config/nvim/ftplugin/haskell.vim +++ b/nvim/.config/nvim/ftplugin/haskell.vim @@ -1,29 +1,30 @@ function! s:OverwriteBuffer(output) - let winview = winsaveview() - silent! undojoin - normal! gg"_dG - call append(0, split(a:output, '\v\n')) - normal! G"_dd - call winrestview(winview) + let winview = winsaveview() + silent! undojoin + normal! gg"_dG + call append(0, split(a:output, '\v\n')) + normal! G"_dd + call winrestview(winview) endfunction function! s:RunStylishHaskell() - let output = system("stylish-haskell" . " " . bufname("%")) - let errors = matchstr(output, '\(Language\.Haskell\.Stylish\.Parse\.parseModule:[^\x0]*\)') - if v:shell_error != 0 - echom output - elseif empty(errors) - call s:OverwriteBuffer(output) - write - else - echom errors - endif + let output = system("stylish-haskell" . " " . bufname("%")) + let errors = matchstr(output, '\(Language\.Haskell\.Stylish\.Parse\.parseModule:[^\x0]*\)') + if v:shell_error != 0 + echom output + elseif empty(errors) + call s:OverwriteBuffer(output) + write + else + echom errors + endif endfunction -augroup haskell-formatting - autocmd! - autocmd BufWritePost *.hs call s:RunStylishHaskell() -augroup END - - set formatprg=stylish-haskell +set makeprg=hlint + +augroup HaskellLint + autocmd! + autocmd BufWritePost *.hs | silent make! | silent redraw! + autocmd QuickFixCmdPost [^l]* cwindow +augroup END diff --git a/nvim/.config/nvim/ftplugin/kotlin.vim b/nvim/.config/nvim/ftplugin/kotlin.vim new file mode 100644 index 0000000..d001ac1 --- /dev/null +++ b/nvim/.config/nvim/ftplugin/kotlin.vim @@ -0,0 +1,19 @@ +setlocal tabstop=4 +setlocal softtabstop=4 +setlocal shiftwidth=4 +setlocal expandtab +setlocal autoindent +setlocal smarttab +setlocal formatoptions=croql + +setlocal comments=:// +setlocal commentstring=//\ %s + +setlocal makeprg=ktlint + +augroup KtLint + autocmd! + autocmd BufWritePost *.kt silent make! | silent redraw + autocmd QuickFixCmdPost [^l]* cwindow +augroup END + diff --git a/nvim/.config/nvim/ftplugin/scheme.vim b/nvim/.config/nvim/ftplugin/scheme.vim index 2b6c296..4af180c 100644 --- a/nvim/.config/nvim/ftplugin/scheme.vim +++ b/nvim/.config/nvim/ftplugin/scheme.vim @@ -6,4 +6,12 @@ setlocal autoindent setlocal smarttab setlocal formatoptions=croql +setlocal makeprg=guile-lint + +augroup SchemeLint + autocmd! + autocmd BufWritePost *.scm silent make! | silent redraw + autocmd QuickFixCmdPost [^l]* cwindow +augroup END + CocDisable -- cgit v1.2.3