From 8e68cbeac051493a54e5d4e0e6bfbb4475f4175f Mon Sep 17 00:00:00 2001 From: yan Date: Sun, 18 Dec 2011 01:38:03 -0800 Subject: [PATCH] Added splitjoin plugin. Use sj and sk to split and join hashes into multiple lines. --- .gitmodules | 3 +++ README.md | 7 ++++++- vim/bundle/AndrewRadev-splitjoin | 1 + vim/plugin/settings/skwp-keymap.vim | 13 +++++++------ 4 files changed, 17 insertions(+), 7 deletions(-) create mode 160000 vim/bundle/AndrewRadev-splitjoin diff --git a/.gitmodules b/.gitmodules index 8e1d8b9..ec8d143 100644 --- a/.gitmodules +++ b/.gitmodules @@ -166,3 +166,6 @@ [submodule "vim/bundle/godlygeek-tabular"] path = vim/bundle/godlygeek-tabular url = https://github.com/godlygeek/tabular +[submodule "vim/bundle/AndrewRadev-splitjoin"] + path = vim/bundle/AndrewRadev-splitjoin + url = https://github.com/AndrewRadev/splitjoin.vim diff --git a/README.md b/README.md index 55ae5f5..d933e4c 100644 --- a/README.md +++ b/README.md @@ -217,6 +217,10 @@ files contain key mappings as well (TODO: probably will move them out to skwp-ke * Cmd-/ - toggle comments (usually gcc from tComment) * gcp (comment a paragraph) added * ,t - Command-T fuzzy file selector (alternative to PeepOpen / LustyJuggler) + * sj - split a line such as a hash {:foo => {:bar => :baz}} into a multiline hash (j = down) + * sk - unsplit a link (k = up) + * Ctrl-a - align things (type a character/expression to align by, works in visual mode or by itself) + * sj and sk - split and unsplit things (like ruby hashes) into multiple lines **Local Anonymous Bookmarking** @@ -262,7 +266,8 @@ Included vim plugins **Utils** - * tabularize - align code effortlessly by using :Tabularize /[character] to align by a character, or try the mappings ,a= and ,a: to align by equals or colons + * SplitJoin - easily split up things like ruby hashes into multiple lines or join them back together. Try :SplitjoinJoin and :SplitjoinSplit or use the bindings sj(split) and sk(unsplit) - mnemonically j and k are directions down and up + * tabularize - align code effortlessly by using :Tabularize /[character] to align by a character, or try the keymaps * yankring - effortless sanity for pasting. every time you yank something it goes into a buffer. after hitting p to paste, use ctrl-p or ctrl-n to cycle through the paste options. great for when you accidentally overwrite your yank with a delete * surround - super easy quote and tag manipulation - ysiw" - sourround inner word with quotes. ci"' - change inner double quotes to single quotes, etc * greplace - use :Gsearch to find across many files, replace inside the changes, then :Greplace to do a replace across all matches diff --git a/vim/bundle/AndrewRadev-splitjoin b/vim/bundle/AndrewRadev-splitjoin new file mode 160000 index 0000000..9896c3a --- /dev/null +++ b/vim/bundle/AndrewRadev-splitjoin @@ -0,0 +1 @@ +Subproject commit 9896c3a62514ca0a2902acf37398ddc36fbcaa8f diff --git a/vim/plugin/settings/skwp-keymap.vim b/vim/plugin/settings/skwp-keymap.vim index c9f695b..59b757b 100644 --- a/vim/plugin/settings/skwp-keymap.vim +++ b/vim/plugin/settings/skwp-keymap.vim @@ -158,15 +158,16 @@ nnoremap :let @/='\<=expand("")\>':set hls nnoremap ' ` nnoremap ` ' -" Tabularization. Hit ,a then type a character you want to align by -" The mnemonic is 'a' for align +" Tabularization. Hit Ctrl-a then type a character you want to align by if exists(":Tabularize") - nmap ,a= :Tabularize /= - vmap ,a= :Tabularize /= - nmap ,a: :Tabularize /:\zs - vmap ,a: :Tabularize /:\zs + nmap :Tabularize / + vmap :Tabularize / endif +" === +" SplitJoin plugin +nmap sj :SplitjoinSplit +nmap sk :SplitjoinJoin " ============================ " VimBookmarking