The third one uses the very awesome –remote-tab-silent option, which gives us the ability to reuse the same window with new tabs when we edit multiple files. The first two branches are pretty clear – they just invoke the MacVim binary in the correct way, for our different modes. In Terminal, cd into the app (remember, to Terminal, the bundle will still. # path names for any filenames you specify, which is hard.Įxec "$binary" -g $opts $ MacVim In the Finder, right-click on the app & select Show Package.# But if you use open instead, you will need to fully qualify the # Note: this isn't perfect, because any error output goes to the # etc., but not when it is invoked as "vim -g". # not we work around this when this script is invoked as "gvim" or "rgview" # The program should fork by default when started in GUI mode, but it does So we replace that command (originally on line 69): # Last step: fire up vim. We also need to modify the command that starts MacVim to handle our different modes, etc. We look for -d (diff mode) and – (stdin) separate from other arguments. This is a pretty normal bash argument getting loop. At Line 60 we add the following: # Add new flags for different modes Well, first we add some extra command line options parsing to detect if we’re in diff mode, if we’re using stdin, and to preserve options for passing back into MacVim later. It doesn’t let you pipe stdin into vim for viewing (great with diffs).Īll those things are awesome, so let’s make the mvim script better! How do we do that?.It doesn’t let you use new tabs for opening new files into an existing window.It doesn’t let you pass in command line options.It doesn’t let you edit multiple files. ![]() Unfortunately, this script is a little weak in a few ways: MacVim comes with a really sweet script called mvim, which lets you launch MacVim and edit files from the command line. If you run into trouble, let me know.Tl dr: Replace the mvim script with this modified version: Moreover, I'm a novice vim user (I use it for remote system administration only), so I can only help you on the Applescript part. > I'm afraid I don't have time right now to test this code, or to give additional details. > Select the lines in vim you want to execute, and do > echo "Can't create temporary file $TMPFILE (already exists)" > delay 0.5 - avoid deleting file before Stata reads it > osascript tell application id "11" to open POSIX file "$" > Similarly, if you wish to send a visual selection to Stata, create a script like the following: > Place the script on your path, and then, while editing a do-file in vim, do > osascript -e "tell application id \"11\" if has ('multibyte') if &termencoding '' let &termencoding &encoding endif set encodingutf-8 setglobal fileencodingutf-8 'setglobal. If it helps, I installed them using homebrew. Is there a way to get MacVim to handle Unicode characters appropriately. For example, to send the file you are currently editing to Stata, you could create the following (executable) shell script (note that you'll need to modify the Bundle identifier if you're using Stata 12): Unicode characters appear in regular old vim in the terminal (iTerm), but not MacVim. > You'll need to communicate with Stata via Apple events, which is most easily done via Applescript. > There is an old Statalist post by Dimitriy Masterov about getting Stata to launch from Vim on Windows, here: > Has anybody managed to integrate Stata with MacVim? I have made an attempt but I am stuck, as follows: > On Jul 31, 2011, at 12:14 PM, Gabi Huiber wrote: I want it to do it for me, as many times as ![]() Still, the original problem remains not solved: I don't want Stata to MP state that Lion saves by default when you quit Stata, so itīasically forces Stata to start with a clean slate. The first shell command there, "rm -Rf ", obliterates the Stata !osascript -e 'tell app "StataMP" to open "%:p"' Without any warning messages is to rewrite my RunIt() function as I have tried other tricks too, with help from the MacVim e-mail list.įor example, one way to get Stata to open my do-file in the editor The blank spaces on either side of > are as shown above, if that Then Stata will start with the do-file editor open with the correctĭo-file loaded. "missing value" warning but have no effect on Stata, as far as I can Running, either in terminal or in the Vim command mode, produce the Subsequent calls to do-file, after Stata is The same thing happens if I edit Documents/hello.do in Vim and in This makes Stata 12 start up with the do-file editor open with a blankĭo-file that is called hello.do. Suppose I had aĭo-file in the Documents folder that had two lines in it: The do-file bash script you suggested kind of works. I will just take one problem at a time: first I sort out how to make I am making some progress, but I'm not there yet. Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |