Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
3  
I'm not sure I entirely understand this. MacVim is a texteditor, not a terminal. What "rich features" does vim offer that Terminal.app doesn't support? –  Jason Salaz May 15 '11 at 21:30
    
You do realize that Mac OS X comes with command-line vim, right? –  Daniel Beck May 15 '11 at 22:07
    
Terminal and iTerm are Unix command lines - vi/MacVim are editors which can call a unix command line –  Mark May 15 '11 at 22:14
    
Ok, first of all yes, I know the vim command line app, that's actually the whole point. My guess was that MacVim uses some sort of command line interface which you don't get to see because it is always in vim mode. exiting this vim mode in macvim means exiting macvim. But what if that could be disabled? –  romeovs May 16 '11 at 5:50

3 Answers 3

up vote 11 down vote accepted

You're confusing the terminal with the text editor, as other commenters have pointed out. Still, there are a number of ways to make the terminal more vim-like, or vim more terminal-like.

If it's vi-style keybindings in the terminal you're after, add set -o vi to your ~/.bash_profile (assuming you're using bash). This will allow you to use vi-style keybindings at the command line (hjkl movement, modal editing, etc.)

If you just want to be able to execute unix commands from within vim, prepend ! to the beginning of those commands at the (Mac)Vim command line. For example :!pwd will print the working directory.

There are also plugins like Conque which allow you to run a shell from within Vim, which sounds like it may be exactly what you're after.

share|improve this answer
    
Conque does come pretty close to what I want;. –  romeovs May 16 '11 at 14:53

This is an old thread, but just in case someone else has this question:

mvim -v

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

1  
And where do you get mvim from? –  patrix Mar 10 '12 at 14:35
    
mvim is a script included when you download the archive from the official site with the precompiled binaries. Just tested it. Works great ;o –  SpoBo Apr 8 '12 at 14:10

If you are looking to navigate and open your files from within VIM, there are a couple things I suggest trying out.

:Sex

:Sex in VIM or MacVim splits the screen and lets you navigate the file system to find a file. I have this bound to ;o in my install.

NERDTree

NERDTree is a VIM add-on that gives you a navigable tree view of the filesystem on the left-hand side of VIM. :NERDTreeToggle ~/path/to/whatever/ will open NERDTree for you, and the root of the tree will be ~/path/to/whatever/. In my VIM installs I use my home directory, and have it aliased to Control+o in .vimrc:

map <C-O> :NERDTreeToggle ~/<CR>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.