Skip to content

Instantly share code, notes, and snippets.

@compwron
Created July 1, 2014 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save compwron/0499c61ba441e3e8cb4a to your computer and use it in GitHub Desktop.
Save compwron/0499c61ba441e3e8cb4a to your computer and use it in GitHub Desktop.
vim tmux practice navigation setup generator
class Tvcom
attr_reader :command
attr_accessor :valid
def initialize(foo, valid)
@command = foo
@valid = valid
end
def flip
@valid = !@valid
end
def to_s
@command
end
end
new_tmux_vert = Tvcom.new("C-a%", :valid)
new_tmux_horiz = Tvcom.new("C-a\"", :valid)
vim = Tvcom.new("vim", :valid)
new_vim_vert = Tvcom.new(":vsplit", :invalid)
new_vim_horiz = Tvcom.new(":split", :invalid)
tvcoms = [new_tmux_vert,
new_tmux_horiz,
vim,
new_vim_vert,
new_vim_horiz]
size = tvcoms.size
p tvcoms
p "tmux"
(0..size*2).each { |i|
tvcom = tvcoms[rand(size)]
if tvcom.valid then
puts tvcom
end
if tvcom == vim then
tvcom.flip
end
}
puts "\nnow navigate!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment