21

I was looking up at tips on screen shifting and came across the following tips:

zz = shift current line to middle of screen
zt = shift current line to top of screen
zb = shift current line to bottom of screen

My question is what is z? What does it stand for? what other functionality might z have?

  • 3
    With folding, it can visually represent a ... folded sheet of paper. Otherwise, a letter that has to be used, after all good letters were taken for "important" operations that could use a good mnemonic. – VanLaser Mar 22 '16 at 23:27
  • 6
    My guess is that it stands for Zhift ;) – ypercubeᵀᴹ Mar 23 '16 at 7:10
26

z doesn't stand for anything. g and z were two letters that went unused as standalone commands (z<CR>, z., z+, z-, and z^ existed) in vi, so they have been repurposed in Vim as a prefix for a variety of commands.

:help z and :help g will show you all the commands that sit behind these prefixes.

  • One of my favorite commands uses both g and z. :g/pattern/z#.2 – jecxjo Mar 23 '16 at 14:52
  • 3
    and what does that command do? – Durga Swaroop Jul 15 '16 at 19:16
  • @DurgaSwaroop It finds all occurrences of pattern, and displays them in a list with line numbers – user70585 Oct 18 '17 at 21:37
  • Here is the description and example for usage of g and z. – SangminKim Jan 6 '18 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.