Skip to main content

vim.merge!(rails)

After meeting tpope and pair programming with reinh I got to see the power of vim. I have never used vim before so this is all new to me. I've been using TextMate exclusively since starting Rails a few years ago. I came to work and started in on a pursuit of how I can do in vim what I do in Textmate. While on this quest, I will document along the way some useful tips that may help you too.
I'll document some vim things I've learned so far:
Vim commands I use often:
  • gf - when cursor is on class name it'll take you to that class definition
  • yyp - duplicate current line
  • :AS - I use a lot to look at code and spec at the same time
  • ^p - autocomplete word from any open file
  • control + shift + 6 - switch between two buffers
  • shift + s - to delete current line
  • :%s/old/new/g - to change text to new text
  • / - to go to line number on page
  • /text, then enter key - to find text in file, n to find next
  • :split - split screen
  • :Rake - run specs in current file
  • :on - if in split screen, will make selected buffer the only buffer
  • escape key - to exit insert mode
  • o - create new line below existing line and enter insert mode
  • v aw - select a word
  • v ap - select paragraph (works well for method definitions too)
What are your favorite commands? I'll post more as I learn.

Comments

  1. run ruby in current file:

    :rubyf %

    ReplyDelete
  2. No need for plugins for editing comments. Just use Visual Block mode with the 'c' command. Enjoy.

    ReplyDelete

Post a Comment

Popular posts from this blog

Beginning Erlang for Ruby Developers

If you missed my "Beginning Erlang for Ruby Developers" here is a link to the presentation.

https://beg-erlang-for-ruby-devs.herokuapp.com/




Setting up Sinatra and DataMapper on Windows

I use a MacBook Pro for work and pleasure on a day-to-day basis. Recently, I was asked to teach web students at a local high school. These students know html/graphics/flash/etc. The advanced students were ready for some server-side programming and database integration. I wanted the students to be able to get up and going quickly (for motivation reasons) and to create useful apps (using a database). I felt Sinatra to be a great fit for this. I created a Sinatra app for my uncle and his business. It was a joy to work with it and I was able to deploy quickly using Heroku.
My experience of using Sinatra on my Mac was straightforward. Like most things using Ruby and Mac: it just worked. However, I found out the students at the high school use MS Windows. Fortunately, I have a Windows XP virtual machine running in VMWare so I could prepare that way. I used to teach computer science and web development at Spokane Community College and am aware of teaching Ruby in a Windows lab environment. …

Improving Traditional Software Development Education

I read Corey Haines post about his idea for software development school. I thought I'd jot down some of my experiences while I taught software development.
I taught community college computer science and web development for 7 years. In the summers I worked as a contractor to gain 'real-world' experience. This allowed me to teach what I learned over the summers in the classroom. Towards the last couple of years of teaching I worked at nights while I was teaching because I enjoyed it so much.
To me I saw a lot of teachers take the easy road: picking canned curriculum that laid out non-practical material, have a work study student grade for them, etc. while they go home early. This was frustrating to watch and be around!! I picked industry books (PragProg, Addison-Wesley, etc.) and used them for reference while I created custom curriculum every quarter because of technology changes. I did not picked canned textbooks. They drove me nuts being out of date and out of touch…