Vim Tips Wiki
m (Category: Compiler)
m (Added to Java category + text reformatted)
Line 12: Line 12:
   
   
  +
I did a search during the weekend, no luck to find similar tips/scripts, so i tried to collect some and put it there, it works for me, but rather hardcode, especially on emulator part, it's not perfect, welcome for any comments =)
 
I did a search during the weekend, no luck to find similar tips/scripts, so i tried to
 
 
collect some and put it there, it works for me, but rather hardcode, especially on
 
 
emulator part, it's not perfect, welcome for any comments =)
 
 
 
   
 
Edit: c:\progra~1\vim\_vimrc, put these:
 
Edit: c:\progra~1\vim\_vimrc, put these:
 
set makeprg=jikes\ -nowarn\ -classpath\ tmpclasses\ -d\ tmpclasses\ -sourcepath\ src\ -Xstdout\ +E\ %
 
set errorformat=%f:%l:%c:%*\\d:%*\\d:%*\\s%m
 
" Above is [stolen] from [[VimTip3]] , thanks Scott for the great tips.
  +
 
map <M-1> :make<CR>:cw5<CR>
 
" cw5 help you to see the error, my favorite, (stolen from :help :cn)
 
map <M-2> :!preverify -classpath c:\wtk22\lib\cldcapi10.jar;c:\wtk22\lib\midpapi10.jar -d bin tmpclasses<CR>
 
" preverify is important before running the WTK emulator, i use Alt-2 to do this, may change.
  +
 
" This emulator is specific for ZhanGuo project: (change zhanguo.jad to yourfile.jad)
 
" it's the best that the jad is generated by WTK22 such that it
 
" place it in : c:\wtk22\apps\zhanguo (zhanguo is your project name)
 
map <M-3> :!c:\wtk22\bin\emulator.exe -classpath bin -Xdescriptor:zhanguo.jad<CR>
  +
 
cmap %/ <C-R>=expand("%:p:h")."/"<CR>
 
" Above is [stolen] from comment inside [[VimTip2]] , thanks yulya@vdcom.ru for the great tips.
   
 
'''Note on path: '''
-------------------------------------------------------------------------------
 
 
set makeprg=jikes\ -nowarn\ -classpath\ tmpclasses\ -d\ tmpclasses\ -sourcepath\ src\ -Xstdout\ +E\ %
 
 
set errorformat=%f:%l:%c:%*\\d:%*\\d:%*\\s%m
 
 
" Above is [stolen] from [[VimTip3]] , thanks Scott for the great tips.
 
 
 
 
map <M-1> :make<CR>:cw5<CR>
 
 
" cw5 help you to see the error, my favorite, (stolen from :help :cn)
 
 
map <M-2> :!preverify -classpath c:\wtk22\lib\cldcapi10.jar;c:\wtk22\lib\midpapi10.jar -d bin tmpclasses<CR>
 
 
" preverify is important before running the WTK emulator, i use Alt-2 to do this, may change.
 
 
 
 
" This emulator is specific for ZhanGuo project: (change zhanguo.jad to yourfile.jad)
 
 
" it's the best that the jad is generated by WTK22 such that it
 
 
" place it in : c:\wtk22\apps\zhanguo (zhanguo is your project name)
 
 
map <M-3> :!c:\wtk22\bin\emulator.exe -classpath bin -Xdescriptor:zhanguo.jad<CR>
 
 
 
 
cmap %/ <C-R>=expand("%:p:h")."/"<CR>
 
 
" Above is [stolen] from comment inside [[VimTip2]] , thanks yulya@vdcom.ru for the great tips.
 
 
------------------------------------------------------------------------------
 
 
Note on path:
 
   
 
You need to have path on c:\wtk22\bin (or else you need full path in many places, lazy)
 
You need to have path on c:\wtk22\bin (or else you need full path in many places, lazy)
 
SET PATH=c:\wtk22\bin;%PATH%
 
SET PATH=c:\wtk22\bin;%PATH%
 
   
 
Need to create 2 directories, normally created by WTK22 or by hand:
 
Need to create 2 directories, normally created by WTK22 or by hand:
 
cd c:\wtk22\apps\[project]
 
mkdir tmpclasses
 
mkdir bin
   
 
Also, u need to start editing in the project path, not the src path. e.g.
 
 
cd c:\wtk22\apps\[project]
 
 
vim src\MyMidlet.java
cd c:\wtk22\apps\[project]
 
 
mkdir tmpclasses
 
 
mkdir bin
 
 
 
 
Also, u need to start editing in the project path, not the src path.
 
 
e.g.
 
 
cd c:\wtk22\apps\[project]
 
 
vim src\MyMidlet.java
 
 
 
   
 
do not go out of the [project] path, if you need to edit another file, do:
 
do not go out of the [project] path, if you need to edit another file, do:
 
:e %/
 
:e %/
 
   
 
This will auto expand to the current [editing] directory. see the [[VimTip2]], great one.
 
This will auto expand to the current [editing] directory. see the [[VimTip2]], great one.
 
 
 
 
 
 
 
}}
 
}}
   
Line 103: Line 55:
 
<!-- parsed by vimtips.py in 0.533870 seconds-->
 
<!-- parsed by vimtips.py in 0.533870 seconds-->
 
[[Category:Compiler]]
 
[[Category:Compiler]]
  +
[[Category:Java]]

Revision as of 17:26, 23 July 2007

Previous TipNext Tip

Tip: #1107 - J2ME development

Created: January 16, 2006 0:41 Complexity: intermediate Author: peter Version: 6.0 Karma: 9/3 Imported from: Tip#1107

If you are same as me, using Vim to write mobile program (J2ME), you may try this.


I did a search during the weekend, no luck to find similar tips/scripts, so i tried to collect some and put it there, it works for me, but rather hardcode, especially on emulator part, it's not perfect, welcome for any comments =)

Edit: c:\progra~1\vim\_vimrc, put these:

set makeprg=jikes\ -nowarn\ -classpath\ tmpclasses\ -d\ tmpclasses\ -sourcepath\ src\ -Xstdout\ +E\ % 
set errorformat=%f:%l:%c:%*\\d:%*\\d:%*\\s%m 
" Above is [stolen] from VimTip3 , thanks Scott for the great tips. 

map <M-1> :make<CR>:cw5<CR> 
" cw5 help you to see the error, my favorite, (stolen from :help :cn) 
map <M-2> :!preverify -classpath c:\wtk22\lib\cldcapi10.jar;c:\wtk22\lib\midpapi10.jar -d bin tmpclasses<CR> 
" preverify is important before running the WTK emulator, i use Alt-2 to do this, may change. 

" This emulator is specific for ZhanGuo project: (change zhanguo.jad to yourfile.jad) 
" it's the best that the jad is generated by WTK22 such that it 
" place it in : c:\wtk22\apps\zhanguo (zhanguo is your project name) 
map <M-3> :!c:\wtk22\bin\emulator.exe -classpath bin -Xdescriptor:zhanguo.jad<CR> 

cmap %/ <C-R>=expand("%:p:h")."/"<CR> 
" Above is [stolen] from comment inside VimTip2 , thanks yulya@vdcom.ru for the great tips. 

Note on path:

You need to have path on c:\wtk22\bin (or else you need full path in many places, lazy)

SET PATH=c:\wtk22\bin;%PATH% 

Need to create 2 directories, normally created by WTK22 or by hand:

cd c:\wtk22\apps\[project] 
mkdir tmpclasses 
mkdir bin 

Also, u need to start editing in the project path, not the src path. e.g.

cd c:\wtk22\apps\[project] 
vim src\MyMidlet.java 

do not go out of the [project] path, if you need to edit another file, do:

:e %/ 

This will auto expand to the current [editing] directory. see the VimTip2, great one.

Comments