Skip to content

Commit 8706786

Browse files
authored
Merge pull request #1096 from ychin/macvim-vimtutor
Bundle vimtutor with MacVim and provide Help menu item to open it
2 parents d0139e4 + fcd5797 commit 8706786

File tree

5 files changed

+48
-2
lines changed

5 files changed

+48
-2
lines changed

runtime/doc/usr_01.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ On Unix, if Vim has been properly installed, you can start it from the shell:
118118
On MS-Windows you can find it in the Program/Vim menu. Or execute
119119
vimtutor.bat in the $VIMRUNTIME directory.
120120

121+
On MacVim, you can run `vimtutor` from the shell, or select "Vim Tutor" in the
122+
Help menu.
123+
121124
This will make a copy of the tutor file, so that you can edit it without
122125
the risk of damaging the original.
123126
There are a few translated versions of the tutor. To find out if yours is

runtime/menu.vim

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,17 @@ endif
9999
" Help menu
100100
if has("gui_macvim")
101101
an 9999.1 &Help.MacVim\ Help :h gui_mac<CR>
102+
tln 9999.1 &Help.MacVim\ Help <C-W>:h gui_mac<CR>
102103
an <silent> 9999.2 Help.MacVim\ Website <Nop>
103104
an 9999.3 &Help.-sep0- <Nop>
104105
endif
106+
if has("gui_macvim")
107+
" Run vimtutor in GUI mode. Need to make sure to override the PATH so we use
108+
" this app instead of accidentally opening another installed Vim/MacVim.
109+
an 9999.5 &Help.Vim\ Tutor :silent !PATH="$VIM/../../bin":/usr/bin:/bin:/usr/sbin:/sbin $VIM/../../bin/vimtutor -g&<CR>
110+
tln 9999.5 &Help.Vim\ Tutor <C-W>:silent !PATH="$VIM/../../bin":/usr/bin:/bin:/usr/sbin:/sbin $VIM/../../bin/vimtutor -g&<CR>
111+
an 9999.6 &Help.-sep-vim-tutor- <Nop>
112+
endif
105113
an 9999.10 &Help.&Overview<Tab><F1> :help<CR>
106114
an 9999.20 &Help.&User\ Manual :help usr_toc<CR>
107115
an 9999.30 &Help.&How-To\ Links :help how-to<CR>
@@ -115,6 +123,19 @@ an 9999.75 &Help.-sep2- <Nop>
115123
an 9999.80 &Help.&Version :version<CR>
116124
an 9999.90 &Help.&About :intro<CR>
117125

126+
tln 9999.10 &Help.&Overview<Tab><F1> <C-W>:help<CR>
127+
tln 9999.20 &Help.&User\ Manual <C-W>:help usr_toc<CR>
128+
tln 9999.30 &Help.&How-To\ Links <C-W>:help how-to<CR>
129+
tln <silent> 9999.40 &Help.&Find\.\.\. <C-W>:call <SID>Helpfind()<CR>
130+
tln 9999.45 &Help.-sep1- <Nop>
131+
tln 9999.50 &Help.&Credits <C-W>:help credits<CR>
132+
tln 9999.60 &Help.Co&pying <C-W>:help copying<CR>
133+
tln 9999.70 &Help.&Sponsor/Register <C-W>:help sponsor<CR>
134+
tln 9999.70 &Help.O&rphans <C-W>:help kcc<CR>
135+
tln 9999.75 &Help.-sep2- <Nop>
136+
tln 9999.80 &Help.&Version <C-W>:version<CR>
137+
tln 9999.90 &Help.&About <C-W>:intro<CR>
138+
118139
fun! s:Helpfind()
119140
if !exists("g:menutrans_help_dialog")
120141
let g:menutrans_help_dialog = "Enter a command or word to find help on:\n\nPrepend i_ for Input mode commands (e.g.: i_CTRL-X)\nPrepend c_ for command-line editing commands (e.g.: c_<Del>)\nPrepend ' for an option name (e.g.: 'shiftwidth')"

src/MacVim/MMAppController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ - (void)refreshMainMenu
906906
// of Screen" to the Window menu, and on repeated calls it will keep adding
907907
// the same item over and over again, without resolving for duplicates. Using
908908
// copies help keep the source menu clean.
909-
NSMenu *mainMenu = [currentMainMenu copy];
909+
NSMenu *mainMenu = [[currentMainMenu copy] autorelease];
910910

911911
// If the new menu has a "Recent Files" dummy item, then swap the real item
912912
// for the dummy. We are forced to do this since Cocoa initializes the

src/MacVim/MacVim.xcodeproj/project.pbxproj

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -840,6 +840,7 @@
840840
1D1C31F00EFFBFD6003FE9A5 /* Make Document Icons */,
841841
528DA6671426D456003380F1 /* Copy Scripts */,
842842
52283AB71EBA200C00A6F6B9 /* Copy mvim scripts */,
843+
90C052E1251E889500E2D81E /* Copy vimtutor */,
843844
);
844845
buildRules = (
845846
);
@@ -1003,6 +1004,26 @@
10031004
shellScript = "# Copy all the locale translation files from the po folder to\n# runtime/lang/<lang>/LC_MESSAGES/vim.mo. Need to do this because unlike normal\n# Vim, MacVim is distributed as a standalone app package and therefore we don't\n# want to install these files to a global location (e.g.\n# /usr/local/share/locale/). This is similar to how Windows installation\n# (po/Make_mvc.mak) works.\ncd \"${SRCROOT}\"/..\nmake macvim-install-languages DEST_LANG=\"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/vim/runtime/lang\"\n";
10041005
showEnvVarsInLog = 0;
10051006
};
1007+
90C052E1251E889500E2D81E /* Copy vimtutor */ = {
1008+
isa = PBXShellScriptBuildPhase;
1009+
alwaysOutOfDate = 1;
1010+
buildActionMask = 2147483647;
1011+
files = (
1012+
);
1013+
inputFileListPaths = (
1014+
);
1015+
inputPaths = (
1016+
);
1017+
name = "Copy vimtutor";
1018+
outputFileListPaths = (
1019+
);
1020+
outputPaths = (
1021+
);
1022+
runOnlyForDeploymentPostprocessing = 0;
1023+
shellPath = /bin/sh;
1024+
shellScript = "BINPATH=$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/bin\nmkdir -p \"${BINPATH}\"\ncp -a \"${SRCROOT}/../vimtutor\" \"${BINPATH}/vimtutor\"\ncp -a \"${SRCROOT}/../gvimtutor\" \"${BINPATH}/gvimtutor\"\nchmod 755 \"${BINPATH}/vimtutor\"\nchmod 755 \"${BINPATH}/gvimtutor\"\ncd \"${BINPATH}\"\nln -fs gvimtutor mvimtutor \n";
1025+
showEnvVarsInLog = 0;
1026+
};
10061027
/* End PBXShellScriptBuildPhase section */
10071028

10081029
/* Begin PBXSourcesBuildPhase section */

src/testdir/test_gui.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ func Test_menu()
744744

745745
" Check deleting menu doesn't cause trouble.
746746
aunmenu Help
747+
tlunmenu Help
747748
call assert_fails('menu Help', 'E329:')
748749
endfunc
749750

0 commit comments

Comments
 (0)