From 86e7b3a1b5f4a1dbf19a368981c05dabcd56bc78 Mon Sep 17 00:00:00 2001 From: Holger Rapp Date: Fri, 10 Jul 2009 12:47:54 +0200 Subject: [PATCH] The project now has a name: UltiSnips --- {PySnippets => UltiSnips}/all.snippets | 0 {PySnippets => UltiSnips}/python.snippets | 0 {PySnippets => UltiSnips}/tex.snippets | 0 plugin/{PySnipEmu.vim => UltiSnips.vim} | 34 +++++++++---------- plugin/{PySnipEmu => UltiSnips}/Buffer.py | 2 +- plugin/{PySnipEmu => UltiSnips}/Geometry.py | 0 .../{PySnipEmu => UltiSnips}/TextObjects.py | 4 +-- plugin/{PySnipEmu => UltiSnips}/__init__.py | 10 +++--- plugin/{PySnipEmu => UltiSnips}/debug.py | 0 test.py | 20 +++++------ 10 files changed, 35 insertions(+), 35 deletions(-) rename {PySnippets => UltiSnips}/all.snippets (100%) rename {PySnippets => UltiSnips}/python.snippets (100%) rename {PySnippets => UltiSnips}/tex.snippets (100%) rename plugin/{PySnipEmu.vim => UltiSnips.vim} (57%) rename plugin/{PySnipEmu => UltiSnips}/Buffer.py (98%) rename plugin/{PySnipEmu => UltiSnips}/Geometry.py (100%) rename plugin/{PySnipEmu => UltiSnips}/TextObjects.py (99%) rename plugin/{PySnipEmu => UltiSnips}/__init__.py (98%) rename plugin/{PySnipEmu => UltiSnips}/debug.py (100%) diff --git a/PySnippets/all.snippets b/UltiSnips/all.snippets similarity index 100% rename from PySnippets/all.snippets rename to UltiSnips/all.snippets diff --git a/PySnippets/python.snippets b/UltiSnips/python.snippets similarity index 100% rename from PySnippets/python.snippets rename to UltiSnips/python.snippets diff --git a/PySnippets/tex.snippets b/UltiSnips/tex.snippets similarity index 100% rename from PySnippets/tex.snippets rename to UltiSnips/tex.snippets diff --git a/plugin/PySnipEmu.vim b/plugin/UltiSnips.vim similarity index 57% rename from plugin/PySnipEmu.vim rename to plugin/UltiSnips.vim index 71565b0..2f3af96 100644 --- a/plugin/PySnipEmu.vim +++ b/plugin/UltiSnips.vim @@ -1,7 +1,7 @@ "" FUNCTIONS -function! PyVimSnips_ExpandSnippet() +function! UltiSnips_ExpandSnippet() if exists('g:SuperTabMappingForward') if g:SuperTabMappingForward == "" let SuperTabKey = "\" @@ -20,7 +20,7 @@ function! PyVimSnips_ExpandSnippet() " Now, really expand something py << EOF -if not PySnipSnippets.try_expand(): +if not UltiSnips_Manager.try_expand(): vim.command("""if exists('SuperTabKey') call feedkeys(SuperTabKey) endif @@ -30,16 +30,16 @@ EOF return "" endfunction -function! PyVimSnips_JumpBackwards() +function! UltiSnips_JumpBackwards() py << EOF -PySnipSnippets.jump(True) +UltiSnips_Manager.jump(True) EOF return "" endfunction -function! PyVimSnips_JumpForwards() +function! UltiSnips_JumpForwards() py << EOF -PySnipSnippets.jump() +UltiSnips_Manager.jump() EOF return "" endfunction @@ -53,25 +53,25 @@ import vim, os, sys for p in vim.eval("&runtimepath").split(','): dname = p + os.path.sep + "plugin" - if os.path.exists(dname + os.path.sep + "PySnipEmu"): + if os.path.exists(dname + os.path.sep + "UltiSnips"): if dname not in sys.path: sys.path.append(dname) break -from PySnipEmu import PySnipSnippets +from UltiSnips import UltiSnips_Manager EOF " You can remap these -inoremap =PyVimSnips_ExpandSnippet() -snoremap :call PyVimSnips_ExpandSnippet() -inoremap =PyVimSnips_JumpBackwards() -snoremap :call PyVimSnips_JumpBackwards() -inoremap =PyVimSnips_JumpForwards() -snoremap :call PyVimSnips_JumpForwards() +inoremap =UltiSnips_ExpandSnippet() +snoremap :call UltiSnips_ExpandSnippet() +inoremap =UltiSnips_JumpBackwards() +snoremap :call UltiSnips_JumpBackwards() +inoremap =UltiSnips_JumpForwards() +snoremap :call UltiSnips_JumpForwards() " Do not remap this. -snoremap :py PySnipSnippets.backspace_while_selected() +snoremap :py UltiSnips_Manager.backspace_while_selected() -au CursorMovedI * py PySnipSnippets.cursor_moved() -au InsertEnter * py PySnipSnippets.entered_insert_mode() +au CursorMovedI * py UltiSnips_Manager.cursor_moved() +au InsertEnter * py UltiSnips_Manager.entered_insert_mode() diff --git a/plugin/PySnipEmu/Buffer.py b/plugin/UltiSnips/Buffer.py similarity index 98% rename from plugin/PySnipEmu/Buffer.py rename to plugin/UltiSnips/Buffer.py index 4321b5c..01d64a5 100644 --- a/plugin/PySnipEmu/Buffer.py +++ b/plugin/UltiSnips/Buffer.py @@ -2,7 +2,7 @@ # encoding: utf-8 import vim -from PySnipEmu.Geometry import Position +from UltiSnips.Geometry import Position __all__ = [ "TextBuffer", "VimBuffer" ] diff --git a/plugin/PySnipEmu/Geometry.py b/plugin/UltiSnips/Geometry.py similarity index 100% rename from plugin/PySnipEmu/Geometry.py rename to plugin/UltiSnips/Geometry.py diff --git a/plugin/PySnipEmu/TextObjects.py b/plugin/UltiSnips/TextObjects.py similarity index 99% rename from plugin/PySnipEmu/TextObjects.py rename to plugin/UltiSnips/TextObjects.py index f0da5ff..b867e81 100644 --- a/plugin/PySnipEmu/TextObjects.py +++ b/plugin/UltiSnips/TextObjects.py @@ -6,8 +6,8 @@ import re import stat import tempfile -from PySnipEmu.Buffer import TextBuffer -from PySnipEmu.Geometry import Span, Position +from UltiSnips.Buffer import TextBuffer +from UltiSnips.Geometry import Span, Position __all__ = [ "Mirror", "Transformation", "SnippetInstance", "StartMarker" ] diff --git a/plugin/PySnipEmu/__init__.py b/plugin/UltiSnips/__init__.py similarity index 98% rename from plugin/PySnipEmu/__init__.py rename to plugin/UltiSnips/__init__.py index 59a33be..8c40dee 100644 --- a/plugin/PySnipEmu/__init__.py +++ b/plugin/UltiSnips/__init__.py @@ -7,9 +7,9 @@ import re import string import vim -from PySnipEmu.Geometry import Position -from PySnipEmu.TextObjects import * -from PySnipEmu.Buffer import VimBuffer +from UltiSnips.Geometry import Position +from UltiSnips.TextObjects import * +from UltiSnips.Buffer import VimBuffer class Snippet(object): _INDENT = re.compile(r"^[ \t]*") @@ -359,7 +359,7 @@ class SnippetManager(object): def _load_snippets_for(self, ft): self._snippets[ft] = {} for p in vim.eval("&runtimepath").split(',')[::-1]: - pattern = p + os.path.sep + "PySnippets" + os.path.sep + \ + pattern = p + os.path.sep + "UltiSnips" + os.path.sep + \ "*%s.snippets" % ft for fn in glob.glob(pattern): @@ -375,5 +375,5 @@ class SnippetManager(object): return snips.get(trigger, []) -PySnipSnippets = SnippetManager() +UltiSnips_Manager = SnippetManager() diff --git a/plugin/PySnipEmu/debug.py b/plugin/UltiSnips/debug.py similarity index 100% rename from plugin/PySnipEmu/debug.py rename to plugin/UltiSnips/debug.py diff --git a/test.py b/test.py index 73996e4..c787c58 100755 --- a/test.py +++ b/test.py @@ -54,7 +54,7 @@ class _VimTest(unittest.TestCase): def setUp(self): self.send(ESC) - self.send(":py PySnipSnippets.reset()\n") + self.send(":py UltiSnips_Manager.reset()\n") if not isinstance(self.snippets[0],tuple): self.snippets = ( self.snippets, ) @@ -65,7 +65,7 @@ class _VimTest(unittest.TestCase): if len(s) == 3: descr = s[-1] self.send(''':py << EOF -PySnipSnippets.add_snippet("%s","""%s""", "%s") +UltiSnips_Manager.add_snippet("%s","""%s""", "%s") EOF ''' % (sv,content.encode("string-escape"), descr.encode("string-escape")) ) @@ -86,7 +86,7 @@ EOF # Execute the command self.type(self.keys) - handle, fn = tempfile.mkstemp(prefix="PySnipEmuTest",suffix=".txt") + handle, fn = tempfile.mkstemp(prefix="UltiSnips_Test",suffix=".txt") os.close(handle) os.unlink(fn) @@ -749,19 +749,19 @@ if __name__ == '__main__': send(":imapclear\n", options.session) send(":smapclear\n", options.session) - send(":inoremap =PyVimSnips_ExpandSnippet()\n", + send(":inoremap =UltiSnips_ExpandSnippet()\n", options.session) - send(":snoremap :call PyVimSnips_ExpandSnippet()\n", + send(":snoremap :call UltiSnips_ExpandSnippet()\n", options.session) - send(":inoremap + =PyVimSnips_JumpBackwards()\n", options.session) - send(":snoremap + :call PyVimSnips_JumpBackwards()\n", + send(":inoremap + =UltiSnips_JumpBackwards()\n", options.session) + send(":snoremap + :call UltiSnips_JumpBackwards()\n", options.session) - send(":inoremap ? =PyVimSnips_JumpForwards()\n", options.session) - send(":snoremap ? :call PyVimSnips_JumpForwards()\n", + send(":inoremap ? =UltiSnips_JumpForwards()\n", options.session) + send(":snoremap ? :call UltiSnips_JumpForwards()\n", options.session) # Mandatory remapping - send(":snoremap :py PySnipSnippets." \ + send(":snoremap :py UltiSnips_Manager." \ "backspace_while_selected()\n", options.session) # Inform all test case which screen session to use