# Syntax highlighting in the "vi".



## valsorym (Aug 11, 2011)

Can the editor "vi" highlight syntax?:
- Shell
- C / Cpp
- Pyhton

I know of the existence of the editor "Vim", but would like to work on "vi".


----------



## graudeejs (Aug 11, 2011)

No. Install and configure editors/vim


----------



## valsorym (Aug 11, 2011)

Ok. Thanks.


----------



## fonz (Aug 11, 2011)

Some background info: vi and vi*m* are often thought to be pretty much the same thing, but they really are not. Vi is the barebones version of the editor, vim basically is vi with all sorts of nifty stuff added to it. Syntax highlighting is one of those things that you get with vim but not with vi.

Fonz

Edited to add: vi is part of the base system and is almost certainly available on any UNIX system. Vim is an application that needs to be installed.


----------



## phoenix (Aug 11, 2011)

Also note that /usr/bin/vi in FreeBSD is *n*vi, and not generic vi.  (Yes, there is a difference.)


----------



## UNIXgod (Aug 11, 2011)

Yup base vi is Keith Bostic's nvi editor's new vi aka nvi

The original Bill Joy's vi is in the ports as well under editors/2bsd-vi

As it's been mentioned vim is what you want for syntax highlighting.


----------



## valsorym (Aug 12, 2011)

vi editor installed on my system by default.
I thought not to impose too much.
vim a lot of sets of dependencies. (during installation)

And editor of "ee" is also not able to highlight?

Ok. I will install vim.

Thanks all.


----------



## UNIXgod (Aug 12, 2011)

doorways said:
			
		

> And editor of "ee" is also not able to highlight?



ee() is meant to be as small as possible. I'm sure it wont have syntax highlight. If you prefer a editor like ee you may want to look at nano or pico. vim is what most vi users use when the need for syntax highlighting is needed.

when you get vim installed you may need to run:

[CMD=":"]syn on[/CMD] or set syntax on in your .vimrc


----------



## freethread (Aug 12, 2011)

there is also midnight commander integrated editor, can be used stand alone misc/mc a norton commander clone, very close to far manager if you already used it on win cmd line, same commands and interface (at most).


----------



## carlton_draught (Aug 12, 2011)

UNIXgod said:
			
		

> vim is what most vi users use when the need for syntax highlighting is needed.


Vim is what should be used when serious work is to be done. For editing config files, vi is a reasonable substitute. /holy_warrior


----------



## jrm@ (Aug 12, 2011)

Well, since the holy war has started, I'm going to completely ignore the original post and mention a common alternative to vi(m), editors/emacs.  This page might be useful: http://en.wikipedia.org/wiki/Editor_war, although slightly outdated.

A warning though... Being caught using emacs by your BSD friends will feel like being caught with a dirty magazine.  You'll feel ashamed at first, but after awhile you'll stop caring what they think.


----------



## carlton_draught (Aug 12, 2011)

mingrone said:
			
		

> Well, since the holy war has started, I'm going to completely ignore the original post and mention a common alternative to vi(m), editors/emacs.  This page might be useful: http://en.wikipedia.org/wiki/Editor_war, although slightly outdated.


Make sure to note the "editors" part of editors/emacs, it may be as astonishing for you to find it there as it was for me. I guess they let similarly tightly focused "do one thing and do it well" editors like libreoffice/openoffice in there too.


> A warning though... Being caught using emacs by your BSD friends will feel like being caught with a dirty magazine.  You'll feel ashamed at first, but after awhile you'll stop caring what they think.


Most people would avoid getting caught reading dirty magazines. It takes a Radically Majorly Special person to be able to shrug off those sort of outdated social mores and just let it all hang out like that, so to speak. More power to you. 

Edit: Apologies if I struck a little below the belt there. I don't care one way or another which editor a person chooses, and AFAIK emacs is as valid a choice as vim. I actually started out using emacs (an emacs user helped set up my config file). Ironically, somehow the config file got deleted and I started using vim some time after that, pretty much exactly as had happened to Tim O'Reilly. Excerpt:


> When vi loyalist O'Reilly wrote in Ask Tim that he first shifted from EMACS to vi only after his customized EMACS profile was trashed, it was one of those subtle jabs vi users like to use against EMACS.


----------



## ikreos (Aug 12, 2011)

Can EMACS run on a Commodore 64 like this vi clone can (svicc)?

Of course the link just has to be down at the moment.


----------



## SirDice (Aug 12, 2011)

doorways said:
			
		

> vim a lot of sets of dependencies. (during installation)


Install editors/vim-lite. It has less dependencies.


----------



## vermaden (Aug 12, 2011)

ikreos said:
			
		

> Can EMACS run on a Commodore 64 (...)



I remember that there is EMACS under AMIGA Workbench 2.0, but I cant tell for Commodore 64 since I did not own it.


----------



## SirDice (Aug 12, 2011)

vermaden said:
			
		

> I remember that there is EMACS under AMIGA Workbench 2.0, but I cant tell for Commodore 64 since I did not own it.


Offtopic but http://aminet.net/search?query=emacs


----------



## valsorym (Aug 12, 2011)

O, Thank you all!
I used vi editor â€“ it is very good editor for me.
Emacs or other editors â€“ I am ignor.

Vim it is a expansion vi â€“ I be use vim editor.
I like vi - so, I like vim.



> Originally Posted by *SirDice*.
> Install editors/vim-lite. It has less dependencies.


Thanks.


----------



## ikreos (Aug 12, 2011)

vermaden said:
			
		

> I remember that there is EMACS under AMIGA Workbench 2.0, but I cant tell for Commodore 64 since I did not own it.



That doesn't surprise me. The Amiga's have plenty of memory to run EMACS. Even vim is available for them (although it is an older version).


----------



## UNIXgod (Aug 12, 2011)

SirDice said:
			
		

> Install editors/vim-lite. It has less dependencies.



This actually give the op the answer. I actually didn't catch it but this is correct. editors/vim-lite is the cli only variant and the one I install and it depends on nothing but itself and patch-level. I have actually had to install this on a user only level install by hand. simple, depends on stuff in base and that's it, install.



			
				carlton_draught said:
			
		

> Vim is what should be used when serious work is to be done. For editing config files, vi is a reasonable substitute. /holy_warrior



oops. here we go :e



			
				mingrone said:
			
		

> Well, since the holy war has started...



In attempt to be editor agnostic there is vile which is vi basic usage inside emacs. I imagine emacs is nice. I have actually though about using it to learn lisp. Though I imagine there are other ways to learn functional programming than installing an editor that uses the language for extensions and endowment. 

Any you guys spend any significant time to try using ed() for a week or two without your `preferred editor`? It is the "original standard unix text editor".

I personally did but lost my skills after the effort. Might be worth the effort if you have some time to switch. Then again learning dvorak would also be nice if time truly was of the essence. 

I do like the fact that vi() in some form or another is on most machines that I am on. I believe the gentoo live cd only has ed and nano. It's obnoxious because it's only 80mb so what would another couple bytes hurt anyone. also nvi is so small it would be negligible. but as forest gump would say "linux is as linux does."

/rant


----------



## DutchDaemon (Aug 13, 2011)

Ok guys, unless anyone wants to go right back to extol the virtues of clay tablets and cuneiform script I believe this thread was solved a little while ago.


----------



## valsorym (Aug 13, 2011)

> Originally Posted by *DutchDaemon*
> Ok guys, unless anyone wants to go right back to extol the virtues of clay tablets and cuneiform script I believe this thread was solved a little while ago.



What do you suggest?
If I like vi.


----------



## carlton_draught (Aug 14, 2011)

doorways said:
			
		

> What do you suggest?
> If I like vi.


I'm not sure. However on a related note, do you ever get a feeling for what a programmer must be like when you are intimately familiar with their program? Yes? That's why whenever I use vi or its descendants, I feel a profound sense of Joy. And the corollary; whenever I try and use another editor it is invariably a Joyless undertaking.


----------



## fonz (Aug 14, 2011)

doorways said:
			
		

> What do you suggest?


It's probably a warning that this thread is getting off-topic. The current vi(m)-emacs debate doesn't have a whole lot to do with your original question any more.

Fonz


----------



## DutchDaemon (Aug 14, 2011)

Exactly.


----------



## UNIXgod (Aug 14, 2011)

doorways said:
			
		

> What do you suggest?
> If I like vi.



Here is a list of vi clones:
http://en.wikipedia.org/wiki/Vi#Derivatives_and_clones

I find the bindings in other places. There is a firefox plugin which has them. KDE editor kate has a vi bindings option. As others have mentioned vi(m) is the most full featured. Your probably best to use that. If anything for the syntax highlighting you are interested in.


----------



## valsorym (Aug 14, 2011)

> Originally Posted by *carlton_draught*.
> I'm not sure. However on a related note, do you ever get a feeling for what a programmer must be like when you are intimately familiar with their program? Yes? That's why whenever I use vi or its descendants, I feel a profound sense of Joy. And the corollary; whenever I try and use another editor it is invariably a Joyless undertaking.





> Originally Posted by *UNIXgod*
> I find the bindings in other places. There is a firefox plugin which has them. KDE editor kate has a vi bindings option. As others have mentioned vi(m) is the most full featured. Your probably best to use that. If anything for the syntax highlighting you are interested in.


Yes. I agree with you. Thanks.



> Originally Posted by *fonz*.
> It's probably a warning that this thread is getting off-topic. The current vi(m)-emacs debate doesn't have a whole lot to do with your original question any more.





> Originally Posted by Originally *DutchDaemon*.
> Exactly.



Yes. You are right. Sorry me.

My choice vim editor.
This theme is closed. Thank you all.


----------



## SirDice (Aug 18, 2011)

To keep it a little on track...

Here's my ~/.vimrc, nothing fancy:

```
set ai
set background=dark
set showtabline=3
set smartindent
set smarttab
set backspace=indent,eol,start
set ruler
syntax on
```


----------



## valsorym (Aug 18, 2011)

Thanks.


----------

