Last active
December 25, 2015 00:29
-
-
Save steadystatic/6888634 to your computer and use it in GitHub Desktop.
Grabs titles from a csv file for an xml file
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
| function! TitleGrab() | |
| let currentLine = line('.') | |
| let bottomLine = line("$") | |
| while currentLine <= bottomLine | |
| try | |
| let @x = '/media-external | |
| 6wvt""ayl:0 | |
| /a | |
| ' | |
| let @y = 'bhvT,"byh/overlay | |
| /CDATA | |
| wwvt]"cy:0 | |
| /c | |
| /textDefault | |
| :s/CDATA\[\]/CDATA\[b\]/g | |
| /labelDefault | |
| :s/CDATA\[\]/CDATA\[b\]/g | |
| /altTExtkbkbkbextDefault | |
| :s/CDATA\[\]/CDATA\[b\]/g | |
| j$' | |
| let @z = '/media-external | |
| j' | |
| let @s = ' | |
| hj' | |
| let l:MissionSuccess = 1 | |
| :normal @x | |
| catch | |
| let l:MissionSuccess = 0 | |
| sleep 1 | |
| :normal @s | |
| finally | |
| if (l:MissionSuccess == 1) | |
| :normal @y | |
| sleep 1 | |
| :normal @z | |
| endif | |
| endtry | |
| endwhile | |
| endfunction |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With this I made good use of registers and printed what was in the register after doing one or two XML blocks into my script...setup a key to call the function, and off vim went! The try catch is super nice for when you don't find a result searching for something, etc.