From 5b8742e22674f05b0373b560fcbc622c913245d4 Mon Sep 17 00:00:00 2001 From: yan Date: Wed, 9 May 2012 17:54:30 -0700 Subject: [PATCH] More vim surround shortcuts ,} ,] ,) ,' etc --- README.md | 2 +- vim/plugin/settings/yadr-keymap.vim | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index db78958..c9a8de9 100644 --- a/README.md +++ b/README.md @@ -333,7 +333,7 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke * `Cmd-'` and `Cmd-"` to change content inside quotes * Cmd-Space to autocomplete. Tab for snipmate snippets. * `,ci` to change inside any set of quotes/brackets/etc - * `,#` and ',"' to surround a word in #{ruby interpolation} or "quotes" + * `,#` `,"` `,'` `,]` `,)` `,}` to surround a word in these common wrappers. the # does #{ruby interpolation}. works in visual mode (thanks @cj) #### Tab Navigation diff --git a/vim/plugin/settings/yadr-keymap.vim b/vim/plugin/settings/yadr-keymap.vim index 8fcffaf..a4aa466 100644 --- a/vim/plugin/settings/yadr-keymap.vim +++ b/vim/plugin/settings/yadr-keymap.vim @@ -40,8 +40,34 @@ imap - " ,# Surround a word with #{ruby interpolation} map ,# ysiw# -" ,# Surround a word with quotes +vmap ,# c#{"} + +" ," Surround a word with "quotes" map ," ysiw" +vmap ," c""" + +" ,' Surround a word with 'single quotes' +map ,' ysiw' +vmap ,' c'"' + +" ,) or ,( Surround a word with (parens) +" The difference is in whether a space is put in +map ,( ysiw( +map ,) ysiw) +vmap ,( c( " ) +vmap ,) c(") + +" ,[ Surround a word with [brackets] +map ,] ysiw] +map ,[ ysiw[ +vmap ,[ c[ " ] +vmap ,] c["] + +" ,{ Surround a word with {braces} +map ,} ysiw} +map ,{ ysiw{ +vmap ,} c{ " } +vmap ,{ c{"} " gary bernhardt's hashrocket imap =>