-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Add Chapter Two #5719 #5729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Chapter Two #5719 #5729
Conversation
Add main English file `runtime/tutor/tutor02` - Lesson 8.1 The Named Registers - Lesson 8.2 The Expression Register - Lesson 8.3 The Numbered Registers - Lesson 8.4 The Beauty of Marks - Lesson 8 Summary Add copy of `tutor02` at `tutor02.utf-8` Add source file `tutor02.vim` - coordinates translations - coordinates source for tmp copy Edit man page - add arguments - add Options - add Examples - trim description Edit main script `src/vimtutor` - add --list option - add --gui option - add -h, --help options - add -c, --chapter options - add -l, --language switches - add validations for languages and chapters - aimed at POSIX compliance
|
I made no attempt to modify |
- Update publication date - Mention "The Vi Tutorial" by name - Clean description - Clean some prose - Fix some formatting mistakes Update Chapter 02 - Remove some unnecessary words - Change :r !date -> :r!date
|
Comments are welcome. |
|
Lesson 8.2 does not work in Windows, where |
|
Lesson 8.3 includes a line that presumably should not be there, after point 5: Also: |
Any suggestions for a system agnostic alternative, or just a |
|
I didn't test this, but I also didn't guess at it either, my misapprehension came from this sentence under
|
I think making a |
|
[Question] Should I change the lesson numbering from EDIT: Just realized this causes some ugliness when doing the summary, i.e. Summary 2.1 looks strange. Propose direct numbering of lessons, i.e. Lesson 1.1, 1.2, ..., 2.1, 2.2 under chapter 2. Ergo, summary becomes simply Summary 1. EDIT 'o EDIT: I'm still going back and forward on this. Should lesson and summary headings be globally unique (Lesson 2.1.1, Summary 2.1) or locally unique (Chapter 2 contains Lesson 1.1, Summary 1), OR globally unique but interdependent and inflexible (Chapter 2 contains Lesson 8.1, Summary 8). EDIT 'o EDIT 'o EDIT: Went with the globally unique and flexible version. |
Remove detritus from another lesson left in 8.3 Add system specific NOTE: in 8.2 Change lesson numbering system to `chapter.lesson.part`
Codecov Report
@@ Coverage Diff @@
## master #5729 +/- ##
==========================================
+ Coverage 84.06% 84.11% +0.05%
==========================================
Files 138 138
Lines 152376 152435 +59
==========================================
+ Hits 128088 128225 +137
+ Misses 24288 24210 -78
Continue to review full report at Codecov.
|
|
> > Lesson 8.2 does not work in Windows, where `date` by itself will expect input. However `system('date /t')` works to just output the date (on Windows 10 at least)
>
> Any suggestions for a system agnostic alternative, or just a `NOTE:` specifying the Windows specific behaviour?
I think making a `NOTE:` about the Windows behaviour would make sense.
In this situtation users are presumably being exposed to Vim's
integration with external tools for the first time, which will almost
always require OS-specific tweaks. So a simple note to point out that
`system()` and `:r !...` etc. are calling outside Vim seems like a
good idea to me.
A higher level comment: Would it be possible to make multiple of these
tutor parts, and have a menu to select which one to take? Then we could
have a Windows specific one. We could also have one for specific
subjects, e.g. how to record and play back a macro.
The user would first do the main tutor, and then gets a menu to select
one of the advanced subjects.
Keep in mind that the tutor is interactive and is intended to "get
things in your fingers". Thus a section on writing Vim script is not a
good idea.
…--
If Microsoft would build a car...
... Occasionally, executing a maneuver such as a left turn
would cause your car to shut down and refuse to restart, in
which case you would have to reinstall the engine.
/// Bram Moolenaar -- [email protected] -- 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 ///
|
Yes, the main tutor02 file could be spliced into sections along the lines of lesson parts with a generic version of each part (linux) and then any number of variations (Windows, Plan9, etc), I imagine most sections would only need the generic section as they wouldn't touch anything system related. E.g. [tutor02-1, tutor_win02-1, tutor_osx2-1, etc]. The tutor02.vim script could select the appropriate sections based on the environment, concatenate, and copy to the temp file. It's not my place to be opinionated on this, but overall I feel it might a bridge too far UNLESS there is a serious intent to introduce content that is heavy on system calls or scripting.
I already have lessons planned for macros, is there a system environment dependency I'm ignorant of?
I agree. |
|
I guess we are not going to have several parts. Even the second chapter may not grow much. About the man page: the list of options at the top is hard to read. Why not just add [options] and mention them in a table further down. |
|
How about embedding vimtutor within vim and introducing |
|
Moving the tutor-specific stuff into Vim would avoid the shell script and batch file - that helps. |
|
I am including this. It's a bit sad, that the new vimtutor shell script is no longer portable, but requires bash (so I changed that). I also made a few further enhancements so that we do not need a separate I hope I didn't brake anything. Please check it. |
|
Would you like a POSIX shell port of diff --git a/src/vimtutor b/src/vimtutor
index 3faf100b4..6e29a7602 100755
--- a/src/vimtutor
+++ b/src/vimtutor
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Start Vim on a copy of the tutor file.
@@ -11,8 +11,7 @@
# Vim could be called "vim" or "vi". Also check for "vimN", for people who
# have Vim installed with its version number.
-# We anticipate up to a future Vim 8.1 version :-).
-seq="vim vim81 vim80 vim8 vim74 vim73 vim72 vim71 vim70 vim7 vim6 vi"
+seq="vim vim91 vim90 vim81 vim80 vim8 vim74 vim73 vim72 vim71 vim70 vim7 vim6 vi"
usage()
{
@@ -31,94 +30,104 @@ usage()
listOptions()
{
- declare -A language
- language[bar]=Bavarian
- language[bg]=Bulgarian
- language[ca]=Catalan
- language[cs]=Czech
- language[da]=Danish
- language[de]=German
- language[el]=Greek
- language[en]=English\(default\)
- language[eo]=Esperanto
- language[es]=Spanish
- language[fr]=French
- language[hr]=Croatian
- language[hu]=Hungarian
- language[it]=Italian
- language[ja]=Japanese
- language[ko]=Korean
- language[lv]=Latvian
- language[nb]=Bokmål
- language[nl]=Dutch
- language[no]=Norwegian
- language[pl]=Polish
- language[pt]=Portuguese
- language[ru]=Russian
- language[sk]=Slovak
- language[sr]=Serbian
- language[sv]=Swedish
- language[tr]=Turkish
- language[uk]=English
- language[vi]=Vietnamese
- language[zh]=Chinese
-
- echo "==OPTIONS======================================================================================="
- echo "Chapter: 1"
- for code in bar bg ca cs da de el en eo es fr hr hu it ja ko lv nb nl no pl pt ru sk sr sv tr uk vi zh
- do
- printf "\tLang: %s => %s\n" ${code} ${language[${code}]}
- done
- echo "Chapter: 2"
- for code in en
- do
- printf "\tLang: %s => %s\n" ${code} ${language[${code}]}
- done
- echo "================================================================================================"
+ echo "==OPTIONS======================================================================================="
+ echo "Chapter: 1"
+ printf "\tLang: %-3s => %s\n" \
+bar Bavarian \
+bg Bulgarian \
+ca Catalan \
+cs Czech \
+da Danish \
+de German \
+el Greek \
+en English\(default\) \
+eo Esperanto \
+es Spanish \
+fr French \
+hr Croatian \
+hu Hungarian \
+it Italian \
+ja Japanese \
+ko Korean \
+lv Latvian \
+nb Bokmål \
+nl Dutch \
+no Norwegian \
+pl Polish \
+pt Portuguese \
+ru Russian \
+sk Slovak \
+sr Serbian \
+sv Swedish \
+tr Turkish \
+uk English \
+vi Vietnamese \
+zh Chinese
+
+ echo "Chapter: 2"
+ printf "\tLang: %-3s => %s\n" \
+en English\(default\)
+ echo "================================================================================================"
}
validateLang()
{
- if [[ $xx =~ ^[^a-z]*$ ]]; then echo "Error: iso639 code must contain only [a-z]" && exit 1; fi
- if [ ${#xx} == 2 ] || [ ${#xx} == 3 ]; then :; else echo "Error: iso639 code must be 2 or 3 characters only" && exit 1; fi
+ case "$xx" in
+ '' | *[!a-z]* )
+ echo "Error: iso639 code must contain only [a-z]"
+ exit 1
+ esac
+
+ case "${#xx}" in
+ [23] )
+ ;;
+ * )
+ echo "Error: iso639 code must be 2 or 3 characters only"
+ exit 1
+ esac
+
export xx
}
validateChapter()
{
- if [[ $cc =~ ^[0-9]*$ ]]; then :; else echo "Error: chapter argument must contain digits only" && exit 1; fi
- if [ $cc == "0" ]; then echo "Error: chapter must be non-zero" && exit 1; fi
- if [ $cc == "00" ]; then echo "Error: chapter must be non-zero" && exit 1; fi
+ case "$cc" in
+ '' | *[!0-9]* )
+ echo "Error: chapter argument must contain digits only"
+ exit 1
+ ;;
+ 0 | 00 )
+ echo "Error: chapter must be non-zero"
+ exit 1
+ esac
+
export CHAPTER="$cc"
}
-shopt -s extglob
while [ "$1" != "" ]; do
- case $1 in
+ case "$1" in
-g | --gui ) seq="gvim gvim91 gvim90 gvim81 gvim80 gvim8 gvim74 gvim73 gvim72 gvim71 gvim70 gvim7 gvim6 $seq"
;;
-l | --language ) shift
- xx=$1
+ xx="$1"
validateLang
;;
- -l[a-z][a-z]?([a-z]) ) xx=${1#*l}
- validateLang
+ -l[a-z][a-z][a-z] | -l[a-z][a-z] )
+ export xx="${1#*l}"
;;
- --language[a-z][a-z]?([a-z]) ) xx=${1#*e}
- validateLang
+ --language[a-z][a-z][a-z] | --language[a-z][a-z] )
+ export xx="${1#*e}"
;;
- [a-z][a-z]?([a-z]) ) xx=$1
- validateLang
+ [a-z][a-z][a-z] | [a-z][a-z] ) export xx="$1"
;;
-c | --chapter ) shift
- cc=$1
+ cc="$1"
validateChapter
;;
- -c[0-9]?([0-9]) ) cc=${1#*c}
- validateChapter
+ -c[1-9][0-9] | -c[1-9] ) export CHAPTER="${1#*c}"
;;
- --chapter[0-9]?([0-9]) ) cc=${1#*r}
- validateChapter
+ --chapter[1-9][0-9] | --chapter[1-9] )
+ export CHAPTER="${1#*r}"
;;
-h | --help ) usage
exit
@@ -129,8 +138,8 @@ while [ "$1" != "" ]; do
"" ) ;;
* ) usage
exit 1
- esac
- shift
+ esac
+ shift
done
@@ -161,10 +170,10 @@ fi
export TUTORCOPY
# remove the copy of the tutor on exit
-trap "rm -rf $TODELETE" 0 1 2 3 9 11 13 15
+trap "rm -rf $TODELETE" EXIT HUP INT QUIT SEGV PIPE TERM
for i in $seq; do
- testvim=$(which $i 2>/dev/null)
+ testvim=$(command -v "$i" 2>/dev/null)
if test -f "$testvim"; then
VIM=$i
break |
|
@zzzyxwvut nice, thanks for this. I'll check it later today |
|
shellcheck will also warn for non-POSIX-portable constructs if the shebang line starts uses |
|
There will likely be other suggestions, let me draft a PR |
Updated to Vim 9.1.1128 This update contains a completely new GUI tabs implementation by @sfsam! It also contains lots of small fixes for window resizing and full screen mode that aims to make using MacVim feel rock solid and stable. Defaults Change ==================== New settings defaults related to window sizing #1528: - "Smoothly resizes window" is now on by default. MacVim's window will now resize smoothly instead of snapped to the size of the character grid. - Vim's `guioption` now has `k` set by default (`:h go-k`). This prevents MacVim's window size from changing unnecessarily when showing/hiding tabs or changing font size. These should align MacVim better with how other apps work and integrate better with OS window management, including macOS 15 Sequoia's window tiling feature. Features ==================== Tabs -------------------- MacVim has a new tabs implementation! The old version (PSMTabBarControl) is not maintained and lacks features such as overflowing tabs and customizable colors. The new tabs will overflow horizontally and are scrollable. They also animate when tabs are closed or moved, respect system settings such as right-to-left locales and high-contrast modes, and are designed to fit within the currently selected Vim colors. There are a few ways to customize the colors of the new tabs, under the "Appearance" settings pane. MacVim defaults to an "Automatic colors" mode which tries to pick sensible colors automatically based on the current foreground/background colors. However, you can also configure it to simply use the tab colors specified by the Vim color scheme (some color schemes will work better than others depending on their choice of colors). Another new option is "Use tabs background color" which when combined with "Transparent title bar" allows the title bar and tabs to look like a single cohesive whole. Relevant work: - #1120 (by @sfsam) - Also: #1535 / #1536 / #1537 / #1538 / #1539 / #1557 / #1558 / #1560 New Vim features -------------------- - new bundled color scheme: - unokai (vim/vim#16443) - new bundled optional plugins (use `packadd` to enable them): - helptoc: Use `:HelpToc` to show an interactive table of contents for Vim help, man pages, Markdown files, and terminal. vim/vim#10446 - new options: - `set diffopt+=linematch:{n}`. Matches lines better when in diff mode. v9.1.1099 - `findfunc`. Customizes `:find` and other commands. v9.1.0831 - `set completeopt+=preinsert`. Preview inserted text in completion. v9.1.1056 - `messagesopt`. Allows customizing hit-enter behavior. v9.1.0908 - new functions: - `getcellpixels()`. Query the pixel size of a character cell in the grid. v9.1.0854 / #1554 / #1555 - Vim tutor has a new interactive plugin (v9.1.0836). There is also now a chapter 2 (vim/vim#5729). Misc New Settings -------------------- - "Open untitled window" (General) has a new option to only open on MacVim re-activation. #1509 - "Show document icon at title bar" (Appearance). Previously MacVim implicitly hid the document icon when using transparent title bar. This is now customizable. #1510 General ==================== - The MacVim dmg installer has a new design. Courtesy of @jasonlong. #1540 #1545 - Legacy builds (macOS 10.9 - 10.12) are no longer built by GitHub hosted runners, due to GitHub's deprecation of old runners. They are now built by a custom self-hosted VM instead. In the future we hope to set up reproducible builds (#1506) so it will not matter who's building the app as it would be verifiable. #1559 - "Nightly" build: We now build a dmg installer for every commit. This allows for trying out the latest developmental version of MacVim, but note that the app will not be signed / notarized, and it will not be as polished as official release/pre-release builds. See [wiki](https://github.com/macvim-dev/macvim/wiki/Installing) for instructions. #1532 Fixes ==================== Apple "Intelligence" Writing Tools -------------------- macOS 15 Sequoia's Apple "Intelligence" Writing Tools should work correctly with MacVim now. To use it, select some text, right click to show menu, and then select the "Writing Tools" sub-menu. As part of this fix, the integration with the "Services" menu now works more reliably as well. You can select texts in blockwise visual mode and select a service and MacVim will try to place the new texts back to the blockwise selection if possible. #1552 Window resizing and full screen -------------------- - Flicker begone: Changing font size, showing/hiding tabs or scroll bars, or entering non-native full screen should no longer cause MacVim to flicker. Previously there could be a momentary but distracting/annoying stale image that flashes briefly. #1547 #1549 - Fixed issue where resizing MacVim window would occasionally cause Vim to be stuck in a stale wrong size. #1518 - Non-native full screen now supports `blurradius` option. #1546 - Fixed window size not always restoring correctly when exiting full screen. Non-native full screen also works more reliably in multi-monitor setup. #1525 - Fixed non-native full screen mode when using an external monitor with a MacBook with a notch, and having the "Show menu bar in non-native mode" option set. Previously MacVim would sometimes miscalculate the menu bar height in the second screen. #1548 - Fixed misc issues with non-native full screen's interaction with `fuoptions` and also the `transparency` setting, and rare crash. #1521 Other Fixes -------------------- - Fixed issue where changing font size (using Cmd =/-) with guifont set to "-monospace-" would result in guifont being changed to a confusing name like ".AppleSystemUIFontMonospaced-Regular". #1544 - "MacVim Website" menu item now goes to the updated URL. #1524 - What's New page now allows changing font size (using Cmd =/-), and showing table of contents. #1561 #1562 - Dark mode documentation is now a bit clearer on `v:os_appearance`. #1511 - Using dictionary look up on selected texts (by right clicking and then selecting "Look Up" in the pop-up menu) is now more resilient as it uses Vim's native `getregion()` to determine the selected texts. #1508 Scripting ==================== - Scripting languages versions: - Ruby is now built against 3.4, up from 3.3. - Perl is now built against 5.34, up from 5.30. Compatibility ==================== Requires macOS 10.9 or above. (10.9 - 10.12 requires downloading a separate legacy build) Script interfaces have compatibility with these versions: - Lua 5.4 - Perl 5.34 - Python2 2.7 - Python3 3.9 or above - Ruby 3.4
Updated to Vim 9.1.1128 This update contains a completely new GUI tabs implementation by @sfsam! It also contains lots of small fixes for window resizing and full screen mode that aims to make using MacVim feel rock solid and stable. Defaults Change ==================== New settings defaults related to window sizing #1528: - "Smoothly resizes window" is now on by default. MacVim's window will now resize smoothly instead of snapped to the size of the character grid. - Vim's `guioption` now has `k` set by default (`:h go-k`). This prevents MacVim's window size from changing unnecessarily when showing/hiding tabs or changing font size. These should align MacVim better with how other apps work and integrate better with OS window management, including macOS 15 Sequoia's window tiling feature. Features ==================== Tabs -------------------- MacVim has a new tabs implementation! The old version (PSMTabBarControl) is not maintained and lacks features such as overflowing tabs and customizable colors. The new tabs will overflow horizontally and are scrollable. They also animate when tabs are closed or moved, respect system settings such as right-to-left locales and high-contrast modes, and are designed to fit within the currently selected Vim colors. There are a few ways to customize the colors of the new tabs, under the "Appearance" settings pane. MacVim defaults to an "Automatic colors" mode which tries to pick sensible colors automatically based on the current foreground/background colors. However, you can also configure it to simply use the tab colors specified by the Vim color scheme (some color schemes will work better than others depending on their choice of colors). Another new option is "Use tabs background color" which when combined with "Transparent title bar" allows the title bar and tabs to look like a single cohesive whole. Relevant work: - #1120 (by @sfsam) - Also: #1535 / #1536 / #1537 / #1538 / #1539 / #1557 / #1558 / #1560 New Vim features -------------------- - new bundled color scheme: - unokai (vim/vim#16443) - new bundled optional plugins (use `packadd` to enable them): - helptoc: Use `:HelpToc` to show an interactive table of contents for Vim help, man pages, Markdown files, and terminal. vim/vim#10446 - new options: - `set diffopt+=linematch:{n}`. Matches lines better when in diff mode. v9.1.1099 - `findfunc`. Customizes `:find` and other commands. v9.1.0831 - `set completeopt+=preinsert`. Preview inserted text in completion. v9.1.1056 - `messagesopt`. Allows customizing hit-enter behavior. v9.1.0908 - new functions: - `getcellpixels()`. Query the pixel size of a character cell in the grid. v9.1.0854 / #1554 / #1555 - Vim tutor has a new interactive plugin (v9.1.0836). There is also now a chapter 2 (vim/vim#5729). Misc New Settings -------------------- - "Open untitled window" (General) has a new option to only open on MacVim re-activation. #1509 - "Show document icon at title bar" (Appearance). Previously MacVim implicitly hid the document icon when using transparent title bar. This is now customizable. #1510 General ==================== - The MacVim dmg installer has a new design. Courtesy of @jasonlong. #1540 #1545 - Legacy builds (macOS 10.9 - 10.12) are no longer built by GitHub hosted runners, due to GitHub's deprecation of old runners. They are now built by a custom self-hosted VM instead. In the future we hope to set up reproducible builds (#1506) so it will not matter who's building the app as it would be verifiable. #1559 - "Nightly" build: We now build a dmg installer for every commit. This allows for trying out the latest developmental version of MacVim, but note that the app will not be signed / notarized, and it will not be as polished as official release/pre-release builds. See [wiki](https://github.com/macvim-dev/macvim/wiki/Installing) for instructions. #1532 Fixes ==================== Apple "Intelligence" Writing Tools -------------------- macOS 15 Sequoia's Apple "Intelligence" Writing Tools should work correctly with MacVim now. To use it, select some text, right click to show menu, and then select the "Writing Tools" sub-menu. As part of this fix, the integration with the "Services" menu now works more reliably as well. You can select texts in blockwise visual mode and select a service and MacVim will try to place the new texts back to the blockwise selection if possible. #1552 Window resizing and full screen -------------------- - Flicker begone: Changing font size, showing/hiding tabs or scroll bars, or entering non-native full screen should no longer cause MacVim to flicker. Previously there could be a momentary but distracting/annoying stale image that flashes briefly. #1547 #1549 - Fixed issue where resizing MacVim window would occasionally cause Vim to be stuck in a stale wrong size. #1518 - Non-native full screen now supports `blurradius` option. #1546 - Fixed window size not always restoring correctly when exiting full screen. Non-native full screen also works more reliably in multi-monitor setup. #1525 - Fixed non-native full screen mode when using an external monitor with a MacBook with a notch, and having the "Show menu bar in non-native mode" option set. Previously MacVim would sometimes miscalculate the menu bar height in the second screen. #1548 - Fixed misc issues with non-native full screen's interaction with `fuoptions` and also the `transparency` setting, and rare crash. #1521 Other Fixes -------------------- - Fixed issue where changing font size (using Cmd =/-) with guifont set to "-monospace-" would result in guifont being changed to a confusing name like ".AppleSystemUIFontMonospaced-Regular". #1544 - "MacVim Website" menu item now goes to the updated URL. #1524 - What's New page now allows changing font size (using Cmd =/-), and showing table of contents. #1561 #1562 - Dark mode documentation is now a bit clearer on `v:os_appearance`. #1511 - Using dictionary look up on selected texts (by right clicking and then selecting "Look Up" in the pop-up menu) is now more resilient as it uses Vim's native `getregion()` to determine the selected texts. #1508 Scripting ==================== - Scripting languages versions: - Ruby is now built against 3.4, up from 3.3. - Perl is now built against 5.34, up from 5.30. Compatibility ==================== Requires macOS 10.9 or above. (10.9 - 10.12 requires downloading a separate legacy build) Script interfaces have compatibility with these versions: - Lua 5.4 - Perl 5.34 - Python2 2.7 - Python3 3.9 or above - Ruby 3.4
Add main English file
runtime/tutor/tutor02Add copy of
tutor02attutor02.utf-8Add source file
tutor02.vimEdit man page
Edit main script
src/vimtutor