aboutsummaryrefslogtreecommitdiff
path: root/vim/vimrc
blob: 9e2c040b6fdc72cb916414cc9c0b313e3416095a (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
" start pathogen to manage the plugins
" runtime bundle/vim-pathogen/autoload/pathogen.vim
" execute pathogen#infect()

" global settings
set nocompatible
syntax enable
set encoding=utf-8
set showcmd                     " display incomplete commands
filetype plugin indent on       " load file type plugins + indentation
colorscheme mustang             " load the mustang colorscheme
set belloff=all                 " disable bell completely
set mouse=                      " disable all mouse support

"set number                      " activate line numbers
" switch between relative and absolute line numbers
set number
set relativenumber
autocmd InsertEnter * :set norelativenumber
autocmd InsertLeave * :set relativenumber
set t_Co=256                    " set 256 colors as everything supports it
set scrolloff=9999              " show as much context as possible
set history=500                 " keep 5000 lines of commands

"" Whitespace
set wrap                        " wrap lines
set tabstop=2 shiftwidth=2      " a tab is two spaces
set expandtab                   " use spaces, not tabs
set backspace=indent,eol,start  " backspace through everything in insert mode

"" Searching
set hlsearch             " highlight matches
set incsearch            " incremental searching
set ignorecase           " searches are case insensitive...
set smartcase            " ... unless they contain at least one capital letter
set cursorline           " highlight the line of the cursor

if version >=703
  set colorcolumn=80     " mark column 80 as a limit
endif

"" command remappings
" clear the search buffer when hitting return
:nnoremap <CR> :nohlsearch<cr>

" easier navigation between split windows
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l

"" file settings
" set backupdir=~/.vim/_backup    " where to put backup files.
" set directory=~/.vim/_temp      " where to put swap files.

"" module settings
if has("autocmd")
  " Remember last location in file, but not for commit messages.
  " see :help last-position-jump
  au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
    \| exe "normal! g`\"" | endif
endif

"" ignore some directories in ctrlp
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
"" open ctrlp selection in new tab by default
let g:ctrlp_prompt_mappings = {
    \ 'AcceptSelection("e")': ['<c-t>'],
    \ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
    \ }