usage
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
command! -nargs=0 -bar -range=% Reverse
\ let save_mark_t = getpos("'t")
\<bar> <line2>kt
\<bar> exe "<line1>,<line2>g/^/m't"
\<bar> call setpos("'t", save_mark_t)
[!TIP|label:references:]
align with first space :
/^\s*\S\+\zs/l0c1l0
align the second
=
to left :/^\(.\{-}\zs=\)\{2}/l1l0
l<N>
left-align (with N spaces padding)
r<N>
right-align (with N spaces padding)
c<N>
center-align (with N spaces padding)
including the <sep>
align to left
:Tabularize /<sep>
or
:Tabularize /<sep>/l1
align to center
align without <sep>
[!NOTE]
i.e.: the second match (
=
)
refer to matches the N pattern
[!NOTE] only for default left-alignemnt. Not support customized right/middle alignment. i.e.:
/r1c1l0
align with 2nd matches
or with \v
(very magic)
reference:
for every N matches
or
[!NOTE|label:pre condition:]
align the first
:
and last matches,
as below:[ isRunning : proc.getOrDefault( 'run' , false ) , name : proc.getOrDefault( 'name' , '') , runningStage : proc.getOrDefault( 'stage' , ['all'] ) , type : proc.type.split('^.*\\u00BB\\s*').last() , ]
first :
reference: via
/^[^;]*\zs:
/^[^;]*\zs:/r1c1l0
/^[^;]*/r1c1l0
/^[^:]*\zs:
/^[^:]*\zs/r1c1l0
/^[^:]*\zs:/r1c1l0
last ,
tips:
actually the pattern not matches with the final
,
, but matches with)<.*> ,
sample code:
/^[^:]*/r1c1l0
isRunning : proc.getOrDefault( 'run' , false ) ,
name : proc.getOrDefault( 'name' , '') ,
runningStage : proc.getOrDefault( 'stage' , ['all'] ) ,
type : proc.type.split('^.*\\u00BB\\s*').last() ,
/^[^:]*:/r1c1l0
:
isRunning : proc.getOrDefault( 'run' , false ) ,
name : proc.getOrDefault( 'name' , '') ,
runningStage : proc.getOrDefault( 'stage' , ['all'] ) ,
type : proc.type.split('^.*\\u00BB\\s*').last() ,
/)[^,]*\zs,
isRunning : proc.getOrDefault( 'run' , false ) ,
name : proc.getOrDefault( 'name' , '') ,
runningStage : proc.getOrDefault( 'stage' , ['all'] ) ,
type : proc.type.split('^.*\\u00BB\\s*').last() ,
or even better align
:1,3Tabularize /,
or :'<,'>Tabularize /,
isRunning : proc.getOrDefault( 'run' , false ) ,
name : proc.getOrDefault( 'name' , '') ,
runningStage : proc.getOrDefault( 'stage' , ['all'] ) ,
type : proc.type.split('^.*\\u00BB\\s*').last() ,
:Tabularize /)[^,]*\zs,
:Tabularize /<sep>/r1c1l0
:Tabularize /<sep>\zs/<specifier>
command! -nargs=1 -range First exec <line1> . ',' . <line2> . 'Tabularize /^[^' . escape(<q-args>, '\^$.[?*~') . ']*\zs' . escape(<q-args>, '\^$.[?*~')
:Tabularize /^\(.\{-}\zs=\)\{N}/
|
`^` means start of the line
: Tabularize /\(.\{-}\zs=\)\{N}/<specifier>
|
no `^` means every `{N}` matches
:Tabularize /\v(.{-}\zs\=){N}/<specifier>
isRunning : proc.getOrDefault( 'run' , false ) ,
name : proc.getOrDefault( 'name' , '') ,
runningStage : proc.getOrDefault( 'stage' , ['all'] ) ,
type : proc.type.split('^.*\\u00BB\\s*').last() ,
isRunning : proc.getOrDefault( 'run' , false ) ,
name : proc.getOrDefault( 'name' , '') ,
runningStage : proc.getOrDefault( 'stage' , ['all'] ) ,
type : proc.type.split('^.*\\u00BB\\s*').last() ,
isRunning : proc.getOrDefault( 'run' , false ) ,
name : proc.getOrDefault( 'name' , '') ,
runningStage : proc.getOrDefault( 'stage' , ['all'] ) ,
type : proc.type.split('^.*\\u00BB\\s*').last() ,
:Tabularize /\v^(.{-}\zs\=){N}/<specifier>
isRunning : proc.getOrDefault( 'run' , false ) ,
name : proc.getOrDefault( 'name' , '') ,
runningStage : proc.getOrDefault( 'stage' , ['all'] ) ,
type : proc.type.split('^.*\\u00BB\\s*').last() ,
isRunning : proc.getOrDefault( 'run' , false ) ,
name : proc.getOrDefault( 'name' , '') ,
runningStage : proc.getOrDefault( 'stage' , ['all'] ) ,
type : proc.type.split('^.*\\u00BB\\s*').last() ,