Get file path + file name in a keybindings file in Sublime Text 2

送分小仙女□ 提交于 2019-12-06 03:45:21

you may try the sublime-snippet, this is my code:

#filename: filename.sublime-snippet
<snippet>
    <content><![CDATA[$TM_FILENAME]]></content>
    <!-- Optional: Tab trigger to activate the snippet -->
    <tabTrigger>fn</tabTrigger>
    <!-- Optional: Scope the tab trigger will be active in -->
    <scope>source.python</scope>
    <!-- Optional: Description to show in the menu -->
    <description>the current file name</description>
</snippet>

when you type 'fn' in python source files, you will get your filename.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!