-
-
Notifications
You must be signed in to change notification settings - Fork 233
VimR MacVim
You can customise the menu key bindings by putting the following in ${HOME}/.vimr_rc
global.keybinding.menuitem.file.new = @-a
global.keybinding.menuitem.file.open-in-tab = @-$-a
global.keybinding.menuitem.file.save-as =
# more keys described below
If a key is set to blank, then the menu item will have no key binding. For instance the following
global.keybinding.menuitem.file.save-as =
will set the binding of Save As... to empty, i.e. Command-Shift-s will be forwarded to Vim. When a key does not have an entry in .vimr_rc, the default binding will not be changed.
-
@for Command -
~for Option -
^for Control -
$for Shift
- Any one character (to avoid weird effects, you should use only alphanumeric characters and simple symbols like
-, i.e. avoid characters likeμ) -
^[for Escape
Each component of the binding is separated by -
-
@-afor Command a -
^-$-afor Control Shift a -
@-$-1for Command Shift 1 -
@--for Command - -
^[for Escape
global.keybinding.menuitem.file.new
global.keybinding.menuitem.file.new-tab
global.keybinding.menuitem.file.open
global.keybinding.menuitem.file.open-in-tab
global.keybinding.menuitem.file.open-quickly
global.keybinding.menuitem.file.close
global.keybinding.menuitem.file.save
global.keybinding.menuitem.file.save-as
global.keybinding.menuitem.file.revert-to-saved
global.keybinding.menuitem.edit.undo
global.keybinding.menuitem.edit.redo
global.keybinding.menuitem.edit.cut
global.keybinding.menuitem.edit.copy
global.keybinding.menuitem.edit.paste
global.keybinding.menuitem.edit.delete
global.keybinding.menuitem.edit.select-all
global.keybinding.menuitem.view.focus-file-browser
global.keybinding.menuitem.view.focus-text-area
global.keybinding.menuitem.view.show-file-browser
global.keybinding.menuitem.view.put-file-browser-on-right
global.keybinding.menuitem.view.show-status-bar
global.keybinding.menuitem.view.font.show-fonts
global.keybinding.menuitem.view.font.bigger
global.keybinding.menuitem.view.font.smaller
global.keybinding.menuitem.view.enter-full-screen
global.keybinding.menuitem.navigate.show-folders-first
global.keybinding.menuitem.navigate.show-hidden-files
global.keybinding.menuitem.navigate.sync-vim-pwd
global.keybinding.menuitem.preview.show-preview
global.keybinding.menuitem.preview.refresh
global.keybinding.menuitem.window.minimize
global.keybinding.menuitem.window.zoom
global.keybinding.menuitem.window.select-next-tab
global.keybinding.menuitem.window.select-previous-tab
global.keybinding.menuitem.window.bring-all-to-front
global.keybinding.menuitem.help.vimr-help
To turn off or change the modifiers for the select n-th tab bindings, turned on to Command-[1-9] by default, you can use the following entries in ${HOME}/.vimr_rc
global.keybinding.select-nth-tab.active = false
global.keybinding.select-nth-tab.modifier = @-$
The characters and syntax for modifiers are the same as for the custom menu item customisation (described above), however you can only customise the modifiers. The possible values for global.keybinding.select-nth-tab.active are true and false.
Put the following in your .vimrc
if has("gui_vimr")
" VimR specific stuff
endif
if has("gui_macvim")
" MacVim specific stuff
endif
Assuming that you selected Open in a new tab for the Default Opening Behavior in the Preferences window:
-
double-click- open in a new tab -
⌃⌥-double-click- open in the current tab -
⌥-double-click- open in a vertical split -
⌃-double-click- open in a horizontal split
-
h- open with default open setting -
j- move selection down -
k- move selection up -
l- open with default open setting -
Esc- focus vim view
-
Space- open with default open setting -
CR- open with default open setting -
o- open with default open setting -
t- open in new tab -
s- open in vertical split -
i- open in horizontal split -
/- search - select next node containing string -
m- display node manipulation menu -Actions: (a)dd (m)ove (d)elete (c)opy -
n- search (forward) using last search string -
N- search backward using last search string
Search (/) and menu (m) are modal actions. Feedback is displayed via the status bar. Esc can be used to cancel either mode and return to "normal mode". In normal mode Esc reassumes its normal function: focus vim view.
Basic line editing is supported with feedback displayed via the status bar. Type /, enter a search string, and then type CR to perform the search.
Actions: (a)dd (m)ove (d)elete (c)opy
A node can be added by typing a and then entering the name of the node to add. names ending in / will create a directory.
-
mcan be used to move/rename the selected node. The user is prompted if this action would clobber an existing file.
-
ddeletes the selected node. A confirmation prompt is displayed and the user must typeyto actually delete the node, ornto cancel. Directories can only be deleted if empty.
-
ccan be used to copy the selected node to the named location. The user is prompted if this action would clobber an existing file.
A workspace is the common directory of open files of one window. The Open Quickly action indexes the workspace and the workspace is set as follows
- New file ➞
~ - Open files ➞ the common parent directory of open files (of a window)
If you have Keep the working directory in sync with Vim's 'pwd' option turned on, the workspace will be the containing directory of your current open file.
Note, that we do not yet handle symlinks, aliases, etc. correctly.
To filter out some folders or files, create .vimr_rc in your home folder with the following content
open.quickly.ignore.patterns = */.git, */.hg, .DS_Store, */target, */*.xcodeproj
Shell wildcard patterns are supported, however following additional rules apply:
-
*/FOLDER_NAME: If a pattern begins with*/, then it is treated as a folder ignore pattern, i.e. all files in the folder are ignored (the absolute path is matched against*/FOLDER_NAME). Otherwise only the file name is matched. -
\is treated as literal back slash
Some examples are
- the pattern
*/.gitmatches/a/b/.git/c/d - the pattern
.vimr_rcmatches/a/b/.vimr_rc, but does not match/a/b/.vimr_rc/config - the pattern
.gitignorematches/a/b/.gitignore - the pattern
*.imlmatches/a/b/c/test.iml - the pattern
*/.git/somematches/a/b/.git/somepath/branch.config - the pattern
*/*.xcodeprojmatches/a/b/VimR.xcodeproj/project.xml
To use the inverse search for LaTeX, you can use the command line tool vimr which is [bundled](Command Line Tool) with VimR
vimr -l %line "%file"
For example with Skim
VimR comes with a command-line tool vimr.
$ vimr file1 file2 ... # opens file1, file2, ... in tabs in the front most window.
$ vimr -n file1 file2 ... # opens file1, file2, ... in tabs in a new window.
$ vimr -m file1 file2 ... # opens file1, file2, ... in separate new windows
$ vimr -l 10 file1 # go to line 10 of file1 (file1 is either opened or brought to front)
$ vimr -h # show help
It can be installed via Preferences ➝ General ➝ "Copy 'vimr' CLI Tool..." button as shown below
Save the tool in your PATH.
The communication between the script and VimR is done via AppleScript. If you want to use AppleScript for above tasks, open the dictionary of VimR with Script Editor.
-
^-⌘-0: to focus the file browser -
Esc: to unfocus the file browser, ie to focus the Vim view again -
⌘-1to⌘-9to select the n-th tab