On Wed, Mar 20, 2013 at 7:21 AM, Sung Pae wrote: > On Sun, Mar 17, 2013 at 05:08:29AM -0700, Kana Natsuno wrote: > >> Especially, the "solution" posted in the discussion >> >> https://github.com/tpope/vim-repeat/issues/8#issuecomment-13951082 >> >> does not work with custom operators using repeat.vim. > > While I do hope Vim will gain native support for repeating custom > commands with `.`, I would like to point out that the posted solution, > while hackish, indeed does work with custom operators, custom motions, > and even in combination.
No. The "solution" does not work in every situation, especially for a combination of a custom operator and a custom text object that use repeat.vim. > I am close to releasing a plugin with 18 custom text objects and cursor > motions for S-Expressions, and I have a satisfactory¹ implementation of > repeatable operator-pending commands here: > > https://github.com/guns/vim-sexp/blob/90cc836e9c83d4b96c6c5e971febc33a5d73f7e7/plugin/sexp.vim#L103..L132 > > The motion mappings created by the above function work with both native > operators and with the custom operators provided by two other plugins by > Tim Pope: vim-surround and vim-commentary. Really? Suppose that we invoke a new Vim process with the following environment: ------------------------------------------------------------ $ git clone git://github.com/tpope/vim-repeat.git $ cd vim-repeat $ git checkout a81bef76031ca1c71766b516417480caeb01c932 $ cd .. $ git clone git://github.com/guns/vim-sexp.git $ cd vim-surround $ git checkout 90cc836e9c83d4b96c6c5e971febc33a5d73f7e7 $ cd .. $ git clone git://github.com/tpope/vim-surround.git $ cd vim-surround $ git checkout 02199ea0080d744ec76b79d74ce56d51d25cf7ae $ cd .. $ vim -u NONE -i NONE -N -c " syntax enable | set runtimepath+=$PWD/vim-repeat,$PWD/vim-sexp,$PWD/vim-surround | runtime! plugin/sexp.vim plugin/surround.vim " ------------------------------------------------------------ Then `:setfiletype scheme` and paste the following snippet: (let ((a b) (c d)) code) (let ((e f)) more-code) Suppose that we do (1) `1ggf(` (move the cursor the second "(" in the first line) (2) `ysabr` (surround the "(...)" block with "[" and "]"), (3) `3ggf(` (move the cursor the second "(" in the third line) (4) `.` (repeat (2), the last edit command) We'll get the following result: (let [((a b) (c d))] code) (let [((e f))] more-code) If we do the following steps on the same snippet: (1) `1ggf(` (2) `ysafr` (surround the current form with "[" and "]"), (3) `3ggf(` (4) `.` We'll get the following result: (let [((a b) (c d))] code) (let [((e f)) more-]code) That's why I don't believe that the "solution" is not a right way to solve this problem. It does not provide repeatability for every combination. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
