visual_studio.vim

本文介绍了一个名为visual_studio.vim的插件,该插件允许用户在Vim编辑器中控制Microsoft Visual Studio。主要功能包括:从Vim加载和操作Visual Studio文件、构建解决方案、编译单个文件等。支持Visual Studio 2003、2005和2008版本。

visual_studio.vim

Version 1.2

1   Overview

This document describes the visual_studio.vim plugin which interfaces Vim with Microsoft Visual Studio. Some highlights:

  • The ability to control Visual Studio from within Vim
  • Compatible with Visual Studio 2003, 2005 and 2008
  • Load the current Visual Studio file into Vim
  • Load the current Vim file into Visual Studio
  • Build the solution, startup project or any project
  • Compile a single file (C++)
  • Access the project file hierarchy through Vim
  • Switch between multiple running instances of Visual Studio

2   Installation

Requirements:

Installation instructions

  • Download the file visual_studio.zip. This contains the files visual_studio.vim and visual_studio.py.
  • Unpack the files into your plugin directory, for example: $VIM/vimfiles/plugin.

3   Gui Operation

This section describes the operation of the visual_studio.vim plugin with gvim.exe. The main menu of the plugin is accessed through the menu bar of a gvim.exe session.

vs_menu_main.png

3.1   Get File

The Get File menu option will load the current Visual Studio file into Vim

3.2   Put File

The Put File menu option will load the Vim file into Visual Studio

3.3   Task List

The Task List menu option will display the task list of Visual Studio in the Vim quickfix buffer. Each line in the quickfix buffer corresponds to one task from the task list. The Visual Studio Task List typically lists compile errors that need to be fixed for a successful build.

The Vim quickfix commands can be used to navigate to any of the tasks in the list. For example the :cnext and :cprev commands can be used to cycle thru the entries in the quickfix window.

3.4   Output

The Output menu option will load the contents of the Visual Studio Output window into the Vim quickfix buffer. This is useful for accessing build information that is not included in the Visual Studio Task List.

3.5   Find Results 1 and Find Results 2

The Find Results 1 and Find Results 2 menu options will format the Visual Studio Find Results into a list in the Vim quickfix buffer.

3.6   Build Solution

The Build Solution menu option will trigger the building of the current Visual Studio solution. Vim will block until the build is complete. Then the build output results will be displayed in the Vim quickfix buffer.

3.7   Build Startup Project

The Build Startup Project menu option will trigger the building of the current Visual Studio startup project. Vim will block until the build is complete. Then the build output results will be displayed in the Vim quickfix buffer.

3.8   Compile File

The Compile File menu option will instruct Visual Studio to compile only the current Vim file. The file is opened in Visual Studio (if not already opened) and is compiled. Vim will block until the compilation is complete. Afterwards the output of the compile will be displayed in the Vim quickfix buffer. This menu option will only work correctly for C++ files.

3.9   Solutions

The Solutions menu option allows for the selection of the current Visual Studio instance. This option is useful for when multiple instances of Visual Studio are currently running and it is necessary to indicate which instance Vim should connect or "pair" with.

Initially the Solutions menu will be empty except for the Refresh option. Select the Refresh option to generate a list of running Visual Studio instances to choose from. Note: it could take a short time to retrieve the list of solutions. Status messages will be displayed in the message area indicating progress.

After selecting a running instance that instance is indicated with a leading asterisk.

vs_menu_solutions.png

Note: if there is only one instance of Visual Studio running it is not necessary to first select the instance before using any of the other visual_studio.vim commands. If no Visual Studio instance is specifically selected then the first (or only) running instance found is used.

As Visual Studio instances are started or stopped it is necessary to select the Refresh menu option to rebuild the Solutions selection menu.

3.10   Projects

The Projects menu option displays the projects submenus. Through the submenus it is possible to build the project in Visual Studio, select the project as the Startup Project, and navigate the file hierarchy of the project.

In the first level submenu the projects of the current solution are displayed. For the first use of the Projects menu it is necessary either to manually Refresh the menu or to have selected a solution in the Solutions menu. Note: it could take a short time to retrieve the project hierarchy. Status messages will be displayed in the message area indicating progress. If an incomplete project menu is displayed, it may mean that the menu is still being created.

The startup project is indicated with an asterisk.

vs_menu_projects.png

Each project submenu has further submenus that are project specific. To load a file of the project into Vim select that file from the project submenu hierarchy.

vs_menu_project_files.png

If a file is added to or removed from the project in Visual Studio, it will be necessary to select the Refresh option to rebuild the Projects menu in Vim

4   Command Mode Operation

In addition to the pull-down menus of gvim.exe, the visual_studio.vim plugin can be accessed via command line (normal mode) mappings (ie shortcuts).

The mappings are defined in the visual_studio.vim file. The mappings depend on the Vim mapleader setting. In the following table the mappings are indicated with the default mapleader "/". Different mappings can be specified if desired.

Command mode mapppings
MappingAction
/vgGet the VS file into Vim
/vpPut the Vim file into VS
/vtLoad the VS Task List into the Vim quickfix buffer
/voLoad the VS Output window into the Vim quickfix buffer
/vfLoad the VS Find Results 1 window into the Vim quickfix buffer
/v2Load the VS Find Results 2 window into the Vim quickfix buffer
/vbBuild the VS Solution
/vuBuild the VS Startup Project
/vcCompile the current file
/vsSelect the current VS Solution instance
/vpSelect the current VS Startup Project
/vaAbout visual_studio.vim
/vhOnline help - this page!

5   Customization

Various settings of visual_studio.vim can be overridden. There are global variables (prefixed by g:) in the visual_studio.vim file that configure the plugin. Typically these will be be left as their default values but can be specified differently in a users .vimrc file for example.


Copyright (c) 2003-2007 Michael Graz

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值