Re: [patch] added entries to CODEOWNERS
Dominique wrote: > Attached patch adds a few entries to file .github/CODEOWNERS I'll include it, thanks. -- To keep milk from turning sour: Keep it in the cow. /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202012142118.0BELImTM173348%40masaka.moolenaar.net.
Re: How to create a syntax keyword at runtime?
Ron Aaron wrote: I explained exactly what I mean in the original post. Yes, of course I'm talking about a specific file type, but the specific type is unimportant since it's something I'm creating and not something in the vim syntax files. What I intend is simply that if the user types in (the file being created) something like: : foo bar ; Then "foo" becomes a syntax keyword. The criteria for becoming a keyword in this context is that it is preceded by a colon, and delimited by white-space. Thus 'bar' is not a keyword, nor is ": foo". Think of the leading colon-space as a function declarator. What I can't figure out is how to trap "foo" without trapping the leading colon-space. OK, as I said in my earlier reply, what you need is to have syn keyword colonDef foo (or whatever you want foo to be highlighted as). The trick is to get the : to trigger getting that new syntax statement. You can try something like: inoremap ; ;:call InsertNewSyntax()a fun! InsertNewSyntax() if getline(".") =~ '^\s*:\s*\h\w*' let newsyn= substitute(getline("."),'^\s*:\s*\(\h\w*\)\s*;','\1','') exe "syn keyword Statement ".newsyn endif endfunction You could even make this part of your syntax file, even though it isn't strictly syntax. Every time you type a semicolon, the function is called which checks to see if it can extract a word from : word ; and, if it can, it will install that word as a new keyword. Regards, Chip Campbell P.S. IMHO -- this topic would've better have to have been in vim_...@googlegroups.com, as it isn't associated with developing vim. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/5028cde4-248a-c91b-21f4-fa7b4492cf52%40drchip.org.
Patch 8.2.2144
Patch 8.2.2144 Problem:Vim9: some corner cases not tested. Solution: Add a few tests. Files: src/testdir/test_vim9_script.vim, src/testdir/test_vim9_cmd.vim *** ../vim-8.2.2143/src/testdir/test_vim9_script.vim2020-12-13 17:50:16.734956500 +0100 --- src/testdir/test_vim9_script.vim2020-12-14 18:24:26.104352109 +0100 *** *** 23,28 --- 23,33 list assert_equal('three$', Screenline(&lines)) bwipe! + + # won't generate anything + if false + :123 + endif enddef let g:alist = [7] *** *** 1890,1895 --- 1895,1903 enddef def Test_for_loop_fails() + CheckDefFailure(['for '], 'E1097:') + CheckDefFailure(['for x'], 'E1097:') + CheckDefFailure(['for x in'], 'E1097:') CheckDefFailure(['for # in range(5)'], 'E690:') CheckDefFailure(['for i In range(5)'], 'E690:') CheckDefFailure(['var x = 5', 'for x in range(5)'], 'E1017:') *** *** 3054,3071 delete('Xdef') enddef - def Test_put_with_linebreak() - new - var lines =<< trim END - vim9script - pu =split('abc', '\zs') - ->join() - END - CheckScriptSuccess(lines) - getline(2)->assert_equal('a b c') - bwipe! - enddef - def InvokeNormal() exe "norm! :m+1\r" enddef --- 3062,3067 *** ../vim-8.2.2143/src/testdir/test_vim9_cmd.vim 2020-12-10 19:43:36.629155311 +0100 --- src/testdir/test_vim9_cmd.vim 2020-12-14 18:29:43.003207450 +0100 *** *** 20,25 --- 20,28 edit X`=filename`xx`=filenr`yy assert_equal('XXtestxx77yy', bufname()) + + CheckDefFailure(['edit `=xxx`'], 'E1001:') + CheckDefFailure(['edit `="foo"'], 'E1083:') enddef def Test_hardcopy_wildcards() *** *** 626,631 --- 629,648 assert_equal('aaa', getline(4)) bwipe! + + CheckDefFailure(['put =xxx'], 'E1001:') + enddef + + def Test_put_with_linebreak() + new + var lines =<< trim END + vim9script + pu =split('abc', '\zs') + ->join() + END + CheckScriptSuccess(lines) + getline(2)->assert_equal('a b c') + bwipe! enddef def Test_command_star_range() *** ../vim-8.2.2143/src/version.c 2020-12-13 21:26:51.565418479 +0100 --- src/version.c 2020-12-14 18:12:00.878944821 +0100 *** *** 752,753 --- 752,755 { /* Add new patch number below this line */ + /**/ + 2144, /**/ -- Mushrooms always grow in damp places and so they look like umbrellas. /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org/// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/202012141732.0BEHWCC4111584%40masaka.moolenaar.net.
Re: How to create a syntax keyword at runtime?
Yes, Maxim; that's exactly what I want to accomplish. And yes, I don't see how to do it in vimscript, but I was hoping someone might have an idea. I suppose an imap on ':' might be able to make it happen with functions. On Monday, December 14, 2020 at 1:41:23 PM UTC+2 Maxim Kim wrote: > If I get you right I don't think this is possible (or really cumbersome to > do) with existing :syntax commands. > > : foo bar ; <-- foo is defined and highlighted as statement > > then anywhere else in the text: > > bla bla bla foo bla bla <-- foo should be highlighted as statement > > Although, text properties with external text analyzer might be a good fit > for it. > > понедельник, 14 декабря 2020 г. в 08:04:27 UTC+3, Ron Aaron: > >> I explained exactly what I mean in the original post. >> >> Yes, of course I'm talking about a specific file type, but the specific >> type is unimportant since it's something I'm creating and not something in >> the vim syntax files. >> >> What I intend is simply that if the user types in (the file being >> created) something like: >> >> *: foo bar ;* >> >> Then "*foo*" becomes a syntax keyword. The criteria for becoming a >> keyword in this context is that it is preceded by a colon, and delimited by >> white-space. Thus 'bar' is not a keyword, nor is ": foo". Think of the >> leading colon-space as a function declarator. >> >> What I can't figure out is how to trap "foo" without trapping the leading >> colon-space. >> >> On Sunday, December 13, 2020 at 5:28:28 PM UTC+2 Charles Campbell wrote: >> >>> Ron Aaron wrote: >>> > Is this possible w/ vim's syntax highlighting? >>> > >>> > On Wednesday, December 9, 2020 at 10:56:35 AM UTC+2 Ron Aaron wrote: >>> > >>> > Hi all - >>> > >>> > I want to have a keyword (user-defined function) highlighted by my >>> > syntax file. >>> > >>> > The code looks like this: >>> > >>> > : foo blah blah ; >>> > >>> > In this case I want "foo" to be scooped up. What I'm doing now is >>> > this: >>> > >>> > syn match colonDef "^\s*:\s\+\zs\S\+" >>> > >>> > That highlights the correct thing (e.g. 'foo') where it's defined, >>> > but I can't figure out how to get it to be highlighted elsewhere >>> > in the code (e.g. when simply 'foo' appears without a leading colon). >>> > >>> > How can I accomplish this? >>> > >>> > >>> What do you mean by "vim's syntax highlighting"? Assuming no filetype, >>> say in a file called "joe.coffee", you could type >>> >>> syn keyword colonDef foo >>> hi link colonDef Statement >>> >>> and foo would be highlighted as Statement in your file. >>> >>> Somehow I don't think you're really meaning "vim's syntax highlighting", >>> but rather "vim's syntax highlighting for the XYZ filetype". Naturally, >>> that missing information greatly affects things. Syntax highlighting >>> involves groups, containment, matches, regions, etc. My guess is that >>> you want your modified "colonDef" highlighting to occur in some region >>> defined by the filetype's syntax highlighting, but you've defined a >>> match that is not contained in that region. To find out what that region >>> is named, you could try my plugin: >>> http://www.drchip.org/astronaut/vim/index.html#HILINKS and use :HLT!, >>> move the cursor about, and you'll see a trace explaining what syntax and >>> highlighting regions/etc are involved. Additionally, there's issues of >>> priority involved, but often you can use "containedin=..." to get what >>> you want. >>> >>> Once you've done that, you could place a file in your >>> .vim/after/syntax/XYZ.vim file the extra directions giving the >>> additional highlighting you want. >>> >>> Regards, >>> Chip Campbell >>> >> -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/6cb90bde-9fc2-4129-86a1-0434bdb16e71n%40googlegroups.com.
Re: How to create a syntax keyword at runtime?
If I get you right I don't think this is possible (or really cumbersome to do) with existing :syntax commands. : foo bar ; <-- foo is defined and highlighted as statement then anywhere else in the text: bla bla bla foo bla bla <-- foo should be highlighted as statement Although, text properties with external text analyzer might be a good fit for it. понедельник, 14 декабря 2020 г. в 08:04:27 UTC+3, Ron Aaron: > I explained exactly what I mean in the original post. > > Yes, of course I'm talking about a specific file type, but the specific > type is unimportant since it's something I'm creating and not something in > the vim syntax files. > > What I intend is simply that if the user types in (the file being created) > something like: > > *: foo bar ;* > > Then "*foo*" becomes a syntax keyword. The criteria for becoming a > keyword in this context is that it is preceded by a colon, and delimited by > white-space. Thus 'bar' is not a keyword, nor is ": foo". Think of the > leading colon-space as a function declarator. > > What I can't figure out is how to trap "foo" without trapping the leading > colon-space. > > On Sunday, December 13, 2020 at 5:28:28 PM UTC+2 Charles Campbell wrote: > >> Ron Aaron wrote: >> > Is this possible w/ vim's syntax highlighting? >> > >> > On Wednesday, December 9, 2020 at 10:56:35 AM UTC+2 Ron Aaron wrote: >> > >> > Hi all - >> > >> > I want to have a keyword (user-defined function) highlighted by my >> > syntax file. >> > >> > The code looks like this: >> > >> > : foo blah blah ; >> > >> > In this case I want "foo" to be scooped up. What I'm doing now is >> > this: >> > >> > syn match colonDef "^\s*:\s\+\zs\S\+" >> > >> > That highlights the correct thing (e.g. 'foo') where it's defined, >> > but I can't figure out how to get it to be highlighted elsewhere >> > in the code (e.g. when simply 'foo' appears without a leading colon). >> > >> > How can I accomplish this? >> > >> > >> What do you mean by "vim's syntax highlighting"? Assuming no filetype, >> say in a file called "joe.coffee", you could type >> >> syn keyword colonDef foo >> hi link colonDef Statement >> >> and foo would be highlighted as Statement in your file. >> >> Somehow I don't think you're really meaning "vim's syntax highlighting", >> but rather "vim's syntax highlighting for the XYZ filetype". Naturally, >> that missing information greatly affects things. Syntax highlighting >> involves groups, containment, matches, regions, etc. My guess is that >> you want your modified "colonDef" highlighting to occur in some region >> defined by the filetype's syntax highlighting, but you've defined a >> match that is not contained in that region. To find out what that region >> is named, you could try my plugin: >> http://www.drchip.org/astronaut/vim/index.html#HILINKS and use :HLT!, >> move the cursor about, and you'll see a trace explaining what syntax and >> highlighting regions/etc are involved. Additionally, there's issues of >> priority involved, but often you can use "containedin=..." to get what >> you want. >> >> Once you've done that, you could place a file in your >> .vim/after/syntax/XYZ.vim file the extra directions giving the >> additional highlighting you want. >> >> Regards, >> Chip Campbell >> > -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/bcde1c7b-1b39-4de8-aba5-7ed26cb2c795n%40googlegroups.com.