Re: VIM syntax files for PO files
- From: Sung-Hyun Nam <namsh lgic co kr>
- To: Sean O Ceallaigh <s_oceallaigh yahoo com>
- Cc: gnome-i18n gnome org
- Subject: Re: VIM syntax files for PO files
- Date: Thu, 24 Aug 2000 14:06:50 +0900
Sean O Ceallaigh wrote:
> Hi,
>
> Are there any VIM syntax files for PO files similar to
> Emacs PO mode. I've used PO mode with Emacs in the past
> and have been using more VIM lately and was wondering
> if others are using it also for translation.
There already is po.vim for syntax color. But I guess you want
something like this. I made it for my own.
This po.vimrc is for vim 6.0. If you use vim 5.x, changing is easy.
Just do next two command:
:%s/^setl/set/g
:%s/ <buffer> //g
Then it will work for vim 5.5 or later. Don't know it work less than
5.5.
And if you save the po file, it automatically change the PO revision
date and author. If you want to use it, you should change email addr.
,fm and ,ff will be useful.
regards,
namsh
" po.vimrc: VIM resource for 'po' file editing.
setl com=
setl path=.,..,../src,,
" find a non-translated msg string
nmap <buffer> ,fm :call FindNonTransMsg()<CR>z.
" find fuzzy and remove
nmap <buffer> ,ff :call FindFuzzyErase()<CR>
" duplicate the original msg.
nmap <buffer> ,fd }?^msgstr<CR>f"ld}?^msgid<CR>f"ly/^msgstr<CR>nf"pNf"l
" erase the translated message
nmap <buffer> ,fe }?^msgstr<CR>f"lc}"<ESC>
" perform language dependent checks on strings
nmap <buffer> ,fc :!msgfmt --check %<CR>
" show statistics
nmap <buffer> ,fs :!msgfmt --statistics %<CR>
" commit current file
nmap <buffer> ,ci :!cvs ci -m '' %<LEFT><LEFT><LEFT>
" goto file which contains the current string
nmap <buffer> ,gf {/^#: <CR>02f:l"aye0f w<C-W><C-F>:<C-R>a<CR>
function! FindNonTransMsg()
let lnum = line(".") + 1
let enum = line("$")
let found = 0
while lnum < enum
let line = getline(lnum)
let lnum = lnum + 1
if line == "msgstr \"\""
let blank = getline(lnum)
if blank == ""
let found = found + 1
exec "normal " . lnum . "ggk"
let lnum = enum
endif
let lnum = lnum + 1
endif
endwhile
if found < 1
echo "Cannot find non-translated msg"
endif
endfun
func! FindFuzzyErase()
let lnum = line(".") + 1
let enum = line("$")
while lnum < enum
let line = getline(lnum)
if line =~ "#, fuzzy"
exec "normal " .lnum. "gg"
if line =~ "#, fuzzy, "
exec "normal ^ldt,"
else
exec "normal dd"
endif
/^msgstr
exec "norm z.f\"l"
echohl WarningMsg | echo "You may want to edit this" | echohl None
return
endif
let lnum = lnum + 1
endwhile
echo "There's no fuzzy"
endfun
" Update the time of the 'PO-Revision-Date'.
imap <buffer> <C-G> <ESC>mG:r!date --utc +'\%Y-\%m-\%d \%T'<CR>"gd$dd`G"gpa
nmap <buffer> _CT mCHmH1G/^"PO-Revision-Date:<CR>f:wct\<C-G>+0900<ESC>
\j0f:llct\Sung-Hyun Nam <namsh@kldp.org><ESC>'Hz<CR>`C
augroup local_rc
au!
" PO revision date update
au BufWritePre,FileWritePre ko.po :norm _CT
augroup END
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]