Sha256: 1be3168341c511c05c1fa55b72f9fc3e7d2babbef35d41f66ba8ebad42e8552a
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
# frozen_string_literal: true module Textbringer module Commands define_command(:resize_window) do Window.resize end define_command(:recenter) do Window.current.recenter Window.redraw end define_command(:scroll_up) do Window.current.scroll_up end define_command(:scroll_down) do Window.current.scroll_down end define_command(:delete_window) do Window.delete_window end define_command(:delete_other_windows) do Window.delete_other_windows end define_command(:split_window) do Window.current.split end define_command(:other_window) do Window.other_window end define_command(:enlarge_window) do |n = number_prefix_arg| Window.current.enlarge(n) end define_command(:switch_to_buffer) do |buffer_name = read_buffer("Switch to buffer: ")| if buffer_name.is_a?(Buffer) buffer = buffer_name else buffer = Buffer[buffer_name] end if buffer Window.current.buffer = Buffer.current = buffer else raise EditorError, "No such buffer: #{buffer_name}" end end define_command(:kill_buffer) do |name = read_buffer("Kill buffer: ", default: Buffer.current.name)| if name.is_a?(Buffer) buffer = name else buffer = Buffer[name] end if buffer.modified? next unless yes_or_no?("The last change is not saved; kill anyway?") message("Arioch! Arioch! Blood and souls for my Lord Arioch!") end buffer.kill if Buffer.count == 0 buffer = Buffer.new_buffer("*scratch*") switch_to_buffer(buffer) elsif Buffer.current.nil? switch_to_buffer(Buffer.last) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
textbringer-0.1.8 | lib/textbringer/commands/windows.rb |