From 709f8dc93f15d25b849af69e5d34076e73463940 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Thu, 16 Apr 2015 17:40:53 +0600 Subject: [PATCH] minor doc fix and new cursor variable --- doc/UltiSnips.txt | 2 ++ pythonx/UltiSnips/snippet/definition/_base.py | 1 + 2 files changed, 3 insertions(+) diff --git a/doc/UltiSnips.txt b/doc/UltiSnips.txt index a8f529e..ea60e84 100644 --- a/doc/UltiSnips.txt +++ b/doc/UltiSnips.txt @@ -36,6 +36,7 @@ UltiSnips *snippet* *snippets* *UltiSnips* 4.7.1 Replacement String |UltiSnips-replacement-string| 4.7.2 Demos |UltiSnips-demos| 4.8 Clearing snippets |UltiSnips-clearing-snippets| + 4.9 Context snippets |UltiSnips-context-snippets| 5. UltiSnips and Other Plugins |UltiSnips-other-plugins| 5.1 Existing Integrations |UltiSnips-integrations| 5.2 Extending UltiSnips |UltiSnips-extending| @@ -1317,6 +1318,7 @@ Following python modules are automatically imported: 're', 'os', 'vim', Also, variables are declared in local scope for use in expression: > 'window' - alias for 'vim.current.window' 'buffer' - alias for 'vim.current.window.buffer' + 'cursor' - alias for 'vim.current.cursor' 'line' and 'column' - aliases for cursor position Keep in mind, that lines in vim numbered from 1, and lists in python starts diff --git a/pythonx/UltiSnips/snippet/definition/_base.py b/pythonx/UltiSnips/snippet/definition/_base.py index 9b9c5de..ea2609e 100644 --- a/pythonx/UltiSnips/snippet/definition/_base.py +++ b/pythonx/UltiSnips/snippet/definition/_base.py @@ -102,6 +102,7 @@ class SnippetDefinition(object): 'buffer': current.buffer, 'line': current.window.cursor[0], 'column': current.window.cursor[1], + 'cursor': current.window.cursor, } exec(code, locals)