From fa89efbaa080bc7cc782182de945e440da2fae69 Mon Sep 17 00:00:00 2001 From: Szymon Wrozynski Date: Thu, 11 Jul 2013 06:18:25 +0200 Subject: [PATCH 1/2] Provide only one text object (i) Provide only one text object behaving differently depending on the current filetype. It doesn't include the line below the indent text for file types where indentantion is a part of the syntax. Currently it means Python, CoffeeScript, and Haml buffers. This can be extended as necessary. If accepted the doc/indent-object.txt should be changed accordingly. --- plugin/indent-object.vim | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugin/indent-object.vim b/plugin/indent-object.vim index afb8edd..4d37b91 100644 --- a/plugin/indent-object.vim +++ b/plugin/indent-object.vim @@ -10,10 +10,10 @@ " 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 @@ -24,17 +24,17 @@ " "-------------------------------------------------------------------------------- -" Mappings excluding line below. -onoremap ai :cal HandleTextObjectMapping(0, 0, 0, [line("."), line("."), col("."), col(".")]) -onoremap ii :cal HandleTextObjectMapping(1, 0, 0, [line("."), line("."), col("."), col(".")]) -vnoremap ai :cal HandleTextObjectMapping(0, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv -vnoremap ii :cal HandleTextObjectMapping(1, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv - " Mappings including line below. -onoremap aI :cal HandleTextObjectMapping(0, 1, 0, [line("."), line("."), col("."), col(".")]) -onoremap iI :cal HandleTextObjectMapping(1, 1, 0, [line("."), line("."), col("."), col(".")]) -vnoremap aI :cal HandleTextObjectMapping(0, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv -vnoremap iI :cal HandleTextObjectMapping(1, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv +onoremap ai :cal HandleTextObjectMapping(0, 1, 0, [line("."), line("."), col("."), col(".")]) +onoremap ii :cal HandleTextObjectMapping(1, 1, 0, [line("."), line("."), col("."), col(".")]) +vnoremap ai :cal HandleTextObjectMapping(0, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv +vnoremap ii :cal HandleTextObjectMapping(1, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv + +" Mappings excluding line below (for specific file types (like Python)) +au FileType python,coffee,haml onoremap ai :cal HandleTextObjectMapping(0, 0, 0, [line("."), line("."), col("."), col(".")]) +au FileType python,coffee,haml onoremap ii :cal HandleTextObjectMapping(1, 0, 0, [line("."), line("."), col("."), col(".")]) +au FileType python,coffee,haml vnoremap ai :cal HandleTextObjectMapping(0, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv +au FileType python,coffee,haml vnoremap ii :cal HandleTextObjectMapping(1, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv let s:l0 = -1 let s:l1 = -1 From 91fc44d3ec725819e6533faf7961fbe1e8107013 Mon Sep 17 00:00:00 2001 From: Szymon Wrozynski Date: Mon, 7 Oct 2013 13:22:43 +0200 Subject: [PATCH 2/2] Add more types --- plugin/indent-object.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/indent-object.vim b/plugin/indent-object.vim index 4d37b91..2a31832 100644 --- a/plugin/indent-object.vim +++ b/plugin/indent-object.vim @@ -31,10 +31,10 @@ vnoremap ai :cal HandleTextObjectMapping(0, 1, 1, [line("'<"), vnoremap ii :cal HandleTextObjectMapping(1, 1, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv " Mappings excluding line below (for specific file types (like Python)) -au FileType python,coffee,haml onoremap ai :cal HandleTextObjectMapping(0, 0, 0, [line("."), line("."), col("."), col(".")]) -au FileType python,coffee,haml onoremap ii :cal HandleTextObjectMapping(1, 0, 0, [line("."), line("."), col("."), col(".")]) -au FileType python,coffee,haml vnoremap ai :cal HandleTextObjectMapping(0, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv -au FileType python,coffee,haml vnoremap ii :cal HandleTextObjectMapping(1, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv +au FileType python,coffee,haml,yaml,slim onoremap ai :cal HandleTextObjectMapping(0, 0, 0, [line("."), line("."), col("."), col(".")]) +au FileType python,coffee,haml,yaml,slim onoremap ii :cal HandleTextObjectMapping(1, 0, 0, [line("."), line("."), col("."), col(".")]) +au FileType python,coffee,haml,yaml,slim vnoremap ai :cal HandleTextObjectMapping(0, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv +au FileType python,coffee,haml,yaml,slim vnoremap ii :cal HandleTextObjectMapping(1, 0, 1, [line("'<"), line("'>"), col("'<"), col("'>")])gv let s:l0 = -1 let s:l1 = -1