I have a Ruby code file open in vi, there are lines commented out with #
:
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. What’s an efficient way to do that in Vim?
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 (-#
).
Related Posts:
- Where is my .vimrc file?
- How to make vim paste from (and copy to) system’s clipboard?
- How can I quickly delete a line in VIM starting at the cursor position?
- How to copy to clipboard in Vim?
- Vim Can’t Save File (E212)
- Move cursor to end of file in vim
- What is Vim recording and how can it be disabled?
- Backspace key not working in Vim/vi
- vim and notepad++
- How do I change tab size in Vim?
- How to go back (ctrl+z) in vi/vim
- How to do case insensitive search in Vim
- Vim clear last search highlighting
- What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in Vim?
- Changing case in Vim
- :wq! command in vim
- Is there a way to create multiline comments in Python?
- Is it bad practice to comment out single lines of CSS with //?
- Can comments be used in JSON?
- Can comments be used in JSON?
- How do I exit the Vim editor?
- How do I comment out a block of tags in XML?
- Is there a way to convert all comments into javadoc comments? [Eclipse/Java]
- How do I comment out a block of tags in XML?
- What is newline character — ‘\n’
- How do you do block comments in YAML?
- Can comments be used in JSON?
- How to get the list of all installed color schemes in Vim?
- How do you comment out code in PowerShell?
- How to set default vim colorscheme
- Comments in Markdown
- Comments in Markdown
- Visual Studio /**/ comment shortcut?
- How to “comment-out” (add comment) in a batch/cmd?
- What does ^M character mean in Vim?
- Autocompletion in Vim
- Is ‘# -*- coding: utf-8 -*-‘ also a comment in Python?
- Vim Can’t Save File (E212)
- Why does using from __future__ import print_function breaks Python2-style print?
- How to add comments into a Xaml file in WPF?
- Copy all the lines to clipboard
- Is it possible to have a multi-line comments in R?
- What is the common header format of Python files?
- How to “comment-out” (add comment) in a batch/cmd?
- How do you make Vim unhighlight what you searched for?
- How to use vim in the terminal?
- How to use vim in the terminal?
- Multi-Line Comments in Ruby?
- vi/vim editor, copy a block (not usual action)
- How to comment and uncomment blocks of code in the Office VBA Editor
- How to write a comment in a Razor view?
- How to write an inline-comment in Python
- What is the difference between MacVim and regular Vim?
- What is the recommended way to use Vim folding for Python code
- R: Comment out block of code
- My Vim replace with a regex is throwing a `E488: Trailing characters`
- single line comment in HTML
- Vim: No write since last change, even though I changed the file
- Vim Opening File E325 Attention Error
- Details of difference between @see and @inheritDoc
- Multi-Line Comments in Ruby?
- How to change “Leave a Reply” title in wordpress twentyfifteen theme
- Where can I find the “Leave a Reply” line in the WordPress SmartBiz.1.1.1 theme?
- Show comments on WordPress home page
- Why do I get comment spam even with Akismet and Captcha?
- Is there ANY way to remove comments function and section totally?
- What tools are available for managing/writing to WordPress? [closed]
- How to rearrange fields in comment_form()
- setting comments off as default for pages and custom post types?
- how to reduce the number of spam comments
- Is it possible to pull comments from facebook into your blog?
- Find out which moderator approved comment?
- Filtering the Admin Comments List to Show Only Comments from the Current User?
- How to export comments in WordPress?
- Non-threaded comment replies with link to original comment
- How to make comments work for a post loaded per Ajax?
- Approve comment hook?
- Commenting in user profile page?
- How to change “You must be logged in to post a comment.”
- How to get comments by post ID?
- What are the package and subpackage comment for?
- comment_post_ID 0 (cannot remove from dashboard)
- Why are the comments disabled by default on my custom_post_types?
- Disable comments on all posts/pages
- How do I delete all comments from a specific old blog post?
- Change HTML Produced by wp_list_comments()
- Removing the “Website” Field from Comments and Replies?
- Stop WordPress redirecting comment-page-1 to the post page?
- Is it possible to filter comments in a post so a user can only see the comments they have written?
- Why are comments and trackbacks still getting through for custom post types?
- Importing old Disqus comments into WordPress
- How to add a class to the comment submit button?
- How to wrap submit button of comment form with div
- WP_Comment_Query pagination, delving into the unknown
- How to enable comments for pending and draft posts?
- Using WordPress’ WYSIWYG for comments
- Enable Submit Comment Without Page Reload (Using Ajax)?
- What for is the table “wp_commentmeta” exactly?
- Comment Walker vs. Comment Callback
- Experiences with adding Nonces to the comment form