什么是在Vim中评论/取消注释行的快速方法? - What's a quick way to comment/uncomment lines in Vim?

问题:

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


解决方案:

参考一: https://stackoom.com/question/72AS/什么是在Vim中评论-取消注释行的快速方法
参考二: https://oldbug.net/q/72AS/What-s-a-quick-way-to-comment-uncomment-lines-in-Vim
相关文章
相关标签/搜索