List Info

Thread: indentation of blocks dependant on comment line




indentation of blocks dependant on comment line
user name
2008-01-02 02:33:34
Hi!

Here is the indentation glitch #2.
As you will see, the indentation of a block is dependant on
a comment 
line above.

I hope this helps.
Thanks
Dirk

Please see the following, which is also attached as a file:

#---------------------------------------#
# file automatically indented with gg=G #
#---------------------------------------#

#vimfiles
#  indent: $Id: ruby.vim,v 1.40 2007/03/20 13:54:25 dkearns
Exp $
#  syntax: $Id: ruby.vim,v 1.134 2007/05/06 17:55:04 tpope
Exp $
#7.1
#  indent: $Id: ruby.vim,v 1.40 2007/03/20 13:54:25 dkearns
Exp $
#  syntax: $Id: ruby.vim,v 1.134 2007/05/06 17:55:04 tpope
Exp $

module Enumerable
  def group_by
    r = Hash.new
    each{|e| (r[yield(e)] ||= []) << e}
    r
  end
end

# These are 4 nearly identical examples. There are two
differences:
# 1. 'do/end' vs. '{}' blocks
# 2. outcommenting of the arr definition in the first line.
#
# In example 1+3 there is no indent during the dbl
definition.
# In example 2+4 after outcommenting of arr the dbl def. is
indented
# In example 2 the closing '}' of the blocks breaks the
indent.
# In example 4 the indent is not reset after 'pop'.
#
# 1. The indentation should not be dependant on the
outcommenting
#    of arr.
# 2. I would prefer the indentation of the complete dbl
definition
#    like in example 4, but naturally with the indent reset
afterwards
#    and the same for the {} blocks.
#
############ block with {}
##########################################

arr = %w(house cat car ball cat)

dbl =
arr.group_by {|n| Digest::MD5.hexdigest(n)
}.delete_if { |k,v| v.size < 2
}.sort.transpose.pop

p dbl

############ block with {} and arr outcommented
#####################

#arr = %w(house cat car ball cat)

dbl =
  arr.group_by {|n| Digest::MD5.hexdigest(n)
}.delete_if { |k,v| v.size < 2
}.sort.transpose.pop

p dbl

############ block with do/end
######################################

arr = %w(house cat car ball cat)

dbl =
arr.group_by do |n| Digest::MD5.hexdigest(n)
end.delete_if do |k,v| v.size < 2
end.sort.transpose.pop

p dbl

############ block with do/end and arr outcommented
#################

#arr = %w(house cat car ball cat)

dbl =
  arr.group_by do |n| Digest::MD5.hexdigest(n)
  end.delete_if do |k,v| v.size < 2
  end.sort.transpose.pop

  p dbl
  
############################################################
##########



_______________________________________________
vim-ruby-devel mailing list
vim-ruby-develrubyforge.org

http://rubyforge.org/mailman/listinfo/vim-ruby-devel
  
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )