aboutsummaryrefslogtreecommitdiff
path: root/vim/vimrc
blob: 6e536c3343b47081b7a492ae4e147dc8e05fb714 (plain) (blame)
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
44
45
46
47
48
49
50
51
52
53
54
" Don't make any effort to be compatible with vi, use more sensible settings
set nocompatible

" Use UTF-8 by default wherever possible, including in this file
if has('multi_byte')
  set encoding=utf-8
  scriptencoding utf-8
endif

" Load configuration files from ~/.vim/config or its analogue, before Pathogen
" loads all its directories into 'runtimepath'
runtime! config/*.vim

" If our version isn't ancient and Pathogen is available, call it to load all
" the plugins in .vim/bundle; these are saved as submodules
if v:version >= 701
  silent! call pathogen#infect()
  silent! call pathogen#helptags()

  " With the plugins loaded, we might now be able to use my custom colorscheme
  if has('syntax')
    silent! colorscheme sahara
  endif
endif

" Don't jump my screen around when I join lines, keep my cursor in the same
" place; this is done by dropping a mark first and then immediately returning
" to it; note that it wipes out your z mark, if you happen to use it
nnoremap J mzJ`z

" Let me backspace over pretty much anything, even if it's not text I inserted
" in the current session
set backspace=indent,eol,start

" Don't assume a number with a leading zero is octal; it's far more likely a
" zero-padded decimal, so increment and decrement with ^A and ^X on that basis
set nrformats-=octal

" Use the tilde as an operator with motions, rather than just swapping the
" case of the character under the cursor
set tildeop

" Change and delete with C and D both cut off the remainder of the line from
" the cursor, but Y yanks the whole line, which is inconsistent (and can be
" done with yy anyway); this fixes it so it only yanks the rest of the line
nnoremap Y y$

" Allow jumping between windows and tabs to find an open instance of a given
" buffer with :sbuffer.
if v:version >= 701
  set switchbuf=useopen,usetab
else
  set switchbuf=useopen
endif