<div dir="ltr"><div><div><div>Hi all,<br><br></div>I am using vim editor for NCL, and I appreciated the tips in <a href="https://www.ncl.ucar.edu/Applications/editor.shtml#vim">https://www.ncl.ucar.edu/Applications/editor.shtml#vim</a>. I also appreciated that the ncl3.vim file is updated promptly after release of the new version of NCL. However, I noticed that ncl.dic has not been updated for 4 years.<br><br></div>Another problem with the current ncl.dic is that some keywords are not showing up correctly with my version of vim (7.2). For example, if I type in "xy", then Ctrl+n, the keyword "xyCoordData"
is trimmed to "xyCo" and several words from "xyCoordDataSpec" to
"xyLineDashSegLenF" are missing. I noticed that my version of vim imposed a 510-byte limit on the maximum line length for the dictionary file (see :help 'dictionary' in vim). I believe this explains the problem seen in <a href="https://www.ncl.ucar.edu/Support/talk_archives/2011/1828.html">https://www.ncl.ucar.edu/Support/talk_archives/2011/1828.html</a>.<br><br></div>Now, this is my solution:<br><br><div><div><div><font face="monospace,monospace">#!/bin/sh<br># produce ncl3.dic from downloaded ncl3.vim<br><br>#wget <a href="http://www.ncl.ucar.edu/Applications/Files/ncl.dic">http://www.ncl.ucar.edu/Applications/Files/ncl.dic</a><br>#mv -i ncl.dic ~/.vim/dictionary/<br>#wget <a href="http://www.ncl.ucar.edu/Applications/Files/ncl3.vim">http://www.ncl.ucar.edu/Applications/Files/ncl3.vim</a> # updated 2 days after release of 6.4.0<br>#mv -i ncl3.vim ~/.vim/syntax/<br><br>sed -n '/^syn keyword nclKeyword/p' ~/.vim/syntax/ncl3.vim > dic3b.ncl<br>sed -n '/^syn keyword nclBoolean/p' ~/.vim/syntax/ncl3.vim >> dic3b.ncl<br>sed -n '/nclKeyword/d;/nclBoolean/d;/^syn keyword/p' ~/.vim/syntax/ncl3.vim >> dic3b.ncl<br>sed -i 's/syn keyword [^ ]* \+\b/\n/' dic3b.ncl<br><br>t_update=`sed -n '/^" Updated/s/" Updated //p' ~/.vim/syntax/ncl3.vim`<br>head -n 5 ~/.vim/dictionary/ncl.dic |sed "s/\(^.* Updated: \+\b\).*$/\1$t_update/;s/\(^.* Author: \+\b\).*$/\1Packard Chan\n\" Based on previous version by Prince K Xavier, and ncl3.vim by Carl Schreck/" > ~/.vim/dictionary/ncl3.dic<br>sed '1d' dic3b.ncl |fold -w 500 -s >> ~/.vim/dictionary/ncl3.dic<br>rm dic3b.ncl<br></font><br></div><div>This script puts the dictionary file in <font face="monospace,monospace">~/.vim/dictionary/ncl3.dic</font>. Make sure you update your vimrc with this new dictionary file location.<br><br></div><div>Any comments and suggestions are welcomed.<br><br></div><div>Cheers,<br></div><div>Packard<br></div><div><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div>Packard Chan<br><span><div><div dir="ltr"><div><div><div>Ph.D. candidate<br><div>Department of Earth and Planetary Sciences<br><div>Harvard University<br></div></div></div>
</div></div><br></div></div></span></div><span style="color:rgb(0,0,0)"></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</div></div></div></div>