RobertF Posted March 11, 2021 Share Posted March 11, 2021 Since I work with a lot of ASCII text files which I like to edit with MacVim, I've set my macOS so that all files with a .txt extension are opened with MacVim. Then, if I want to edit one on the fly, I can just type my Alfred keyboard shortcut and then type "open somefile.txt" and Alfred will open it in MacVim. But what I've noticed is that MacVim doesn't appear to be reading my ~/.vimrc file when I open files using Alfred as the settings I have in that file aren't set in MacVim when the file is opened. On the other hand, if I were to open and terminal window and change to the directory where the file is located and open it using MacVim from the command line "mvim -v somefile.txt", all my vim settings are present. Has anyone else had this problem? Is this happening because I'm opening MacVim using Alfred? If so, is there a way to fix it? Thanks. Link to comment
deanishe Posted March 11, 2021 Share Posted March 11, 2021 What happens when you open a file in MacVim via Finder? Link to comment
RobertF Posted March 12, 2021 Author Share Posted March 12, 2021 Hmmm. Good question. It appears to not read the vimrc there either as tabs aren't converted to spaces (this is a setting I have in my .vimrc). I guess that removes Alfred from the equation. Thanks. Link to comment
deanishe Posted March 12, 2021 Share Posted March 12, 2021 Then it’s either your environment (Mac apps don’t use your shell environment because they aren’t launched from a shell) or the mvim command behaves differently to the MacVim app. The MacVim docs say its configuration file is ~/.gvimrc. What do you have in that file? If it doesn’t exist, what happens if you symlink your ~/.vimrc to ~/.gvimrc? Link to comment
RobertF Posted March 12, 2021 Author Share Posted March 12, 2021 That was the problem! Thanks very much! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now