mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(tutor): set a value for ":syntax iskeyword" (#27833)
Problem: "NOTE"s, inline Vim script code, and links ending in digits may not be highlighted correctly within the :Tutor. Solution: set an explicit value for ":syntax iskeyword" that includes digits. Do it after ":syntax include"s, so the included syntax/sh.vim doesn't mess with the value. Increase screen test width so all text within the conclusion section is visible. Co-authored-by: Sean Dewar <6256228+seandewar@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,8 @@ syn include @TUTORSHELL syntax/sh.vim
|
|||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
syn include @VIMNORMAL syntax/vimnormal.vim
|
syn include @VIMNORMAL syntax/vimnormal.vim
|
||||||
|
|
||||||
|
syn iskeyword @,-,_,48-57
|
||||||
|
|
||||||
syn match tutorLink /\[.\{-}\](.\{-})/ contains=tutorInlineNormal
|
syn match tutorLink /\[.\{-}\](.\{-})/ contains=tutorInlineNormal
|
||||||
syn match tutorLinkBands /\[\|\]\|(\|)/ contained containedin=tutorLink,tutorLinkAnchor conceal
|
syn match tutorLinkBands /\[\|\]\|(\|)/ contained containedin=tutorLink,tutorLinkAnchor conceal
|
||||||
syn match tutorLinkAnchor /(.\{-})/ contained containedin=tutorLink conceal
|
syn match tutorLinkAnchor /(.\{-})/ contained containedin=tutorLink conceal
|
||||||
|
@@ -12,7 +12,7 @@ describe(':Tutor', function()
|
|||||||
clear({ args = { '--clean' } })
|
clear({ args = { '--clean' } })
|
||||||
command('set cmdheight=0')
|
command('set cmdheight=0')
|
||||||
command('Tutor')
|
command('Tutor')
|
||||||
screen = Screen.new(80, 30)
|
screen = Screen.new(81, 30)
|
||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
[0] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Gray },
|
[0] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Gray },
|
||||||
[1] = { bold = true },
|
[1] = { bold = true },
|
||||||
@@ -20,6 +20,7 @@ describe(':Tutor', function()
|
|||||||
[3] = { foreground = Screen.colors.SlateBlue },
|
[3] = { foreground = Screen.colors.SlateBlue },
|
||||||
[4] = { bold = true, foreground = Screen.colors.Brown },
|
[4] = { bold = true, foreground = Screen.colors.Brown },
|
||||||
[5] = { bold = true, foreground = Screen.colors.Magenta1 },
|
[5] = { bold = true, foreground = Screen.colors.Magenta1 },
|
||||||
|
[6] = { italic = true },
|
||||||
})
|
})
|
||||||
screen:attach()
|
screen:attach()
|
||||||
end)
|
end)
|
||||||
@@ -94,4 +95,42 @@ describe(':Tutor', function()
|
|||||||
feed(':700<CR>zt')
|
feed(':700<CR>zt')
|
||||||
screen:expect(expected)
|
screen:expect(expected)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('applies hyperlink highlighting', function()
|
||||||
|
local expected = [[
|
||||||
|
{0: }^ |
|
||||||
|
{0: }{3:#}{5: CONCLUSION} |
|
||||||
|
{0: } |
|
||||||
|
{0: }This was intended to give a brief overview of the Neovim editor, just enough to|
|
||||||
|
{0: }allow you to use it fairly easily. It is far from complete as Neovim has |
|
||||||
|
{0: }many many more commands. Consult the help often. |
|
||||||
|
{0: }There are also countless great tutorials and videos to be found online. |
|
||||||
|
{0: }Here's a bunch of them: |
|
||||||
|
{0: } |
|
||||||
|
{0: }- {6:Learn Vim Progressively}: |
|
||||||
|
{0: } {2:https://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/} |
|
||||||
|
{0: }- {6:Learning Vim in 2014}: |
|
||||||
|
{0: } {2:https://benmccormick.org/learning-vim-in-2014/} |
|
||||||
|
{0: }- {6:Vimcasts}: |
|
||||||
|
{0: } {2:http://vimcasts.org/} |
|
||||||
|
{0: }- {6:Vim Video-Tutorials by Derek Wyatt}: |
|
||||||
|
{0: } {2:http://derekwyatt.org/vim/tutorials/} |
|
||||||
|
{0: }- {6:Learn Vimscript the Hard Way}: |
|
||||||
|
{0: } {2:https://learnvimscriptthehardway.stevelosh.com/} |
|
||||||
|
{0: }- {6:7 Habits of Effective Text Editing}: |
|
||||||
|
{0: } {2:https://www.moolenaar.net/habits.html} |
|
||||||
|
{0: }- {6:vim-galore}: |
|
||||||
|
{0: } {2:https://github.com/mhinz/vim-galore} |
|
||||||
|
{0: } |
|
||||||
|
{0: }If you prefer a book, {6:Practical Vim} by Drew Neil is recommended often |
|
||||||
|
{0: }(the sequel, {6:Modern Vim}, includes material specific to Neovim). |
|
||||||
|
{0: } |
|
||||||
|
{0: }This tutorial was written by Michael C. Pierce and Robert K. Ware, Colorado |
|
||||||
|
{0: }School of Mines using ideas supplied by Charles Smith, Colorado State |
|
||||||
|
{0: }University. E-mail: {2:bware@mines.colorado.edu}. |
|
||||||
|
]]
|
||||||
|
|
||||||
|
feed(':960<CR>zt')
|
||||||
|
screen:expect(expected)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user