How can I make MacVim as “Application” on Mac;
up vote
1
down vote
favorite
I would like to use Snap
(free) to assign a shortcut for Vim on Mac (installed as macvim through brew
on command line). However, Snap
only works when the application is literally "found as an application".
Here's the window that Snap
opens to find an "application"
Is there a way to list the Vim
(accessible through my Terminal as mvim
) to be an application? Or, is there a way to call Vim
with a keyboard shortcut, say Command+I?
macos mac vim
add a comment |
up vote
1
down vote
favorite
I would like to use Snap
(free) to assign a shortcut for Vim on Mac (installed as macvim through brew
on command line). However, Snap
only works when the application is literally "found as an application".
Here's the window that Snap
opens to find an "application"
Is there a way to list the Vim
(accessible through my Terminal as mvim
) to be an application? Or, is there a way to call Vim
with a keyboard shortcut, say Command+I?
macos mac vim
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I would like to use Snap
(free) to assign a shortcut for Vim on Mac (installed as macvim through brew
on command line). However, Snap
only works when the application is literally "found as an application".
Here's the window that Snap
opens to find an "application"
Is there a way to list the Vim
(accessible through my Terminal as mvim
) to be an application? Or, is there a way to call Vim
with a keyboard shortcut, say Command+I?
macos mac vim
I would like to use Snap
(free) to assign a shortcut for Vim on Mac (installed as macvim through brew
on command line). However, Snap
only works when the application is literally "found as an application".
Here's the window that Snap
opens to find an "application"
Is there a way to list the Vim
(accessible through my Terminal as mvim
) to be an application? Or, is there a way to call Vim
with a keyboard shortcut, say Command+I?
macos mac vim
macos mac vim
edited Mar 17 '16 at 15:04
fixer1234
17.4k144281
17.4k144281
asked Mar 17 '16 at 13:56
llinfeng
235113
235113
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
up vote
0
down vote
accepted
To launch MacVim from a shortcut.
Launch Automator and go to File > New and select « Services »
Select « no input » in the « Service receives » list.
In the search box at the upper right, search after « Run AppleScript ». Double click on it and enter this script:
on run {input}
set cmd to "vim"
tell application "System Events" to set terminalIsRunning to exists application process "Terminal"
tell application "Terminal"
activate
if terminalIsRunning is true then
do script with command cmd
else
do script with command cmd in window 1
end if
end tell
end run
Save your automator script.
Go in the « Keyboard shortcut pane » in System preferences.
Select service part.
Go to your new MacVim automator script and assign your Command+I shortcut.
Hi @Redbug, here is the thing:Vim
does not show up in the list of "application". I followed your suggestion up till the "launch application" step, however, from the list I got from launch application, I did not find any of "macvim, vim or mvim". Any suggestion on this?
– llinfeng
Mar 17 '16 at 15:43
Try "launch a shell script" in place of "launch application" and put the full path of your mvim application
– RedBug
Mar 17 '16 at 15:51
thank you for the timely update. I was able to find an "Action" calledRun Shell Script
, but feeding invim
ends up with a infinite loop (hitting run and the script keeps running); and feeding inmvim
, which used to work on the terminal, was not recognized by the shell. n In the list of available shells, I did not find an option forterminal
. Should I installvim
again for these different shells?
– llinfeng
Mar 17 '16 at 16:15
Ok.. My answer was modified with a solution that works with vim
– RedBug
Mar 18 '16 at 7:13
Hi @Redbug, your code does the job of passing the string "vim" to the Terminal and have got it executed. However, there are two ripples: 1. that the Terminal only got used once, every new "call of the automator script" shall live me with a fresh new Terminal instance; 2. that upon quitting the MacVim session (I changed the string from "vim" to "mvim"), the Terminal is still there; Thank you!
– llinfeng
Mar 19 '16 at 1:25
|
show 1 more comment
up vote
0
down vote
Background: It suddenly came to me that Mac is not only a programming machine, but rather a graphical sandbox whose operation is supposed to be intuitive. (This is day 2 of my attempt to use a Mac, as a long-time Windows user.)
Solution is simple:
Step 1: hold left-click on the (Mac)Vim symbol, and got to
Option
and thenShow in Finder
; this will bring us to where the executable file named asMacVim
is located;Step 2: Create an "alias" for the
MacVim
-executable. This essentially creates a shortcut that opens aMacVim
instance;Step 3: DRAG the "short cut" to the Application folder, found as the left-panel of the Finder.
Done.
PS: a failed attempt was to Duplicate
the executable file, and drag it to the Application "folder" at the left panel of the finder; this ends up with essentially having two "installations" of Vim, of which will bring up two Vim icon if we open these two installations graphically. In short, alias
and DRAGing helps!
PPS: Many thanks to RedBug, for this helpful lesson on Automator. In return, I will select his answer as the programmable solution, yet keep my personal solution here, as a backup. (As of Fri Mar 18, 2016, 22:31, I am still looking forward to a modification of the AppleScript that will terminate the Terminal once having opened it to execute "mvim" command.)
add a comment |
up vote
0
down vote
Had the same problem (MacVim did not appear in the Applications directory). Tried what was suggested above but did not manage to make it work.
I chased the MacVim.app file until I found it (in my system) in /usr/local/Cellar/macvim/8.1-151
I duplicated the MacVim.app file, and put the copy in the Applications directory.
I now have 2 MacVims that work in my environment... but it is better than not being able to open some files with MacVim because it did not show up in the Applications directory.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
To launch MacVim from a shortcut.
Launch Automator and go to File > New and select « Services »
Select « no input » in the « Service receives » list.
In the search box at the upper right, search after « Run AppleScript ». Double click on it and enter this script:
on run {input}
set cmd to "vim"
tell application "System Events" to set terminalIsRunning to exists application process "Terminal"
tell application "Terminal"
activate
if terminalIsRunning is true then
do script with command cmd
else
do script with command cmd in window 1
end if
end tell
end run
Save your automator script.
Go in the « Keyboard shortcut pane » in System preferences.
Select service part.
Go to your new MacVim automator script and assign your Command+I shortcut.
Hi @Redbug, here is the thing:Vim
does not show up in the list of "application". I followed your suggestion up till the "launch application" step, however, from the list I got from launch application, I did not find any of "macvim, vim or mvim". Any suggestion on this?
– llinfeng
Mar 17 '16 at 15:43
Try "launch a shell script" in place of "launch application" and put the full path of your mvim application
– RedBug
Mar 17 '16 at 15:51
thank you for the timely update. I was able to find an "Action" calledRun Shell Script
, but feeding invim
ends up with a infinite loop (hitting run and the script keeps running); and feeding inmvim
, which used to work on the terminal, was not recognized by the shell. n In the list of available shells, I did not find an option forterminal
. Should I installvim
again for these different shells?
– llinfeng
Mar 17 '16 at 16:15
Ok.. My answer was modified with a solution that works with vim
– RedBug
Mar 18 '16 at 7:13
Hi @Redbug, your code does the job of passing the string "vim" to the Terminal and have got it executed. However, there are two ripples: 1. that the Terminal only got used once, every new "call of the automator script" shall live me with a fresh new Terminal instance; 2. that upon quitting the MacVim session (I changed the string from "vim" to "mvim"), the Terminal is still there; Thank you!
– llinfeng
Mar 19 '16 at 1:25
|
show 1 more comment
up vote
0
down vote
accepted
To launch MacVim from a shortcut.
Launch Automator and go to File > New and select « Services »
Select « no input » in the « Service receives » list.
In the search box at the upper right, search after « Run AppleScript ». Double click on it and enter this script:
on run {input}
set cmd to "vim"
tell application "System Events" to set terminalIsRunning to exists application process "Terminal"
tell application "Terminal"
activate
if terminalIsRunning is true then
do script with command cmd
else
do script with command cmd in window 1
end if
end tell
end run
Save your automator script.
Go in the « Keyboard shortcut pane » in System preferences.
Select service part.
Go to your new MacVim automator script and assign your Command+I shortcut.
Hi @Redbug, here is the thing:Vim
does not show up in the list of "application". I followed your suggestion up till the "launch application" step, however, from the list I got from launch application, I did not find any of "macvim, vim or mvim". Any suggestion on this?
– llinfeng
Mar 17 '16 at 15:43
Try "launch a shell script" in place of "launch application" and put the full path of your mvim application
– RedBug
Mar 17 '16 at 15:51
thank you for the timely update. I was able to find an "Action" calledRun Shell Script
, but feeding invim
ends up with a infinite loop (hitting run and the script keeps running); and feeding inmvim
, which used to work on the terminal, was not recognized by the shell. n In the list of available shells, I did not find an option forterminal
. Should I installvim
again for these different shells?
– llinfeng
Mar 17 '16 at 16:15
Ok.. My answer was modified with a solution that works with vim
– RedBug
Mar 18 '16 at 7:13
Hi @Redbug, your code does the job of passing the string "vim" to the Terminal and have got it executed. However, there are two ripples: 1. that the Terminal only got used once, every new "call of the automator script" shall live me with a fresh new Terminal instance; 2. that upon quitting the MacVim session (I changed the string from "vim" to "mvim"), the Terminal is still there; Thank you!
– llinfeng
Mar 19 '16 at 1:25
|
show 1 more comment
up vote
0
down vote
accepted
up vote
0
down vote
accepted
To launch MacVim from a shortcut.
Launch Automator and go to File > New and select « Services »
Select « no input » in the « Service receives » list.
In the search box at the upper right, search after « Run AppleScript ». Double click on it and enter this script:
on run {input}
set cmd to "vim"
tell application "System Events" to set terminalIsRunning to exists application process "Terminal"
tell application "Terminal"
activate
if terminalIsRunning is true then
do script with command cmd
else
do script with command cmd in window 1
end if
end tell
end run
Save your automator script.
Go in the « Keyboard shortcut pane » in System preferences.
Select service part.
Go to your new MacVim automator script and assign your Command+I shortcut.
To launch MacVim from a shortcut.
Launch Automator and go to File > New and select « Services »
Select « no input » in the « Service receives » list.
In the search box at the upper right, search after « Run AppleScript ». Double click on it and enter this script:
on run {input}
set cmd to "vim"
tell application "System Events" to set terminalIsRunning to exists application process "Terminal"
tell application "Terminal"
activate
if terminalIsRunning is true then
do script with command cmd
else
do script with command cmd in window 1
end if
end tell
end run
Save your automator script.
Go in the « Keyboard shortcut pane » in System preferences.
Select service part.
Go to your new MacVim automator script and assign your Command+I shortcut.
edited Mar 18 '16 at 7:13
answered Mar 17 '16 at 15:22
RedBug
45325
45325
Hi @Redbug, here is the thing:Vim
does not show up in the list of "application". I followed your suggestion up till the "launch application" step, however, from the list I got from launch application, I did not find any of "macvim, vim or mvim". Any suggestion on this?
– llinfeng
Mar 17 '16 at 15:43
Try "launch a shell script" in place of "launch application" and put the full path of your mvim application
– RedBug
Mar 17 '16 at 15:51
thank you for the timely update. I was able to find an "Action" calledRun Shell Script
, but feeding invim
ends up with a infinite loop (hitting run and the script keeps running); and feeding inmvim
, which used to work on the terminal, was not recognized by the shell. n In the list of available shells, I did not find an option forterminal
. Should I installvim
again for these different shells?
– llinfeng
Mar 17 '16 at 16:15
Ok.. My answer was modified with a solution that works with vim
– RedBug
Mar 18 '16 at 7:13
Hi @Redbug, your code does the job of passing the string "vim" to the Terminal and have got it executed. However, there are two ripples: 1. that the Terminal only got used once, every new "call of the automator script" shall live me with a fresh new Terminal instance; 2. that upon quitting the MacVim session (I changed the string from "vim" to "mvim"), the Terminal is still there; Thank you!
– llinfeng
Mar 19 '16 at 1:25
|
show 1 more comment
Hi @Redbug, here is the thing:Vim
does not show up in the list of "application". I followed your suggestion up till the "launch application" step, however, from the list I got from launch application, I did not find any of "macvim, vim or mvim". Any suggestion on this?
– llinfeng
Mar 17 '16 at 15:43
Try "launch a shell script" in place of "launch application" and put the full path of your mvim application
– RedBug
Mar 17 '16 at 15:51
thank you for the timely update. I was able to find an "Action" calledRun Shell Script
, but feeding invim
ends up with a infinite loop (hitting run and the script keeps running); and feeding inmvim
, which used to work on the terminal, was not recognized by the shell. n In the list of available shells, I did not find an option forterminal
. Should I installvim
again for these different shells?
– llinfeng
Mar 17 '16 at 16:15
Ok.. My answer was modified with a solution that works with vim
– RedBug
Mar 18 '16 at 7:13
Hi @Redbug, your code does the job of passing the string "vim" to the Terminal and have got it executed. However, there are two ripples: 1. that the Terminal only got used once, every new "call of the automator script" shall live me with a fresh new Terminal instance; 2. that upon quitting the MacVim session (I changed the string from "vim" to "mvim"), the Terminal is still there; Thank you!
– llinfeng
Mar 19 '16 at 1:25
Hi @Redbug, here is the thing:
Vim
does not show up in the list of "application". I followed your suggestion up till the "launch application" step, however, from the list I got from launch application, I did not find any of "macvim, vim or mvim". Any suggestion on this?– llinfeng
Mar 17 '16 at 15:43
Hi @Redbug, here is the thing:
Vim
does not show up in the list of "application". I followed your suggestion up till the "launch application" step, however, from the list I got from launch application, I did not find any of "macvim, vim or mvim". Any suggestion on this?– llinfeng
Mar 17 '16 at 15:43
Try "launch a shell script" in place of "launch application" and put the full path of your mvim application
– RedBug
Mar 17 '16 at 15:51
Try "launch a shell script" in place of "launch application" and put the full path of your mvim application
– RedBug
Mar 17 '16 at 15:51
thank you for the timely update. I was able to find an "Action" called
Run Shell Script
, but feeding in vim
ends up with a infinite loop (hitting run and the script keeps running); and feeding in mvim
, which used to work on the terminal, was not recognized by the shell. n In the list of available shells, I did not find an option for terminal
. Should I install vim
again for these different shells?– llinfeng
Mar 17 '16 at 16:15
thank you for the timely update. I was able to find an "Action" called
Run Shell Script
, but feeding in vim
ends up with a infinite loop (hitting run and the script keeps running); and feeding in mvim
, which used to work on the terminal, was not recognized by the shell. n In the list of available shells, I did not find an option for terminal
. Should I install vim
again for these different shells?– llinfeng
Mar 17 '16 at 16:15
Ok.. My answer was modified with a solution that works with vim
– RedBug
Mar 18 '16 at 7:13
Ok.. My answer was modified with a solution that works with vim
– RedBug
Mar 18 '16 at 7:13
Hi @Redbug, your code does the job of passing the string "vim" to the Terminal and have got it executed. However, there are two ripples: 1. that the Terminal only got used once, every new "call of the automator script" shall live me with a fresh new Terminal instance; 2. that upon quitting the MacVim session (I changed the string from "vim" to "mvim"), the Terminal is still there; Thank you!
– llinfeng
Mar 19 '16 at 1:25
Hi @Redbug, your code does the job of passing the string "vim" to the Terminal and have got it executed. However, there are two ripples: 1. that the Terminal only got used once, every new "call of the automator script" shall live me with a fresh new Terminal instance; 2. that upon quitting the MacVim session (I changed the string from "vim" to "mvim"), the Terminal is still there; Thank you!
– llinfeng
Mar 19 '16 at 1:25
|
show 1 more comment
up vote
0
down vote
Background: It suddenly came to me that Mac is not only a programming machine, but rather a graphical sandbox whose operation is supposed to be intuitive. (This is day 2 of my attempt to use a Mac, as a long-time Windows user.)
Solution is simple:
Step 1: hold left-click on the (Mac)Vim symbol, and got to
Option
and thenShow in Finder
; this will bring us to where the executable file named asMacVim
is located;Step 2: Create an "alias" for the
MacVim
-executable. This essentially creates a shortcut that opens aMacVim
instance;Step 3: DRAG the "short cut" to the Application folder, found as the left-panel of the Finder.
Done.
PS: a failed attempt was to Duplicate
the executable file, and drag it to the Application "folder" at the left panel of the finder; this ends up with essentially having two "installations" of Vim, of which will bring up two Vim icon if we open these two installations graphically. In short, alias
and DRAGing helps!
PPS: Many thanks to RedBug, for this helpful lesson on Automator. In return, I will select his answer as the programmable solution, yet keep my personal solution here, as a backup. (As of Fri Mar 18, 2016, 22:31, I am still looking forward to a modification of the AppleScript that will terminate the Terminal once having opened it to execute "mvim" command.)
add a comment |
up vote
0
down vote
Background: It suddenly came to me that Mac is not only a programming machine, but rather a graphical sandbox whose operation is supposed to be intuitive. (This is day 2 of my attempt to use a Mac, as a long-time Windows user.)
Solution is simple:
Step 1: hold left-click on the (Mac)Vim symbol, and got to
Option
and thenShow in Finder
; this will bring us to where the executable file named asMacVim
is located;Step 2: Create an "alias" for the
MacVim
-executable. This essentially creates a shortcut that opens aMacVim
instance;Step 3: DRAG the "short cut" to the Application folder, found as the left-panel of the Finder.
Done.
PS: a failed attempt was to Duplicate
the executable file, and drag it to the Application "folder" at the left panel of the finder; this ends up with essentially having two "installations" of Vim, of which will bring up two Vim icon if we open these two installations graphically. In short, alias
and DRAGing helps!
PPS: Many thanks to RedBug, for this helpful lesson on Automator. In return, I will select his answer as the programmable solution, yet keep my personal solution here, as a backup. (As of Fri Mar 18, 2016, 22:31, I am still looking forward to a modification of the AppleScript that will terminate the Terminal once having opened it to execute "mvim" command.)
add a comment |
up vote
0
down vote
up vote
0
down vote
Background: It suddenly came to me that Mac is not only a programming machine, but rather a graphical sandbox whose operation is supposed to be intuitive. (This is day 2 of my attempt to use a Mac, as a long-time Windows user.)
Solution is simple:
Step 1: hold left-click on the (Mac)Vim symbol, and got to
Option
and thenShow in Finder
; this will bring us to where the executable file named asMacVim
is located;Step 2: Create an "alias" for the
MacVim
-executable. This essentially creates a shortcut that opens aMacVim
instance;Step 3: DRAG the "short cut" to the Application folder, found as the left-panel of the Finder.
Done.
PS: a failed attempt was to Duplicate
the executable file, and drag it to the Application "folder" at the left panel of the finder; this ends up with essentially having two "installations" of Vim, of which will bring up two Vim icon if we open these two installations graphically. In short, alias
and DRAGing helps!
PPS: Many thanks to RedBug, for this helpful lesson on Automator. In return, I will select his answer as the programmable solution, yet keep my personal solution here, as a backup. (As of Fri Mar 18, 2016, 22:31, I am still looking forward to a modification of the AppleScript that will terminate the Terminal once having opened it to execute "mvim" command.)
Background: It suddenly came to me that Mac is not only a programming machine, but rather a graphical sandbox whose operation is supposed to be intuitive. (This is day 2 of my attempt to use a Mac, as a long-time Windows user.)
Solution is simple:
Step 1: hold left-click on the (Mac)Vim symbol, and got to
Option
and thenShow in Finder
; this will bring us to where the executable file named asMacVim
is located;Step 2: Create an "alias" for the
MacVim
-executable. This essentially creates a shortcut that opens aMacVim
instance;Step 3: DRAG the "short cut" to the Application folder, found as the left-panel of the Finder.
Done.
PS: a failed attempt was to Duplicate
the executable file, and drag it to the Application "folder" at the left panel of the finder; this ends up with essentially having two "installations" of Vim, of which will bring up two Vim icon if we open these two installations graphically. In short, alias
and DRAGing helps!
PPS: Many thanks to RedBug, for this helpful lesson on Automator. In return, I will select his answer as the programmable solution, yet keep my personal solution here, as a backup. (As of Fri Mar 18, 2016, 22:31, I am still looking forward to a modification of the AppleScript that will terminate the Terminal once having opened it to execute "mvim" command.)
answered Mar 19 '16 at 2:32
llinfeng
235113
235113
add a comment |
add a comment |
up vote
0
down vote
Had the same problem (MacVim did not appear in the Applications directory). Tried what was suggested above but did not manage to make it work.
I chased the MacVim.app file until I found it (in my system) in /usr/local/Cellar/macvim/8.1-151
I duplicated the MacVim.app file, and put the copy in the Applications directory.
I now have 2 MacVims that work in my environment... but it is better than not being able to open some files with MacVim because it did not show up in the Applications directory.
add a comment |
up vote
0
down vote
Had the same problem (MacVim did not appear in the Applications directory). Tried what was suggested above but did not manage to make it work.
I chased the MacVim.app file until I found it (in my system) in /usr/local/Cellar/macvim/8.1-151
I duplicated the MacVim.app file, and put the copy in the Applications directory.
I now have 2 MacVims that work in my environment... but it is better than not being able to open some files with MacVim because it did not show up in the Applications directory.
add a comment |
up vote
0
down vote
up vote
0
down vote
Had the same problem (MacVim did not appear in the Applications directory). Tried what was suggested above but did not manage to make it work.
I chased the MacVim.app file until I found it (in my system) in /usr/local/Cellar/macvim/8.1-151
I duplicated the MacVim.app file, and put the copy in the Applications directory.
I now have 2 MacVims that work in my environment... but it is better than not being able to open some files with MacVim because it did not show up in the Applications directory.
Had the same problem (MacVim did not appear in the Applications directory). Tried what was suggested above but did not manage to make it work.
I chased the MacVim.app file until I found it (in my system) in /usr/local/Cellar/macvim/8.1-151
I duplicated the MacVim.app file, and put the copy in the Applications directory.
I now have 2 MacVims that work in my environment... but it is better than not being able to open some files with MacVim because it did not show up in the Applications directory.
answered Nov 20 at 11:44
Dargand
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1054057%2fhow-can-i-make-macvim-as-application-on-mac%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown