`:doautocmd java_spotbugs_post ShellCmdPost`
must be removed from such "*Action" (or "*Command") implementations (i.e. the
lines `(a)` and `(b)` in the listed examples) to retain a sequential order for
non-blocking execution, and any notification (see below) must be suppressed.
A `ShellCmdPost` `:autocmd` can be associated with any |:augroup| by assigning
its name to the "augroupForPostCompilerAction" key.
When default actions are not suited to a desired workflow, proceed by writing
arbitrary functions yourself and matching their Funcrefs to the supported
keys: "PreCompilerAction", "PreCompilerTestAction", and "PostCompilerAction".
The next example re-implements the default pre-compiler actions for a Maven
project and requests other default Maven settings with the "compiler" entry:
>vim
function! MavenPreCompilerAction() abort
call spotbugs#DeleteClassFiles()
compiler maven
make compile
cc
endfunction
function! MavenPreCompilerTestAction() abort
call spotbugs#DeleteClassFiles()
compiler maven
make test-compile
cc
endfunction
let g:spotbugs_properties = {
\ 'compiler': 'maven',
\ 'PreCompilerAction':
\ function('MavenPreCompilerAction'),
\ 'PreCompilerTestAction':
\ function('MavenPreCompilerTestAction'),
\ }
Note that all entered custom settings will take precedence over the matching
default settings in "g:spotbugs_properties".
Note that it is necessary to notify the plugin of the result of a pre-compiler
action before further work can be undertaken. Using |:cc| after |:make| (or
|:ll| after |:lmake|) as the last command of an action is the supported means
of such communication.
Two commands, "SpotBugsRemoveBufferAutocmd" and "SpotBugsDefineBufferAutocmd",
are provided to toggle actions for buffer-local autocommands. For example, to
also run actions on any |BufWritePost| and |Signal| event, add these lines to
`~/.config/nvim/after/ftplugin/java.vim`: >vim
if exists(':SpotBugsDefineBufferAutocmd') == 2
SpotBugsDefineBufferAutocmd BufWritePost Signal
endif
Otherwise, you can turn to `:doautocmd java_spotbugs User` at any time.
The "g:spotbugs_properties" variable is consulted by the Java filetype plugin
(|ft-java-plugin|) to arrange for the described automation, and, therefore, it
must be defined before |FileType| events can take place for the buffers loaded
with Java source files. It could, for example, be set in a project-local
|vimrc| loaded by [1].
Both "g:spotbugs_properties" and "b:spotbugs_properties" are recognized and
must be modifiable (|:unlockvar|). The "*Command" entries are always treated
as global functions to be shared among all Java buffers.
The SpotBugs Java library and, by extension, its distributed shell scripts do
not support in the `-textui` mode listed pathnames with directory filenames
that contain blank characters [2]. To work around this limitation, consider
making a symbolic link to such a directory from a directory that does not have
blank characters in its name and passing this information to SpotBugs: >vim
let g:spotbugs_alternative_path = {
\ 'fromPath': 'path/to/dir_without_blanks',
\ 'toPath': 'path/to/dir with blanks',
\ }
[0] https://github.com/Konfekt/vim-compilers
[1] https://github.com/MarcWeber/vim-addon-local-vimrc
[2] https://github.com/spotbugs/spotbugs/issues/909
GNU MAKE *compiler-make*
Since the default make program is "make", the compiler plugin for make,
:compiler make, will reset the 'makeprg' and 'errorformat' option to
the default values and unlet any variables that may have been set by a
previous compiler plugin.
GROFF *quickfix-groff* *compiler-groff*
The GROFF compiler plugin uses the mom macro set (documented in the groff_mom
manpage) as input and expects that the output file type extension is passed to
make, say :make html or :make pdf.
Additional arguments can be passed to groff by setting them in
`b:groff_compiler_args` or `g:groff_compiler_args`. The `language` argument
passed to groff is set using