Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-06-2004, 11:11 PM   #1
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Rep: Reputation: 30
Question vim: coding mode and doc writing mode?

I use vim for C coding and also for writing general text documents. Is there an easy way I can create a coding 'mode' which has the options I want (like cindent) and a doc mode (with no ai or cindent, tw=0, etc)?

Thanks for any help! I'm not that great with vim but it seems so powerful.
Old 03-07-2004, 02:23 PM   #2
Senior Member
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
To do it the most simple way, just create a basic .vimrc (and/or a .gvimrc - I have all common settings in my .vimrc and source it from my .gvimrc) with options that you will always want. Then create two separate files with the commands/settings you would want for each mode and simply source them from vim: Open vim (it's in your "basic" mode) and just type :so docmode or whatever you have called your file.

This could also be implemented with functions in your .vimrc I guess, but I haven't dived that deep into the workings of vim scripting. Also, make sure you check the tips and tricks section of the vim website.

Old 03-07-2004, 08:51 PM   #3
Registered: Oct 2002
Location: Sydney, Australia
Distribution: Gentoo, Ubuntu, Debian
Posts: 184

Original Poster
Rep: Reputation: 30
Thanks Håkan! That looks to be exactly what I'm after.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 can I change display mode from character mode to graph mode wuzhong Linux - Hardware 1 08-08-2004 09:36 AM
moving around in vim while in insert mode cleff Linux - Software 3 06-14-2004 10:26 PM
VIM Setup- No 'insert' mode uveraser Linux - Software 1 05-25-2004 10:44 AM
insert mode in vim usr Linux - Software 1 01-18-2004 01:25 PM
Vim - select mode for mouse robertmarkbram Linux - Software 2 12-02-2003 08:23 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:33 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration