LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-14-2010, 09:47 PM   #1
iamonly
LQ Newbie
 
Registered: Nov 2009
Distribution: Slackware 12.2.0
Posts: 13

Rep: Reputation: 0
Unhappy vi can not show the first line!!!


Hi all!
I just use The traditional VI (http://ex-vi.sourceforge.net/) ex-050325.tar.bz2 as my editor.
All things are going fine until yesterday.
I found that
'vi myfile.txt'
in command line (bash shell) can not display the first line of myfile.txt properly.

The problem is that the first 20 characters (or so) of the first line do not show on my screen. So I can not edit them. All the other lines are fine. While
'cat myfile.txt'
shows the content perfectly.

Everything is fine if I issue
'vi myfile.txt'
in an x-term (i.e. vi works pretty well within X Window)


Any ideas to fix this problem? Thanks for your time!!

Last edited by iamonly; 03-14-2010 at 09:53 PM.
 
Old 03-14-2010, 11:46 PM   #2
penguiniator
Member
 
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
Is there any difference in your TERM variable between xterm and a virtual terminal? How many screen lines are being displayed? What is the value of LINES?
 
Old 03-15-2010, 12:05 AM   #3
kainosnous
Member
 
Registered: Mar 2010
Location: Tennessee, USA
Distribution: Arch, Fedora
Posts: 59

Rep: Reputation: 18
Just throwing this out there, but does it appear that the file starts on line 2? I have in the past started vi and found myself on the continued part of the first line. Since up/k moves up to the actual line (as opposed to gk), it can appear like you can't reach it.

Also, is it a matter of placement? If you :read the file into a later part of itself, does it still have the same issue? Are they all just standard characters [a-zA-Z0-9] ?

I'm just taking a shot in the dark. I've never had that happen to me.
 
Old 03-15-2010, 12:07 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You could try the 'od' cmd eg http://linuxshellaccount.blogspot.co...acters-in.html.
Similarly, try 'hexdump' on the file in qn.
 
Old 03-15-2010, 12:41 AM   #5
iamonly
LQ Newbie
 
Registered: Nov 2009
Distribution: Slackware 12.2.0
Posts: 13

Original Poster
Rep: Reputation: 0
Thank you for your replying.
To penguiniator:
1. in X Window:
----------------------
echo $TERM
xterm
echo $LINES
13
------------------------
2. in virtual terminal:
-------------------------
echo $TERM
linux
echo $LINES
25
--------------------------
3. The displayed screen lines is actually 25 in the terminal.

To kainosnous:
There are no special character in the file. All of them are in [a-zA-Z0-9].
And it seems that, in the terminal+vi, the cursor just can not be seen in the first line.
I 'set number' in ~/.exrc, and in the terminal+vi, the screen is like this:
-------------------------------------------

2 this is the second line
3 this is the third line
...
...
...
--------------------------------
Notice that the first line is of no number and when I '1 G',
the cursor is missing. Then 'a' to append 40 (say) letters to the first line, but only
the last 5 (say) letters of them are displayed in the first screen line like this:
-------------------------------------------
schri
2 this is the second line
3 this is the third line
...
...
...
--------------------------------

Help!!!

Last edited by iamonly; 03-15-2010 at 12:45 AM.
 
Old 03-15-2010, 01:08 AM   #6
kainosnous
Member
 
Registered: Mar 2010
Location: Tennessee, USA
Distribution: Arch, Fedora
Posts: 59

Rep: Reputation: 18
Is syntax highlighting turned on? There may be something strange in there like a black foreground text or folding. What does vi think the filetype is? (:se filetype)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
show line numbers in vi swamprat Linux - Newbie 1 12-28-2008 04:55 PM
Show a certain line in file shahgols Linux - Newbie 4 03-22-2007 09:47 AM
ps doesn't show the full command line OlRoy *BSD 2 01-29-2007 09:34 PM
How to show a progress bar on the next line? Chowroc Programming 10 10-26-2005 10:27 PM
could u show me the last line of your /etc/inittab file? C++freak Linux - Software 2 07-30-2002 08:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration