Skip to content

Commit 3df190c

Browse files
committed
Fix MMShareFindPboard not working properly and update docs
MMShareFindPboard is supposed to prevent MacVim from updating the system find pasteboard when searching, but the previous behavior was that it would only set the Vim-specific format to the find pasteboard so you could still share search patterns across Vim windows but it has the effect of clearing the global find pasteboard. Just fix that by making MacVim not touch the system find pasteboard at all when MMShareFindPboard is set to NO to respect user's wish. Cmd-G will still use the system find pasteboard to make it easy to search in another macOS program and jump to Vim. The user can always use `n` instead if that's not desired. Also update docs to make this clear, and rename all "OS X" to "macOS" to keep up with the times. Close #773
1 parent 2c43cd6 commit 3df190c

5 files changed

Lines changed: 71 additions & 48 deletions

File tree

runtime/doc/gui_mac.txt

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Other relevant documentation:
3030
==============================================================================
3131
1. MacVim differences *macvim-differences*
3232

33-
One of the goals of MacVim is to make Vim behave like a proper Mac OS X
33+
One of the goals of MacVim is to make Vim behave like a proper macOS
3434
application. For this reason MacVim behaves slightly different from other GUI
3535
ports of Vim. Most of the modifications are provided in the system gvimrc
3636
file; you can quickly open this file and look at it yourself by typing: >
@@ -65,8 +65,8 @@ file at all. In this situation, you will need to set both 'encoding' and
6565
the file is read into memory, the original bytes are left untouched.
6666

6767
*macvim-shift-movement*
68-
Text editors on Mac OS X lets the user hold down shift+movement key to extend
69-
the selection. Also, pressing a printable key whilst selecting replaces the
68+
Text editors on macOS lets the user hold down shift+movement key to extend the
69+
selection. Also, pressing a printable key whilst selecting replaces the
7070
current selection with that character. MacVim can emulate this kind of
7171
behaviour (by providing key bindings and by setting 'keymodel' and
7272
'selectmode' to non-default values) although it is not enabled by default. To
@@ -121,14 +121,19 @@ These are the non-standard commands that MacVim supports:
121121

122122
*macvim-find*
123123
Whenever you search for something in Vim (e.g. using "/") the search query is
124-
copied to the OS X "Find Pasteboard". The idea is that if you search for
124+
copied to the macOS "Find Pasteboard". The idea is that if you search for
125125
something and switch to another application, then you can hit <D-g> (or <D-G>)
126126
to repeat the search in the new app. The same feature works if you search in
127127
some app, switch to MacVim and hit <D-g>.
128128

129+
If you would like to turn off sharing Vim's search query to the macOS Find
130+
Pasteboard, you can set |MMShareFindPboard| to "NO". <D-g> will still use the
131+
OS Find Pasteboard for searching though (use |n| instead if that's not what
132+
you want).
133+
129134
Note that the command |n| is not the same as <D-g>. The former will repeat
130135
the last search made in Vim, whereas the latter searches for the string on the
131-
OS X Find Pasteboard using the action findNext: (see |:macaction|).
136+
macOS Find Pasteboard using the action findNext: (see |:macaction|).
132137

133138
The <D-g> key equivalent is a great way to bring a search from one window to
134139
another in MacVim. Simply search for something in one window (using "/") then
@@ -156,7 +161,7 @@ up the "Open with" menu. You can also drag and drop files onto the Dock icon
156161
to open them in tabs in a new window, or you can drop them in an already open
157162
window to open the files in tabs in that specific window (it is possible to
158163
have files open in e.g. splits by changing the "Open files from applications"
159-
option in the General preference pane). Finally, you can use Mac OS X System
164+
option in the General preference pane). Finally, you can use macOS System
160165
Services to open files in MacVim, see |macvim-services|.
161166

162167
Use |mvim| script to start MacVim from Terminal.
@@ -206,9 +211,9 @@ history as the window you just closed (however the next window you open will).
206211
For these reasons Quickstart is disabled by default.
207212

208213
*odbeditor* *external-editor*
209-
MacVim can act as an 'external editor' for Mac OS X applications that support
210-
the ODB Editor Protocol (or the 'external editor' protocol). Each application
211-
has different ways of configuring this option, check the application's
214+
MacVim can act as an 'external editor' for macOS applications that support the
215+
ODB Editor Protocol (or the 'external editor' protocol). Each application has
216+
different ways of configuring this option, check the application's
212217
documentation. Once configured properly MacVim can be used to open files in
213218
such an application.
214219

@@ -231,32 +236,32 @@ circumstances. These options can still be changed with the "defaults" command
231236
by opening Terminal and typing >
232237
defaults write org.vim.MacVim KEY VALUE
233238
Check the man page on "defaults" for more information on this command as well
234-
as general information regarding Mac OS X user defaults.
239+
as general information regarding macOS user defaults.
235240

236241
Here is a list of relevant dictionary entries:
237242

238243
KEY VALUE ~
239-
MMCellWidthMultiplier width of a normal glyph in em units [float]
240-
MMDialogsTrackPwd open/save dialogs track the Vim pwd [bool]
241-
MMFullScreenFadeTime fade delay for non-native fullscreen [float]
242-
MMLoginShellArgument login shell parameter [string]
243-
MMLoginShellCommand which shell to use to launch Vim [string]
244-
MMNoFontSubstitution disable automatic font substitution [bool]
245-
MMNoTitleBarWindow hide title bar [bool]
246-
MMShareFindPboard share search text to Find Pasteboard [bool]
247-
MMShowAddTabButton enable "add tab" button on tabline [bool]
248-
MMTabMaxWidth maximum width of a tab [int]
249-
MMTabMinWidth minimum width of a tab [int]
250-
MMTabOptimumWidth default width of a tab [int]
251-
MMTextInsetBottom text area offset in pixels [int]
252-
MMTextInsetLeft text area offset in pixels [int]
253-
MMTextInsetRight text area offset in pixels [int]
254-
MMTextInsetTop text area offset in pixels [int]
255-
MMTexturedWindow use brushed metal window (Tiger only) [bool]
256-
MMTranslateCtrlClick interpret ctrl-click as right-click [bool]
257-
MMUseMouseTime use mousetime to detect multiple clicks [bool]
258-
MMVerticalSplit files open in vertical splits [bool]
259-
MMZoomBoth zoom button maximizes both directions [bool]
244+
*MMCellWidthMultiplier* width of a normal glyph in em units [float]
245+
*MMDialogsTrackPwd* open/save dialogs track the Vim pwd [bool]
246+
*MMFullScreenFadeTime* fade delay for non-native fullscreen [float]
247+
*MMLoginShellArgument* login shell parameter [string]
248+
*MMLoginShellCommand* which shell to use to launch Vim [string]
249+
*MMNoFontSubstitution* disable automatic font substitution [bool]
250+
*MMNoTitleBarWindow* hide title bar [bool]
251+
*MMShareFindPboard* share search text to Find Pasteboard [bool]
252+
*MMShowAddTabButton* enable "add tab" button on tabline [bool]
253+
*MMTabMaxWidth* maximum width of a tab [int]
254+
*MMTabMinWidth* minimum width of a tab [int]
255+
*MMTabOptimumWidth* default width of a tab [int]
256+
*MMTextInsetBottom* text area offset in pixels [int]
257+
*MMTextInsetLeft* text area offset in pixels [int]
258+
*MMTextInsetRight* text area offset in pixels [int]
259+
*MMTextInsetTop* text area offset in pixels [int]
260+
*MMTexturedWindow* use brushed metal window (Tiger only) [bool]
261+
*MMTranslateCtrlClick* interpret ctrl-click as right-click [bool]
262+
*MMUseMouseTime* use mousetime to detect multiple clicks [bool]
263+
*MMVerticalSplit* files open in vertical splits [bool]
264+
*MMZoomBoth* zoom button maximizes both directions [bool]
260265

261266
As an example, if you have more than one mouse button and would wish to free
262267
up Ctrl-click so you can bind it to something else, then the appropriate
@@ -337,9 +342,9 @@ highlight color when a window becomes inactive.
337342
==============================================================================
338343
5. Menus *macvim-menus*
339344

340-
Menus in Mac OS X behave slightly different from other platforms. For that
345+
Menus in macOS behave slightly different from other platforms. For that
341346
reason two new commands have been added to Vim. To understand what these
342-
commands do you must first understand how menus work on OS X.
347+
commands do you must first understand how menus work on macOS.
343348

344349
Each entry in a menu is called a "menu item". With each menu item is
345350
associated: a title, a key equivalent and an action message. When a menu is
@@ -348,7 +353,7 @@ shown on the right. Key equivalents enable you to access a menu item using
348353
the keyboard instead of having to use the mouse. When a menu item is clicked
349354
it will send its associated action message. Actions can be used to instruct
350355
MacVim to paste some text (paste:), open a new window (newWindow:), etc.
351-
Certain actions are standard throughout OS X which is why MacVim must be able
356+
Certain actions are standard throughout macOS which is why MacVim must be able
352357
to set these for each menu item. (E.g. the menu item "Edit.Paste" must be
353358
bound to the action "paste:" otherwise pasting won't work in dialogs since
354359
that is the action that instructs them to paste something.)
@@ -471,7 +476,7 @@ whose name begins with "-space" ("-flexspace") and ends with "-"
471476
Toolbar icons should be tiff, png, icns, or heic, of dimension 32x32 or 24x24
472477
pixels. The larger size is used when 'tbis' is "medium" or "large", otherwise
473478
the smaller size is used (which is the default). If the icon file only
474-
contains one dimension then Mac OS X will scale the icon to the appropriate
479+
contains one dimension then macOS will scale the icon to the appropriate
475480
dimension if necessary. To avoid this, use a file format which supports
476481
multiple resolutions (such as icns) and provide both 32x32 and 24x24 versions
477482
of the icon.
@@ -532,8 +537,7 @@ outline.
532537
MacVim supports two system services. These can be accessed from the MacVim
533538
submenu in the Services menu or by right-clicking a selection. For services
534539
to work, MacVim.app should be located in the /Applications folder. (You might
535-
have to logout and then login again before Mac OS X detects the MacVim
536-
services.)
540+
have to logout and then login again before macOS detects the MacVim services.)
537541

538542
These are the currently supported services:
539543
* New MacVim Buffer With Selection: Create a new buffer and paste the
@@ -640,7 +644,7 @@ sometimes be slightly involved. Here are all the things you need to consider:
640644
- Bindings to <D-..> are case sensitive: <D-d> is not the same as <D-D>. If
641645
you want to map something to Cmd+Shift+d, then you need to use <D-D>, not
642646
<D-S-d> or <D-S-D>.
643-
- Some command key shortcuts are reserved by Mac OS X and cannot be mapped to
647+
- Some command key shortcuts are reserved by macOS and cannot be mapped to
644648
(e.g. <D-Tab>). However, some of these shortcuts can be freed up in the
645649
System Preferences under Keyboard (e.g. Cmd+Space).
646650
- A few command key mappings are set up by MacVim, see |cmd-movement|.
@@ -685,9 +689,9 @@ See the section on |key-mapping| for more help on how to map keys.
685689

686690
When editing non-English text it may be convenient to keep separate keyboard
687691
layouts for normal and insert mode. This is supported via the 'imd' option on
688-
Mac OS X 10.5 or later (on 10.4 the 'imd' option support is not as useful as
689-
it only switches between Roman and non-Roman input sources and it has been
690-
known not to work very reliably).
692+
macOS 10.5 or later (on 10.4 the 'imd' option support is not as useful as it
693+
only switches between Roman and non-Roman input sources and it has been known
694+
not to work very reliably).
691695

692696
For example: When 'noimd' is enabled (i.e. IM is enabled) the input source is
693697
saved when toggling between normal and insert mode, so you can use a US layout

runtime/doc/tags

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4801,6 +4801,27 @@ Macintosh os_mac.txt /*Macintosh*
48014801
Mark motion.txt /*Mark*
48024802
MenuPopup autocmd.txt /*MenuPopup*
48034803
MiNT os_mint.txt /*MiNT*
4804+
MMCellWidthMultiplier gui_mac.txt /*MMCellWidthMultiplier*
4805+
MMDialogsTrackPwd gui_mac.txt /*MMDialogsTrackPwd*
4806+
MMFullScreenFadeTime gui_mac.txt /*MMFullScreenFadeTime*
4807+
MMLoginShellArgument gui_mac.txt /*MMLoginShellArgument*
4808+
MMLoginShellCommand gui_mac.txt /*MMLoginShellCommand*
4809+
MMNoFontSubstitution gui_mac.txt /*MMNoFontSubstitution*
4810+
MMNoTitleBarWindow gui_mac.txt /*MMNoTitleBarWindow*
4811+
MMShareFindPboard gui_mac.txt /*MMShareFindPboard*
4812+
MMShowAddTabButton gui_mac.txt /*MMShowAddTabButton*
4813+
MMTabMaxWidth gui_mac.txt /*MMTabMaxWidth*
4814+
MMTabMinWidth gui_mac.txt /*MMTabMinWidth*
4815+
MMTabOptimumWidth gui_mac.txt /*MMTabOptimumWidth*
4816+
MMTextInsetBottom gui_mac.txt /*MMTextInsetBottom*
4817+
MMTextInsetLeft gui_mac.txt /*MMTextInsetLeft*
4818+
MMTextInsetRight gui_mac.txt /*MMTextInsetRight*
4819+
MMTextInsetTop gui_mac.txt /*MMTextInsetTop*
4820+
MMTexturedWindow gui_mac.txt /*MMTexturedWindow*
4821+
MMTranslateCtrlClick gui_mac.txt /*MMTranslateCtrlClick*
4822+
MMUseMouseTime gui_mac.txt /*MMUseMouseTime*
4823+
MMVerticalSplit gui_mac.txt /*MMVerticalSplit*
4824+
MMZoomBoth gui_mac.txt /*MMZoomBoth*
48044825
Moolenaar intro.txt /*Moolenaar*
48054826
MorphOS os_amiga.txt /*MorphOS*
48064827
Motif gui_x11.txt /*Motif*

runtime/menu.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ elseif has("gui_macvim")
231231
vnoremenu <silent> &Edit.Find.Find\.\.\. y:promptfind <C-R>=<SID>FixFText()<CR><CR>
232232
an 20.410.20 &Edit.Find.Find\ Next <Nop>
233233
an 20.410.30 &Edit.Find.Find\ Previous <Nop>
234-
vmenu 20.410.35 &Edit.Find.Use\ Selection\ for\ Find y:let @/=@"<CR>:<BS>
234+
vnoremenu 20.410.35 &Edit.Find.Use\ Selection\ for\ Find y:let @/=@"<CR>:<BS>
235235
else
236236
an 20.410 &Edit.&Find<Tab>/ /
237237
an 20.420 &Edit.Find\ and\ Rep&lace<Tab>:%s :%s/

src/MacVim/MMWindowController.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,10 +1582,7 @@ - (void)doFindNext:(BOOL)next
15821582
if ([bestType isEqual:VimFindPboardType]) {
15831583
query = [pb stringForType:VimFindPboardType];
15841584
} else {
1585-
BOOL shareFindPboard = [[NSUserDefaults standardUserDefaults]
1586-
boolForKey:MMShareFindPboardKey];
1587-
if (shareFindPboard)
1588-
query = [pb stringForType:NSStringPboardType];
1585+
query = [pb stringForType:NSStringPboardType];
15891586
}
15901587
}
15911588

src/MacVim/gui_macvim.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,8 @@
18701870
{
18711871
if (!pat) return;
18721872

1873+
if (!MMShareFindPboard) return;
1874+
18731875
#ifdef FEAT_MBYTE
18741876
pat = CONVERT_TO_UTF8(pat);
18751877
#endif
@@ -1891,8 +1893,7 @@
18911893
// The second entry will be used by other applications when taking entries
18921894
// off the Find pasteboard, whereas MacVim will use the first if present.
18931895
[pb setString:s forType:VimFindPboardType];
1894-
if (MMShareFindPboard)
1895-
[pb setString:[s stringByRemovingFindPatterns] forType:NSStringPboardType];
1896+
[pb setString:[s stringByRemovingFindPatterns] forType:NSStringPboardType];
18961897
}
18971898

18981899
void

0 commit comments

Comments
 (0)