tabular
tabular copied to clipboard
Expose if there's a last used pattern
Define a function to check if Tabularize has been called yet,
meaning that executing :Tabularize will reuse the last pattern.
The use-case for this is defining a single mapping that either calls Tabularize directly if there's a saved pattern, or prompts you for a pattern. Like this:
function TabularizeThisN()
if exists('g:tabular_loaded')
let l:cmd = ':Tabularize'
if exists('*TabularizeHasPattern') && TabularizeHasPattern()
" Reuse the last Tabularize command
let l:cmd .= "\<CR>"
else
let l:cmd .= "\<Space>"
endif
return l:cmd
endif
endfunction
nnoremap <expr> <LocalLeader><Tab> TabularizeThisN()
Rebased this to the latest master.
I like this... sounds like a great addition