Suggested Vim Mappings

Since each person has their own preference when it comes to key mappings, eclim deliberately omits any convenience mappings for the provided functionality.

So, instead this page provides some suggested mappings and examples that may or may not suit your tastes, but will at least give you a template that you can use to define your own mappings.

Note

In the mappings below you will see <leader> used quite frequently. In Vim the <leader> argument is mapped to a character of your choice. Please see “:help mapleader” in Vim for more information.

C/C++ Mappings

Here are some mappings for the c/c++ funtionality provided by eclim. To make use of these mappings, simply create a ftplugin file for c/cpp and place your mappings there (:help ftplugin-name).

  • The following mapping allows you to simply hit <enter> on an element to perform a search to find it.

    nnoremap <silent> <buffer> <cr> :CSearchContext<cr>
    

Ant Mappings

Here are some mappings for the ant funtionality provided by eclim. To make use of these mappings, simply create a ftplugin file for ant and place your mappings there (:help ftplugin-name).

  • Lookup and open the documentation for the ant element under the cursor with <enter>.

    noremap <silent> <buffer> <cr> :AntDoc<cr>
    

Java Mappings

Here are some mappings for the java funtionality provided by eclim. To make use of these mappings, simply create a ftplugin file for java and place your mappings there (:help ftplugin-name).

  • Import the class under the cursor with <leader>i.

    nnoremap <silent> <buffer> <leader>i :JavaImport<cr>
    
  • Search for the javadocs of the element under the cursor with <leader>d.

    nnoremap <silent> <buffer> <leader>d :JavaDocSearch -x declarations<cr>
    
  • Perform a context sensitive search of the element under the cursor with <enter>.

    nnoremap <silent> <buffer> <cr> :JavaSearchContext<cr>
    

Php Mappings

Here are some mappings for the php funtionality provided by eclim. To make use of these mappings, simply create a ftplugin file for php and place your mappings there (:help ftplugin-name).

  • The following mapping allows you to simply hit <enter> on an element to perform a search to find it.

    nnoremap <silent> <buffer> <cr> :PhpSearchContext<cr>
    

Python Mappings

Here are some mappings for the python funtionality provided by eclim. To make use of these mappings, simply create a ftplugin file for python and place your mappings there (:help ftplugin-name).

  • The following mapping allows you to simply hit <enter> on an element to perform a search to find its definition or occurrences depending on the context.

    nnoremap <silent> <buffer> <cr> :PythonSearchContext<cr>
    
  • If you are doing django development you may want to use the following mapping which will execute :DjangoViewOpen, or :DjangoTemplateOpen depending on the context of the text under the cursor and if no results were found from either of those, it will issue :PythonFindDefinition.

    function! s:MyFind ()
      let found = eclim#python#django#find#ContextFind()
      if !found
        PythonFindDefinition
      endif
    endfunction
    nnoremap <silent> <buffer> <cr> :call <SID>MyFind()<cr>
    

Vim Script Mappings

Here are some mappings for the Vim script funtionality provided by eclim. To make use of these mappings, simply create a ftplugin file for Vim and place your mappings there (:help ftplugin-name).

  • Perform a context sensitive search for the element under the cursor using <enter>.

    See :FindByContext for more info.

    " avoid overwriting <cr> mapping in 'command-line' buffer (:h cmdwin).
    if bufname('%') !~ '^\(command-line\|\[Command Line\]\)$'
      nnoremap <silent> <buffer> <cr> :FindByContext<cr>
    endif