syntax highlighting problem with vim7 for multiline macro in C
Hi, I am facing this syntax highlighting problem here for the following code segment. The problem is if we put this code in a file having .c extension. The same macro color is shown for the main() function also. Does anyone else faced this problem with vim7 ? regards, s ===somefile.c= #define GET_TAG_STRING(tagFeildPtr) { \ *feildEndP = 'a'; \ *feildEndP+1 = '\0'; \ } main() { }
Re: syntax highlighting problem with vim7 for multiline macro in C
On 8/3/06, Srinivas Rao. M [EMAIL PROTECTED] wrote: I am facing this syntax highlighting problem here for the following code segment. The problem is if we put this code in a file having .c extension. The same macro color is shown for the main() function also. Does anyone else faced this problem with vim7 ? regards, s ===somefile.c= #define GET_TAG_STRING(tagFeildPtr) { \ *feildEndP = 'a'; \ *feildEndP+1 = '\0'; \ } main() { } For me (vim7), main() is highlighted correctly. What is your vim version ? What is version of your $VIMRUNTIME/syntax/c.vim file ? Do you possibly have some custom additions in ~/.vim/after/syntax/c.vim ? And if you do, does highlighting changes when you temporarity rename your ~/.vim/after/syntax/c.vim file ? Yakov
Re: syntax highlighting problem with vim7 for multiline macro in C
On Thu, 2006-08-03 at 14:09, Yakov Lerner wrote: On 8/3/06, Srinivas Rao. M [EMAIL PROTECTED] wrote: I am facing this syntax highlighting problem here for the following code segment. The problem is if we put this code in a file having .c extension. The same macro color is shown for the main() function also. Does anyone else faced this problem with vim7 ? regards, s ===somefile.c= #define GET_TAG_STRING(tagFeildPtr) { \ *feildEndP = 'a'; \ *feildEndP+1 = '\0'; \ } main() { } For me (vim7), main() is highlighted correctly. What is your vim version ? What is version of your $VIMRUNTIME/syntax/c.vim file ? Hi Yakov, My vim version is : VIM - Vi IMproved 7.0 (2006 May 7, compiled May 23 2006 12:47:54) Compiled by [EMAIL PROTECTED] Big version with GTK2 GUI. Features included (+) or not (-): +arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +folding -footer +fork() -gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse +mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra -perl +postscript +printer -profile -python +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save system vimrc file: $VIM/vimrc user vimrc file: $HOME/.vimrc user exrc file: $HOME/.exrc system gvimrc file: $VIM/gvimrc user gvimrc file: $HOME/.gvimrc system menu file: $VIMRUNTIME/menu.vim fall-back for $VIM: /usr/local/share/vim Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/X11R6/include -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -I/usr/X11R6/include Linking: gcc -L/usr/X11R6/lib -L/usr/local/lib -o vim -Wl,--export-dynamic -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lXt -lncurses -lacl -lgpm And my $VIMRUNTIME/syntax/c.vim 's file's header contains: Vim syntax file Language: C Maintainer: Bram Moolenaar [EMAIL PROTECTED] Last Change: 2006 May 01 Quit when a (custom) syntax file was already loaded if exists(b:current_syntax) finish endif Do you possibly have some custom additions in ~/.vim/after/syntax/c.vim ? And if you do, does highlighting changes when you temporarity rename your ~/.vim/after/syntax/c.vim file ? No I donot have custom c.vim syntax file. The version inforamtion on I tried by replacing completely the ~/.vim/ folder. But still it behaves like this. I am running on Fedora core 2 system with vim7 upgraded from vim6.3. thanks and regards, Srini..
Re: syntax highlighting problem with vim7 for multiline macro in C
Srinivas Rao. M wrote: I am facing this syntax highlighting problem here for the following code segment. The problem is if we put this code in a file having .c extension. The same macro color is shown for the main() function also. Does anyone else faced this problem with vim7 ? regards, s ===somefile.c= #define GET_TAG_STRING(tagFeildPtr) { \ *feildEndP = 'a'; \ *feildEndP+1 = '\0'; \ } main() { } Hello! The code text looks fine to me. May I suggest trying nmap silent F10 :echo hi . synIDattr(synID(line(.),col(.),1),name) . ' trans' . synIDattr(synID(line(.),col(.),0),name) . lo . synIDattr(synIDtrans(synID(line(.),col(.),1)),name) . CR (that's all one line in case some mailer thinks its smarter than me) Put that into your .vimrc file (you *do* have one so that :echo cp shows 0, I hope), then when next editing your somefile.c, place the cursor atop the main and press the F10 key. You should get a message telling what highlighting is being used. Well, what syntax highlighting is being used. If you happened to have done a search for main and have hlsearch enabled, then main will be highlighted for reasons that bypass the syntax highlighting. Regards, Chip Campbell
Re: Syntax Highlighting problem
Jerin Joy wrote: I use gvim as my default editor. My source files are in a non standard language whose syntax is similar to Verilog. When I open files from command line in independent gvim windows the syntax highlighting uses the verilog syntax which is what I want. The only thing is when I use the split command to split an existing gvim window between 2 files, the new file opened does not have the syntax highlighting or colour. Read :help new-filetype As an example: - filetype.vim: if exists(did_load_myfiletypes) finish endif let did_load_myfiletypes= 1 augroup filetypedetect au BufNewFile,BufReadPost *.ExampleSuffixsetf Example augroup END - where you put any suffix that is associated with your non-standard language files instead of ExampleSuffix and, in your case, change setf Example to setf verilog. The file is .vim/filetype.vim (or, under windows, ...\vimfiles\filetype.vim). Now, if you don't have a suffix associated with your NSL (non-standard language), then read :help new-filetype-scripts . Regards, Chip Campbell
Re: Syntax Highlighting problem
On Wed, May 10, 2006 at 04:06:38PM +0530, Jerin Joy wrote: Hi, I use gvim as my default editor. My source files are in a non standard language whose syntax is similar to Verilog. When I open files from command line in independent gvim windows the syntax highlighting uses the verilog syntax which is what I want. The only thing is when I use the split command to split an existing gvim window between 2 files, the new file opened does not have the syntax highlighting or colour. Does anyone know why its not using the verilog syntax for the second file? Is there a way to add this file type so that gvim recognizes it? It works fine for Verilog/C++ source files. I wanted to use the split command instead of multiple gvim windows to reduce clutter on my desktop. Jerin How is it that the first file you open is detected properly. For example, have you added something to your vimrc file to make verilog syntax the default? Probably you should read :help new-filetype (and perhaps some of the preceding docs for context). The goal is to have vim set the 'filetype' option automatically each time you open one of these files, and then to load the verilog syntax. HTH --Benji Fisher
Syntax Highlighting problem
Hi, I use gvim as my default editor. My source files are in a non standard language whose syntax is similar to Verilog. When I open files from command line in independent gvim windows the syntax highlighting uses the verilog syntax which is what I want. The only thing is when I use the split command to split an existing gvim window between 2 files, the new file opened does not have the syntax highlighting or colour. Does anyone know why its not using the verilog syntax for the second file? Is there a way to add this file type so that gvim recognizes it? It works fine for Verilog/C++ source files. I wanted to use the split command instead of multiple gvim windows to reduce clutter on my desktop. Jerin