Vim: Navigation Showcase

Notes

We split the extratation into two parts:

  • A prepared lecture
  • A section for requests from the class

Prepared Notes

Because people asked, we went over some things we’ll learn later in the semester.

We’ll be learning about what the vimrc is later in the semester. If you’re not sure what it is yet, just hang tight!

Add the following to your vimrc to get incremental search highlighting:

set incsearch

Add the following to your vimrc to have tabs expand to 2 spaces:

" Tab settings
set expandtab          " Expand tabs into spaces
set tabstop=2          " default to 2 spaces for a hard tab
set softtabstop=2      " default to 2 spaces for the soft tab
set shiftwidth=2       " for when <TAB> is pressed at the beginning of a line

For navigating around with splits, it’s somewhat tedious to input ^W [hjkl]. To instead use ^H, ^J, ^K, and ^L, you can add these lines to your vimrc:

" Make navigation with splits easier
nnoremap <silent> <C-h> <C-w>h
nnoremap <silent> <C-j> <C-w>j
nnoremap <silent> <C-k> <C-w>k
nnoremap <silent> <C-l> <C-w>l
Copyright © 2014, Great Practical Ideas in Computer Science.