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

<think>我们首先需要明确用户的问题:用户想要找到通过`conda env export > old_env.yml`命令导出的YAML文件的位置,以及用什么程序打开它。 根据用户提供的引用和之前的知识,我们可以知道: - `conda env export`命令会生成一个YAML格式的环境配置文件,默认情况下,这个命令会将内容输出到标准输出(即终端屏幕上)。 - 当用户使用重定向`> old_env.yml`时,文件`old_env.yml`会被保存在当前工作目录中。 因此,关键点在于**当前工作目录**。用户执行命令时所在的目录就是文件保存的位置。 ### 步骤1:确定文件位置 1. **理解当前工作目录**: - 在终端中执行`conda env export > old_env.yml`时,文件`old_env.yml`会被保存在终端的当前工作目录。 - 例如: - 如果用户在终端中位于`~/projects/`目录下,那么文件就会在`~/projects/old_env.yml`。 - 在Windows中,如果当前目录是`C:\Users\username\Documents`,那么文件就会在`C:\Users\username\Documents\old_env.yml`。 2. **如何查找当前工作目录**: - 在终端中,执行命令前通常会显示当前路径(如Linux/macOS的`~`或Windows的`C:\>`提示符)。 - 如果已经执行了命令,可以通过以下方式定位: - **Linux/macOS**:在终端中执行`pwd`(print working directory)命令,会显示当前目录的绝对路径。 - **Windows**:在命令提示符中,当前路径通常显示在提示符中(如`C:\Users\username>`),也可以执行`cd`(不带参数)来显示当前目录。 3. **如果忘记了执行命令时的目录怎么办?**: - 可以使用系统的搜索功能: - 在文件资源管理器(Windows)或Finder(macOS)中搜索`old_env.yml`。 - 在终端中使用查找命令: - Linux/macOS: `find ~ -name "old_env.yml"`(从用户主目录开始搜索) - Windows: 在文件资源管理器的搜索框中输入`old_env.yml`。 ### 步骤2:打开YAML文件的程序 YAML文件是纯文本文件,可以用任何文本编辑器打开。常见的有: 1. **系统自带编辑器**: - Windows: 记事本(Notepad)、写字板(WordPad) - macOS: 文本编辑(TextEdit) - Linux: gedit、Kate、Vim等 2. **代码编辑器或IDE**(推荐,因为支持语法高亮,便于阅读): - Visual Studio Code(VS Code) - Sublime Text - Atom - PyCharm(可以直接在IDE中打开) 3. **专用工具**: - 一些YAML查看器(如YAML Viewer)但通常不需要,因为文本编辑器足够。 ### 操作示例 假设用户在终端中执行了以下命令: ```bash conda activate my_env conda env export > old_env.yml ``` 那么文件`old_env.yml`就位于执行命令时的当前目录。例如,如果用户在`/home/user/project`目录下执行,则文件路径为`/home/user/project/old_env.yml`。 用VS Code打开该文件的命令(在同一终端中): ```bash code old_env.yml ``` 或者用系统默认文本编辑器打开(Linux): ```bash xdg-open old_env.yml ``` ### 注意事项 - 如果导出时指定了路径(如`conda env export > /path/to/old_env.yml`),则文件会保存在指定路径。 - YAML文件内容可读性强,但编辑时需注意缩进(空格),因为YAML对格式敏感[^1][^3]。 ### 相关问题 根据用户可能进一步的需求,生成以下相关问题: §§相关问题§§ 1. 如何修改YAML文件以定制Conda环境配置? 2. 导出环境时如何排除某些包(如pip安装的包)? 3. 在不同操作系统间迁移Conda环境时YAML文件需要调整哪些内容? 4. Conda环境导出文件与`pip freeze`生成的requirements.txt有何区别? [^1]: Conda分享环境配置--生成.yml文件。anaconda可以管理不同的环境配置,当你想将自己的环境配置分享给其他人时,就可以生成.yml文件,这样别人可以快速生成与你一样的环境来运行代码[^3]。 [^2]: environment.yml文件长下面这个样子,记录了运行代码需要的packages和对应版本[^2]。 [^3]: conda env create -f environment.yml。就会创建一个名为es3的环境,python版本3.6,并在环境中安装:mxnet-cu113-1.0.0版本,d2lzh1.0.0版本,jupyter1.0.0版本、matplotlib2.2.2版本、pandas0.23.4版本[^4]。</think>### 如何查找并打开Conda导出的YAML文件 #### 1. **查找YAML文件位置** `conda env export > old_env.yml` 命令会将环境配置文件保存在**当前工作目录**中: - 在终端执行该命令时,文件会保存在你**当前所在的目录** - 可通过以下命令验证位置: ```bash # Linux/macOS pwd && ls -l old_env.yml # Windows cd && dir old_env.yml ``` - 若忘记位置,可使用系统搜索功能: - Windows:资源管理器搜索 `old_env.yml` - macOS:Spotlight 搜索(⌘+空格) - Linux:`find ~ -name "old_env.yml"` #### 2. **打开YAML文件的程序推荐 YAML是纯文本格式,可用以下工具打开(推荐带语法高亮的编辑器): | 工具类型 | 推荐程序 | 特点 | |----------------|-----------------------------|--------------------------| | **代码编辑器** | VS Code / Sublime Text | 语法高亮,自动缩进 | | **IDE** | PyCharm / JupyterLab | 环境管理集成 | | **系统自带** | 记事本(Windows)/文本编辑(mac)| 基础查看,无格式优化 | | **专用工具** | Yaml Viewer / Online YAML Parser | 结构化视图 | #### 3. **操作示例 ```mermaid graph LR A[终端执行] --> B[conda env export > old_env.yml] B --> C[文件保存到当前目录] C --> D[用编辑器打开] D --> E[查看/编辑环境配置] ``` #### 4. **注意事项 1. 文件内容示例(部分): ```yaml name: old_env channels: - defaults dependencies: - python=3.9 - numpy=1.21.5 # 核心科学计算库[^2] - pandas=1.4.0 ``` 2. 编辑建议: - 修改Python版本需谨慎(可能导致依赖冲突) - 删除不需要的包可减少环境大小 - 添加 `prefix:` 字段可指定环境安装路径[^3] #### 5. **快速打开技巧 - 终端直接打开: ```bash # VS Code code old_env.yml # Linux/macOS (默认文本编辑器) open old_env.yml # macOS xdg-open old_env.yml # Linux ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值