Ask Different (Apple)
Q&A for power users of Apple hardware and software
Latest Questions
1
votes
1
answers
49
views
Disable MacVim when using Finder context menu item: Open in Terminal
[![enter image description here][1]][1]The `context menu` (i.e. right-click menu) on the `Finder Pathbar` includes the option: `Open in Terminal`. But when I try to use it, the file or folder selected gets opened in MacVim. I guess I set that behavior somewhere some time ago, but I don't remember an...

context menu
(i.e. right-click menu) on the Finder Pathbar
includes the option: Open in Terminal
. But when I try to use it, the file or folder selected gets opened in MacVim. I guess I set that behavior somewhere some time ago, but I don't remember and I want to reset it back to the default (i.e. to actually open the item in terminal, not MacVim). I've looked over my .bash_profile
and .bashrc
and .vimrc
but I don't see anything related.
Does anyone know how to fix this?
UPDATE: added screenshot of info panel for folders, which shows there is no 'open with' option.
This post (below) describes a similar problem, but for iterm2. But the solution, which involves items in the Application Support folder, does not help because there is no Application Support item for MacVim.
Can not change "Open in Terminal" default back to Terminal from iterm2
someguyinafloppyhat
(177 rep)
Sep 3, 2024, 12:12 AM
• Last activity: Sep 3, 2024, 01:24 PM
7
votes
3
answers
12189
views
Remap arrow key to different shortcut
I am used to vim and like to move with H , J , K , L . I would like to avoid switching to the arrow keys when I am in a text field for example. Is there a way to remap the following keys in all application on **Mac OS X**, so that: ← can also be triggered by OPTION H ↓ can also be triggere...
I am used to vim and like to move with H, J, K, L. I would like to avoid switching to the arrow keys when I am in a text field for example.
Is there a way to remap the following keys in all application on **Mac OS X**, so that:
← can also be triggered by OPTION H
↓ can also be triggered by OPTION J
↑ can also be triggered by OPTION K
→ can also be triggered by OPTION L
Mick
(186 rep)
May 21, 2013, 06:10 AM
• Last activity: Mar 31, 2024, 08:51 PM
5
votes
2
answers
815
views
Difficulty setting the 'Open with app' to an alias
I am trying to set MacVim, installed via homebrew, to be the default HEX file editor. I started this task by creating an alias to MacVim.app located in `/usr/local/Cellar/macvim/7.3-61` and placing the aliased app in `/Applications`. This allowed me to see and open MacVim from the Application folder...
I am trying to set MacVim, installed via homebrew, to be the default HEX file editor. I started this task by creating an alias to MacVim.app located in
/usr/local/Cellar/macvim/7.3-61
and placing the aliased app in /Applications
. This allowed me to see and open MacVim from the Application folder (more info [here](https://apple.stackexchange.com/q/23653/4605)) .
Now that the aliased app is there the "Open with app" selection via the RightClick
->Info
has the aliased app greyed out. To make matters worse it does not allow me to browse/select the real app located in /usr/local/Cellar
.
This doesn't seem to be asking to much here, any ideas on how to change this?
Adam Lewis
(274 rep)
Aug 27, 2013, 01:52 PM
• Last activity: Jul 26, 2023, 10:03 PM
0
votes
0
answers
24
views
How to replace Finder.app with any other file viewer?
Is it possible to replace Finder.app with any other file viewer apps such as: - [Marta.sh][1] - [Pathfinder][2] - [Forklift][3] I'd love to use a more customizable file viewer alternative that would allow me to use Vim-like hotkeys for navigation. [1]: https://marta.sh/ [2]: https://www.cocoatech.io...
Is it possible to replace Finder.app with any other file viewer apps such as:
- Marta.sh
- Pathfinder
- Forklift
I'd love to use a more customizable file viewer alternative that would allow me to use Vim-like hotkeys for navigation.
TheScriptan
(101 rep)
Mar 9, 2023, 06:49 AM
3
votes
2
answers
3712
views
Command-C in vim on macOS is not copying even with "+clipboard" flag
Let's take a look at the _clipboard_ flags: ``` vim --version | grep clip +clipboard +keymap +printer +vertsplit +eval -mouse_jsbterm -sun_workshop -xterm_clipboard ``` Looks ok to me .. Highlighting some text in `vim` _does_ turn on `Visual` mode. But then hitting Command C results in an annoyed "b...
Let's take a look at the _clipboard_ flags:
vim --version | grep clip
+clipboard +keymap +printer +vertsplit
+eval -mouse_jsbterm -sun_workshop -xterm_clipboard
Looks ok to me .. Highlighting some text in vim
_does_ turn on Visual
mode. But then hitting CommandC results in an annoyed "beep" and nothing more than that.
So I added the following to the default .vimrc
set clipboard=unnamed
Still no dice. What needs to be done?
**Update**. +y
does work.. but I've seen CommandC work on other mac laptops i've owned. The last one right here (that does work) did not have anything special done afaict: there's not even any ~/.vimrc
file.
WestCoastProjects
(6555 rep)
Nov 2, 2022, 04:42 AM
• Last activity: Jan 31, 2023, 11:57 PM
0
votes
1
answers
237
views
How to debug applescript when an Application's class methods don't respond
In Applescript, I'm trying to change which text editor I'm using. TextEdit works fine, providing the document name, and it opens in MacVim. However, when I try the exact same `get path of document 1` command in MacVim, it stays undefined, and terminal shows error: > execution error: MacVim got an er...
In Applescript, I'm trying to change which text editor I'm using. TextEdit works fine, providing the document name, and it opens in MacVim. However, when I try the exact same
**How I call the script to get the error**
get path of document 1
command in MacVim, it stays undefined, and terminal shows error:
> execution error: MacVim got an error: Can’t get document 1. Invalid index. (-1719)
The MacVim library claims it uses the same document object, both really coming from the 'Standard Suite'.
What's my next debug step?
**All the Details Below Here**
Applescript code to "toggle text editing apps" of the currently open and focused file:
on run argv
set my_arg to argv
set the_path to "error - not found"
if (my_arg contains "v") then
set the_path to from_app("TextEdit")
open_in_app("MacVim", the_path)
else if (my_arg contains "e") then
set the_path to from_app("MacVim")
open_in_app("TextEdit", the_path)
else
display dialog "Error: Use argument 'e' or 'v' to switch TO textEditor or macVim"
end if
end run
on from_app(from_app)
tell application from_app
activate
set my_path to get path of document 1
close document 1
end tell
return my_path
end from_app
on open_in_app(to_app, my_path)
tell application to_app
activate
open my_path
end tell
end open_in_app
Standard Suite in TextEdit
> document n [inh. item; see also TextEdit suite] : A document.
> elements: contained by application, application. properties: path
> (text) : The document's path.
TextEdit suite in TextEdit
> document n [see also Standard Suite] : A TextEdit document.
> properties: text (text) : The text of the document.
Standard Suite in MacVim
> document n [inh. item] : A document. elements: contained by
> application. properties: path (text) : The document's path.
Not seeing how to make these images smaller yet...



user@userMBP % osascript ~/toggle-text-editor.apple.scpt e
**Versions**
MacVim was installed with brew install macvim
, Custom Version 9.0.65 (173)
.
Mac is Bug Sur version 11.6.8 (20G730)
**Answers to questions**
> Does homebrew install a gui "MacVim"? Is it launched when the script runs?
Yes, MacVim includes a GUI, and it is successfully launched when the script runs.
> What returns from path to application "MacVim"? Is it correct?
Not sure what you mean. open my_path
successfully opens the right document in MacVim. set my_path to get path of document 1
fails.
> What returns from tell application "Macvim" to documents?
Again, not sure what you mean. There are 2 lines that can issue a tell application MacVim
. One is successful (opening document), one fails (asking MacVim the name of currently open document).
Thank you @Mockman and @CJK. Opened [issue1226](https://github.com/macvim-dev/macvim/issues/1266) on MacVim github.
Polo
(141 rep)
Aug 1, 2022, 02:56 AM
• Last activity: Dec 11, 2022, 04:04 PM
0
votes
2
answers
469
views
MacVim and Python on new M1 MacBook
On a vanilla MacBook with M1 processor, I installed MacVim via Homebrew: ``` brew install --cask macvim ``` However, when running `:python import sys; print(sys.version)` inside MacVim, I get: ``` E370: Could not load library /System/Library/Frameworks/Python.framework/Versions/2.7/Python: dlopen(/S...
On a vanilla MacBook with M1 processor, I installed MacVim via Homebrew:
brew install --cask macvim
However, when running :python import sys; print(sys.version)
inside MacVim, I get:
E370: Could not load library /System/Library/Frameworks/Python.framework/Versions/2.7/Python: dlopen(/System/Library/Frameworks/Python.framework/Versions/2.7/Python, 0x0009): tried: '/System/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file), '/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file)
E263: Sorry, this command is disabled, the Python library could not be loaded.
I strangely can't find the right instructions based on the above error message, as I expect this problem to be quite common.
The cause is that macOS no longer ships with Python, but fixing it is not trivial. It seems that I'll need the right combination of a specific Python installation (Homebrew?) and the correct Vim configuration.
Does anyone know the exact setup and configuration instructions?
Ruben Verborgh
(199 rep)
Sep 1, 2022, 12:27 AM
• Last activity: Sep 1, 2022, 08:53 AM
0
votes
1
answers
74
views
Vim — Automatically Doing a Linefeed When Editing a Markdown (.md) File
*(MacVim 8.2, Terminal Vim 8.2, MacOS 10.14.6 Mojave)* Not sure when this started happening. Whenever I edit a file with a `.md` extension, `Vim` immediately does a linefeed after I type certain lines, as below: e.g. 1 ### WR ...> e.g.2 * hello ...> How do I stop this from happening?
*(MacVim 8.2, Terminal Vim 8.2, MacOS 10.14.6 Mojave)*
Not sure when this started happening.
Whenever I edit a file with a
.md
extension, Vim
immediately does a linefeed after I type certain lines, as below:
e.g. 1
### WR ...>
e.g.2
* hello ...>
How do I stop this from happening?
Anthony C
(303 rep)
Aug 5, 2021, 11:09 PM
• Last activity: May 7, 2022, 05:03 PM
0
votes
1
answers
1453
views
How do I use homebrew to link MacVim and Vim at the same time?
I have used homebrew to install both Vim and MacVim on my mac. Right now, MacVim is the one that is linked. When I run ```mvim --version```, I get the most recent and installed version that appears. When I run ```vim --version```, the one pre-installed on the computer comes up, even though Vim has b...
I have used homebrew to install both Vim and MacVim on my mac. Right now, MacVim is the one that is linked. When I run
--version
, I get the most recent and installed version that appears. When I run --version
, the one pre-installed on the computer comes up, even though Vim has been installed via homebrew and is fully up to date. How can I make it so both
and
link to their respective homebrew installed version, rather than only
with
not being up to date, or
with
not working?
coopikoop
(3 rep)
Oct 31, 2021, 06:01 PM
• Last activity: Oct 31, 2021, 09:03 PM
4
votes
1
answers
762
views
MacVim color scheme has the right color, but vim through Terminal doesn't
I've installed color schemes that seem to be working well with MacVim. When I run Vim using Terminal, however, the colors change and the color scheme doesn't appear to be working anymore. Is there a way to get it to support the true color the color schemes intend?
I've installed color schemes that seem to be working well with MacVim.
When I run Vim using Terminal, however, the colors change and the color scheme doesn't appear to be working anymore.
Is there a way to get it to support the true color the color schemes intend?
kanayt
(401 rep)
Oct 4, 2020, 06:46 PM
• Last activity: Oct 4, 2021, 08:39 PM
2
votes
1
answers
1961
views
How to improve into vim of MacOS Mojave the speed of vertical scroll with bottom/up keys?
I transfer the original post from StackOverflow ([Original post][1]) to here since this is about Apple specificity. I have a new macbook with Mojave and vim already installed. Unfortunately, even for small source files, the cursor is very fast when I browse the current part of file where I am locate...
I transfer the original post from StackOverflow (Original post ) to here since this is about Apple specificity.
I have a new macbook with Mojave and vim already installed.
Unfortunately, even for small source files, the cursor is very fast when I browse the current part of file where I am located **but it becomes very slow when I am over this current page (the same thing occurs if I am over or lower this part) with down/up keys.**
I don't talk about "mouse scrolling speed" but scrolling with down/up keys.
I saw and tried to apply different suggested solutions on web but none of these work for me (disable
If you have no power on, GPU rendering was by default disable like, so uncheck the first box to be able to benefit from GPU rendering when computer is on battery :
That's all !
cursorline
, using an empty ~/.vimrc
, etc ...).
Maybe threre is a conflict with some options in my ~/.vimrc
.
Here below my ~/.vimrc
:
set encoding=utf-8
scriptencoding utf-8
set ic
command Il :%s/^/\=line('.'). ' '
set hlsearch
set shiftwidth=2 " number of spaces to use for auto indent
set autoindent " copy indent from current line when starting a new line
set nu
syntax on " syntax highlighting
set backspace=indent,eol,start " delete with backspace
"TOhtml
let html_use_css=1
let html_number_lines=1
let html_no_pre=0
highlight DiffAdd cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red
I have changed into System Preferences
the delay between 2 repeated keys to a small value :
So, into the default Terminal of Mojave macbook, I can move quickly with left/right keys on the command line.
Is there a relation between this small delay I have set and this slow scroll vertically with donw/up keys into vim ?
Another bug which must be known is that some commented code parts (for example when editing Python code with vim) **appears as not commented when scrolling with down/up keys and also the contrary occurs** : anyone has already got this strange behavior ? this problem doesn't happen when I browse file with CTRL+F
or CTRL+B
shortcuts.
Any help is welcome, Regards
**UPDATE 1 :**
Finally, I get to increase speed with the following link :
https://rehmann.co/blog/better-key-rates-osx/
I decided to switch to iterm2
. So, as partial conclusion, the solution was to set fatest options in System Preferences
and put into ~/.bashrc
:
#disable special characters when holding keys
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# normal minimum is 15 (225 ms)
defaults write -g InitialKeyRepeat -float 10.0
defaults write NSGlobalDomain InitialKeyRepeat -float 10.0
# normal minimum is 2 (30 ms)
defaults write NSGlobalDomain KeyRepeat -float 1.0
defaults write -g KeyRepeat -float 1.0
############# Enable spees ######################
**It might be even too fast**. That's why I wonder **if there is a way to apply this big speed only for selected keys**, i.e in my case, **I would like to have this behavior for only down/up and left/right keys** and NOT for the others keys (letters or special characters) ?
Is it possible to get this behavior ?
**UPDATE 2 :** Ok, I have finally found the trick : in iterm2
terminal, there is a GPU rendering option on below image :


user256573
Oct 14, 2019, 11:06 AM
• Last activity: Jul 16, 2021, 01:51 AM
1
votes
0
answers
87
views
Vim in Iterm2 closes after compiling Latex file
When I run ``` !pdflatex % ``` in Macvim, the latex file compiles and I am not exited from Macvim. In iterm2, the compilation occurs and them I am taken out of Vim back into the terminal prompt. Any ideas why the behavior is different? I have looked around and to my surprise haven't seen anything ab...
When I run
!pdflatex %
in Macvim, the latex file compiles and I am not exited from Macvim. In iterm2, the compilation occurs and them I am taken out of Vim back into the terminal prompt. Any ideas why the behavior is different? I have looked around and to my surprise haven't seen anything about it.
aladdinoscopy
(11 rep)
Feb 21, 2021, 06:10 AM
1
votes
0
answers
97
views
Skim/Preview : forward sync not working
I am using `Skim` to preview pdfs generated by `vimtex` plugged into `MacVim` via `vim-plug` on MacBook Air M1. Whenever I write any changes to my `.tex` files the pdf opened in Skim does get updated but the display page doesn't move to the updated location. I have set `Sync` options to `MacVim` and...
I am using
Skim
to preview pdfs generated by vimtex
plugged into MacVim
via vim-plug
on MacBook Air M1.
Whenever I write any changes to my .tex
files the pdf opened in Skim does get updated but the display page doesn't move to the updated location. I have set Sync
options to MacVim
and enabled Check for file changes
and Reload automatically
options in the Preferences.
Can someone help me by suggesting how to reload pdfs to correct page?
Alternatively, I tried using Preview
but it doesn't even auto-reload until I move focus back to the opened pdf on it. I will be okay with whichever of the two can be made to work properly.
asymptoticallyboundedgluon
(271 rep)
Dec 19, 2020, 08:41 AM
• Last activity: Dec 21, 2020, 10:25 AM
0
votes
1
answers
380
views
macvim not respecting os/x shortcuts
I have macvim working as expected on my older mac. On a newly minted Mac however, the normal key sequences to select, copy, and paste text: > Shift arrow keys (select) > Command C, Command X, Command V (copy, cut, paste) are not being recognized. Then there must be some settings/configuration requir...
I have macvim working as expected on my older mac. On a newly minted Mac however, the normal key sequences to select, copy, and paste text:
> Shift arrow keys (select)
> Command C, Command X, Command V (copy, cut, paste)
are not being recognized.
Then there must be some settings/configuration required to get the Cut/Copy/Select using OS/X keystrokes to work in macvim? What is/are those settings?
thanks!
WestCoastProjects
(6555 rep)
Aug 14, 2015, 12:16 AM
• Last activity: Nov 16, 2020, 04:59 PM
9
votes
4
answers
4775
views
Vim/Emacs keybinding for `Preview.app`
Does anybody have ideas about using `emacs`/ `vim` key binding for `Preview.app` to browser `pdf` files and how?
Does anybody have ideas about using
emacs
/ vim
key binding for Preview.app
to browser pdf
files and how?
Firegun
(317 rep)
Jan 4, 2013, 07:42 AM
• Last activity: Jun 25, 2020, 02:16 PM
4
votes
3
answers
281
views
Open a new MacVim window with AppleScript
I can open a new iTerm window like this: tell application "iTerm" create window with default profile end tell How do I do the same but with MacVim?
I can open a new iTerm window like this:
tell application "iTerm"
create window with default profile
end tell
How do I do the same but with MacVim?
zoran119
(153 rep)
Apr 23, 2018, 01:48 AM
• Last activity: Jun 13, 2020, 06:36 PM
3
votes
3
answers
2036
views
How do you position your hand to use the control + w key? What fingers do you use?
I would like to improve my typing. Currently, I start web dev with vim. I use one of the feature called split, which create new window for me. then we need to hit Control+ W to move around cursors. I find myself vary awkward hit press the control key and w key at the same time, pinky for control key...
I would like to improve my typing. Currently, I start web dev with vim. I use one of the feature called split, which create new window for me. then we need to hit Control+ W to move around cursors. I find myself vary awkward hit press the control key and w key at the same time, pinky for control key and ring for w key.
I understand there is one correct answer to this question. I would like to know how you guys do it. I definitely will find useful tips to improve the typing overall. Thank you so much in advance.
edit:
Ok, I need to specific, I am using MacbookPro 2016, which only have left control key. (I wish we could modify the right option key to act as a control key, but the left option key stays the same)
user284787
Apr 10, 2018, 07:40 AM
• Last activity: May 18, 2020, 06:24 PM
0
votes
1
answers
185
views
how to set afplay as default media player for wma files in mac OS
Hi I am using a vim plugin named [eblook][2] which turns vim console into a dictionary. The problem is that the implementation of the plugin is using a default player for WMA file to play the sound file (for example pronunciation of a certain word in the dictionary). I would like to use afplay as th...
Hi I am using a vim plugin named
which turns vim console into a dictionary. The problem is that the implementation of the plugin is using a default player for WMA file to play the sound file (for example pronunciation of a certain word in the dictionary).
I would like to use afplay as the default media player in Mac so that when I use the plugin, all sound can be played without need to use iTunes or any other UI based media player (due to overhead of iTunes or any other UI based media player)



Huibin Zhang
(101 rep)
Apr 13, 2020, 10:49 AM
• Last activity: Apr 13, 2020, 11:25 AM
1
votes
0
answers
251
views
Command-C does not copy highlighted text into clipboard from MacVim
I just installed `macVim`/`mvim` on macOS Catalina and uncertain why the normal macOS shortcuts are not working. They work on my other macOS Mojave system. There are probably some settings I am missing here. This is what I have in `~/.vim` directory. [![][1]][1] **Update** Responding to question abo...
I just installed
**Update** Responding to question about the configuration on both systems: I used the _copy from another mac_ to initialize the new system (that does not work) from the old system (that does) . That led to the entire home directory being bulk copied: so the configs are the same in both.
**Another update** Corrected above to say
macVim
/mvim
on macOS Catalina and uncertain why the normal macOS shortcuts are not working. They work on my other macOS Mojave system. There are probably some settings I am missing here.
This is what I have in ~/.vim
directory.

vim _directory_
(not vim _file_
) Also here are contents of couple of those files
$cat gvimrc
set guifont=Menlo:h10
Under .vim/plugin
we have:
$ll plugin
total 16
-rw-r--r-- 1 steve staff 6747 May 6 2017 cua-mode.vim
drwxr-xr-x 3 steve staff 96 May 6 2017 .
drwxr-xr-x 7 steve staff 224 Mar 13 12:18 ..
The cua-mode.vim
is here
https://gist.github.com/javadba/a639e8e75e63dfe0499679b3f78635e5 . As for all the other files this is working on the first machine and not the new one.
WestCoastProjects
(6555 rep)
Apr 12, 2020, 03:15 AM
• Last activity: Apr 12, 2020, 05:10 PM
10
votes
4
answers
13073
views
Use MacVim as standard Terminal?
I used to love the terminal.app for many reasons. I especially liked the way I could navigate to a file and edit using vim it all in one app, without having to leave the keyboard. But, since the terminal.app doesn't support many of vim's rich features, I decided to make the step to MacVim. This brea...
I used to love the terminal.app for many reasons.
I especially liked the way I could navigate to a file and edit using vim it all in one app, without having to leave the keyboard.
But, since the terminal.app doesn't support many of vim's rich features, I decided to make the step to MacVim.
This breaks the symmetry though, I have to use terminal.app to navigate to a file, edit in MacVim (using
mvim
of course), quit MacVim and open up the terminal again.
Isn't there a way to use MacVim in stead of terminal to do all this? I'm not talking about iTerm 2
etc, these apps don't cut is for me. I'm talking about true unix command line in MacVim..
This should be possible, I guess, only... is it?
romeovs
(4453 rep)
May 15, 2011, 08:48 PM
• Last activity: Feb 11, 2020, 02:16 PM
Showing page 1 of 20 total questions