EDIFACT position in a segment


Ⅰ. 插件描述

works out the position of the cursor in an EDIFACT segment

Ⅱ. 基本信息

创建日期:  2002-06-10
使用用户:  1
Github星:  1
插件作者:  colin dearing

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/edifact-position-in-a-segment'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/edifact-position-in-a-segment'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/edifact-position-in-a-segment'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/EDIFACT-position-in-a-segment

Ⅳ. 文档说明

i spend quite a lot of time reading, editing, and translating EDIFACT messages.  so i have produced this to help me work out where i am in the file.

the EDIFACT position dscription
SG2.PNA.C816.3836
isnt that helpful without a spec for reference.  the first two parts (segment group 2, segment PNA) are quite clear, but the last two arent very useful.

for an example segment
PNA+PAT+NHS_NUM1:OPI+++SU:SURNAME1+FO:FORENAME1A+TI:TITLE1+MI:FORENAME1B+FS:FORENAME1C'

that is the fragment "SURNAME1"

so instead i use numbers for the element and fragment positions, both numbered from zero.  "PNA" is element zero, "PAT" element one, etc.

using this function, place your cursor in the "SURNAME1" fragment, and it will return the info:
element = 5 , fragment = 1

when using this, make sure that every segment starts on a new line in your file (search for ' and replace with 'r will do this nicely).  trying to read EDIFACT when it is all one line is just to painful, so i dont recorment it.

this function has the seperators "+" and ":" hard coded at the moment, and doesnt handle escaped seperators.

添加新评论