session 4 [vim,] - Ahmed-Ayman/Mushtarak-WebSchool GitHub Wiki

review

  • library : collection of functions , classes and definitions used to

VIM

  • meta data : is data about the data, an example is the HTML tags , describes the content.

another example is the difference between the .doc and the .txt files..the .doc have more meta data about the characters.

we will be just using plain txt files to write our code.

and lets check out VI.

Hello World in VI ..

the modes..

  • i => insert mode.
  • esc => back to the commands/options mode.

some vim options :

  1. y => copying.
  2. p => pasting.
  3. x => cut.
  4. n[options] => make the option n times .. eg, 4y => copy four times.
  5. dd => delete line.
  6. u => undo.
  7. dw => delete word.
  8. $ => until the end of the line.
  9. ^ => until the beginning of the line.
  10. ctrl + w => save file.
  11. Substitution :
  • :range s[ubstitute]/pattern/string/cgiI For each line in the range replace a match of the pattern with the string where:
    • c : Confirm each substitution
    • g : Replace all occurrences in the line (without g - only first).
    • i : Ignore case for the pattern.
    • I : Don't ignore case for the pattern.

playing with the errors.txt file (static analysis) ---> :% s/^CA[0-9]{4}/CAXXXX/

exercise :

  • remove CA2 -> CA.
  • replace the 3 numbers with three X's