Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A few remarks' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A few remarks
Authored by: Soliman on Jul 12, '07 03:17:21PM
I modified a bit your script for my setup : since I don't like the error message of z0 if there are no folds under the cursor, I removed that line.

Since I usually run vim in a Terminal with the corresponding title set I had to change the tell application "Vim" to activate into something much more complex:

 exec osascript \
   -e "set ESC to ASCII character of 27" \
   -e "set vimFound to false" \
   -e "tell application \"Terminal\"" \
   -e "   activate" \
   -e "   repeat with theWindow in windows" \
   -e "      if name of the theWindow is \"vim\" then" \
   -e "         set frontmost of theWindow to true" \
   -e "         set vimFound to true" \
   -e "      end if" \
   -e "   end repeat" \
   -e "end tell" \
   -e "if not vimFound then" \
   -e "   tell application \"Finder\" to open POSIX file \"$filename\"" \
   -e "   tell application \"System Events\" to delay 5" \
   -e "end if" \
   -e "tell application \"System Events\"" \
   -e "   tell process \"Vim\"" \
   -e "      if vimFound then" \
   -e "         keystroke ESC & \":set hidden\" & return " \
   -e "         keystroke \":if bufexists('$filename')\" & return " \
   -e "         keystroke \":exe \\\":buffer \\\" . bufnr('$filename')\"  & return " \
   -e "         keystroke \":else \" & return " \
   -e "         keystroke \":    edit ${filename// /\\\\ }\" & return " \
   -e "         keystroke \":endif\" & return " \
   -e "      end if" \
   -e "      keystroke \":$lineNum\" & return " \
   -e "   end tell" \
   -e "end tell"
Just in case somebody else has a setup as weird as I do :)

---
Sylvain

[ Reply to This | # ]