kana / vim-textobj-indent

Vim plugin: Text objects for indented blocks of lines
http://www.vim.org/scripts/script.php?script_id=2484
166 stars 10 forks source link

Smarter ii #6

Closed nashbridges closed 11 years ago

nashbridges commented 11 years ago

Given code sample below:

>def hello
  output = "hello!"

  output.upcase
end

def bye
  "bye!"
end

when I run vii, I get

|def hello
| output = "hello!"

  output.upcase
end

def bye
  "bye!"
end

while vai gives me

|def hello
| output = "hello!"
|  
| output.upcase
|end
|
|def bye
| "bye!"
|end

I see current logic here, but with vii I'd rather have

|def hello
| output = "hello!"
|  
| output.upcase
|end

def bye
  "bye!"
end

i. e. do not give up on an empty line if the following line is more indented than current one.

nashbridges commented 11 years ago

However, this case is probably language specific and should be addressed in a separate plugin (I've found https://github.com/rhysd/vim-textobj-ruby, haven't tested it though)

kana commented 11 years ago

As you noticed, what you want to do is specific to Ruby language. While vim-textobj-indent provides generic text objects like ap, ip, and others. In this case, use other, language-specific, text objects instead.