Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf78ff46

Browse files
committed
Implement select logical line
1 parent4bc4581 commitf78ff46

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

‎after/ftplugin/python.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ if g:pymode_motion
4242
vnoremap<buffer>aM:<C-U>call pymode#motion#select('^<Bslash>s*<Bslash>(async<Bslash>s<Bslash>+<Bslash>)<Bslash>=@', '^<Bslash>s*<Bslash>(async<Bslash>s<Bslash>+<Bslash>)<Bslash>=def<Bslash>s', 0)<CR>
4343
vnoremap<buffer>iM:<C-U>call pymode#motion#select('^<Bslash>s*<Bslash>(async<Bslash>s<Bslash>+<Bslash>)<Bslash>=@', '^<Bslash>s*<Bslash>(async<Bslash>s<Bslash>+<Bslash>)<Bslash>=def<Bslash>s', 1)<CR>
4444
45+
onoremap<buffer>V:<C-U>call pymode#rope#select_logical_line()<CR>
46+
4547
endif
4648

4749
ifg:pymode_rope&&g:pymode_rope_completion

‎autoload/pymode/rope.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,7 @@ fun! pymode#rope#generate_package() "{{{
194194
endif
195195
PymodePython rope.GenerateElementRefactoring('package').run()
196196
endfunction"}}}
197+
198+
fun!pymode#rope#select_logical_line()"{{{
199+
PymodePython rope.select_logical_line()
200+
endfunction"}}}

‎pymode/environment.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,5 +242,8 @@ def goto_buffer(bufnr):
242242
ifstr(bufnr)!='-1':
243243
vim.command('buffer %s'%bufnr)
244244

245+
defselect_line(self,start,end):
246+
vim.command('normal %sggV%sgg'% (start,end))
247+
245248

246249
env=VimPymodeEnviroment()

‎pymode/rope.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
importsite
66
importsys
77

8-
fromrope.baseimportproject,libutils,exceptions,change,worder,pycore
8+
fromrope.baseimportproject,libutils,exceptions,change,worder,pycore,codeanalyze
99
fromrope.base.fscommandsimportFileSystemCommands# noqa
1010
fromrope.base.taskhandleimportTaskHandle# noqa
1111
fromrope.contribimportautoimportasrope_autoimport,codeassist,findit,generate# noqa
@@ -921,6 +921,18 @@ def _insert_import(name, module, ctx):
921921
reload_changes(changes)
922922

923923

924+
@env.catch_exceptions
925+
defselect_logical_line():
926+
source,offset=env.get_offset_params()
927+
928+
lines=codeanalyze.SourceLinesAdapter(source)
929+
lineno=lines.get_line_number(offset)
930+
line_finder=codeanalyze.LogicalLineFinder(lines)
931+
start,end=line_finder.logical_line_in(lineno)
932+
933+
env.select_line(start,end)
934+
935+
924936
# Monkey patch Rope
925937
deffind_source_folders(self,folder):
926938
"""Look only python files an packages."""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp