sublime 默认 vim 模式

有的时候,希望一打开一个文件默认就是 vim 模式来操作 (原*伪vim用户的习惯)。

首先,找到菜单上【Tools】->【New Plugin…】,然后出现一个未保存的内容:

import sublime, sublime_plugin

class ExampleCommand(sublime_plugin.TextCommand):
	def run(self, edit):
		self.view.insert(edit, 0, "Hello, World!")

复制博主的代码,修改为:

import sublime, sublime_plugin

class EventListener(sublime_plugin.EventListener):
    def on_activated(self, view):
        view.run_command('exit_insert_mode');

保存到 sublime 的 User 目录下,那么接下来的只要打开文件就会自动进入 vim 模式了,又省了一点时间。

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google+ photo

You are commenting using your Google+ account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s