Hot answers tagged


I believe this is what you're looking for: brew install macvim --with-override-system-vim This will create vim, vimdiff, etc. symlinks to mvim in /usr/local/bin/vim, and as long as /usr/local/bin is before /usr/bin in your PATH, you'll get the results you're looking for. Earlier versions of brew used the switch --override-system-vim which was deprecated. ...


:help new :help vnew should bring you on course. you will have a new buffer then, obviously. that buffer becomes a file only if you :w it to the disk.


Control+W followed by W to toggle between open windows and, Control+W followed by H/J/K/L to move to the left/bottom/top/right window accordingly.


Start up vim and try: :recover <filename> If the file never had a name, then simply: :recover That's your best bet. For more about swap files and recovery, see: :help usr_11 About the swap files, typically they're saved in the same directory as the file being edited, but with a . added the beginning to make it hidden and .swp at the end, but it's ...


I'm sure the help file covers it, but to move a split to cover the top of the screen, you can do ctrl-w K (with H = left, J = bottom, K = top, L = right). Note that the letters are uppercase. ctrl-w k will instead move up between splits, etc.


try following: " Syntax coloring lines that are too long just slows down the world set synmaxcol=128 else i recommend speeding up vim by: set ttyfast " u got a fast terminal set ttyscroll=3 set lazyredraw " to avoid scrolling problems


another way is to do a <CTRL + W> n in normal mode. This will create a new split. EDIT: You can also do <CTRL + W> v in normal mode to create a vertical split (the previous one will do a horizontal split. And just to be complete, you move to the different splits by doing <CTRL + W> <direction> with the direction being any h, j, k, ...


try setting the following line in ~/.gvimrc set lines=50 columns=90


If I understand correctly - from :h ^: ^ To the first non-blank character of the line. |exclusive| motion. (in contrast to 0, which gets you to the beginning, regardless of whitespace or not)


This isn't specifically a mac question, this is really a vi question. In navigation mode, ctrl-f scrolls down a page and ctrl-b scrolls up a page (think "F"orward and "B"ack). Ctrl-d scrolls down half a page, and ctrl-u scrolls up half a page. ^ takes you to the beginning of a line, and $ to the end. I know, I know, but there are historical reasons for ...


Not a good answer here, but I wanted to leave a note confirming that I encountered this exact same issue on a ~fresh Mountain Lion install. There is some interesting discussion at the link below which suggests a controversial bug between the MacVim and Python configure files ... but making the suggested change in the config file did not work for me ...


This is a known problem with Vim and very long lines. I see three solutions: Turn off syntax highlighting with :syntax off. Limit syntax highlighting with :set synmaxcol=200 or some other value. Break down your long line in smaller chunks with :s/\s<a/<C-v><Enter><a. In this particular case I'd recommend solution 3.


Found it: Command-T recommends using the following snippet: if has("gui_macvim") macmenu &File.New\ Tab key=<nop> map <D-t> :CommandT<CR> endif So basically you unmap the respective menu item, and then you are free to map the shortcut you were trying to map. (I'm not sure what the ampersand is doing; it works with and without ...


I suggest you read through the help file for vim windows. The specific sections of that file that apply to your question: :help opening-window :help window-moving Edit: I can only assume this is periodically getting downvotes because I haven't provided specific answers here. The problem is that the original poster asked several questions, and they were ...


You might try the patch mentioned in a related thread (“OSX 10.6.5 ,, pbpaste, pbcopy do not work under tmux”) from the tmux-users mailing list (actually hosted at, but I abhor their archive interface). Note: the patch was, at one time, applied to the MacPorts port, but it was later reverted when it was suspected to be ...


Since MacVim is an actual program on Mac OS, you can map tab switching the same way you map commands in any program (which I personally just learned about recently). Open up System Preferences, select "Keyboard", then "Application Shortcuts" (in the left menu). Under the menu on the right, click on the plus (+) to add a new command. Choose MacVim for the ...


First, remove MacVim if you've already installed it: brew remove macvim Next, edit MacVim's Formula with the command: brew edit macvim. Find the arguments list (begins with args = %W[ ...), and modify this line: --enable-pythoninterp Change it to these two lines: --enable-pythoninterp=dynamic --with-python-config-dir=/usr/local/lib/python2.7/config ...


There are a number of ways to do this. Select the range of lines in the destination buffer that you want to obtain from the source buffer and use :diffget. For example, you could visually-select a range of lines with V, then type :diffget. Select the range of lines in the source buffer that you want to put into the destination buffer and use :diffput. For ...


To do it just once, you can :!open % which will call the shell command open with the path to the current file as argument. I don't use Mac myself, but open seems appropriate to me. If it isn't, replace with whatever program you wish the file be opened with. Of course you can bind a key, if you'll need it frequently: :map <silent> <F5> :!open ...


The Vi command line switch works. alias vim='mvim -v'


You can create an alias in your ~/.bash_profile, just add this line to that file: alias vim="/Users/user/Applications/"


If you consistently end up with multiple MacVim icons in your Dock, then you might want to examine how you are starting MacVim. Specifically, :help macvim-start says Do NOT call the MacVim binary inside the app bundle to start MacVim. From the command line, you would normally use either open -a MacVim filename or mvim filename1. From the GUI, you can ...


Terminal's default preferences map Shift-Page Up and Shift-Page Down to the character sequences that tell programs like Vim and Emacs to scroll (ESC [ 5 ~ and ESC [ 6 ~). If you want these keys to send character sequences to the terminal without the Shift modifier, you can customize the keyboard map: Terminal > Preferences > Settings > [profile] > ...


Instead of pressing ^ you can press _(underscore) to jump to the first non-whitespace character on the same line the cursor is on. + and - jump to the first non-whitespace character on the next / previous line. (These commands only work in command mode, not in insert mode.)


To find out where 'textwidth' and 'wrapmargin' were set last, execute :verbose set tw? wm? To see what files have been sourced, execute :scriptnames If those aren't enough to find the problem, you can use the -V option when Vim starts and log the various startup events to a file. See :help -V Also, the default values for 'textwidth' and 'wrapmargin' ...


MacVim appears to be getting the $PATH in a way that ignores a regular user's custom dotfiles. I can't say why they prefer to do it this way, but it appears to be true. In the preferences (under the Advanced tab), you can choose to "Launch Vim processes in a login shell", but it only improves the $PATH slightly for me. The best I can tell, MacVim uses ...


You can of course change shortcuts with OSXs system preferences for your keyboard as shown here: How to Remap Any Keyboard Shortcut in Mac OS X Some might prefer to do it via their .vimrc: if has("gui_macvim") " Press Ctrl-Tab to switch between open tabs (like browser tabs) to " the right side. Ctrl-Shift-Tab goes the other way. noremap ...


I had the same issue. I moved to /Applications and then symlinked into the homebrew cellar directory. mv /usr/local/Cellar/macvim/7.3-65/ /Applications/ ln -s /Applications/ /usr/local/Cellar/macvim/7.3-65/


The beauty of Vim is its portability! Keep it agnostic. inoremap <C-d> <Esc>lxi edit: KISS even better! inoremap <C-d> <Del>


Chris Johnsen has made a wrapper which solves the problem of using pbcopy and pbpase on OSX. (the root cause of the MacVim problem above).

Only top voted, non community-wiki answers of a minimum length are eligible