-
Notifications
You must be signed in to change notification settings - Fork 0
/
osm.vim
70 lines (60 loc) · 1.97 KB
/
osm.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
""""""""" vimrc for OSM-anuvadak """""""""
"
" This file needs to be source from your vimrc for it to work.
" If you are seeing this file on Github, then key-notations used in vim may not
" be displayed properly (such as `^M`, `^[` etc.)
" prepare to start
" from command line run `vim path/to/level0_editor.txt`
" find '/name =', go 1 line up, and create a new file to save source (English) 'name' strings
" the initial space before the `name =` is left to avoid detecting `alt_name` tag
let @q='/ name =k:e en:bn'
" extract name tags
" at the end of this macro the level0 data buffer will be open
let @w='nyy:bnp:bn@w'
" keep only strings to be translated
" go to top line
" go to the next buffer,
" remove 1st (blank) line,
" keep only the names on each line and
" save the file
let @e='gg:bnggdd0Gf=lx:w'
" copy the entire list of names into the system clipboard
" and close the buffer (since it is no longer needed)
let @r='gg"+yG:bd'
" translate from en to lang
" this is a separate task (of doing the actual translation) not related to vim
" translate the copied contents of `en` file **as it is**.
" Once the translation is done, copy the translated text **as it is**.
" get back to vim and continue with the below macro
" paste the translation data
" make a new file 'mr', paste the copied text above the cursor and save the file.
" a simple manual review of the above copy paste operation can be to check if
" both the en and mr files have the same number of lines. If they don't match
" then something is wrong.
let @t=':e mr"+P:w'
" add 'name:mr' tags to all lines and save
let @y='0GI name:mr = ggOgg:w'
" add name:lang tags to the destination file
let @u='jyy:bnnp:bn@u'
" close the `mr` buffer and save the level0 data buffer
let @i=':bd:w'
" make macros of macros
let @a='@q@w' " prep and extract
let @s='@e@r' " trim and copy
let @d='@t@y@u' " paste and format
let @f=@i " save