Created
April 26, 2011 20:52
-
-
Save levicole/943117 to your computer and use it in GitHub Desktop.
I18n helper for vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "takes whatever you have highlighted in visual mode, you give it a localization key, it inserts that and puts the key plus the phrase in a register for yanking into your locale file. | |
| function! Rlocalize(lk) range | |
| let saved_reg_type = getregtype('"') | |
| let old_reg = getreg('"') | |
| normal! ""gvy | |
| let selection = getreg('"') | |
| let key = split(a:lk, '\.') | |
| let phrase = key[-1].": \"".selection."\"" | |
| call setreg('l', phrase, "l") | |
| call setreg('"', old_reg, saved_reg_type) | |
| normal! gvd | |
| exe "normal i t(\"".a:lk."\")" | |
| .s/\(\S\)\s\+/\1 /g | |
| .s/\s\+$// | |
| endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment