[vim] Syntax Highlighting Takes a Holiday
- From: Michael Soyka <msoyka_nospam@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 01 Dec 2005 19:46:55 -0500
Hi y'all,
On the job I use RCS for version control under Windows. Quite often I begin to modify a file only to be warned it is read only. So, to avoid having to go to a DOS window and check out the file, I wrote a vim function to do it and set it up to be triggered by the FileChangedRO event. I've included the code below.
The problem I'm writing about is after the "edit" command, all the foreground colors change to either white or black, depending on the background, dark or light. I have to manually enable syntax highlighting via "syntax enable" or "syntax on" to restore the colors in the colorscheme. This is why you see the "syntax enable" command in my function after edit.
So, does anyone know why it is that syntax highlighting seemingly takes a holiday?
Feel free to make "constructive" comments on the code if you must! ;)
Mike
Code from _gvimrc below:
autocmd FileChangedRO * call FileChangedCmd()
function FileChangedCmd()
let fname = expand("%:t")
let hasrcs = filereadable("./RCS/" . fname)
if hasrcs == 0
echo "You are modifying a read-only file."
else
let choice = confirm("Check it out?","&Yes\n&No",1,"Q")
if choice == 1
let cur_line = line(".")
let cur_col = col(".")
call inputsave()
let rc = system("C:/rcs/bin/win32/co -l " . fname)
edit
syntax enable
call inputrestore()
call cursor(cur_line,cur_col)
endif
endif
endfunction
.- Follow-Ups:
- Re: [vim] Syntax Highlighting Takes a Holiday
- From: Preben 'Peppe' Guldberg
- Re: [vim] Syntax Highlighting Takes a Holiday
- Prev by Date: Re: [vim] Virtual Edit not working
- Next by Date: vi(m) displaying lines over 80 characters
- Previous by thread: [vim] Virtual Edit not working
- Next by thread: Re: [vim] Syntax Highlighting Takes a Holiday
- Index(es):
Relevant Pages
|