Skip to content

Instantly share code, notes, and snippets.

@subnut
Last active August 1, 2022 16:33
Show Gist options
  • Save subnut/c93a832051fbf619a32ec95e27c93c88 to your computer and use it in GitHub Desktop.
Save subnut/c93a832051fbf619a32ec95e27c93c88 to your computer and use it in GitHub Desktop.
Useful vim commands

Insert special characters using two-letter short forms

:help digraphs
:help digraph-table

Highlight some text in a window

:help :match

Remove join/part messages from a buffer containing text copied from weechat's bare mode

:g/\v..:.. (\<--|--\>)/d

Filter chat/nick/actp messages from a buffer containing text /dumped from glirc

:%s/\v^.{-} (..:..):../\1/|2d
:2,$g!/\v^.{-} (chat|nick|actp)/d
:g/\v^([^!]*)![^ ]*: (.*)$/s/\v^([^!]*)![^ ]*: (.*)$/\1: \2/
:%s/\v^(..:.. )chat /\1/
:%s/\v^(..:.. )actp /\1/

Remove trailing whitespace

:%s/\s*$//
:$g/^$/d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment