Jump to content

MacVim Toolkit


Recommended Posts

MacVim Toolbox

This workflow adds commands for working with MacVim. The commands are:

vim:editterminal
    Edit the selected file from Finder or PathFinder in a terminal MacVim in Terminal.app.

 

vim:edititerm

   Edit the selected file from Finder or PathFinder in a terminal MacVim in iTerm2 in a tab.

vim:editgui
    Edit the selected file from Finder or PathFinder in a gui MacVim

It also has commands for the Alfred Browser to edit with MacVim in terminal or gui. There are hotkey you can define as well.

 

Version:         1.2

Date:              Jan 5, 2016

 

Packal:          http://www.packal.org/workflow/macvim-toolkit

GitHub:          https://github.com/raguay/MyAlfred

My Website:   http://customct.com/alfred-2-workflows

Edited by raguay.customct
Link to comment

I like me some vim, so I tried this out but noticed a few problems:

  • It doesn't work with Terminal at all, as you've hard-coded iTerm. You should probably mention this, as iTerm isn't a standard application.
  • It doesn't work properly with iTerm, as it just pastes vim /your/path/here into the active session instead of creating a new tab/window. If there's actually something running in the active session (e.g. tail), nothing happens.
  • The icon is kinda messed up on Packal (weird artefacts).
Link to comment

Hi,

 

That is the way I wrote it simply because that fits my workflow! :) I do not like multiple windows and I can not seem to figure how to make it a new tab instead of a new window. I think I am missing something somewhere.

 

I am planning to add Terminal based keywords. That is coming.

 

The above two comments are for the slap workflow also.

 

Yea, I am not a good graphics guy. Just a coder!

Link to comment

I'm not criticising the lack of Terminal support, I just think you should mention in the OP that it needs iTerm to open the cli version. Not everyone has iTerm installed, and might wonder why it doesn't work for them.

 

Here's how to do the new tab thing (assuming variable theScript contains your mvim /some/file/path command):

on isRunning(appName)
	tell application "System Events" to (name of processes) contains appName
end isRunning

set iTermRunning to isRunning("iTerm")
tell application "iTerm"
	activate
	set myterm to (current terminal)
	try
		get myterm
	on error
		set myterm to (make new terminal)
	end try
	tell myterm
		if iTermRunning then
			set mysession to (launch session "Default")
		else
			set mysession to (current session)
		end if
		if theScript is not "" then
			tell mysession to write text theScript
		end if
		select mysession

	end tell
end tell

This will create a new tab in the current window if one exists and open a new window if it doesn't. If iTerm isn't running, it'll skip creating a new tab/window and just use the default one when iTerm starts.
 
IIRC, I adapted this from the examples on the iTerm wiki (I just extracted it from my Open This Folder in iTerm script).
 
FWIW, it's a lot easier with Terminal:

tell application "Terminal"
	activate
	do script theScript
end tell
Edited by deanishe
Link to comment
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...