amoffat / snake

Full Python Scripting in Vim
1.41k stars 56 forks source link

How can I insert an code snippet in file? #13

Closed zct closed 9 years ago

zct commented 9 years ago

for example i map this to insert an code snippet: @key_map("coco") def cocoCreate():

in this function how insert code in File?

amoffat commented 9 years ago

sorry for the late reply on this! somehow i missed it.

i think you want to do something like this:

@key_map("<leader>o")
def cocoCreate():
    with preserve_registers("a"):
        set_register("a", "testing")
        keys('"ap')
zct commented 9 years ago

yeap, thks~~~ sorry for the late reply :+1: