Vim is a text editor program for Unix, cloned from Vi.

Configure

Try out a config and if you like it, set it in the config so it is set up whenever you open a file.

Once-off

  1. Press esc.
  2. Type :MY COMMAND. e.g. :set number.
  3. Press enter.

Set in config

  1. Open the vim config. You may have to create it.
     $ open ~/.vimrc
    
  2. Add your command. e.g.
     set number
    
  3. Save the file.

Config options

Set these using one of the approaches above.

See Vim config files here for more options than the ones covered below. You can also follow the installation instructions there if you want to have your configs managed for you.

Enable line numbers in gutter

set number

Or

:setnumber

Enable syntax highlighting

:syntax on

Execute code

Python

Execute Python code from inside vim. Alternatives here.

:w !python