"create a lazy loaded java object function! CLLJ(var_type, var_name) let start_line = line('.') let template = ["private CLLJ_VAR_TYPE CLLJ_VAR_NAME = null;", "", "private CLLJ_VAR_TYPE getCLLJ_VAR_NAME() {", "\if (CLLJ_VAR_NAME == null) {", "\\CLLJ_VAR_NAME = new CLLJ_VAR_TYPE();", "\}", "\return CLLJ_VAR_NAME;","}"] call append(line('.'), template) execute "normal :%s/CLLJ_VAR_TYPE/" . a:var_type ."/g\" execute "normal :%s/CLLJ_VAR_NAME/" . a:var_name ."/g\" call cursor(start_line + 9, 0) endfunction "create a java GridBagConstraints object with default values function! CGBCJ(var_name) let start_line = line('.') let template = ["// create constraints for CGBCJ_NAME", "GridBagConstraints CGBCJ_NAMEConstraints = new GridBagConstraints();", "CGBCJ_NAMEConstraints.gridx = 0;", "CGBCJ_NAMEConstraints.gridy = 0;", "CGBCJ_NAMEConstraints.gridwidth = 1;", "CGBCJ_NAMEConstraints.gridheight = 1;", "CGBCJ_NAMEConstraints.weightx = 0;", "CGBCJ_NAMEConstraints.weighty = 0;","CGBCJ_NAMEConstraints.ipadx = 0;", "CGBCJ_NAMEConstraints.ipady = 0;", "CGBCJ_NAMEConstraints.anchor = GridBagConstraints.CENTER;", "CGBCJ_NAMEConstraints.fill = GridBagConstraints.NONE;", "CGBCJ_NAMEConstraints.insets = new Insets(0,0,0,0); //t,l,b,r" ] call append(line('.'), template) execute "normal :%s/CGBCJ_NAME/" . a:var_name . "/g\" call cursor(start_line + 15, 0) endfunction