Results 1 to 6 of 6

Thread: How to make Vi(m) automatically show all file content

  1. #1

    Default How to make Vi(m) automatically show all file content

    I've search a lot of Vi documentation for this problem, but couldn't find anything. Anybody have an idea what Vi setting I should change to make Vi show all of a file's content. My problem is, everytime I open a file with Vi, it will always show a few lines only. The rest of the lines is sort of hidden with a line showing that there are a certain number of lines below it, hidden. For example, one file I open will contain something like this:
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    mg.inp simulation created by user1

    bomlev -2

    -- +94-lines -------------------------------------------

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    I can expand the line with any insert command (a, i, o, etc) but is there a way to make Vi automatically expand the lines?

  2. #2
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: How to make Vi(m) automatically show all file content

    On 06/16/2011 09:06 PM, fading wrote:
    >
    > I can expand the line with any insert command (a, i, o, etc) but is
    > there a way to make Vi automatically expand the lines?


    i'll tell you how i solved that problem: i installed midnight commander
    and instead of typing "vi" i type "mc" and get a file editor, file
    manager, an ftp client, and and and and . . .

    try it!!

    the only downside is that vi[m] is "always" included on "any" *nix
    machine you might sit down at or ssh into....mc, maybe or maybe not..

    --
    dd
    http://is.gd/bpoMD

  3. #3
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,890
    Blog Entries
    3

    Default Re: How to make Vi(m) automatically show all file content

    I don't recall ever seeing that. Maybe that happens if you have very long lines, so that the first line or two fills the screen.

    On the other hand, one of the first things I do after installing opensuse is:
    Code:
    rm /etc/vimrc
    That avoids most of the vi behavior that I don't want.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  4. #4

    Default Re: How to make Vi(m) automatically show all file content

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Once in vi just type the following:

    zR

    Let me know if that's what you're after. Found it here:
    http://vimdoc.sourceforge.net/htmldoc/fold.html

    Good luck.





    On 06/16/2011 03:08 PM, DenverD wrote:
    > On 06/16/2011 09:06 PM, fading wrote:
    >>
    >> I can expand the line with any insert command (a, i, o, etc) but is
    >> there a way to make Vi automatically expand the lines?

    >
    > i'll tell you how i solved that problem: i installed midnight commander
    > and instead of typing "vi" i type "mc" and get a file editor, file
    > manager, an ftp client, and and and and . . .
    >
    > try it!!
    >
    > the only downside is that vi[m] is "always" included on "any" *nix machine
    > you might sit down at or ssh into....mc, maybe or maybe not..
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.15 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJN+ncsAAoJEF+XTK08PnB5O1UP/1rgGsdHM2gtSMHhIgPkKHml
    X+I78E0t8FavV3cWFIwP+VpZ1QCLlygqOkneVANS83MZVDq0WDEz2OfxL4xh1DxU
    9p2alccq+keO725eZ61OTlIv+UPB2AN5jY3i1Dm8hPq0XJkgDdMXdLSg15M8g5+K
    15B/UhZeD9P1mVLeGzoq1QpxFtMCN0DHYCdP1b/eMpl1LPYPT9BC5LtqXeb6KQGy
    0aCY/WWoDDxi3CXB05xqze6bJVo4YpSQSqP+4kIkb1/JjPC0jV/YGl7TKLykXC3L
    0bt4GkEpH+VdQIPe3vPnwFXWyYwVBan1g7nZ/qf/hJx0oi7kFNZSk0iK49dxxAUq
    enVo76zFFkE2Yc+VBNpgpwCfpPtBFrxMFwA4L77ne7V/G7BJkAd3UUXBHOilY90A
    3z6JLC5Q9ail0GKf99Vy+sfkWfKzK4E5NSewTqTDBwFVK2e7SB/I/k6vxCrH+MRm
    gLac2btBwln91K/4QBEfH828I1uS1z5/+RZEBPAQLRgu8Hv0frV6x6W7fRrzbo+S
    Dz5sMv5CB3VtXkIHXMK+wiVMQ5FDjF7JF/IjMdcSb1C5/vL89yvsG4R3FOa8RlPY
    zIlvzYOGbiRHCnMm1R5FW8zfWJ4nz7qGDvN8lxuaeabLF0zFGJubXEdTW6LbweEW
    wGrnWMNVa4W4wd87ohLj
    =4xqz
    -----END PGP SIGNATURE-----

  5. #5
    Taki NNTP User

    Default Re: How to make Vi(m) automatically show all file content

    On 06/16/2011 12:06 PM, fading wrote:
    > [...] My problem is, everytime I open a
    > file with Vi, it will always show a few lines only. The rest of the
    > lines is sort of hidden with a line showing that there are a certain
    > number of lines below it, hidden. For example, one file I open will
    > contain something like this:
    > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    >
    > mg.inp simulation created by user1
    >
    > bomlev -2
    >
    > -- +94-lines -------------------------------------------
    >
    > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    [...]

    <My knowledge of Vim is elementary.>

    I have never seen it, either. It seems a configuration issue. I can make
    only 10 lines to be seen, by issuing, in the command mode, ":set
    lines=10", or by inserting ~/.vimrc a line "set lines=10". In either
    case, the "xterm" shrinks to show only 10 lines. But I don't get the line:
    -- +xxx lines -------.

    (By using ~/.vimrc disables "vi" compatibility; I insert "set
    nocompatible" in this file, just to make sure.)

    1). Is the number of visible lines the same each time you launch "vi"?
    And does the size of the terminal emulator shrink to show only
    those lines or does the size remain the usual size, with blank
    lines below those lines?
    2). Are you issuing the command "vi" on the command-line in a terminal,
    without disabling vi compatibility?
    3). "Vim" is installed by default, I think. Is it actually installed?
    4). With "vi", ":set window=10" / "set window=10" is said to do the
    trick. With "Vim", this has no effect (no error warning, either,
    according to my reference).

    Anyway, there's newsgroup "comp.editors" where very knowledgeable
    people, especially about "Vim", hang around. Try that one; your case is
    quite unusual.



  6. #6

    Default Re: How to make Vi(m) automatically show all file content

    Quote Originally Posted by fading View Post
    I've search a lot of Vi documentation for this problem, but couldn't find anything. Anybody have an idea what Vi setting I should change to make Vi show all of a file's content. My problem is, everytime I open a file with Vi, it will always show a few lines only. The rest of the lines is sort of hidden with a line showing that there are a certain number of lines below it, hidden. For example, one file I open will contain something like this:
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    mg.inp simulation created by user1

    bomlev -2

    -- +94-lines -------------------------------------------

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    I can expand the line with any insert command (a, i, o, etc) but is there a way to make Vi automatically expand the lines?
    It looks like code folding. It's a feature of Vim, to let you navigate around fast by hiding chunks of code(Like some comments, functions, etc). Check this link Code folding in vim -Smarticus , I think this will solve your problem . I too was annoyed with code folding, but later on found in useful in navigating big files.

    Hope this helps.
    --
    Vivek Bhat
    Linux User #496540
    Dell 620 S Desktop, 8GB, Intel(R) Core(TM) i5-2310 CPU @ 2.90GHz, openSuSE Leap 42.1
    +Plasma 5, Kernel 4.1.20-11-default x86_64

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •