tabularize
myster-t opened this issue · 12 comments
This is a great plugin. I use it often!
Can you show me how to enable this for the tabularize plugin? I currently have these maps:
if exists(":Tabularize")
nmap <Leader>aa :Tabularize /=<CR>
vmap <Leader>aa :Tabularize /=<CR>
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:\zs<CR>
vmap <Leader>a: :Tabularize /:\zs<CR>
endif
The maintainer of tabularize has to add support for vim-repeat into the plugin itself. You could open an issue for tabularize and request it.
Actually, .
usually only repeats maps, not functions, so adding it to the map is pretty reasonable. The basic case should be little more than :call repeat#set(":Tabularize...\<CR>")
afterwards.
Yet again I make the mistake of not assuming tpope's plugin is as awesome as possible.
Thanks @tpope, but I still can't seem to figure it out. Would one of my command become:
nmap <Leader>aa :Tabularize /=<CR> repeat#set(":Tabularize \=\<CR>")
I tried that and it didn't work.
@phaitour You need to append exactly what @tpope told you. You're currently missing the :call
.
So like this @graywh?
nmap aa :Tabularize /= :call repeat#set(":Tabularize /=")
That didn't seem to work either.
nmap <Leader>aa :Tabularize /=<CR>:call repeat#set(":Tabularize /=<Bslash><lt>CR>")<CR>
Hmm, I got this back:
E114: Missing quote: ":Tabularize...\
E116: Invalid arguments for function repeat#set
Press ENTER or type command to continue
I've updated the mapping.
Still doesn't work, but definitely seems to be on the right track! Instead of performing the repeat action, it just says this on the command line
:Tabularize /=<CR>
So, if I start typing asdf
, it becomes :Tabularize /=<CR>asdf
However, if I hit backspace and delete the <CR>
part of the command and hit <enter>
, then it'll work.
If I modify the mapping to be:
nmap <Leader>aa :Tabularize /=<CR>:call repeat#set(":Tabularize /=")<CR>
Then it has the right command, but it just hangs on the command line. I have to hit <enter>
for it to run.
Yeah, I left out the . Try again.
Woohoo!! It works. Thanks for helping me figure this out!!