aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/tutor_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
commitff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch)
tree729bbcb92231538fa61dab6c3d890b025484b7f5 /test/functional/plugin/tutor_spec.lua
parent376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff)
parent28c04948a1c887a1cc0cb64de79fa32631700466 (diff)
downloadrneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/plugin/tutor_spec.lua')
-rw-r--r--test/functional/plugin/tutor_spec.lua175
1 files changed, 108 insertions, 67 deletions
diff --git a/test/functional/plugin/tutor_spec.lua b/test/functional/plugin/tutor_spec.lua
index 99538e1db0..9f381d45db 100644
--- a/test/functional/plugin/tutor_spec.lua
+++ b/test/functional/plugin/tutor_spec.lua
@@ -1,18 +1,20 @@
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local helpers = require('test.functional.helpers')(after_each)
-local clear = helpers.clear
-local command = helpers.command
-local feed = helpers.feed
-local is_os = helpers.is_os
+
+local clear = n.clear
+local command = n.command
+local feed = n.feed
+local is_os = t.is_os
describe(':Tutor', function()
- local screen
+ local screen --- @type test.functional.ui.screen
before_each(function()
clear({ args = { '--clean' } })
command('set cmdheight=0')
command('Tutor')
- screen = Screen.new(80, 30)
+ screen = Screen.new(81, 30)
screen:set_default_attr_ids({
[0] = { foreground = Screen.colors.DarkBlue, background = Screen.colors.Gray },
[1] = { bold = true },
@@ -20,6 +22,7 @@ describe(':Tutor', function()
[3] = { foreground = Screen.colors.SlateBlue },
[4] = { bold = true, foreground = Screen.colors.Brown },
[5] = { bold = true, foreground = Screen.colors.Magenta1 },
+ [6] = { italic = true },
})
screen:attach()
end)
@@ -27,71 +30,109 @@ describe(':Tutor', function()
it('applies {unix:…,win:…} transform', function()
local expected = is_os('win')
and [[
- {0: }^ |
- {0: } 3. To verify that a file was retrieved, cursor back and notice that there |
- {0: } are now two copies of Lesson 5.3, the original and the retrieved version. |
- {0: } |
- {0: }{1:NOTE}: You can also read the output of an external command. For example, |
- {0: } |
- {0: } :r {4:!}dir |
- {0: } |
- {0: } reads the output of the ls command and puts it below the cursor. |
- {0: } |
- {0: }{3:#}{5: Lesson 5 SUMMARY} |
- {0: } |
- {0: } 1. {2::!command} executes an external command. |
- {0: } |
- {0: } Some useful examples are: |
- {0: } :{4:!}dir - shows a directory listing |
- {0: } :{4:!}del FILENAME - removes file FILENAME |
- {0: } |
- {0: } 2. {2::w} FILENAME writes the current Neovim file to disk with |
- {0: } name FILENAME. |
- {0: } |
- {0: } 3. {2:v} motion :w FILENAME saves the Visually selected lines in file |
- {0: } FILENAME. |
- {0: } |
- {0: } 4. {2::r} FILENAME retrieves disk file FILENAME and puts it |
- {0: } below the cursor position. |
- {0: } |
- {0: } 5. {2::r !dir} reads the output of the dir command and |
- {0: } puts it below the cursor position. |
- {0: } |
+ {0: }^ |
+ {0: } 3. To verify that a file was retrieved, cursor back and notice that there |
+ {0: } are now two copies of Lesson 5.3, the original and the retrieved version. |
+ {0: } |
+ {0: }{1:NOTE}: You can also read the output of an external command. For example, |
+ {0: } |
+ {0: } :r {4:!}dir |
+ {0: } |
+ {0: } reads the output of the ls command and puts it below the cursor. |
+ {0: } |
+ {0: }{3:#}{5: Lesson 5 SUMMARY} |
+ {0: } |
+ {0: } 1. {2::!command} executes an external command. |
+ {0: } |
+ {0: } Some useful examples are: |
+ {0: } :{4:!}dir - shows a directory listing |
+ {0: } :{4:!}del FILENAME - removes file FILENAME |
+ {0: } |
+ {0: } 2. {2::w} FILENAME writes the current Neovim file to disk with |
+ {0: } name FILENAME. |
+ {0: } |
+ {0: } 3. {2:v} motion :w FILENAME saves the Visually selected lines in file |
+ {0: } FILENAME. |
+ {0: } |
+ {0: } 4. {2::r} FILENAME retrieves disk file FILENAME and puts it |
+ {0: } below the cursor position. |
+ {0: } |
+ {0: } 5. {2::r !dir} reads the output of the dir command and |
+ {0: } puts it below the cursor position. |
+ {0: } |
]]
or [[
- {0: }^ |
- {0: } 3. To verify that a file was retrieved, cursor back and notice that there |
- {0: } are now two copies of Lesson 5.3, the original and the retrieved version. |
- {0: } |
- {0: }{1:NOTE}: You can also read the output of an external command. For example, |
- {0: } |
- {0: } :r {4:!}ls |
- {0: } |
- {0: } reads the output of the ls command and puts it below the cursor. |
- {0: } |
- {0: }{3:#}{5: Lesson 5 SUMMARY} |
- {0: } |
- {0: } 1. {2::!command} executes an external command. |
- {0: } |
- {0: } Some useful examples are: |
- {0: } :{4:!}ls - shows a directory listing |
- {0: } :{4:!}rm FILENAME - removes file FILENAME |
- {0: } |
- {0: } 2. {2::w} FILENAME writes the current Neovim file to disk with |
- {0: } name FILENAME. |
- {0: } |
- {0: } 3. {2:v} motion :w FILENAME saves the Visually selected lines in file |
- {0: } FILENAME. |
- {0: } |
- {0: } 4. {2::r} FILENAME retrieves disk file FILENAME and puts it |
- {0: } below the cursor position. |
- {0: } |
- {0: } 5. {2::r !ls} reads the output of the ls command and |
- {0: } puts it below the cursor position. |
- {0: } |
+ {0: }^ |
+ {0: } 3. To verify that a file was retrieved, cursor back and notice that there |
+ {0: } are now two copies of Lesson 5.3, the original and the retrieved version. |
+ {0: } |
+ {0: }{1:NOTE}: You can also read the output of an external command. For example, |
+ {0: } |
+ {0: } :r {4:!}ls |
+ {0: } |
+ {0: } reads the output of the ls command and puts it below the cursor. |
+ {0: } |
+ {0: }{3:#}{5: Lesson 5 SUMMARY} |
+ {0: } |
+ {0: } 1. {2::!command} executes an external command. |
+ {0: } |
+ {0: } Some useful examples are: |
+ {0: } :{4:!}ls - shows a directory listing |
+ {0: } :{4:!}rm FILENAME - removes file FILENAME |
+ {0: } |
+ {0: } 2. {2::w} FILENAME writes the current Neovim file to disk with |
+ {0: } name FILENAME. |
+ {0: } |
+ {0: } 3. {2:v} motion :w FILENAME saves the Visually selected lines in file |
+ {0: } FILENAME. |
+ {0: } |
+ {0: } 4. {2::r} FILENAME retrieves disk file FILENAME and puts it |
+ {0: } below the cursor position. |
+ {0: } |
+ {0: } 5. {2::r !ls} reads the output of the ls command and |
+ {0: } puts it below the cursor position. |
+ {0: } |
]]
feed(':700<CR>zt')
screen:expect(expected)
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)