Installation of MacVim to use gvim - macos

Previously I had gVim running and working; however, my hard drive crashed so everythin'g got erased. Anyways, I am trying to run gVim to open files "-bash: gVim: command not found. I installed X11 and MacVim and did everything that i did before but it just wont open my file. When i open my file with vim it works, but i would prefer gVim.
Any suggestions on how to get givm to work??

I'm not sure you know what you are doing.
MacVim has nothing to do with X11 at all so… are you trying to run GVim — the GTK front end of Vim — under X11 (to mimic a Linux desktop, maybe) or do you simply want to run some GUI Vim (GVim or MacVim, whatever).
If you really want GVim, you can install it (and its dependencies) from source but, judging by your question I don't think you should take that path.
If you only want a GUI Vim, the MacVim download comes with a mvim script that you can put anywhere in your $PATH. $ mvim filename will work just like $ gvim filename on Linux.
You can even rename that script to gvim if you absolutely need a gvim command.

You can install MacVim either from this site:
https://code.google.com/p/macvim/
or for example from the macports project, with port install MacVim (you must install first macports (see www.macports.org)
with macvim you will get the mvim terminal command, what is an small shell script.

TL;DR: gvim is aliased from the MacVim application's bin folder and you can add that bin directory to your $PATH variable to enable access to gvim from the terminal.
I recently downloaded the latest MacVim.dmg file from https://github.com/macvim-dev/macvim/releases, opened it, in the window that pops up, dragged the MacVim icon to the Applications icon, then closed that window and ejected the MacVim.dmg installer from the finder.
From a finder window I navigated to the /Applications folder, I right-clicked on MacVim.app and selected "Show Package Contents". Then I opened Contents/bin and there found a set of symlinks from mvim and gvim to vim.
I opened a terminal, and changed directory to the home directory by typing cd ~ . From the home directory, I typed ls -al to list all files even the hidden ones which start with a dot, and verify there was a .bash_profile file. (If you don't have this file, see if you have any other other profile files, or search the web to determine which to use or add, so that you can set the following additions to your $PATH variable and have them persist after you log out and back in.)
From the home directory, I used my favorite editor to edit the .bash_profile file, and added the following line to add MacVim's bin file to the $PATH variable:
export PATH=$PATH:/Applications/MacVim.app/Contents/bin
I saved and exited the .bash_profile file, then loaded my change with source .bash_profile. Now when I type in the terminal which gvim it lists that location, and I can run gvim from the terminal to open a file.

I’m a hard-core gvim user (i.e., I prefer gvim to vi, vim, mvim, and other text editors that are available on Mac). I’ve searched online for “How to install gvim on Mac?”, and have found many answers. The one answer that works best for me is as follows. Assuming you have brew available, on a terminal, type:
brew install macvim
You may be asked to fix some errors. Just follow the onscreen instructions, which may include running commands: brew unlink vim, brew unlink macvim, etc.
Once your macvim has been installed, type the following command:
brew link macvim
If this is successful, then gvim should have been installed, and you can verify this by typing:
which gvim
You should see:
/usr/local/bin/gvim
as the screen output.

Related

Open Mac Terminal, activate venv and leave the terminal windows running (.command file)

Using OSX, I want to create an easy shortcut to get a terminal that already has a venv initialized.
I tried creating a .command file with the following:
#!/bin/zsh
source /path/to/code/venv-python3.10/bin/activate
cd /path/to/code/my_project_directory/
zsh
I double-click the .command file within finder, and my objective is to start up a terminal with the correct venv initialised, so I can continue working in the terminal.
But without the zsh at the end, the terminal window auto-exits.
With the zsh, it remains open but does not leave me within the virtualenv.

Emacs editor "locks" out terminal when being used

The issue I am having is when I open a file via emacs it will open another window in the emacs text editor, but lock out the terminal. What I mean by lock out is that the terminal seems to be linked to the window of emacs that had opened up. When I first downloaded the software I did not have this issue and was able to open multiple emacs windows at once but now I have to close out of the current emacs window to open another. Any suggestions on fixing this?
It sounds like you want to have the file pop up in a window when you open it, rather than fill the whole terminal.
If that's the case, you should
install a graphical version of Emacs from http://emacsformacosx.com/
put alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs in you ~/.bashrc
open files with emacs file.txt &. The file will open in a separate window and you can keep using your terminal

Read only for open directories in vim

Then I open vim from terminal and open an directory like vim ., my starts in Read Only Mode.
I cant figure out why this happen and how I can change it.
If I start MacVim everything is fine. But then I start vim from the terminal and open a directory this screen comes. I can navigate one dir up and back again, and I have write access.
EDIT
I installed all my vim settings on Ubuntu 15.04. Now I can use
Does anybody know how to change this behaviour of vim?
Now I can use netw with the command vim . like I always used.
As you can see, there is no RO (read only) mark. How can
I have this in Mac on iTerm too?
What you see is exactly what you are supposed to see when doing $ vim .: the built-in netrw plugin displays a listing of the current directory that you can use to navigate your project.
If you don't want that listing, don't ask for it:
$ vim
or:
$ vim file
ctrl-p is not mapped by netrw; on my system, its set up by the yankring plugin. If vim is doing something other than going up one line, then you have a plugin involved. Try using :map to see what its mapped to; then do a search for that in your plugins directory.
The netrw way of opening a file in the same window is to use the <enter> key, although the g:netrw_browse_split variable may be used to change that default behavior.
Netrw opens in read-only mode, and that's not going to change. The file being opened should not be in read-only mode, however, if that's what you meant. If you're having a problem of that sort, please update your netrw; the most up-to-date version is at http://www.drchip.org/astronaut/vim/index.html#NETRW .
After I installed macvim 7.4 Every thing works!

Need to re-edit .bash_profile but locked out because PATH is wrong

I just added an incorrect PATH line to my .bash_profile and now every command results in "command not found", include vim. How can I re-edit the file to make the correction?
Thanks!
Try specifying an absolute path to an editor:
% /usr/bin/vim ~/.bash_profile
On the Mac you can also use the open command to have the OS open a GUI-based editor of its choosing (or have you select one.) I believe TextEdit is the default for .bash_profile:
% open ~/.bash_profile
In the case command line tools won't work, files on most systems (eg. linux, osx, cygwin, etc) can be edited by non-command tools such as notepad. This tool, in contrast to Wordpad, is a plain text editor, while Wordpad is a word processor. In case some errors appear after using it, in the terminal simply runs:
dos2unix your-problematic-file
that should solve the problem.

OSX: Environment variables pointing to application bundles?

I want cscope to open files in MacVim instead of vim, so I'm trying to have the path to MacVim as the Value of the EDITOR environment variable which is used by cscope:
$ export EDITOR=/Applications/MacVim.app/Contents/MacOS/MacVim
If I'm now trying to edit a file from within ctags, it won't work and throws this error message:
$ MacVim[8384:10b] No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting
Calling MacVim from the commandline with
$ /Applications/MacVim.app/Contents/MacOS/MacVim
works, though.
How can I fix this?
Make sure you put the mvim script in your path, and try this out:
export EDITOR="mvim -f"
This was the ticket for me when using MacVim as editing git commit messages.
Have you tried export EDITOR=/Applications/MacVim.app?
Or wrapping MacVim in a small script that uses open to start the app?
It works fine for me when I set my EXPORT variable to exactly that, and start a git commit. What are you using that's calling it? Have you considered setting EXPORT to point to the mvim script that comes on the MacVim disk image instead?
<plug>
My launch tool is designed for this. It's like Apple's open, but allows you to get the path to an application bundle rather than launching it. For example:
% launch -ni com.apple.safari
/Applications/Safari.app
launch is in Fink and MacPorts too.
</plug>

Resources