Skip to content

Instantly share code, notes, and snippets.

@maxjacobson
Created March 3, 2017 18:09
Show Gist options
  • Select an option

  • Save maxjacobson/ceaa63a24c241e49c36c1e1c2a9a57de to your computer and use it in GitHub Desktop.

Select an option

Save maxjacobson/ceaa63a24c241e49c36c1e1c2a9a57de to your computer and use it in GitHub Desktop.
require 'readline'
def reminder
puts "vi editing mode? #{Readline.vi_editing_mode?}"
puts "emacs editing mode? #{Readline.emacs_editing_mode?}"
puts "Try:
writing something!
going up and down in history
going forward and backwards some characters
going to beginning of line
going to end of line
deleting to end of line
"
end
def read
Readline.readline("> ", true).tap { |input| p input }
end
def looop
":)" while read != "stop"
end
reminder
looop
Readline.vi_editing_mode
reminder
looop
puts "Wisdom:
Even if you generally like vim,
it's good to learn the emacs basics,
because emacs is everywhere
and is often the default
(especially on macs)
emacs bindings cheat sheat:
C-a (go to stArt of line)
C-e (go to End of line)
C-k (delete to end of line (Kill))
C-p (go to Previous line)
C-n (go to Next line)
C-b (go Back a character) (note: this conflicts with the tmux prefix :( )
C-f (go Forward a character)
using emacs as an editor cheat sheet:
emacs . (open emacs)
C-x C-c (quit emacs)
C-x C-f (find a file)
C-_ (undo)
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment