""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " File: ftplugin/python/pythonsense.vim " Author: Jeet Sukumaran " " Copyright: (C) 2018 Jeet Sukumaran " " License: Permission is hereby granted, free of charge, to any person obtaining " a copy of this software and associated documentation files (the " "Software"), to deal in the Software without restriction, including " without limitation the rights to use, copy, modify, merge, publish, " distribute, sublicense, and/or sell copies of the Software, and to " permit persons to whom the Software is furnished to do so, subject to " the following conditions: " " The above copyright notice and this permission notice shall be included " in all copies or substantial portions of the Software. " " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE " " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. " " Credits: - pythontextobj.vim by Nat Williams (https://github.com/natw/vim-pythontextobj) " - chapa.vim by Alfredo Deza (https://github.com/alfredodeza/chapa.vim) " - indentobj by Austin Taylor's (https://github.com/austintaylor/vim-indentobject) " - Python Docstring Text Objects by gfixler (https://pastebin.com/u/gfixler) """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Book-Keeping Variables {{{1 let b:pythonsense_is_tab_indented = 0 " 1}}} " Commands {{{1 command! Pywhere :call pythonsense#echo_python_location() " }}}1 " " Plug Definitions {{{1 " Text Objects {{{2 onoremap (PythonsenseOuterFunctionTextObject) :call pythonsense#python_function_text_object(0, "o") onoremap (PythonsenseInnerFunctionTextObject) :call pythonsense#python_function_text_object(1, "o") onoremap (PythonsenseOuterClassTextObject) :call pythonsense#python_class_text_object(0, "o") onoremap (PythonsenseInnerClassTextObject) :call pythonsense#python_class_text_object(1, "o") onoremap (PythonsenseOuterDocStringTextObject) :call pythonsense#python_docstring_text_object(0) onoremap (PythonsenseInnerDocStringTextObject) :call pythonsense#python_docstring_text_object(1) vnoremap (PythonsenseOuterFunctionTextObject) :call pythonsense#python_function_text_object(0, "v")gv vnoremap (PythonsenseInnerFunctionTextObject) :call pythonsense#python_function_text_object(1, "v")gv vnoremap (PythonsenseOuterClassTextObject) :call pythonsense#python_class_text_object(0, "v")gv vnoremap (PythonsenseInnerClassTextObject) :call pythonsense#python_class_text_object(1, "v")gv vnoremap (PythonsenseOuterDocStringTextObject) :cal pythonsense#python_docstring_text_object(0) vnoremap (PythonsenseInnerDocStringTextObject) :cal pythonsense#python_docstring_text_object(1) " }}}2 " Motions {{{2 nnoremap (PythonsenseStartOfNextPythonClass) :call pythonsense#move_to_python_object("class", 0, 1, "n") vnoremap (PythonsenseStartOfNextPythonClass) :call pythonsense#move_to_python_object("class", 0, 1, "v") onoremap (PythonsenseStartOfNextPythonClass) V:call pythonsense#move_to_python_object("class", 0, 1, "o") nnoremap (PythonsenseEndOfPythonClass) :call pythonsense#move_to_python_object("class", 1, 1, "n") vnoremap (PythonsenseEndOfPythonClass) :call pythonsense#move_to_python_object("class", 1, 1, "v") onoremap (PythonsenseEndOfPythonClass) V:call pythonsense#move_to_python_object("class", 1, 1, "o") nnoremap (PythonsenseStartOfPythonClass) :call pythonsense#move_to_python_object("class", 0, 0, "n") vnoremap (PythonsenseStartOfPythonClass) :call pythonsense#move_to_python_object("class", 0, 0, "v") onoremap (PythonsenseStartOfPythonClass) V:call pythonsense#move_to_python_object("class", 0, 0, "o") nnoremap (PythonsenseEndOfPreviousPythonClass) :call pythonsense#move_to_python_object("class", 1, 0, "n") vnoremap (PythonsenseEndOfPreviousPythonClass) :call pythonsense#move_to_python_object("class", 1, 0, "v") onoremap (PythonsenseEndOfPreviousPythonClass) V:call pythonsense#move_to_python_object("class", 1, 0, "o") nnoremap (PythonsenseStartOfNextPythonFunction) :call pythonsense#move_to_python_object('\(def\\|async def\)', 0, 1, "n") vnoremap (PythonsenseStartOfNextPythonFunction) :call pythonsense#move_to_python_object('\(def\\|async def\)', 0, 1, "v") onoremap (PythonsenseStartOfNextPythonFunction) V:call pythonsense#move_to_python_object('\(def\\|async def\)', 0, 1, "o") nnoremap (PythonsenseEndOfPythonFunction) :call pythonsense#move_to_python_object('\(def\\|async def\)', 1, 1, "n") vnoremap (PythonsenseEndOfPythonFunction) :call pythonsense#move_to_python_object('\(def\\|async def\)', 1, 1, "v") onoremap (PythonsenseEndOfPythonFunction) V:call pythonsense#move_to_python_object('\(def\\|async def\)', 1, 1, "o") nnoremap (PythonsenseStartOfPythonFunction) :call pythonsense#move_to_python_object('\(def\\|async def\)', 0, 0, "n") vnoremap (PythonsenseStartOfPythonFunction) :call pythonsense#move_to_python_object('\(def\\|async def\)', 0, 0, "v") onoremap (PythonsenseStartOfPythonFunction) V:call pythonsense#move_to_python_object('\(def\\|async def\)', 0, 0, "o") nnoremap (PythonsenseEndOfPreviousPythonFunction) :call pythonsense#move_to_python_object('\(def\\|async def\)', 1, 0, "n") vnoremap (PythonsenseEndOfPreviousPythonFunction) :call pythonsense#move_to_python_object('\(def\\|async def\)', 1, 0, "v") onoremap (PythonsenseEndOfPreviousPythonFunction) V:call pythonsense#move_to_python_object('\(def\\|async def\)', 1, 0, "o") " }}}2 " Information {{{2 nnoremap (PythonsensePyWhere) :Pywhere " }}}2 " }}}1 " Plug Binding Key Maps {{{1 if ! get(g:, "is_pythonsense_suppress_keymaps", 0) && ! get(g:, "is_pythonsense_suppress_object_keymaps", 0) if !hasmapto('PythonsenseOuterClassTextObject') vmap ac (PythonsenseOuterClassTextObject) omap ac (PythonsenseOuterClassTextObject) sunmap ac endif if !hasmapto('PythonsenseInnerClassTextObject') vmap ic (PythonsenseInnerClassTextObject) omap ic (PythonsenseInnerClassTextObject) sunmap ic endif if !hasmapto('PythonsenseOuterFunctionTextObject') vmap af (PythonsenseOuterFunctionTextObject) omap af (PythonsenseOuterFunctionTextObject) sunmap af endif if !hasmapto('PythonsenseInnerFunctionTextObject') vmap if (PythonsenseInnerFunctionTextObject) omap if (PythonsenseInnerFunctionTextObject) sunmap if endif if !hasmapto('PythonsenseOuterDocStringTextObject') omap ad (PythonsenseOuterDocStringTextObject) vmap ad (PythonsenseOuterDocStringTextObject) sunmap ad endif if !hasmapto('PythonsenseInnerDocStringTextObject') omap id (PythonsenseInnerDocStringTextObject) vmap id (PythonsenseInnerDocStringTextObject) sunmap id endif endif if ! get(g:, "is_pythonsense_suppress_keymaps", 0) && ! get(g:, "is_pythonsense_suppress_location_keymaps", 0) if !hasmapto('(PythonsensePyWhere)') map g: (PythonsensePyWhere) endif endif " }}}1