Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to set VIM (higlight syntax and so on)

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
mono
Posts: 145
Joined: 2009-05-10 14:39

How to set VIM (higlight syntax and so on)

#1 Post by mono »

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.

User avatar
traveler
Posts: 942
Joined: 2010-06-09 22:07

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

#2 Post by traveler »

Code: Select all

:syntax enable
I wish for a conjugal visit and world peace. (Don't want to seem selfish.)

mono
Posts: 145
Joined: 2009-05-10 14:39

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

#3 Post by mono »

...it looks same like "syntax on".

User avatar
nadir
Posts: 5961
Joined: 2009-10-05 22:06
Location: away

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

#4 Post by nadir »

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
traveler
Posts: 942
Joined: 2010-06-09 22:07

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

#5 Post by traveler »

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.)

mono
Posts: 145
Joined: 2009-05-10 14:39

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

#6 Post by mono »

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.

User avatar
traveler
Posts: 942
Joined: 2010-06-09 22:07

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

#7 Post by traveler »

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.)

mono
Posts: 145
Joined: 2009-05-10 14:39

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

#8 Post by mono »

Code: Select all

polo@Lenny:~$ ls /usr/share/vim/addons/
doc  plugin

User avatar
dbbolton
Posts: 2129
Joined: 2007-06-20 08:17
Location: Iapetus

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

#9 Post by dbbolton »

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
stoffepojken
Posts: 705
Joined: 2007-01-25 01:21
Location: Stockholm, Sweden

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

#10 Post by stoffepojken »

If you have dark background in your terminal you can try "set background=dark" in your vimrc

mono
Posts: 145
Joined: 2009-05-10 14:39

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

#11 Post by mono »

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. ...

User avatar
Telemachus
Posts: 4574
Joined: 2006-12-25 15:53
Been thanked: 2 times

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

#12 Post by Telemachus »

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

barriehie

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

#13 Post by barriehie »

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

Barrie

Post Reply