summaryrefslogtreecommitdiffstats
path: root/software/vim.page
blob: 0025f10d88af0e3702ce18533e84165b17b5c8f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
format: rst
toc: no
...

============
It's vim! 
============

Typical .vimrc
------------------
Here's what a typical ``.vimrc`` looks like for me::

    if has('syntax') && (&t_Co > 2)
        syntax on
    endif

    set history=50
    set wildmode=list:longest,full
    set showmode
    set showcmd
    set smartcase
    set shiftwidth=4
    set tabstop=4
    set shiftround
    set expandtab
    set autoindent

    autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except, finally,def,class

Commands
-------------
I search and replace globally a lot::

    :%s/before/after/g

Tricks
-------------
I often want to pull a particular gnarly line or two from another file; here's
the command I use to grab three lines of context around 'phrase'::

    :r!grep -A 3 'phrase' ../otherfile.txt