On Mar 10, 3:41 pm, Charles Campbell <[email protected]>
wrote:
>
> I'm afraid that I don't see that problem. What happens without the
> syntax highlighting changes; does use of the cursor cause odd behavior?
You are right Charles. The reason seems elsewhere but is still
mysterious. Let me explain:
I did more testing. Tried commenting out each of those 4 lines and it
boils down that this is the line that is correlated with the bizarre
behavior:
au InsertLeave * syn on
But then I tried "syn off" and "syn on" manually and the bizarre
behavior still remains. So my "syn on" seems to be having this strange
side effect of putting the cursor at the bottom of the file. How can I
change this? Relevant two lines from my .vimrc are below:
au BufRead,BufNewFile *.nc.txt set filetype=ncfile
au! Syntax ncfile source ~/.vim/syntax/ncfile.vim
Essentially where does the cursor end up after parsing the file? That
is the key issue. Mine seems to fall to the end after each syn
highlighting.
A related issue:If I totally disable syn-highlighting then vim seems
to remember the last cursor point and return exactly there on
reopening the file too. Syn highlighting seems to have broken that
feature for me. I suspect somewhere I ought to save and reset cursor
position. Any tips are greatly appreciated!
A full reproduction of my syntax file (with liberal credits due to
other members here for helping me develop this fairly complicated syn
file!) might be key to solving this problem. Here it is (with some
editing to remove extraneous matter):
##########################################################
let b:current_syntax = "ncfile"
syn sync clear
syn sync fromstart
syn keyword Identifier DynamicAtomPositions
[snip]
syn match Delimiter "{\|}"
syn region MaskReg start=/^ DynamicAtomAttributes =/ end=/;/ keepend
contains=Mask,L?
syn match Mask /^ DynamicAtomAttributes =.*\n/ nextgroup=L1 contained
syn region PosReg start=/^ DynamicAtomPositions =/ end=/;/ keepend
contains=Pos,L?
syn match Pos /^ DynamicAtomPositions =.*\n/ nextgroup=L1 contained
syn match L1 /.*\n/ nextgroup=L2 contained
syn match L2 /.*\n/ nextgroup=L3 contained
[snip]
syn match L29 /.*\n/ nextgroup=L30 contained
syn match L30 /.*\n/ nextgroup=L31 contained
syn keyword C C
[snip]
"adsorbate atoms
hi C ctermfg=Black
[snip]
func! Update()
let s = search('^ DynamicAtomSpecies =','w')
let e = search(';')
for l in range(s+1,e)
let atom = matchstr(getline(l),'\w\+')
exec 'hi link L'.(l-s).' '.atom
endfor
endfun
call Update()
finish
######################
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---