forked from python-mode/python-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtextobject.vim
More file actions
83 lines (65 loc) · 1.73 KB
/
textobject.vim
File metadata and controls
83 lines (65 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
set noautoindent
let g:pymode_rope=1
" Load sample python file.
" With 'def'.
execute "normal! idef func1():\<CR> a = 1\<CR>"
execute "normal! idef func2():\<CR> b = 2"
normal 3ggdaMggf(P
" Assert changes.
let content=getline('^', '$')
call assert_true(content == ['def func2():', ' b = 2', 'def func1():', ' a = 1'])
" Clean file.
%delete
" With 'class'.
execute "normal! iclass Class1():\<CR> a = 1\<CR>"
execute "normal! iclass Class2():\<CR> b = 2\<CR>"
normal 3ggdaCggf(P
" Assert changes.
let content=getline('^', '$')
call assert_true(content == ['class Class2():', ' b = 2', '', 'class Class1():', ' a = 1'])
" Clean file.
%delete
" With 'def'.
execute "normal! iprint(\<CR> 1\<CR>)\<CR>"
execute "normal! iprint(\<CR> 2\<CR>)\<CR>"
execute "normal! iprint(\<CR> 3\<CR>)\<CR>"
normal 4ggdV
let content=getline('^', '$')
call assert_true(content == [
\ "print(", " 1", ")",
\ "print(", " 3", ")",
\ ""
\])
" Clean file.
%delete
" With 'def'.
execute "normal! iprint(\<CR> 1\<CR>)\<CR>"
execute "normal! iprint(\<CR> 2\<CR>)\<CR>"
execute "normal! iprint(\<CR> 3\<CR>)\<CR>"
execute "normal! iprint(\<CR> 4\<CR>)\<CR>"
normal 5ggd2V
let content=getline('^', '$')
call assert_true(content == [
\ "print(", " 1", ")",
\ "print(", " 4", ")",
\ ""
\])
" Clean file.
%delete
" With 'def'.
execute "normal! iprint(\<CR> 1\<CR>)\<CR>"
execute "normal! iprint(\<CR> 2\<CR>)\<CR>"
execute "normal! iprint(\<CR> 3\<CR>)\<CR>"
execute "normal! iprint(\<CR> 4\<CR>)\<CR>"
normal 5ggd2V
let content=getline('^', '$')
call assert_true(content == [
\ "print(", " 1", ")",
\ "print(", " 4", ")",
\ ""
\])
if len(v:errors) > 0
cquit!
else
quit!
endif