Skip to content

Instantly share code, notes, and snippets.

@cmccormack cmccormack/0-vim.md
Last active Nov 26, 2018

Embed
What would you like to do?
VIM Commands and Tools

Vim - Vi IMproved

Vim is a highly configurable text editor for efficiently creating and changing any kind of text. It is included as "vi" with most UNIX systems and with Apple OS X.

Vim is rock stable and is continuously being developed to become even better. Among its features are:

  • persistent, multi-level undo tree
  • extensive plugin system
  • support for hundreds of programming languages and file formats
  • powerful search and replace
  • integrates with many tools

Color Schemes

Change Configured Color Scheme

Change via Vim Command Line:

  • colorscheme [scheme]
    • Example: colorscheme zellner
  • Command can be shortened to just colo
    • Example: colo zellner

Change via .vimrc file:

  1. Create .vimrc file if it doesn't exist:
    • touch ~/.vimrc
  2. Add the color scheme to the file using one of the following methods:
    • Edit the file via Vim:
      • vim ~/.vimrc
      • Add the colorscheme command somewhere in the file:
      colorscheme zellner
      syntax on
      
    • Add the command from the CLI:
      • echo "colorscheme zellner" >> ~/.vimrc

View Configured Color Scheme

View within Vim:

  • colorscheme with no arguments
    • colo is the shortened version of the same command

View from shell:

$ cat ~/.vimrc | grep colo
colorscheme zellner

Add/Modify Color Files

Color files should be located within the Vim install directory.

  • For Example, on MacOSX for Vim 8.0: /usr/share/vim/vim80/colors/[colorscheme].vim

Syntax Highlighting

Enable/Disable Syntax Highlighting

Within Vim:

  • Enable: syntax on
  • Disable: syntax off

Within .vimrc file:

  1. Create .vimrc file if it doesn't exist:
    • touch ~/.vimrc
  2. Add the command to the file using one of the following methods:
    • Edit the file via Vim:
      • vim ~/.vimrc
      • Add the following command somewhere in the file: syntax on
    • Add the command from the CLI:
      • echo "syntax on" >> ~/.vimrc

Add/Modify Syntax Files

Syntax files should be located within the Vim install directory.

  • For Example, on MacOSX for Vim 8.0: /usr/share/vim/vim80/syntax/[language].vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.