How to set VIM (higlight syntax and so on)

If none of the more specific forums is the right place to ask

How to set VIM (higlight syntax and so on)

Postby mono » 2010-09-24 20:11

Hello,
I can not find how to set VIM so that it higlight syntax (for exapmle bash scripts). I installed VIM package by using aptitude, but I dont have file .vimrc in my home directory. I found out that settings have to be written in this file. I can use command in VIM :"syntax on" but VIM showes syntax terrible. I think that is cause by some color setting. Can anybody help me with VIM settings?
Thanks for help.
mono
 
Posts: 142
Joined: 2009-05-10 14:39

Re: How to set VIM (higlight syntax and so on)

Postby traveler » 2010-09-24 20:20

Code: Select all
:syntax enable
I wish for a conjugal visit and world peace. (Don't want to seem selfish.)
User avatar
traveler
 
Posts: 942
Joined: 2010-06-09 22:07

Re: How to set VIM (higlight syntax and so on)

Postby mono » 2010-09-24 20:39

...it looks same like "syntax on".
mono
 
Posts: 142
Joined: 2009-05-10 14:39

Re: How to set VIM (higlight syntax and so on)

Postby nadir » 2010-09-24 20:44

Have you tried /etc/vim/vimrc?
I don't know how :syntax on looks like. I edit said file (either copy it to my home or do it there, cause i want hightlighting for all)
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.
User avatar
nadir
 
Posts: 5965
Joined: 2009-10-05 22:06
Location: away

Re: How to set VIM (higlight syntax and so on)

Postby traveler » 2010-09-24 20:50

Did you only install vim-tiny?
on and enable both work fine here.
I wish for a conjugal visit and world peace. (Don't want to seem selfish.)
User avatar
traveler
 
Posts: 942
Joined: 2010-06-09 22:07

Re: How to set VIM (higlight syntax and so on)

Postby mono » 2010-09-24 20:53

Can you advise me how to change color settings? I mean how to add various "color theme". I have VIM and VIM-TINY. But I dont see diffrence.
mono
 
Posts: 142
Joined: 2009-05-10 14:39

Re: How to set VIM (higlight syntax and so on)

Postby traveler » 2010-09-24 20:57

Worked out of the box for me.
Code: Select all
/usr/share/vim/addons$ ls
doc  indent  plugin  syntax

Do you have syntax in your addons directory as above?
I wish for a conjugal visit and world peace. (Don't want to seem selfish.)
User avatar
traveler
 
Posts: 942
Joined: 2010-06-09 22:07

Re: How to set VIM (higlight syntax and so on)

Postby mono » 2010-09-24 21:06

Code: Select all
polo@Lenny:~$ ls /usr/share/vim/addons/
doc  plugin
mono
 
Posts: 142
Joined: 2009-05-10 14:39

Re: How to set VIM (higlight syntax and so on)

Postby dbbolton » 2010-09-24 21:12

Code: Select all
aptitude install vim-common vim-runtime
vim +'help syntax'
vim +'help colorscheme'


The Vim color sampler pack: http://www.vim.org/scripts/script.php?script_id=625
Screenshots: http://vimcolorschemetest.googlecode.co ... dex-c.html

Use a 256 color one if you're using a terminal or console.
Last edited by dbbolton on 2010-09-25 00:26, edited 2 times in total.
GitHub | zsh docs in Letter PDF

Telemachus wrote:Put down the CGI.
User avatar
dbbolton
 
Posts: 2131
Joined: 2007-06-20 08:17
Location: Iapetus

Re: How to set VIM (higlight syntax and so on)

Postby stoffepojken » 2010-09-25 00:02

If you have dark background in your terminal you can try "set background=dark" in your vimrc
User avatar
stoffepojken
 
Posts: 707
Joined: 2007-01-25 01:21
Location: Stockholm, Sweden

Re: How to set VIM (higlight syntax and so on)

Postby mono » 2010-09-25 08:43

Code: Select all
 sudo aptitude install vim-common vim-runtime
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading extended state information     
Initializing package states... Done
Reading task descriptions... Done 
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 162 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
W: Duplicate sources.list entry http://security.debian.org lenny/updates/non-free Packages (/var/lib/apt/lists/security.debian.org_dists_lenny_updates_non-free_binary-i386_Packages)
W: Duplicate sources.list entry http://volatile.debian.org lenny/volatile/main Packages (/var/lib/apt/lists/volatile.debian.org_debian-volatile_dists_lenny_volatile_main_binary-i386_Packages)
W: You may want to update the package lists to correct these missing files
Writing extended state information... Done
Reading package lists... Done             
Building dependency tree       
Reading state information... Done
Reading extended state information     
Initializing package states... Done
Reading task descriptions... Done


Code: Select all
locate *vimrc*
/etc/vim/vimrc
/etc/vim/vimrc.tiny
/usr/share/vim/vimrc
/usr/share/vim/vimrc.tiny
/usr/share/vim/vim71/gvimrc_example.vim
/usr/share/vim/vim71/vimrc_example.vim


It is strange that I dont have .vimrc file in my HOME... I dont have .vimrc at all. Thanks for useful links. ...
mono
 
Posts: 142
Joined: 2009-05-10 14:39

Re: How to set VIM (higlight syntax and so on)

Postby Telemachus » 2010-09-25 12:12

mono wrote:It is strange that I dont have .vimrc file in my HOME... I dont have .vimrc at all. Thanks for useful links. ...

Actually, I don't think it's strange. You don't have one until you create one.

For syntax highlighting and indenting, you can start with this:

Code: Select all
" Most general settings first
set nocompatible            " Set Vim rather than Vi settings; must go first
set noeb                    " Set no audio or visual error beep
set bs=indent,eol,start     " Backspace over everything in insert mode
set history=500               " Keep 50 lines of command line history
set scrolloff=3             " A little breathing room

" Set items for view @ bottom of windows
set ruler                   " Show the cursor position all the time
set showcmd                 " Display incomplete commands
set showmode                " Display current mode
set ls=2                    " Always show status bar

" Syntax basics
syntax on
filetype indent on
filetype plugin on
set autoindent
set smartindent
"We have not been faced with the need to satisfy someone else's requirements, and for this freedom we are grateful."
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System
User avatar
Telemachus
 
Posts: 4676
Joined: 2006-12-25 15:53

Re: How to set VIM (higlight syntax and so on)

Postby barriehie » 2010-09-26 04:44

Lots of stuff here on/about/for vim. http://vim.wikia.com/wiki/

Barrie
barriehie
 
Posts: 188
Joined: 2010-02-07 01:59


Return to General Questions

Who is online

Users browsing this forum: No registered users and 12 guests

fashionable