LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-26-2004, 12:22 PM   #1
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Configuring (g)vim-tab with C++/Java


Hello all!

I'm trying to configure vim to use as C++/java programming. I've been always using vim, and, before I started coding anything, I always typed:

esc: set tabstop=4

and

set vb

to make the tab spaces equivalent to 4 spacebars and to use a visual bell instead of the annoying beep's. The thing is, whenever I try to add the line set tabstop=4 to .vimrc (to make it as default tabstop), when I code in C it does:

main()
{
<tab><tab>mycode
}

What I mean is, always after a "}" or "{" vim auto-places two tabspaces, when I want only one tab equivalent to 4 spaces. Using the vim command "esc: set tabstop=4" makes it work just fine, but not when added to .vimrc. This is hard to describe, I hope you can understand what I mean . The very same happens with gvim.

1 - Any ideas about fixing this?

2 - Another question, is it possible to edit vim syntax-highlight colors? (Only vim, not gvim).
 
Old 01-27-2004, 04:58 PM   #2
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
I was just looking through the vim documentation and found this. Perhaps it is what you are looking for.

:set cindent shiftwidth=4

Edit: As for editing the colors, I haven't done anything with this, but I believe that all the syntax stuff is in a directory like:

/usr/share/vim/vim62/syntax/*.vim

and colors in

/usr/share/vim/vim62/colors/*.vim

Look around at some of those files and you may find what you want

Edit, edit, edit... Why can't I ever get everything I mean to say in the post the first time... Geesh...

BTW, I found the above command in a manual here:
http://www.eandem.co.uk/mrw/vim/usr_doc/doc_a4c.pdf

Last edited by deiussum; 01-27-2004 at 05:02 PM.
 
Old 01-28-2004, 06:27 AM   #3
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Original Poster
Rep: Reputation: 65
Thanks mate!

I will give it a try. By the way, sweet 229 pages of vim manual. That editor surely has a lot of functions . The colors I've already tried and you are right. The command

:colorscheme <color name>

sets the color. I will take a look better at those files and see if I can make some custom ones

Thanks once again!
 
  


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
how to make a tab is 4 spaces width in vim? ICO SUSE / openSUSE 8 03-05-2013 10:24 AM
configuring Vim Fulkan Linux - Newbie 5 07-22-2010 01:20 PM
VIM doesn't complete filenames on pressing Tab The Scientist Linux - Software 2 10-13-2004 10:15 AM
Extremely stupid question about tab key (specifically in Vim) Imek Linux - Newbie 1 03-08-2004 05:11 PM
Java syntax highlighting in vim Phantomas Linux - Software 0 08-16-2003 04:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:20 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