[SOLVED] syntax highlighting in vim

Hi,
How do you guys set syntax highlighting in your vimrc?  For example, I have a bunch of mutt config files saved as something like alias.muttrc, colors.muttc, etc... and I want them all to use the muttrc syntax.
Currently, I have this in my vimrc:
au BufNewFile,BufRead *.muttrc setf muttrc
This works unless my first line is a comment (or first non-blank line).   Which is annoying because I want to begin with a comment sometimes!
Also, I noticed that if my main config file--muttrc--is set correctly whether or not it begins with a comment.   (This file is already matched to muttrc syntax without my intervention).
Does anyone have a better/different way of setting the syntax?
Last edited by miggy (2009-05-27 16:15:44)

Thanks for the suggestion but I'm experiencing the same behavior.  Something weird's going on.   Can someone confirm this same behavior?
file1.muttrc
color normal white default
file2.muttrc
# Comment
color normal white default
file3.muttrc
color normal white default
# Comment
As I'm writing these, they all are good, but when I go to edit them, only file1.muttrc has the correct highlighting.  The others can get it if I say :set syntax=muttrc. 
It's especially weird that the comments are highlighted but nothing else is.  If I'm not using any sort of file detecting then not even the comments are highlighted

Similar Messages

  • Lost syntax highlight in Vim after upgrade

    I don't know why, but Vim is not enabling syntax highlight anymore after the upgrade from 7.1.12-1 to 7.1.63-1. I've already searched in Vim's website and with ':help syntax.txt' but no luck. Any guesses?
    EDITED:
    I figured out part of the problem. I've always used the syntax 'vi filename' to open my files because I knew Vi had a link to Vim. But now it's not linking anymore. Opening files with 'vim filename' gives me the syntax highlight. So I guess the last upgrade had removed the link. Any chances to have it back?
    Last edited by alexmatos (2007-08-12 14:07:06)

    I had the same problem too, but the difference is, I always use vim, but after upgrading Arch I lost syntax highlight. After googling a lot and lurking @ vim sites I finally found the indirect answer here!
    I tried the opposite and use vi to open files but bash said vi not found, I did pacman -S vi, and pac said vi is up to date, upgrade? I decided not to believe vi and upgraded, everything's back now.
    So thank you for helping without knowing.

  • Enable syntax highlighting with configuration file in emacs

    When editing configuration files such as .procmailrc, .fetchmailrc, Emacs won't automatically highlight syntax for me.
    I can enable syntax highlighting in Vim by appending "syntax on"  to the .vimrc.
    I tried adding "global-font-lock-mode t" in the .emacs file, but it didn't solve my problem.
    What is the solution?

    igndenok wrote:
    Some of my config file have this (using conf-unix-mode)
    # this is .somerc
    # -*- conf-unix -*-
    Or using this in your .emacs
    (add-to-list 'auto-mode-alist '("\\.*rc$" . conf-unix-mode))
    I followed your advice, and it does have some syntax highlighting, but less than Vim does.
    For example, Vim will highlight all the names of colors in the .muttrc file, but Emacs doesn't.
    I guess Emacs is not as strong as Vim when it comes to editing configuration files.
    Last edited by yu3k (2011-09-14 10:06:47)

  • [SOLVED] VIM: different syntax highlighting for new vs existing file

    I've had this minor nagging issue for a while that I've been trying to figure out, but I just don't know where to look.
    It is most obvious with LaTeX files (*.tex).  When I create a new file with "vim file.tex" it is recognized as a latex file and I get syntax highlighting, but it seems odd, or off.  When I close then reopen the same file, it gets "propper" syntax highlighting.
    I gather that this must be because of the two different mechanisms for matching the syntax type: filename versus content.  When the file is new, vim only uses the extension.  Once there is a latex comand (e.g., "\documentclass{article}") it recognizes it as something else and the highlighting style is different.
    It turns out just by actually elaborating exactly what the problem was, I was able to find the solution.  I looked for how vim recognizes the files, and found two relevant lines in /usr/share/vim/vim73/filetype.vim on lines 2093 and 2094.  Apparently the .tex filetype is not the same as .latex and others.  I changed it so it was, and I got the desired behavior.
    I thought about just not posting this - but it may be useful for others.

    You're right about it being overridden.  This change should be able to be placed in ~/.vimrc though.
    Well  that was foolish - I should have read the comments right below in that file.  It says exactly how to set it in vimrc.  I've now added the following to my ~/.vimrc and this is completely solved without modifying the /usr/... file.
    let g:tex_flavor = "tex"
    Last edited by Trilby (2013-03-29 16:11:26)

  • [self-SOLVED]vim + lilypond syntax highlighting

    I'm trying to get vim to use syntax highlighting in lilypond files. Apparently lilypond comes with the necessary files, but I have not been able to make vim find them (?). I am not very experienced with vi(m), so there might be something wrong with my setup.
    I have, of course, both vim and lilypond installed. The files for lilypond syntax highlighting are in subdirectories of /usr/share/lilypond/2.12.3/vim/. Vim syntax highlighting works for other files, such as C++, HTML, etc., so no problem there. My ~/.vimrc file contains
    set runtimepath+=/usr/share/lilypond/2.12.3/vim/
    as per instruction given in http://lilypond.org/doc/v2.12/Documenta … m/Vim-mode (and the path is correctly modified). But when I open a lilypond file (with the correct .ly suffix) all I get is black and white. What's the problem?
    [EDIT: Oh heck, nevermind! Apparently I was getting too tired to read instructions properly. Was missing the ~/.vim/filetype.vim file described in the above link.]
    Last edited by lotuskip (2010-04-12 18:33:42)

    You're right about it being overridden.  This change should be able to be placed in ~/.vimrc though.
    Well  that was foolish - I should have read the comments right below in that file.  It says exactly how to set it in vimrc.  I've now added the following to my ~/.vimrc and this is completely solved without modifying the /usr/... file.
    let g:tex_flavor = "tex"
    Last edited by Trilby (2013-03-29 16:11:26)

  • Tweak vims syntax highlighting

    here is a little tutorial for making your own s-h theme for vim,
    if you're using gvim you can skip the part about terminals,
    for terminal users you must first set your prefered terminal colours in .Xdefaults ,
    eg for urxvt:
    urxvt*scrollColor: #111111
    urxvt*font: xft:Bitstream Vera Sans Mono:pixelsize=13
    urxvt*scrollBar_floating: false
    urxvt*scrollstyle: urxvt
    urxvt*saveLines: 1000
    urxvt*foreground: #eeeeee
    urxvt*background: #000000
    ! black
    urxvt*color0: #000000
    urxvt*color8: #444444
    ! red
    urxvt*color1: #b21818
    urxvt*color9: #ee9090
    ! green
    urxvt*color2: #18b218
    urxvt*color10: #54ee54
    ! yellow
    urxvt*color3: #968a38
    urxvt*color11: #eeee77
    ! blue
    urxvt*color4: #1818b2
    urxvt*color12: #9090ee
    ! magenta
    urxvt*color5: #963c59
    urxvt*color13: #cf9ebe
    ! cyan
    urxvt*color6: #418179
    urxvt*color14: #71bebe
    ! white
    urxvt*color7: #aaaaaa
    urxvt*color15: #eeeeee
    then you save this example file as ~/.vim/colors/xerxes.vim
    " local syntax file - set colors on a per-machine basis:
    hi clear
    set background=dark
    if exists("syntax_on")
    syntax reset
    endif
    let g:colors_name = "xerxes"
    hi Normal guifg=white guibg=black
    hi Scrollbar guifg=darkcyan guibg=cyan
    hi Menu guifg=black guibg=cyan
    hi SpecialKey term=bold cterm=bold ctermfg=2 guifg=Blue
    hi NonText term=bold cterm=bold ctermfg=darkred gui=bold guifg=Blue
    hi Directory term=bold cterm=bold ctermfg=brown guifg=Blue
    hi ErrorMsg term=standout cterm=bold ctermfg=grey ctermbg=blue guifg=White guibg=Red
    hi Search term=reverse ctermfg=white ctermbg=red guifg=white guibg=Red
    hi MoreMsg term=bold cterm=bold ctermfg=darkgreen gui=bold guifg=SeaGreen
    hi ModeMsg term=bold cterm=bold gui=bold guifg=White guibg=Blue
    hi LineNr term=underline cterm=bold ctermfg=darkcyan guifg=Yellow
    hi Question term=standout cterm=bold ctermfg=darkgreen gui=bold guifg=Green
    hi StatusLine term=bold,reverse cterm=bold ctermfg=4 ctermbg=15 gui=bold guifg=blue guibg=white
    hi StatusLineNC term=reverse ctermfg=white ctermbg=lightblue guifg=white guibg=blue
    hi Title term=bold cterm=bold ctermfg=darkmagenta gui=bold guifg=Magenta
    hi Visual term=reverse cterm=reverse gui=reverse
    hi WarningMsg term=standout cterm=bold ctermfg=red guifg=Red
    hi Cursor guifg=bg guibg=Green
    hi Comment term=bold ctermfg=6 guifg=#80a0ff
    hi Constant term=underline ctermfg=9 guifg=#ffa0a0
    hi Special term=bold ctermfg=1 guifg=Orange
    hi Identifier term=underline ctermfg=14 guifg=#40ffff
    hi Statement term=bold cterm=bold ctermfg=11 gui=bold guifg=#ffff60
    hi PreProc term=underline ctermfg=5 guifg=#ff80ff
    hi Type term=underline cterm=bold ctermfg=lightgreen gui=bold guifg=#60ff60
    hi Error term=reverse ctermfg=darkcyan ctermbg=black guifg=Red guibg=Black
    hi Todo term=standout ctermfg=black ctermbg=darkcyan guifg=Blue guibg=Yellow
    hi link IncSearch Visual
    hi link String Constant
    hi link Character Constant
    hi link Number Constant
    hi link Boolean Constant
    hi link Float Number
    hi link Function Identifier
    hi link Conditional Statement
    hi link Repeat Statement
    hi link Label Statement
    hi link Operator Statement
    hi link Keyword Statement
    hi link Exception Statement
    hi link Include PreProc
    hi link Define PreProc
    hi link Macro PreProc
    hi link PreCondit PreProc
    hi link StorageClass Type
    hi link Structure Type
    hi link Typedef Type
    hi link Tag Special
    hi link SpecialChar Special
    hi link Delimiter Special
    hi link SpecialComment Special
    hi link Debug Special
    now you can start tweaking the theme, use the numbers in .Xdefaults  as your prefered colours in the "ctermfg" and "ctermbg" commands,
    now you can use the "colorscheme" command in vim to enable it,
    colorscheme xerxes

    hello iphitus,
    i've edited the first post and if you use that .Xdefaults the following scheme should give you something close to desert,
    " Vim color file
    set background=dark
    if version > 580
    " no guarantees for version 5.8 and below, but this makes it stop
    " complaining
    hi clear
    if exists("syntax_on")
    syntax reset
    endif
    endif
    let g:colors_name="desert"
    hi Normal guifg=White guibg=grey20
    " highlight groups
    hi Cursor guibg=khaki guifg=slategrey
    "hi CursorIM
    "hi Directory
    "hi DiffAdd
    "hi DiffChange
    "hi DiffDelete
    "hi DiffText
    "hi ErrorMsg
    hi VertSplit guibg=#c2bfa5 guifg=grey50 gui=none
    hi Folded guibg=grey30 guifg=gold
    hi FoldColumn guibg=grey30 guifg=tan
    hi IncSearch guifg=slategrey guibg=khaki
    "hi LineNr
    hi ModeMsg guifg=goldenrod
    hi MoreMsg guifg=SeaGreen
    hi NonText guifg=LightBlue guibg=grey30
    hi Question guifg=springgreen
    hi Search guibg=peru guifg=wheat
    hi SpecialKey guifg=yellowgreen
    hi StatusLine guibg=#c2bfa5 guifg=black gui=none
    hi StatusLineNC guibg=#c2bfa5 guifg=grey50 gui=none
    hi Title guifg=indianred
    hi Visual gui=none guifg=khaki guibg=olivedrab
    "hi VisualNOS
    hi WarningMsg guifg=salmon
    "hi WildMenu
    "hi Menu
    "hi Scrollbar
    "hi Tooltip
    " syntax highlighting groups
    hi Comment guifg=SkyBlue
    hi Constant guifg=#ffa0a0
    hi Identifier guifg=palegreen
    hi Statement guifg=khaki
    hi PreProc guifg=indianred
    hi Type guifg=darkkhaki
    hi Special guifg=navajowhite
    "hi Underlined
    hi Ignore guifg=grey40
    "hi Error
    hi Todo guifg=orangered guibg=yellow2
    " color terminal definitions
    hi SpecialKey ctermfg=darkgreen
    hi NonText cterm=bold ctermfg=darkblue
    hi Directory ctermfg=darkcyan
    hi ErrorMsg cterm=bold ctermfg=7 ctermbg=1
    hi IncSearch cterm=NONE ctermfg=yellow ctermbg=green
    hi Search cterm=NONE ctermfg=grey ctermbg=blue
    hi MoreMsg ctermfg=darkgreen
    hi ModeMsg cterm=NONE ctermfg=brown
    hi LineNr ctermfg=3
    hi Question ctermfg=green
    hi StatusLine cterm=bold,reverse
    hi StatusLineNC cterm=reverse
    hi VertSplit cterm=reverse
    hi Title ctermfg=5
    hi Visual cterm=reverse
    hi VisualNOS cterm=bold,underline
    hi WarningMsg ctermfg=1
    hi WildMenu ctermfg=0 ctermbg=3
    hi Folded ctermfg=darkgrey ctermbg=NONE
    hi FoldColumn ctermfg=darkgrey ctermbg=NONE
    hi DiffAdd ctermbg=4
    hi DiffChange ctermbg=5
    hi DiffDelete cterm=bold ctermfg=4 ctermbg=6
    hi DiffText cterm=bold ctermbg=1
    hi Comment ctermfg=12
    hi Constant ctermfg=9
    hi Special ctermfg=5
    hi Identifier ctermfg=10
    hi Statement cterm=bold ctermfg=11
    hi PreProc ctermfg=1
    hi Type ctermfg=2
    hi Underlined cterm=underline ctermfg=5
    hi Ignore cterm=bold ctermfg=7
    hi Ignore ctermfg=darkgrey
    hi Error cterm=bold ctermfg=7 ctermbg=1

  • Vim, Perl and syntax highlight

    Hello all,
    Suppose you have a little snippet of Perl code like such:
    sub foo # some comment with keywords for die and or not
    print "In sub foo!\n";
    The comment in the sub line is not treated (i.e. highlighted) as a comment. Rather, it is highlighted as regular source code. Seems like a bug, but before reporting it to the maintainer, I wanted to see if anyone else shared the same issue.
    To clarify: this refers only to highlight in vim, running the code works as expected. And I took care to see if this could be the results of my settings: the problem seems in fact, to be with the perl.vim file (in my system: /usr/share/vim/vim73/syntax/perl.vim).
    So, can anyone reproduce this behaviour?

    frabjous wrote:Yes, same for me. (I don't write perl, so I don't have anything special installed for it other than the default /usr/share/vim73/syntax/perl.vim.)
    Hum, ok. I'll report it to the maintainer then.

  • [vim syntax] Highlight all occurences of word following keyword

    Is it possible with vim syntax files to have special highlighting for all occurrences of words (preferably excluding occurences in comments and quoted strings) following a keyword? Eg. in the case of declaring variables:
    short <varname>
    I'd like every occurrence of all variables declared as 'short' (preferably including the occurrence in the declaration) to be a specific color.

    You can do `short <varname>` and have that occurence of <varname> be highlighted but you can't have all occurences of <varname> be highlighted. Vim syntax only uses simple pattern matching so it can't determine dynamically what the pattern is after you declare it. Your next best option might be to set hlsearch and use the # and * and related operators.

  • [SOLVED] Associate extensions to syntax highlights pluma/gedit

    Hi,
    I am trying to make pluma/gedit use the SQL syntax highlight by default, when I open or create a file
    with extension .hql (hive).
    I think I added correctly the mime for hql file, but it still doesn't work.
    Can you help me with this issue?
    (also if there is an hive syntax highlighter for pluma it is even better, but for the moment I would be happy just to highlight it as an Sql file).
    Thanks a lot in advance for the help,
    Cheers,
    Luca
    Last edited by lucacerone (2014-12-10 11:50:17)

    Hi,
    go to:
    /usr/share/gtksourceview-3.0/language-specs
    edit sql.lang:
    sudo gedit sql.lang
    go to line 27 and change
    <property name="globs">*.sql</property>
    to
    <property name="globs">*.sql;*.hql</property>
    and restart gedit. Worked for me (Ubuntu 14.04 LTS)
    Cheers

  • [SOLVED] Odd colours in vim/urxvt

    So I'm using the base16 colourset in my Xresources and something really strange seems to be happening. The colours being used by vim to perform syntax highlighting are just wrong. As in, there are colours being used that aren't even specified in my Xresources file.
    Periodically, like 1 out of 50 calls to vim they will look "correct".
    $TERM is rxvt-unicode-256colors
    Nothing to do with colours or colour schemes in my .vimrc.
    Can anyone tell me what's going on here?
    EDIT: I should add that the colours look strange for commands like ls as well.
    Last edited by Vixus (2012-11-05 15:43:23)

    doug piston wrote:Well to my knowledge (Someone correct me if I am wrong), Vim doesn't look at your .Xresources by default. You can make it do such a thing but using the a colorscheme is still a better option. Just install the colorscheme, I do not see why you don't want to...
    Sorry, I may not have explained clearly, but I did try and install the base16 colorscheme for vim, following all the steps that the author provided. However there were some steps involving running bash scripts that just didn't work, most likely why the colorscheme didn't work.
    Thanoulis wrote:1) Vim always uses a colorscheme, even if not present in .vimrc. In that case it uses :colorscheme default.
    This I did not know. Thanks for telling me. In that case I guess there are bugs in the base16 colourscheme for vim (as a lot of comments on the repository seem to suggest).
    2) In Xresources, we define the terminal's color palette, not vim's colorscheme. My guess is that you use a different color palette for urxvt and xterm (hence the differences in vim colors)
    I don't, since I only have one Xresources file that presumably applies to both terminal emulators.
    3) The weird looks from your ssh session, is because in the host machine there is not a valid terminfo file. Usually its fixed by installing the same type of terminal emulator in both machines.
    Ugh, really? I never thought that was necessary... can I fake this in any way? I don't have sudo access to any of the work machines I ssh into.
    If you really like the base 16 colors in vim, try :colorscheme peachpuff (it's the one i use, and comes with vim).
    Thanks, this worked a treat!

  • HTML editor with syntax highlighting and UTF-8 support

    In an ongoing effort to move our lives into the cloud and into our pockets (and as a part of an article series for a tech blog), me and a friend are trying to completely replace the need for computers with our iPhones.
    In some ways, it is going splendidly (Documents to Go Premium + foldable bluetooth keyboard = all my writing needs as a journalist solved). In others, concessions have to be made (as a practicing musician, my options are a bit limited, but with the help of Xewton Music Studio, Multitrack DAW/NanoStudio, etc, I can at least lay down some basic tracks, create basic MIDI compositions, etc).
    However, there is one area in where we’ve made no headway at all. My friend has the great misfortune of being blessed with logic , and therefore, unlike me, does honest programming and web app designing work. And as far as we know, there is not a single HTML/script editor with more than just the bare, basic functions in the app store.
    What we need is this:
    * Syntax highlighting
    * Support for UTF-8
    A built-in FTP editor would be a nice bonus, but is not essential.
    We found one for the iPad, but when we contacted the company behind the app, they revealed no immediate plans for an iPhone version. (They felt coding on the iPhone was, at best, impractical, but they did concede the fact that if there are indeed users who have that need, the existence of an iOS HTML editor would be justified, and possible lucrative, regardless of their feelings on the matter. On that ground, they promised to examine the possibilities to port their iPad app in the future, but so far, no signs.)
    Does anyone know of such an app? Rest assured your assistance will be mentioned in the article series should you point us in the right direction

    Unfortunately, my friend has offered his iPhone an ultimatum. No syntax highlighting, no computer replacement. It is strange that such as standardized feature has not found its way into any known HTML editor for iOS.
    But FTPOntheGo seems to be a great app in general, so thanks!

  • Syntax Highlighting for MATRIXx MathScript and TPL

    There have been some questions about text editors for MATRIXx, so I wanted to let everyone know about an application note that we just posted. It describes how to configure a syntax highlighter for use with MathScript and Template Programming Language (TPL). There is also an example of how Crimson Editor can be configured. I choose Crimson Editor because it was free, but the same thing can be done in other syntax highlighters. Using a syntax highlighter makes MATRIXx code a lot easier to read.
    http://zone.ni.com/devzone/conceptd.nsf/webmain/C43375149CB01C3186256E530081EAA5
    While I am at it, I am going to point out some other resources. The application note is located on Developer Zone section of our website, where
    you can find other MATRIXx examples and tutorials:
    http://zone.ni.com/devzone/devzone.nsf/webcategories/A92DB8BA2DE149F486256CBC00655A0C?opendocument
    If you have code or examples that you want to share with other users you can submit the example to the Example Code Library:
    http://www.ni.com/devzone/dev_exchange/ex_search.htm
    Suggestions and feedback can be submitted from Product Feedback section of Contact NI:
    http://sine.ni.com/apps/we/nicc.call_me?p_action=country&p_lang_id=US
    And of course the main MATRIXx page is:
    http://www.ni.com/matrixx
    Carl L
    National Instruments

    I found another editor with syntax highlighting capabilities for MATRIXx. The editor is VIM which is based on the Unix VI editor, and is available on both Solaris and Windows.
    www.vim.org
    Carl L
    National Instruments
    www.ni.com/matrixx

  • [SOLVED] How to convince vim my terminal supports color?

    Hi. I recently got a shell account from Kaitocracy on his linode machine. I noticed that my bash prompt has color, as expected, but when I copied over my vim configuration (which includes a color theme), it didn't work! After some toying around, I noticed that vim recognizes the terminal escape codes using `:hi <type> start= stop=`, but not the existing `cterm` commands in my color theme. To make things more confusing, I know my terminal (urxvt) is capable of using the cterm flags.
    Also, Ctrl+L does not clear/redraw the screen as expected.
    What can I do to fix these issues? Here are the configs:
    ~/.vimrc:
    " No vi compatibility; strictly vim here.
    set nocompatible
    " Don't source /etc/vimrc
    set noexrc
    " My background is always black
    set background=dark
    " The mouse is helpful every now and then...
    set mouse=a
    " I'm a Linux user
    set fileformats=unix,dos,mac
    " Search while I type
    set incsearch
    " The blinking pisses me off
    set novisualbell
    " Line numbers are key to debugging
    set number
    set numberwidth=5
    " My tabs are 4 characters long
    set tabstop=4
    set softtabstop=4
    " Indention is also 4 characters
    set shiftwidth=4
    " Normally, I don't want tabs converted to spaces.
    set noexpandtab
    " Syntax highlighting is a staple :D
    syntax on
    " I want liberal use of hidden buffers, just in case.
    set hidden
    set laststatus=2
    " filename, filetype, readonly flag, modified flag line #, column #, %age of file length, hex value of byte under cursor.
    " Ex: .vimrc [vim][+] 48,22 55% hex:20
    set statusline=%f\ %y%r%m\ %l,%c\ %P\ hex:%B
    set noai
    " I can see where tabs and line endings are
    set listchars=tab:▸\ ,eol:¬
    " This turns on the config above; I can turn it off with :set nolist
    set list
    " I want wordwrap on, coupled with sane line-breaking. This will not work when :set list is active.
    set wrap
    set lbr
    " My color scheme is pwn
    colorscheme sporkbox
    filetype indent on
    if has("autocmd")
    " enable filetype detection
    filetype on
    " I want to convert tabs to spaces to adhere to PEP 8.
    autocmd FileType python setlocal ts=4 sts=4 sw=4 expandtab
    endif
    " \l toggles invisibles
    nmap <leader>l :set list!<CR>
    " I like to get rid of trailing white space.
    nnoremap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR>
    " Fast window movement is important
    map <C-h> <C-w>h
    map <C-j> <C-w>j
    map <C-k> <C-w>k
    map <C-l> <C-w>l
    " Courtesy of vimcasts.org
    function! <SID>StripTrailingWhitespaces()
    " Save last search and cursor position
    let _s=@/
    let l = line(".")
    let c = col(".")
    " Do the business:
    %s/\s\+$//e
    " Restore previous search history and cursor position
    let @/=_s
    call cursor(l, c)
    endfunction
    ~/.vim/colors/sporkbox.vim:
    " Color scheme "sporkbox"
    " by Daniel Campbell <[email protected]>
    " Tab characters and EOLs should be dark gray so they don't stand out too much.
    highlight SpecialKey ctermfg=darkgray
    highlight NonText ctermfg=darkgray
    " If I'm in a mode, I want to see it.
    highlight ModeMsg ctermfg=green
    " The current file should be obvious; the others can be faded.
    highlight StatusLine ctermfg=green ctermbg=black
    highlight StatusLineFC ctermfg=darkgray ctermbg=white
    " Line numbers should be just-visible, not bright.
    highlight LineNr ctermfg=darkgray
    " Titles in Markdown
    highlight Title cterm=bold ctermfg=white
    " My splits should not be bright
    highlight VertSplit ctermfg=black ctermbg=darkblue
    highlight Comment ctermfg=darkgreen
    highlight Constant ctermfg=cyan
    highlight Identifier ctermfg=yellow
    highlight Statement ctermfg=magenta
    highlight PreProc ctermfg=lightblue
    highlight Type ctermfg=blue
    highlight Special ctermfg=lightblue
    Remote .bashrc:
    ### ~/.bashrc: Sourced by all interactive bash shells on startup
    # Set a fancier prompt
    PS1='\[\e[32;01m\]\u\[\e[m\] \[\e[36m\]\w\[\e[m\]: '
    # Turn on colors for ls and grep
    alias less='less --RAW-CONTROL-CHARS'
    alias ls='ls --color=auto'
    alias grep='grep --color=auto'
    # Set colors for ls and friends
    if [ -f ~/.dir_colors ]; then
    eval `dircolors -b ~/.dir_colors`
    elif [ -f /etc/dir_colors ]; then
    eval `dircolors -b /etc/dir_colors`
    else eval `dircolors -b`; fi
    # Compilation optimization flags
    CHOST="i686-pc-linux-gnu"
    MAKEFLAGS="-j2"
    LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=both"
    CFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
    FFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
    CPPFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
    CXXFLAGS="-march=pentium4 -O2 -pipe -fomit-frame-pointer"
    export PGHOST="private1.kiwilight.com"
    export PS1 CHOST MAKEFLAGS LDFLAGS CFLAGS FFLAGS CXXFLAGS
    To make matters more confusing, my vim theme works when I connect to the linode in a GNU screen session, but not when it's a straight-up terminal.
    Last edited by xelados (2010-04-25 00:34:44)

    Mr.Elendig wrote:Make sure you are using rxvt-unicode-256color and that your TERM is rxvt-256color outside of screen, and screen-256color inside of screen.
    That's the peculiarity of the problem; when I run vim in my local environment, I always get color using the `:hi <hilighttype> ctermfg=* ctermbg=*` commands. This applies inside of X through rxvt-unicode (non-256color), GNU screen, and on the plain command line in vc1. This issue seems to be related to the remote environment and/or variables not being sent through ssh.
    @moljac: When I echo'd TERM inside a screen session, it returned "screen", so I don't know whether it's legit or not.
    Last edited by xelados (2010-04-24 11:47:52)

  • Syntax highlighting not working with label on if statement in fortran in Visual studio 2010

    I am having a difficult time in figuring out the syntax highlighting in Visual studio. I am using fortran code and there are labels in if statements as follows: 
                if_2003: IF (FRAC_PBED(NNSED,L).LT.0.0.AND.
         +                   FRAC_PBED(NNSED,L).GT.SMALL_NEG_NO) THEN
                  FRAC_PBED(NNSED,L) = 0.0
           TSED_PBED(1,NNSED,L) = 0.0
         END IF if_2003
    So the problem I am having is when I click on the `if` next to label `if_2003`, then I cannot use `CTRL + ]` to move to the ending `if`. If there is no label before `if`, then the shortcut is working fine. I don't know what I could do so that it would start
    behaving as it is supposed to. 
    In the contrary, when I have do loop as follows: 
        do_410: DO NNSED=1,NSTD
             D50AVG(L) = D50AVG(L) + 
             +                 FRAC_ALAY_SURF(NNSED,L)*D50(NNSED)/10000.  ! BASED ON BED COMPOSITION
        C
             TSED_ALAY_SURF(2,NNSED,L)=TSED_ALAY_SURF(1,NNSED,L)
             TSED_ALAY_BUFF(2,NNSED,L)=TSED_ALAY_BUFF(1,NNSED,L)
             TSED_PBED(2,NNSED,L)=TSED_PBED(1,NNSED,L)
                  END DO do_410
    I can move to the end/start of `do` loop using the keyboard shortcut `CTRL + ]`. Any suggestions is appreciated.  
    Regards, Jdbaba

    Hello Jdbaba,
    Based on my research, your post is related to use fortran in Visual Studio:https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-for-windows-build-intel-mkl-program-with-intel-fortran-in-microsoft-visual-studio This
    technology is provided by Intel. So the question should be consulted on Intel fortran related forum. Not Visual Studio Setup forum, setup forum is about install/uninstall Visual Studio.
    Best regards,  
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Different Styles in PlainView - Syntax Highlighting?

    Hi,
    I've managed to extend PlainView and looking at old JEdit code I have the syntax highlighting working for the most part. However, at certain times while typing the cursor starts to get way ahead of the text it's typing. And as I backspace on the line the cursor eventually gets closer to the character the closer it gets to the start of the line.
    I'm overridding the "drawUnselectedText()" method in PlainView to do the coloring.
    Here's the code, you can see the call to SyntaxUtilities.paintSyntaxLine() which is JEdit's class to do the drawing.
             * Renders the given range in the model as normal unselected text. This
             * is implemented to paint colors based upon the token-to-color
             * translations. To reduce the number of calls to the Graphics object,
             * text is batched up until a color change is detected or the entire
             * requested range has been reached.
             * @param g
             *            the graphics context
             * @param x
             *            the starting X coordinate
             * @param y
             *            the starting Y coordinate
             * @param p0
             *            the beginning position in the model
             * @param p1
             *            the ending position in the model
             * @returns the location of the end of the range
             * @exception BadLocationException
             *                if the range is invalid
            protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1) throws BadLocationException {
                System.out.println("p0: " + p0 + " p1: " + p1 + " x: " + x + " y: " + y);
                // Get the start of the element
                int lineIndex = doc.getDefaultRootElement().getElementIndex(p0);
                // Get the element for the line
                Element elem = doc.getDefaultRootElement().getElement(lineIndex);
                System.out.println("lineIndex: " + lineIndex + " elemStartIDX: " + elem.getStartOffset() + " elemEndIDX: " + elem.getEndOffset());
                // Get the line text
                doc.getText(p0, p1 - p0, currentLineText);
                // If highlighting, mark the tokens
                if (marker != null) {
                    Token t = marker.markTokens(currentLineText, lineIndex);
                    x = SyntaxUtilities.paintSyntaxLine(currentLineText, t, styles, this, g, x, y, p0, p1);
                    System.out.println("Painted line at: " + x);
                } else {
                    // No highlighting requested, draw normal text
                    Font defaultFont = g.getFont();
                    Color defaultColor = styles[0].getColor(); // Default color of text
                    g.setFont(defaultFont);
                    g.setColor(defaultColor);
                    x = Utilities.drawTabbedText(currentLineText, x, y, g, this, p0);
                // Set the last line processed
                lastLine  = lineIndex;
                return x;
    Here is the code from the paintSyntaxLine() method:
         * Paints the specified line onto the graphics context. Note that this
         * method munges the offset and count values of the segment.
         * @param line
         *            The line segment
         * @param tokens
         *            The token list for the line
         * @param styles
         *            The syntax style list
         * @param expander
         *            The tab expander used to determine tab stops. May be null
         * @param gfx
         *            The graphics context
         * @param x
         *            The x co-ordinate
         * @param y
         *            The y co-ordinate
         * @return The x co-ordinate, plus the width of the painted string
        public static int paintSyntaxLine(Segment line, Token tokens, SyntaxStyle[] styles, TabExpander expander, Graphics gfx, int x, int y, int p0, int p1) {
            Font defaultFont = gfx.getFont();
            Color defaultColor = Color.black;
            FontMetrics fm = gfx.getFontMetrics(defaultFont);
            int offset = 0;
            while (tokens != null && tokens.id != Token.END) {
                int length = tokens.length;
                if (tokens.id == Token.NULL) {
                    if (!defaultColor.equals(gfx.getColor()))
                        gfx.setColor(defaultColor);
                    if (!defaultFont.equals(gfx.getFont()))
                        gfx.setFont(defaultFont);
                } else {
                    styles[tokens.id].setGraphicsFlags(gfx, defaultFont);
    //                fm = gfx.getFontMetrics();//[tokens.id].getStyledFont(defaultFont);
    //                FontMetrics dfm = Toolkit.getDefaultToolkit().getFontMetrics(defaultFont);
    //                System.out.println("Font Info: CharWidth[" + fm.charWidth(line.array[p1])+"], Max Advance[" + fm.getMaxAdvance()+"]");
    //                System.out.println("Default Font Info: CharWidth[" + dfm.charWidth(line.array[p1])+"], DMax Advance[" + dfm.getMaxAdvance()+"]");
    ////                x = fm.charsWidth(line.array, p0, length);
                line.count = length;
                x = Utilities.drawTabbedText(line, x, y, gfx, expander, p0);
                line.offset += length;
                offset += length;
                tokens = tokens.next;
            return x;
    I'm not sure what the problem is..i thought it might be an issue with the View and drawing multiple font styles. Since plain view only deals with a single font color and size. I tried using LabelView but that seems to need a StyledDocument and I had problems when I tried to use DefaultStyledDocument for my syntaxdocument. I was getting strange offset issues when using the Segment class.
    Here's what I posted: http://forum.java.sun.com/thread.jspa?threadID=780801
    I am using PlainDocument because that seemed to be what everyone was using for a syntax editor..since the structure of the document in a Plain Document is less complex.
    I orginally started out using the setCharacterAttributes() method on the DefaultStyledDocument and letting the views draw the text. That all seemed to work except for the "segment offset" issue. And I wasn't sure where the best spot to get the document to redraw subsequent lines in the case of changing a multiline comment, etc.
    So, everything I read about others attempts for syntax highlighters seems to use either StyledEditorKit with a fixed language set with custom parsing and using the setCharacterAttributes method. Or they use the plaindocument approach with a custom view..(which no one seems to share the source) or the project just simply uses the JEditTextArea directly (which we can't do in our product).
    We don't need multiple fonts per-line.. The document will always use one font face (Arial, Helvetica, etc) but may use different styles per word (bold, italic, etc).
    I thought I'd need to use FontMetrics to get the size of the font and such. But there didn't seem to be a difference in measurements based on the style of the font. (i.,e A bold font has the same charWidth('m') size as a regular style.
    At least that's what my test program showed..
    The other thing I noticed is that when the document is successfully colored and I use the mouse to select a region of text, the style of the text reverts back to normal. I'm sure that's because I only override the drawUnselectedText() method.
    Any ideas? Is there anyone who has successfully done this?
    Thanks,
    - Tim

    I just tried using a proportional font in my editor, and now I'm seeing your runaway-caret problem. Specifically, the caret remains in sync with the text as long as no bold characters are encountered, but it gets noticeably farther out of whack with each bold character it passes. I suspect that, when you measured the charWidth, your FontMetrics object wasn't really based on a bold font, because bold versions of proportional fonts are larger. And of course, the model/view conversion methods assume that the same style of the same font is used throughout the document. I've never had to deal with that problem, since I've always used monospaced fonts by preference, and bold versions of monospaced fonts really are the same size as the non-bold versions. I suggest you do the same, because getting this to work with proportional fonts look like a major hassle.

Maybe you are looking for

  • ITunes can't see Aperture Library - iMovie can't see most videos in Aperture Library

    Issues: Nearly all of my videos in the Aperture/iPhoto library do not show up when I select iPhoto library option in iMovie and iMovie is unable to locate them in any other way.  iTunes does not recognize my Aperture library, and I get the following

  • Elements 11: Can't open raw files from Panasonic Lumix TZ60.  Will there be an update?

    I have downloaded the Silkypix developer studio software that came with my camera (Mac Version) BUT my main camera is the Nikon D7100 and am used to using Raw in Photoshop elements 11.  Will there be a Raw update which includes Panasonic Lumix TZ60 o

  • Inconsistent Dep req in MRP run

    Let me explain the scenario with an example: B is child part of A. When we ran MPS, A's planned order has generated dep req on B. Subsequently A's Requirement and Planned order were deleted . But in the subsequent MPS run it is not deleting Child par

  • Create sales document with reference document

    Hi Experts:                 In the case of create sales document ,i set that create sales order with reference a billing document.                 But i have a problem,the Pricing procedure in billing document is A, after coping from it,the sales doc

  • Help with a BEx Query

    Hello Gurus, I have a requirement to write a query to list all the customers who have purchased over $450 (customer total) for a three month period and had not purchased any product from an item category in the same time period. My users want to see