Hi all,

I'm new to vim and this list so apologies if this has already been answered.

I have some settings for comments in my vimrc (see attached vimrc.txt).

These settings work fine when I launch vim.
I.e. for launching vim without specifying the file type I get the following
for comments:
comments=://,b:#,:%,:XCOMM,n:>,fb:-,s1:/*,mb:**,ex:*/,fb:*,b:",n::

However when I edit text files using vim (vim test.txt), the comments get
overridden with the following:
comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-

And for C/C++ files, the comments get overridden with the following:
comments=sO:* -,mO:*  ,exO:*/,s1:/*,mb:*,ex:*/,://

How can I prevent this?
I.e. I would like to keep my comments setting for all file types.
Is this possible?
I tried placing the comments setting at the bottom of the vimrc but that
doesn't override the file type settings either.

Any suggestions?

Thanks and Regards,
Abhishek

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

" *** User Interface ***

if has('syntax') && (&t_Co > 2)
  syntax on                        " Syntax highlighting in terminals which can 
display colours
endif

set nocompatible                   " Use Vim's extended capabilities
set showmode                       " Display the current mode
set nomodeline                     " Don't let files override this vimrc
set wildmode=list:longest,full     " Command-line completion <Tab> (for 
filenames, help topics, option names)
set showcmd                        " Display partially-typed commands in the 
status line
set number                         " Show line numbers
set shortmess=atI                  " Abbreviate messages
set ruler                          " show the cursor position all the time


" *** Search ***

set hlsearch                       " Highlight searches
set incsearch                      " Do incremental searching
set ignorecase                     " Ignore case when searching
set smartcase                      " Override 'ignorecase' if the search 
contains upper case characters
set nowrapscan                     " Do not wrap searches


" *** Scroll ***

set nostartofline                  " Don't jump to first character when paging
set scrolloff=3                    " Keep 3 lines when scrolling


" *** General Formatting ***

set nowrap                         " Do not wrap files
set nobackup                       " Do not keep a backup file
set shiftwidth=2                   " Numbers of spaces to (auto)indent
set shiftround                     " Round indent to multiple of 'shiftwidth'
set expandtab                      " Use the appropriate number of spaces to 
insert a <TAB>
set autoindent                     " Always set autoindenting on
set smartindent                    " Do smart autoindenting when starting a new 
line

set formatoptions-=t               " Do not wrap lines


" *** Formatting - File Type Specific ***

filetype on                        " Enable File Type detection

augroup filetype                   " Mark all .txt files as human readable
  autocmd BufNewFile,BufRead *.txt set filetype=human
augroup end

" For human readable files auto wrap text at column 50
autocmd FileType human set formatoptions+=t textwidth=50

" For C/C++ files set cindent
autocmd FileType c,cpp set cindent

" For makefiles don't expand <TAB> to Spaces and have all indentation ar 8 chars
autocmd FileType make set noexpandtab shiftwidth=8


" *** This does not Override File Type Formatting ?? ***

set formatoptions+=croq            " Format comments
set comments-=s1:/*,mb:*,ex:*/     " Remove C style comments with single * in 
middle part
set comments+=s1:/*,mb:**,ex:*/    " Add comment style with multiple ** in 
middle part
set comments+=fb:*                 " Define bullet list style for single *
set comments+=b:\"                 " Treat lines starting with " as comments
set comments+=n::                  " When formatting text, recognize numbered 
lists

Reply via email to