Skip to content

Instantly share code, notes, and snippets.

@kenny-evitt
Last active April 16, 2017 19:27
Show Gist options
  • Save kenny-evitt/2b42dd7d140bd43cf060 to your computer and use it in GitHub Desktop.
Save kenny-evitt/2b42dd7d140bd43cf060 to your computer and use it in GitHub Desktop.
# Find the first instance of text like "[something]" on each line in a visual selection and replace each line with "something"
'<,'>s/^\s\+\[\(\w\+\)\].\+$/\1/g
# Replace `div` tags with `p` tags
%s/<\(\/\=\)div>/<\1p>/g
# On Mac OS X, the default Vim when run from Terminal can't access the clipboard ("pasteboard"). This command will run the `pbcopy` program to copy the current visual selection:
w !pbcopy
# Generate a 32 character password by calling `pwgen`:
r !pwgen -s -y 32
# Copied from an old *.vimrc* of mine:
imap <F3> <C-R>=strftime("%Y-%m-%d %H:%M")<CR>
# Source my *.vimrc*:
source $MYVIMRC
# Yank the file name of the current buffer into the "unnamed register", i.e. just use <kbd>p</kbd>
# From [this StackOverflow answer](http://stackoverflow.com/a/954336/173497)
:let @" = expand("%")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment