32

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?

2
  • 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, 2016 at 23:27
  • 7
    My guess is that it stands for Zhift ;) Mar 23, 2016 at 7:10

1 Answer 1

34

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.

5
  • 2
    One of my favorite commands uses both g and z. :g/pattern/z#.2
    – jecxjo
    Mar 23, 2016 at 14:52
  • 8
    and what does that command do? Jul 15, 2016 at 19:16
  • 2
    @DurgaSwaroop It finds all occurrences of pattern, and displays them in a list with line numbers
    – user70585
    Oct 18, 2017 at 21:37
  • Here is the description and example for usage of g and z.
    – SangminKim
    Jan 6, 2018 at 15:58
  • That 'Power of g' article doesnt explain it, it merely demonstrates it. Explanation is wanting.
    – markling
    Jan 22, 2022 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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