Fedora Linux Support Community & Resources Center
  #1  
Old 17th March 2012, 05:03 PM
xtian Offline
Registered User
 
Join Date: Oct 2009
Posts: 133
linuxfirefox
Help with VIM script conditional syntax

I am testing the conditional loading of VIM settings. Below is a test script and its not working properly. I've read the VIMDOCS and followed the instructions there for conditionals. The vimrc right now correctly loads filetypes,

This html_vimrc file has both (which I alternatively comment to test the different blocks),
Code:
:let g:prog=1
:set number
This is the main vimrc,
Code:
"Load additional settings for html file type
:autocmd FileType html source $HOME/.vim/html_vimrc.vim

"Test conditional using global variable set in html_vimrc,
:if !exists("g:prog")
:  set spell
:else
:  set nospell
:endif

"Test conditional using vimrc setting number set in html_vimrc,
:if (&number==0)
:  set spell  
:else 
:  set nospell
:endif
I've tried if (&number), if &number, if (&number=="0"), if (&number=="number"). The result is always the same in all my tested variations. The result test "spell" consistently returns on-on or off-off, and, of course, the desired result is on-off.
Reply With Quote
Reply

Tags
conditional, script, syntax, vim, vimrc

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
help me with the syntax calltobharath Programming & Packaging 3 16th April 2008 06:41 PM
Writing your own rc.d script - some syntax questions akvino Using Fedora 1 9th August 2007 10:37 PM
Script not running due to syntax error - please help code_astronomer Programming & Packaging 8 19th December 2005 07:39 PM


Current GMT-time: 04:21 (Thursday, 27-11-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Helsinki - Nanded City - Montenegro Instagram Photos