*vim-common-project*


Eclipse Projects
****************

The core concept in most IDEs is the that of a project, and Eclipse is
no different.  Since a project must exist before you can perform any
of the more interesting tasks, eclim provides a set of commands to
create and manage projects from within Vim.

For the commands below that accept a project name as an argument, you
may use Vim's command line completion to complete the project name.

>

   :ProjectSettings a_p<Tab>
   :ProjectSettings a_project

<


*:ProjectCreate*

- :ProjectCreate <folder> [-p <project_name>] -n <nature> ... [-d
  <project_dependency> ...]

  - -p: Optional argument used to specify the project name.  If
    omitted, eclim will use the last segment of the project's path,
    with any spaces replaced with underscores, as the project name.

  - -n: Required argument which specifies a space separated list of
    project natures (java, php, etc.) to add to the project.  If you
    want to create a project with no natures, you can use the word
    "none" here.

    >
       :ProjectCreate ~/workspace/test -n none

    <

    Note that eclim supports command completion of available nature
    names.

    >
       :ProjectCreate ~/workspace/test -n p<tab>
       :ProjectCreate ~/workspace/test -n php

    <

  - -d: Optional argument used to specify a space separated list of
    project names which the project you're creating depends on.

  Some Examples

  >
     :ProjectCreate ~/projects/a_project -n java
     :ProjectCreate ~/projects/a_project -n java -d another_project yet_another_project
     :ProjectCreate ~/projects/a_project -n java php -p My\ Project\ Name

  <

*:ProjectImport*

- :ProjectImport <folder>

  If you have an existing eclipse project folder which does not exist
  as a project in your current workspace, you can import that project
  using this command:

  >
     :ProjectImport ~/workspace/some_project

  <

*:ProjectList*

- :ProjectList

  Simply echo a list of available projects.

*:ProjectSettings*

- :ProjectSettings [<project>]

  Opens a window with the project's available settings. If a project
  name is supplied with this command, then the settings for that
  project are opened.  If no project name is supplied, and the current
  file is in a project directory, then the settings for the current
  project will be opened.

  In the resulting window you can modify the values and save the
  changes by simply writing the file in the usual Vim manner (:w). The
  format of the buffer is in the standard properties file format as
  supported by java, so all the same rules apply when editing. You can
  refer to the settings (|vim-settings|) documentation for a
  description of the available settings.

*:ProjectDelete*

- :ProjectDelete <project>

  Deletes the project with the specified name.

*:ProjectRename*

- :ProjectRename [<project>] <name>

  Renames a project.  If two arguments are supplied then the first
  argument is interpreted as the name of the project to rename and the
  second argument as the new name for the project.  When only a single
  argument is supplied, then that argument is used as the new name for
  the project which the current file belongs to.

*:ProjectMove*

- :ProjectMove [<project>] <dir>

  Moves a project to the specified directory.  If two arguments are
  supplied then the first argument is interpreted as the name of the
  project to move and the second argument as the directory to move the
  project to.  When only a single argument is supplied, then that
  argument is used as the directory to move the current project to.

  Warning: :ProjectMove, and possibly :ProjectRename, will result in the
    renaming of your project's directory in the underlying file
    system.  Eclim will do its best to reload any files that have
    moved as a result of the directory renaming and adjust your
    current working directory if necessary, but only for the current
    vim session.  If you have other vim sessions open with files from
    the project, then eclim will be unable to reload those files in
    those sessions for you, so you will have to do so manually.  A
    best practice would be to close any other vim sessions that might
    be affected by the moving or renaming of a project.

  Note: When open files have moved as a result of :ProjectMove or
    :ProjectRename, eclim will reload those files in the current
    session, but it must do so via an :edit, which means that vim's
    undo tree will be lost. However, you will still have access to the
    eclipse history (|vim-common-history|).

*:ProjectRefresh*

- :ProjectRefresh [<project> <project> ...]

  Refreshes the supplied list of named projects by synchronizing each
  project against the current files on disk. If no projects names are
  supplied, refresh the current project. Useful when files may have
  been added, removed, or updated by a secondary application, like a
  version control system (cvs, subversion, etc).

*:ProjectRefreshAll*

- :ProjectRefreshAll

  Refreshes all projects.

*:ProjectInfo*

- :ProjectInfo [<project>]

  Echo info about the current or supplied project.

*:ProjectOpen*

- :ProjectOpen [<project>]

  Opens a closed project.

*:ProjectClose*

- :ProjectClose [<project>]

  Closes the current or supplied project. According to the Eclipse
  documentation, closing unused projects can reduce the amount of
  memory used, and may improve performance when building projects.

*:ProjectNatures*

- :ProjectNatures [<project>]

  Echo list of natures for the supplied project name or for all
  projects if no project name specified.

*:ProjectNatureAdd*

- :ProjectNatureAdd <project> [<nature> ...]

  Adds one or more natures to a project. Supports command line
  completion of nature names.

*:ProjectNatureRemove*

- :ProjectNatureRemove <project> [<nature> ...]

  Removes one or more natures from a project. Supports command line
  completion of nature names.

*:ProjectProblems*

- :ProjectProblems [<project>] Populates vim's quickfix with a list of
  all eclipse build errors and warnings for the current, or specific
  project, and all related projects.  Very similar to eclipse's
  "Problems" view.  By default, if the current quickfix list
  represents a problems list, then as you save source files this list
  will be updated accordingly.

  Note: Problems are only reported for those projects that have an
    associated builder in their .project file.  If a project is not
    reporting errors, first check that a proper builder is present in
    the .project file.  For java projects created via eclim prior to
    eclim 1.5.2, the java builder may be missing, so you'll need to
    recreate the project, at which time eclim will add the java
    builder.

  Configuration

  Vim Settings

  *g:EclimProblemsQuickFixOpen*
  - g:EclimProblemsQuickFixOpen (Default: 'botright copen')

    Specified the command used to open the quickfix window when
    executing the :ref`:ProjectProblems` command.

  *g:EclimProjectProblemsUpdateOnSave*
  - g:EclimProjectProblemsUpdateOnSave (Default: 1)

    When non 0, indicates that the problems list should be updated
    when saving source files, but only if the quickfix list currently
    represents a problems list.

*:ProjectCD*

- :ProjectCD

  Changes the global current working directory to the root directory
  of the current file's project (executes a :cd).

*:ProjectLCD*

- :ProjectLCD

  Changes the current working directory of the current window to the
  root directory of the current file's project (executes a :lcd).

*:ProjectTree*

- :ProjectTree [<project> <project> ...]

  Opens a window containing a navigable tree for the root directory of
  one or more projects.  If no arguments are supplied, the resulting
  tree is for the current project.  Otherwise, the tree contains
  multiple root nodes, one for each project root directory.

  Available key mappings in project tree window.

  - <cr> - Toggles expansion / collapsing of a directory, or executes
    the first available action for a file.

  - E - Opens the current file using 'edit' in the content window.

  - S - Opens the current file in a new split.

  - T - Opens the current file in a new tab.

  - o - Toggles folding / unfolding of a directory, or opens a window
    of available actions to be executed on the selected file.  Hitting
    <enter> on an entry in the action window will execute that action
    on the current file.

  - s - Executes :shell for the directory under the cursor or the
    parent directory of the file under the cursor.

  - R - Refreshes the current directory against the current state of
    the file system.

  - A - Toggles whether or not hidden files are displayed in the tree.

  - ~ - Changes the root node to the current user's home directory.

  - C - Changes the root node to the directory under cursor.

  - B - Changes the root node to the parent directory of the current
    root node.

  - K - Changes the root node to the root path which will be either
    the project root or the file system root.

  - p - Moves the cursor to the parent of the node under the cursor.

  - P - Moves the cursor to the last child of the nearest open
    directory.

  - :CD <dir> - Changes the root to the supplied directory.

  - D - Prompts you for a directory name to create, pre-filled with
    the directory path in the tree where this mapping was executed.

  - F - Prompts you for a new or existing filename to open, pre-filled
    with the directory path in the tree where this mapping was
    executed.

  - ? - View the help buffer

  Configuration

  Vim Settings

  *g:EclimProjectTreeAutoOpen*
  - g:EclimProjectTreeAutoOpen (Default: 0)

    When non 0, a project tree window will be auto opened for new Vim
    sessions or new tabs in existing sessions if the current file is
    in a project.

  *g:EclimProjectTreeAutoOpenProjects*
  - g:EclimProjectTreeAutoOpenProjects (Default: ['CURRENT'])

    List of project names that will be in the project tree when it is
    auto opened.  The special name 'CURRENT' represents the current
    project of the file being loaded in Vim when the tree is auto
    opened.

  *g:EclimProjectTreeExpandPathOnOpen*
  - g:EclimProjectTreeExpandPathOnOpen (Default: 0)

    When non 0, the path of the current file will be expanded in the
    project tree when the project tree window is opened.

  *g:EclimProjectTreeSharedInstance*
  - g:EclimProjectTreeSharedInstance (Default: 0)

    When non 0, a tree instance with the same list of projects will be
    shared across vim tabs.  This allows you to have the same project
    tree open in several tabs all with the same state (with the
    exception of folds).

  *g:EclimProjectTreeActions*
  - g:EclimProjectTreeActions

    Default:

    >
       let g:EclimProjectTreeActions = [
           \ {'pattern': '.*', 'name': 'Split', 'action': 'split'},
           \ {'pattern': '.*', 'name': 'Tab', 'action': 'tabnew'},
           \ {'pattern': '.*', 'name': 'Edit', 'action': 'edit'},
         \ ]

    <

    List of mappings which link file patterns to the available actions
    for opening files that match those patterns.  Note that the first
    mapping is the list is used as the default (<cr>).

*:ProjectsTree*

- :ProjectsTree

  Similar to :ProjectTree but opens a tree containing all projects.

*:ProjectTab*

- :ProjectTab project

  Command to initialize a new vim tab with the project tree open and
  the tab relative working directory set to the project root.  This
  allows you to work on multiple projects within a single vim instance
  where each project is isolated to its own tab.

*:ProjectGrep*

- :ProjectGrep /<pattern>/ file_pattern [file_pattern ...]

  Executes vimgrep using the supplied arguments from the root of the
  current project allowing you to run a project wide grep from any
  file within the project.

*:ProjectGrepAdd*

- :ProjectGrepAdd /<pattern>/ file_pattern [file_pattern ...]

  Just like :ProjectGrep but using vimgrepadd instead.

*:ProjectLGrep*

- :ProjectLGrep /<pattern>/ file_pattern [file_pattern ...]

  Just like :ProjectGrep but using lvimgrep instead.

*:ProjectLGrepAdd*

- :ProjectLGrepAdd /<pattern>/ file_pattern [file_pattern ...]

  Just like :ProjectGrep but using lvimgrepadd instead.

*:ProjectTodo*

- :ProjectTodo

  Searches all the source files in the project (those with extensions
  included in |g:EclimTodoSearchExtensions|) for the fixme / todo
  pattern (defined by |g:EclimTodoSearchPattern|) and adds all
  occurrences to the current location list.

*:Todo*

- :Todo

  Just like :ProjectTodo, but limits the searching to the current
  file.

  Configuration

  Vim Settings

  *g:EclimTodoSearchPattern*
  - g:EclimTodoSearchPattern

    Default:

    >
       let g:EclimTodoSearchPattern = '\(\<fixme\>\|\<todo\>\)\c'

    <

    Defines the regex pattern used to identify todo or fixme entries.

  *g:EclimTodoSearchExtensions*
  - g:EclimTodoSearchExtensions

    Default:

    >
       let g:EclimTodoSearchExtensions = ['java', 'py', 'php', 'jsp', 'xml', 'html']

    <

    Defines a list of file extensions that will be searched for the
    todo / fixme entries.


Tracker
=======

*:TrackerTicket*

- :TrackerTicket <ticket_id>

  Opens the supplied ticket via your web browser for the configured
  tracking system configured via org.eclim.project.tracker.

  Configuration

  Eclim Settings

  *org.eclim.project.tracker*
  - org.eclim.project.tracker Url used to view tickets in your ticket
    tracking software. This url supports the '<id>' placeholder which
    will be replaced with the ticket id.

    Ex. An example setting for a Trac installation:

    >
       org.eclim.project.tracker=http://somedomain.com/trac/ticket/<id>

    <

    In addition to being used by :TrackerTicket, this setting is also
    used in conjunction with |:VcsLog| and |:VcsChangeSet| to enable
    linking of ticket ids of the form #ticket_id (#1234) found in user
    supplied commit comments.  You may also specify other patterns to
    match by setting the g:EclimVcsTrackerIdPatterns
    (|g-eclimvcstrackeridpatterns|) variable.

vim:ft=eclimhelp