Skip to content

Instantly share code, notes, and snippets.

@trevmex
Created September 30, 2013 16:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trevmex/6766312 to your computer and use it in GitHub Desktop.
Save trevmex/6766312 to your computer and use it in GitHub Desktop.
My first VimL function. It removes all matched lines in a file. Woohoo!
" :RL <regexp> will now remove all matched lines in a file
function! RemoveLine(regexp)
exe '%s,^.*' . a:regexp . '.*$\n,,g'
endfunction
command! -nargs=1 RL call RemoveLine(<f-args>)
@robertmeta
Copy link

:%g/foo/d

will delete all lines containing foo.

But glad you are learning VimL -- cause I don't want to have to write those wonderful plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment