1
0
mirror of https://github.com/gryf/python.vim.git synced 2025-12-17 11:30:22 +01:00

3 Commits
1.8 ... 1.11

Author SHA1 Message Date
Jon Franklin
bf1056d729 Version 1.11: Add shortcuts for all remaining menu options. -
Jon Franklin
ef20af29a9 Version 1.10: Add shortcuts for commenting/uncommenting selections. -
Jon Franklin
6dbc984278 Version 1.9
Fixed bug in IM-Python menu where function and class names beginning with "_" were not included.
-

View File

@@ -1,8 +1,8 @@
" -*- vim -*-
" FILE: python.vim
" LAST MODIFICATION: 2006-08-18 07:30
" LAST MODIFICATION: 2006-11-29 4:09pm
" (C) Copyright 2001-2005 Mikael Berthe <bmikael@lists.lilotux.net>
" Version: 1.8
" Version: 1.11
" USAGE:
"
@@ -20,7 +20,7 @@
" shift commands...
"
" REQUIREMENTS:
" vim (>= 6)
" vim (>= 7)
"
" Shortcuts:
" [[ -- Jump to beginning of block
@@ -28,6 +28,8 @@
" ]v -- Select (Visual Line Mode) block
" ]< -- Shift block to left
" ]> -- Shift block to right
" ]# -- Comment selection
" ]u -- Uncomment selection
" ]c -- Select current/previous class
" ]f -- Select current/previous function
" ]<up> -- Jump to previous line with the same/lower indentation
@@ -45,6 +47,11 @@ vmap ]< <
map ]> [[V]]>
vmap ]> >
map ]# :call PythonCommentSelection()<CR>
vmap ]# :call PythonCommentSelection()<CR>
map ]u :call PythonUncommentSelection()<CR>
vmap ]u :call PythonUncommentSelection()<CR>
map ]c :call PythonSelectObject("class")<CR>
map ]f :call PythonSelectObject("function")<CR>
@@ -52,6 +59,22 @@ map ]<up> :call PythonNextLine(-1)<CR>
map ]<down> :call PythonNextLine(1)<CR>
" You may prefer use <s-up> and <s-down>... :-)
" jump to previous class
map ]J :call PythonDec("class", -1)<CR>
vmap ]J :call PythonDec("class", -1)<CR>
" jump to next class
map ]j :call PythonDec("class", 1)<CR>
vmap ]j :call PythonDec("class", 1)<CR>
" jump to previous function
map ]F :call PythonDec("function", -1)<CR>
vmap ]F :call PythonDec("function", -1)<CR>
" jump to next function
map ]f :call PythonDec("function", 1)<CR>
vmap ]f :call PythonDec("function", 1)<CR>
" Menu entries
@@ -72,23 +95,23 @@ nmenu <silent> &Python.Shift\ Block\ Right<Tab>]>
vmenu <silent> &Python.Shift\ Block\ Right<Tab>]>
\]>
nmenu &Python.-Sep3- :
vmenu <silent> &Python.Comment\ Selection
\:call PythonCommentSelection()<CR>
nmenu <silent> &Python.Comment\ Selection
\:call PythonCommentSelection()<CR>
vmenu <silent> &Python.Uncomment\ Selection
\:call PythonUncommentSelection()<CR>
nmenu <silent> &Python.Uncomment\ Selection
\:call PythonUncommentSelection()<CR>
vmenu <silent> &Python.Comment\ Selection<Tab>]#
\]#
nmenu <silent> &Python.Comment\ Selection<Tab>]#
\]#
vmenu <silent> &Python.Uncomment\ Selection<Tab>]u
\]u
nmenu <silent> &Python.Uncomment\ Selection<Tab>]u
\]u
nmenu &Python.-Sep4- :
nmenu <silent> &Python.Previous\ Class
\:call PythonDec("class", -1)<CR>
nmenu <silent> &Python.Next\ Class
\:call PythonDec("class", 1)<CR>
nmenu <silent> &Python.Previous\ Function
\:call PythonDec("function", -1)<CR>
nmenu <silent> &Python.Next\ Function
\:call PythonDec("function", 1)<CR>
nmenu <silent> &Python.Previous\ Class<Tab>]J
\]J
nmenu <silent> &Python.Next\ Class<Tab>]j
\]j
nmenu <silent> &Python.Previous\ Function<Tab>]F
\]F
nmenu <silent> &Python.Next\ Function<Tab>]f
\]f
nmenu &Python.-Sep5- :
nmenu <silent> &Python.Select\ Block<Tab>]v
\]v
@@ -312,7 +335,7 @@ function! MenuBuilder()
let parentclass = ""
while line(".") < line("$")
" search for a class or function
if match ( getline("."), '^\s*class\s\+[a-zA-Z].*:\|^\s*def\s\+[a-zA-Z].*:' ) != -1
if match ( getline("."), '^\s*class\s\+[_a-zA-Z].*:\|^\s*def\s\+[_a-zA-Z].*:' ) != -1
norm ^
let linenum = line('.')
let indentcol = col('.')