Here’s a gist from running /usr/local/bin/vim -version.Īlternatively, you could download MacVim. If you use Homebrew, you can get Vim with clipboard by running: brew install vim Here’s the gist from running /usr/bin/vim -version on Mavericks (and the same on Mountain Lion). On OS X Mavericks, Apple ships Vim version 7.3 with -clipboard. Let’s look at a few ways of getting the clipboard feature on OS X and Ubuntu. On Linux it is a no-brainer, and on Windows there is basically no decent text editor built-in (Notepad should’ve been dropped as a built-in app more than a decade ago, because it is so bad).ĭo you have more cool tips on Vim to share? Don’t forget to comment.Many systems ship with a version of Vim that was compiled with the -clipboard feature disabled, which is a damned nuisance! Being able to access the system clipboard from Vim is an essential feature. On the Mac, I don’t think I will be dropping Textmate any time soon, but if I need to use either Linux or Windows, that’s definitely my primary choice. Vim is very powerful and has lots of options that you will learn and get used to very fast. To learn a little bit more about Vim editing, read the Why, oh WHY, do those nutheads use vi? article. vim/snippets/ruby-rails/hm.snippet means that if you type “hm” inside a model file, if will activate the “has_many” snippet (see on my screencast). There you will find sub-directories for each file type. To find out all the abbreviations, take a look at the. Finally, while editing your Rails files you can try the very same abbreviations from Textmate. “R” (uppercase “R”) refreshes it and “o” (lowercase “o”) opens the folder/file your cursor is currently over. Then “\ p” (backslash and “p”) brings up the Nerd Tree, which resembles Textmate’s Project Drawer. Rails.vim gives you commands such as :Rgenerate that calls script/generate, :Rake for rake tasks, :Rscript for other script/* inside your Rails project, and so on and so forth.Ĭtrl t is FuzzyFinder, the equivalent to Commant T on Textmate. You can use “:help surround”, “:help nerdtree” to learn more about the other bundled plugins as well. Now, from inside Vim, do “:helptags ~/.vim/doc” (“:helptags ~/vimfiles/doc”, on Windows) and then “:help rails” to learn more about Tim Pope’s Rails.vim plugin. On Windows, also from your home directory, do: git clone git:///akitaonrails/vimfiles.git vimfilesĬopy vimfiles\32 vimfiles\after\plugin\snippets.vim Git clone git:///akitaonrails/vimfiles.git ~/.vim On the Linux and Mac, from your home directory, do: On Windows you must have a _vimrc file and vimfiles folder also under your home directory (ex: c:\Documents and Settings\akitaonrails, on Windows XP or c:\Users\akitaonrails, on Vista and Windows 7). vim folder under your home directory (ex. Then, in your ~/.bash_profile type in the following:Īlias vim=“/Applications/MacVim.app/Contents/MacOS/Vim” 1 2 3 4 5 6 7 To install it on the Mac, you should not use the built-in Vim because it doesn’t come with the necessary Ruby bindings. Jamis Buck’s FuzzyFinder adaptation is also a great replacement for Textmate’s file navigator. The end result is something very similar, though Textmate’s snippets engine is still ahead of NERDSnippets. I spent a day converting Textmate snippets to NERDSnippets in Vim, including the bundles for Ruby, Rails, Javascript, Rspec, jQuery. I got one that I felt more complete and I did my own fork. So I spent a couple of days researching the Web, looking for the pieces to make Vim behave more like Textmate. On the other hand I never really stopped to configure Vim decently.
0 Comments
Leave a Reply. |