LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How can I get a 'real' vi editor - Ubuntu (https://www.linuxquestions.org/questions/linux-general-1/how-can-i-get-a-real-vi-editor-ubuntu-771218/)

david.ledger 11-24-2009 08:20 AM

How can I get a 'real' vi editor - Ubuntu
 
Every time I have to work seriously on Linux I have to re-adjust my environment, which is ok, but some things really get in my way. vim is one of them.

I have never been able to smoothly read text that has embedded bold bits in it, let alone coloured words. My brain stops at each transition and it's as if I have to re-focus. I've had 'more' aliased to 'TERM=dumb more' for years. Vim is a harder nut to crack. I can remove the colours, but I still get bold text according to syntax. This must be set as the file to edit is opened, which is after any .exrcr or .vimrc is done, and I have to use ':set syntax=' to clear it every time I open an edit. The easy way would be install a real, simple, vi if I could. Are there any out there?

I learned vi in '83, and use a commercial 'straight' vi on an almost daily basis, so "get used to it" is not an acceptable answer.

David

theNbomr 11-24-2009 08:27 AM

You should be able to 'set syntax=' and any other preferences in .vimrc in your home directory.
--- rod.

david.ledger 11-24-2009 08:58 AM

> You should be able to 'set syntax=' and any other preferences in .vimrc in your home directory.

Tried that and it didn't work. Of course, it doesn't know until it opens the file which syntax it is. I suspect that setting it to blank in .vimrc is just setting it to what it would be anyway at that stage. For 'vi x.pl y.php z.c' to work (and I assume it does) it must be capable of switching syntax on each file open.

David

MBybee 11-24-2009 09:09 AM

Quote:

Originally Posted by david.ledger (Post 3767961)
> You should be able to 'set syntax=' and any other preferences in .vimrc in your home directory.

Tried that and it didn't work. Of course, it doesn't know until it opens the file which syntax it is. I suspect that setting it to blank in .vimrc is just setting it to what it would be anyway at that stage. For 'vi x.pl y.php z.c' to work (and I assume it does) it must be capable of switching syntax on each file open.

David

Just set this in the vimrc:
Code:

syntax off
It will be overridden by other settings, if you have them, so make it the very last line.

I just tested toggling it back in forth in my vimrc here with total success.

Vrajgh 11-24-2009 09:10 AM

I have always found that not having a ~/.vimrc makes it behave a lot more like traditional vi. (See the following section from the help. I get the impression that you can still customize it with ~/.exrc but I have never used that file.

Quote:

*compatible-default*
When Vim starts, the 'compatible' option is on. This will be used when Vim
starts its initializations. But as soon as a user vimrc file is found, or a
vimrc file in the current directory, or the "VIMINIT" environment variable is
set, it will be set to 'nocompatible'.

voyciz 11-24-2009 09:14 AM

Well with vim on my system I can remove the files in /usr/share/vim/vim72/syntax/ and then no syntax rules will apply to any files.

pcunix 11-24-2009 09:20 AM

I have no idea why "set syntax" doesn't work for some people - it didn't work for me either.

However, I found that the fix for me was to add

Code:


set t_Co=0
# t_C0=2 turns off MOST colors, 0 kills all


to the top of /etc/vimrc.

I took that from http://aplawrence.com/Forum/TonyLawrence10.html

ilikejam 11-24-2009 09:20 AM

Hi.

If vim is run as 'vi', it goes into old-skool plain vi mode. Check 'aliases' to see if there's one set up and unalias it if necessary.

Dave

chrism01 11-24-2009 11:40 PM

vim is often aliased to vi. Just remove the alias and you'll get vi (if you type in 'vi' and not 'vim'). It's not vim-in-vi mode BTW.
You can do 'which vi' to find the real one.

ilikejam 11-25-2009 04:37 AM

Quote:

It's not vim-in-vi mode BTW
Well, it kind of is - vi is usually the vim-minimum version on Linux. But yeah, it's not the same binary.

Dave

david.ledger 11-26-2009 07:36 AM

Thanks all for your input.

syntax off
in my .exrc did it. On the Ubuntu installation I'm working on 'vi' runs an 'vim' no matter how you start it. There doesn't seem to be a non-vim version of vi installed anywhere.

set t_Co=0
also fixed my colours in a much tidier way than I was using. I'm running it in an xterm from a Mac at home, but the non-colour xterm in OSX still does colours.

The Linux box is not my system, and there are several other users, so I can't do anything that would change what happens for anyone else. I'd rather fix things with changes to my environment anyway. That box is just a VM on something else. It'll probably go away shortly, to be replaced by a possibly different Linux.

Thanks again,
David


All times are GMT -5. The time now is 08:09 PM.