1. introduction
  2. basics
  3. commands
  4. search
  5. visual mode
  6. configuration
  7. commandline commands
  8. macros
  9. marks and registers
  10. optional plugins

Command-Line Commands

This page describes the commands available within the command-line : mode.

Commands may be chained with a | character between them. For example:
:'<,'>s/foo/bar/g | '<,'>s/baz/bat/g

Vrapper allows abbreviated commands only when there are no conflicts (e.g. custom commands defined in .vrapperrc).

Command Description
:w
:update
Writes the edited file to disk.
:wa[ll] Writes all edited files to disk.
:q Closes the editor if nothing was changed since the last save.
:qall Closes all editors if nothing was changed since the last save.
:wq
:x
Writes the edited file to disk and closes the editor.
:wqall
:xall
Writes all edited files to disk and closes all editors.
:q! Closes the editor even if there are unsaved changes.
:u
:undo
Undoes the last change.
:red[o] Redoes an undone change.
:fm
:format
Calls the formatter of the underlying editor if present.
The formatter will be applied to the current selection or the whole text if nothing is selected.
:ascii Display the ascii value of the character under the cursor
:<number> Jumps to line <number>.
:e[dit] <filename> Opens a file relative to the current working directory.
If <filename> doesn't exist, create a new file in the current working directory.
:e[dit] Refresh current file
:e[dit]! Revert changes to current file
:cd <directory> Changes current working directory (used by :e[dit] command).
:pwd Print current working directory.
:find <filename>
:tabfind <filename>
Opens a file found in the list of directories defined by path variable.
:tabnext
:bn[ext]
Move to next Eclipse editor (tab)
:tabprevious
:bp[revious]
Move to previous Eclipse editor (tab)
:tabrewind Move to first Eclipse editor (tab)
:tablast Move to last Eclipse editor (tab)
:files List all open files in the current block of editors in the Eclipse UI. Editors which are open in another split are not listed.
:buffers
:ls
List all recently-seen buffers and their ids. The currently active buffer is marked with '%', the previously active buffer is marked with '#'.
:b[uffer ]<buffer id> Switch to the buffer with the given id. The special '%' and '#' ids are also allowed. See :buffers above.
:bd[elete] Close current editor (tab)
:registers List current registers and their contents
:marks List current marks and their locations
:delmarks[!][marks]

Delete specified mark, or delete all marks with :delmarks!

Formats supported:

  • :delmarks a
  • :delmarks a b c
  • :delmarks abc
  • :delmarks a-e
:only
:tabonly
Close all "other" Eclipse editors (close other tabs)
:tabnew Invoke Eclipse's New File dialog
:tabs Display open files (tabs)
:noh[lsearch] Clear the current search highlight without disabling the search highlight feature.
:source <filename> Include another config file (e.g. :source .vimrc) to extend current configuration.
:let @<char>=<register contents>

Programmatically set register contents for register <char>. Register can then be executed as a macro.

You can also set the contents of one register to the contents of another with @<char>=@<char>.

Note that the search register is special: setting it to an empty string will clear search highlighting, setting it to a given value will activate a search query for the given string with defaults (forward, any part of a word, ...) or use settings from the last given search query after which the highlighting will be updated (when hlsearch is enabled).

:let mapleader=<character> Set the value of <Leader> for use in mappings.
:command <name> <command> Defines a custom command-line command <name> which will execute the command <command>. Note that <command> can use | to chain multiple commands to a single <name>.

Example:
:command MyReplace s/foo/bar/g | s/baz/bat/g
would be executed with :MyReplace
:<range>!<command> Execute a shell command with the text from the given range as input, replacing that text with the output.
Examples:
  • :%!xmllint --format -
  • :'<,'>!tr -d [:space:]
:r!<command> Execute a shell command and insert the output.
:move [line number] Move current line to [line number]
:copy [line number] Copy current line to [line number]
:autocmd <editor type> <command> Execute a .vrapperrc <command> only if the current editor is of Eclipse editor type <editor type>. The <editor type> is the "registered name" of the Eclipse "part".

For example:
  • autocmd "C/C++ Editor" eclipseaction gv org.eclipse.cdt.ui.edit.text.c.select.last
  • autocmd "CMake Editor" nnoremap <CR> gf
:[%]s/<search>/<replace>/[g|c|i|I] The famous substitution feature.
  • Supports flags g for global (all matches), c for confirmation, i for case-insensitive
  • Supports \%V to search within visually-selected area only (useful when selection is not line-based)
  • Supports % for performing substitution on all lines
    (e.g., :%s/foo/bar/)
  • Whatever non-alphanumeric character is after :s will be the delimiter
    (e.g., :s_foo_bar_)
  • Uses Eclipse's flavor of regex
    (e.g., :s/foo(.+)foo/bar$1bar/)
  • Supports \k regex class for iskeyword property
:<range>,<range>[y|d|s|c|t|m] Perform either the yank (y), delete (d), substitution (s), copy (c, t), or move (m) operation on a range of lines.
Supports:
  • number for specific line number
  • . for current line
  • $ for last line in the file
  • ?<pattern>? for first match above current line
  • /<pattern>/ for first match below current line
  • '<a-x> for mark
  • You can also add modifiers +/-
Examples:
  • :3,5d
  • :3,5y
  • :.,$y
  • :.+3,$-2y
  • :2,5s/foo/bar/g
  • :1,/foo/d
  • :'a,'bd
  • :?something?,+4y
  • :?something?,/foo/y
  • :10,20 copy 140
  • :15,35 move 110
:[range,range]sort[!] [/pattern/] [i|n|x|o|u] Sort lines in entire file or over specified range.
  • Supports ! flag for reverse sort
  • Supports i flag for case-insensitive sort
  • Supports n flag for numeric sort
  • Supports x flag for hex-numeric sort
  • Supports o flag for octal-numeric sort
  • Supports u flag for unique sort (remove duplicates)
  • Supports /pattern/ to only sort lines (within the range) which include /pattern/
    • Strings only, no regex
    • Sort will compare the text at cursor position after the /pattern/ match
:retab[!] [new_tabstop] Replace all tabs with spaces (or spaces with tabs) within the file.
  • If ! is specified, replace all spaces with equivalent number of tabs
  • If new_tabstop is specified, replace each tab with the given number of spaces rather than the value stored in tabstop config property.
If neither ! nor new_tabstop is specified, the behavior is determined by the expandtab and tabstop config properties.
:g/<pattern>/[d|s|normal]
:g!/<pattern>/[d|s|normal]
:v/<pattern>/[d|s|normal]
Perform an operation on all lines that match pattern. Or, in the case of :g! and :v, all lines that don't match pattern.
Operations are:
  • d to delete those lines
    :g/foo/d
  • s to perform substitution on those lines
    :g/foo/s/something/else/g
  • normal to perform (basic) normal-mode commands on those lines
    :g/foo/normal wwdw
    This basically executes an anonymous macro on all lines that match (or don't match, for :g! and :v). Special keys are defined like in mappings. For example, <esc>
:startinsert[!] Start in insertmode (only useful as the last line of a .vrapperrc file)
:vim The current active file in Eclipse is opened in a new gvim window. Cursor is on the exact same line and column as it was in Eclipse. This allows you to perform any operation in gvim which Vrapper doesn't support. After you save the file and exit gvim (:wq) Eclipse will reload the file with your changes.

Path to gvim is determined by gvimpath property (defaults to /usr/bin/gvim).
Arguments for gvim is determined by gvimargs property.
:maximize Maximize this editor tab in Eclipse. Run again to restore editor size.
:eclipseaction[!] <name> <id> Binds the Eclipse action with the specified id to a (command line mode) command <name>.
There are lists with action ids for workbench, text editors, and java editors.

For example, if you wanted to define an action for JDT's "Find all References in Workspace" you can put the following in the .vrapperrc file:
eclipseaction findref org.eclipse.jdt.ui.edit.text.java.search.references.in.workspace
This command can then be called with :findref
The action can be mapped to keys, for example gr:
nmap gr :findref<enter>
If ! is passed any existing command binding will be overwritten!
:eclipseuiaction[!] <name> <id> Similar to :eclipseaction except it handles commands which display (or may display) a popup or dialog.