ct[char] # e.g. ct" to delete to the next " and go into insert mode dt[char] # dt" to delete up to next "
ci"
da)
Some useful references;
s = 'supercalifragelisticexpealodocious' | |
s.scan(/\S{10}/).join('-\n') | |
# => "supercalif-\\nragelistic-\\nexpealodoc" |
# cat .editrc bind -v | |
bind -v |
" remove trailing whitespace (don't use on binary files!!) | |
map <leader>tws :%s/\s\+$//<CR> | |
" go to previous file | |
map <Leader>p <C-^> |
[merge] | |
tool = p4merge | |
keepBackup = false | |
[mergetool "p4merge"] | |
cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED" | |
keepTemporaries = false | |
trustExitCode = false | |
keepBackup = false | |
[diff] | |
external = p4diff |
p ModelName.method(:method_name).source_location |
%h1= "Listing " + "#{resource_name}s" | |
.btn-group.pull-right | |
= link_to "All #{resource_name(item: resource_class.superclass)}s", polymorphic_path([:admin, resource_class.superclass]), class: 'btn' | |
= link_to "Add #{resource_name}", new_resource_path, class: 'btn-primary btn' | |
%br | |
%br | |
%table.table.table-bordered.table-striped#sortable{:data => {update_url: polymorphic_path([:sort, :admin, resource_class])}} |
# This has the effect of moving all the lower items up one. | |
def decrement_positions_on_lower_items(position=nil) | |
return unless in_list? | |
position ||= send(position_column).to_i | |
acts_as_list_class.unscoped.update_all( | |
"#{position_column} = (#{position_column} - 1)", "#{scope_condition} AND #{position_column} > #{position}" | |
) | |
end |
# source_for(Person.new, :update) | |
def source_for(object, method) | |
location = object.method(method).source_location | |
`mate #{location[0]} -l #{location[1]}` | |
location | |
end |