Ir para conteúdo principal
Lucas Caton

JÁ CONHECE MEU NOVO CURSO?

O caminho certo para aprender React

70 videoaulas. Mais de 11 horas de conteúdo. Vários projetos desenvolvidos!

Quero saber mais

How to remove several lines in the Vim editor using Regex

Lucas Caton

Lucas Caton

@lucascaton
A quick tip for those who use Vim: if you need to remove several lines that match your regular expression, you can achive that by running
vim
:g /pattern/d
Let's say you want to remove the commented lines from the following file:
ruby
# This is a comment
def foo
end

# This is another comment
def bar
end
Run :g /^#.*/d and your code will become:
ruby
def foo
end

def bar
end
Simple, hey? :)

Post atualizado em 02/10/2017, 10:00:00