This talk is not ...
This talk is ...
Show and tell is scary. I'm trying to show you the things that were the keys to my understanding, but that reveals to you how I learn, and that's scary.
.vimrc
file, and learn something from it.You will find yourself using h
, j
, k
, and l
for navigation in the craziest places.
more
/ less
man
Two basic modes
Press i
to go from Normal to Insert
Press <esc>
to go from Insert to Normal
At least three more modes:
v
to enter normal visual mode<Shift-v>
to enter visual line mode<Ctrl-v>
to enter visual column mode:
to enter<Shift-R>
to enter:w
for write to save:q
to quit:e
for edit:h
for helpJust remember to be in normal mode first!
~/.vimrc
~/.vim/vimrc
" Turn off vi compatibility, use advanced vim-only featuresset nocompatible" Turn on syntax highlightingsyntax enable" Set colors to use 256 color paletteset t_Co=256" Use the system clipboard as the default copy registerset clipboard=unnamed" Copy indentation level when creating a new lineset autoindent" Try to put the indent level at the right placeset smartindent" Keep vim files in the ~/.vim folderset viminfo='100,h,n~/.vim/viminfo
" Case insensitive searchset ignorecase" Unless there is mixed case, then make it case sensitiveset smartcase" Highlight search terms instead of just moving the cursorset hlsearch" Highlight search terms as you type themset incsearch
map
is used to map shortcuts to actionsmap [sequence of keys] [sequence of keys]
<Alt-h>
nnoremap <A-h> :bp<cr>
maps <Alt+h>
to type :bp
followed by the enter key (carriage return)nore
to a keyboard mapping to make it non-recursivenoremap <leader>' <esc>:qa!<cr>
i
- Input moden
- Normal modec
- Command modev
- Visual modeType :help map-modes
for more information
<leader>
shows up all the time, particularly in shortcuts specific to pluginsSet the leader:
let mapleader=","
Use leader in a shortcut:
noremap <leader>sn :set number!<cr>
" Set the leader to comma, it'll grow on youlet mapleader=","" Set the sequence 'jk' to hit escape" This will make leaving input mode easierinoremap jk <esc>" This will save you when you discover you" don't have permission to save a filecnoremap w!! w !sudo tee % >/dev/null" These make moving around easier with wrapped linesnnoremap j gjnnoremap k gk" These allow you enter command mode without the shift keynnoremap ; :vnoremap ; :
You will be hard pressed to find an editor or IDE with more plugins than Vim.
You will be hard pressed to find an editor or IDE with more plugins than Vim.
You will be hard pressed to find an editor or IDE with more plugins than Vim.
A plugin manager will make it simple to manage and load your Vim plugins.
A few common managers include:
" Vim Plug automatic installationif empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fsLo ~/.vim/autoload/plug.vim \ --create-dirs https://raw.githubusercontent.com\ /junegunn/vim-plug/master/plug.vim autocmd VimEnter * PlugInstall | source $MYVIMRCendif
" Pluginscall plug#begin('~/.vim/plugged') " Color schemes Plug 'vim-scripts/wombat256.vim' " Core plugins Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' Plug 'scrooloose/nerdtree' Plug 'sjl/gundo.vim' Plug 'easymotion/vim-easymotion' Plug 'ConradIrwin/vim-bracketed-paste' " Git Plug 'tpope/vim-fugitive' Plug 'airblade/vim-gitgutter' " Language specific Plug 'jmcantrell/vim-virtualenv', {'for': 'python'} Plug 'plasticboy/vim-markdown', {'for': 'markdown'}call plug#end()
vimtutor
in your terminal for interactive trainingKeyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |