I have a Ruby code file open in vi, there are lines commented out with #
: 我在vi中打開了一個Ruby代碼文件,有一些註釋掉了#
: ui
class Search < ActiveRecord::Migration def self.up # create_table :searches do |t| # t.integer :user_id # t.string :name # t.string :all_of # t.string :any_of # t.string :none_of # t.string :exact_phrase # # t.timestamps # end end def self.down # drop_table :searches end end
Say I want to uncomment all the lines in the first def ... end
section. 假設我想取消註釋第一個def ... end
部分中的全部行。 What's an efficient way to do that in Vim? 在Vim中這樣作的有效方法是什麼? spa
In general, I'm looking for an easy and fluid way to comment and uncomment lines. 通常來講,我正在尋找一種簡單流暢的方式來評論和取消註釋。 Here I'm dealing with Ruby code, but it could be JavaScript ( //
) or Haml ( -#
). 在這裏,我正在處理Ruby代碼,但它多是JavaScript( //
)或Haml( -#
)。 .net