]> Sergey Matveev's repositories - dotfiles.git/blobdiff - vim/.vim/ftplugin/python/testname.vim
Vim scripts refactoring
[dotfiles.git] / vim / .vim / ftplugin / python / testname.vim
index e388f1bbb36657425a991e6254aace7aa5ec3a0a..7ec780230136d338038ab694825af2e0aa3bc9b6 100644 (file)
@@ -1,24 +1,2 @@
-" Nose-compatible test name preparer
-" Maintainer: Sergey Matveev <stargrave@stargrave.org>
-" License: GNU General Public License version 3 of the License or later
-"
-" When standing inside TestCase's test method, type <leader>t and full
-" Python (your.project.tests:TestCaseName.test_method_name) path will be
-" copied to clipboard ("*) register.
-
-function! TestName()
-    normal mm
-    normal ?.*\s*def .*[Tt]est\r
-    normal ^f(Byw
-    let postfix = @"
-    normal [[f(Byw
-    let postfix = @" . "." . postfix
-    normal `m
-    let base = join([""] + split(getcwd(), "/")[:-1], "/")
-    let prefix = substitute(expand("%:p:r")[len(base)+1:], "/", ".", "g")
-    let name = prefix . ":" . postfix
-    let @* = name
-    echomsg name
-endfunction
-
-nmap <leader>t :call TestName()<CR>
+if exists("*python#testname#get") | finish | endif
+nmap <buffer> <leader>t :call python#testname#get()<CR>