/vim-quickrun-module-hook-rewrite_java_srcfile

QuickRun Java code written in an unnamed buffer

Primary LanguageVim script

vim-quickrun-module-hook-rewrite_java_srcfile

Build Status

vim-quickrun-module-hook-rewrite_java_srcfile is a Vim plugin to provide a module for vim-quickrun.

This plugin depends on:

Latest: https://github.com/Jagua/vim-quickrun-module-hook-rewrite_java_srcfile

Abstract

QuickRun is able to execute Java source code like the following written in an unnamed buffer without this plugin.

public class Hello {
    public static void main(String[] args) {
        System.out.print("Hello, world!");
    }
}

The commands are:

:QuickRun java -tempfile '%{fnamemodify(tempname(), ":p:h") . "/Hello.java"}'

or

:QuickRun java -tempfile '$TMPDIR/Hello.java'

This plugin is able to execute by the following command instead.

:QuickRun java -rewrite_java_srcfile/enable 1

.vimrc

let g:quickrun_config = get(g:, 'quickrun_config', {})
let g:quickrun_config['java'] = {
      \  'command' : 'java',
      \  'exec' : ['javac %o -d %s:p:h %s', '%c -cp %s:p:h %s:t:r %a'],
      \  'rewrite_java_srcfile/enable' : 1,
      \}