compsci-missing_semester_2020/_subsections/lesson-03.org
2025-02-27 03:23:17 +02:00

2.7 KiB

Lesson 03 | text editors (vim)

notes

modes

normal mode

  • not editing directly
  • default
  • get to it via ESC

insert mode

  • i
  • pushes text aside

replace mode

  • R (capital 'r')
  • overwrites text

visual mode

  • line visual: Shift+V

    • goes by line
  • block visual: Ctrl+V

    • allows you to select vertical and horizontal

command line

opening vim

  • entered via ':'

buffers vs windows

  • vim maintains a set of open buffers

    • any buffer can be open in 0 or more windows at any time
  • you can have tabs, and tabs can contain windows

quiting

  • :q only closes the current WINDOW, not buffer

    • :q exits when there are no more windows open
    • :qa is "quit all" and closes all windows

movement

  • hjkl
  • w/b forward and backward by one word
  • e end of word
  • 0/$ beginning and end of line
  • ^ first non empty character on a line

scrolling up and down

  • C+U move up
  • C+D move down

move by buffer

  • G moves to end of buffer
  • gg move to top of buffer

move by screen

  • L moves to lowest line on screen
  • M moves to middle line on screen
  • H moves to the highest on screen

move by find

  • f <letter> will move to the first letter forward
  • F <letter> backwards
  • t <letter> moves to just before the letter
  • T <letter> moves backwards to in front of the letter

editing commands