Vim Tips Wiki
m (Added to Java category + text reformatted)
m (Reverted edits by 94.242.211.40 (talk | block) to last version by JohnBot)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{Tip
 
 
|id=1107
 
|id=1107
  +
|previous=1103
|title=J2ME development by Vim __PLUS__ WTK22
 
  +
|next=1108
|created=January 16, 2006 0:41
+
|created=January 16, 2006
 
|complexity=intermediate
 
|complexity=intermediate
 
|author=peter
 
|author=peter
 
|version=6.0
 
|version=6.0
 
|rating=9/3
 
|rating=9/3
  +
|category1=Compiler
|text=
 
  +
|category2=Java
If you are same as me, using Vim to write mobile program (J2ME), you may try this.
 
 
}}
  +
When using Vim to write J2ME programs for mobile phones, you may find the following useful in your vimrc:
   
  +
<pre>
 
set makeprg=jikes\ -nowarn\ -classpath\ tmpclasses\ -d\ tmpclasses\ -sourcepath\ src\ -Xstdout\ +E\ %
 
set errorformat=%f:%l:%c:%*\\d:%*\\d:%*\\s%m
   
 
map <M-1> :make<CR>:cw5<CR>
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 =)
 
 
" cw5 help you to see the error (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.
   
 
" This emulator is specific for ZhanGuo project: (change zhanguo.jad to yourfile.jad)
Edit: c:\progra~1\vim\_vimrc, put these:
 
 
" It's best that the jad is generated by WTK22 such that it
set makeprg=jikes\ -nowarn\ -classpath\ tmpclasses\ -d\ tmpclasses\ -sourcepath\ src\ -Xstdout\ +E\ %
 
 
" place it in : c:\wtk22\apps\zhanguo (zhanguo is your project name)
set errorformat=%f:%l:%c:%*\\d:%*\\d:%*\\s%m
 
 
map <M-3> :!c:\wtk22\bin\emulator.exe -classpath bin -Xdescriptor:zhanguo.jad<CR>
" Above is [stolen] from [[VimTip3]] , thanks Scott for the great tips.
 
 
map &lt;M-1&gt; :make&lt;CR&gt;:cw5&lt;CR&gt;
 
" cw5 help you to see the error, my favorite, (stolen from :help :cn)
 
map &lt;M-2&gt; :!preverify -classpath c:\wtk22\lib\cldcapi10.jar;c:\wtk22\lib\midpapi10.jar -d bin tmpclasses&lt;CR&gt;
 
" 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 &lt;M-3&gt; :!c:\wtk22\bin\emulator.exe -classpath bin -Xdescriptor:zhanguo.jad&lt;CR&gt;
 
 
cmap %/ &lt;C-R&gt;=expand("%:p:h")."/"&lt;CR&gt;
 
" Above is [stolen] from comment inside [[VimTip2]] , thanks yulya@vdcom.ru for the great tips.
 
   
 
cmap %/ <C-R>=expand("%:p:h")."/"<CR>
'''Note on path: '''
 
  +
</pre>
   
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).
  +
<pre>
SET PATH=c:\wtk22\bin;%PATH%
+
SET PATH=c:\wtk22\bin;%PATH%
  +
</pre>
   
Need to create 2 directories, normally created by WTK22 or by hand:
+
Need to create two directories, normally created by WTK22 or by hand:
  +
<pre>
cd c:\wtk22\apps\[project]
+
cd c:\wtk22\apps\[project]
mkdir tmpclasses
 
mkdir bin
+
mkdir tmpclasses
  +
mkdir bin
  +
</pre>
   
Also, u need to start editing in the project path, not the src path. e.g.
+
Also, you need to start editing in the project path, not the src path. e.g.
  +
<pre>
cd c:\wtk22\apps\[project]
+
cd c:\wtk22\apps\[project]
vim src\MyMidlet.java
+
vim src\MyMidlet.java
  +
</pre>
   
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:
  +
<pre>
:e %/
+
:e %/
  +
</pre>
   
This will auto expand to the current [editing] directory. see the [[VimTip2]], great one.
+
This will auto expand to the current [editing] directory.
}}
 
   
== Comments ==
+
==Comments==
<!-- parsed by vimtips.py in 0.533870 seconds-->
 
[[Category:Compiler]]
 
[[Category:Java]]
 

Latest revision as of 08:55, 1 December 2014

Tip 1107 Printable Monobook Previous Next

created January 16, 2006 · complexity intermediate · author peter · version 6.0


When using Vim to write J2ME programs for mobile phones, you may find the following useful in your vimrc:

set makeprg=jikes\ -nowarn\ -classpath\ tmpclasses\ -d\ tmpclasses\ -sourcepath\ src\ -Xstdout\ +E\ %
set errorformat=%f:%l:%c:%*\\d:%*\\d:%*\\s%m

map <M-1> :make<CR>:cw5<CR>
" cw5 help you to see the error (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.

" This emulator is specific for ZhanGuo project: (change zhanguo.jad to yourfile.jad)
" It's 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>

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

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

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

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

Also, you 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.

Comments[]