在Sublime Text 2中的键绑定文件中获取文件路径和文件名 [英] Get file path + file name in a keybindings file in Sublime Text 2

查看:120
本文介绍了在Sublime Text 2中的键绑定文件中获取文件路径和文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Sublime Text 2中的键绑定文件中获取当前文件的路径+文件名(不带扩展名).$file_path${file_path}都不起作用.

I'm trying to get the path of the current file + the file's name (without extension) in a Key Binding file in Sublime Text 2. $file_path or ${file_path} are both not working.

原因是我想执行一个* .exe文件,该文件之前已经构建过(但是不想同时构建和执行一个步骤).有什么想法吗?

The reason is that I want to execute an *.exe file, which was built before (but don't want to both build and execute in one step). Any ideas?

格里兹

推荐答案

Sublime提供了一个名为copy_path的命令,该命令会将当前文件的绝对路径复制到剪贴板.不幸的是,这包括文件扩展名.但是,如果您熟悉如何滚动自己的快速插件,则可以在其中发布copy_path,并执行一些基本的字符串操作以去除文件扩展名.如果不是,您可以将copy_path绑定到组合键并从那里开始工作.

Sublime offers a command called copy_path which will copy the current file's absolute path to the clipboard. Unfortunately, this includes the file extension. But if you're familiar with how to roll your own quick plugin, you can issue copy_path therein, and perform some basic string manipulation to strip the file extension. If not though, you can bind copy_path to a key combination and work from there.

这篇关于在Sublime Text 2中的键绑定文件中获取文件路径和文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆