summaryrefslogtreecommitdiffstats
path: root/.vimrc
blob: 13fcfeb9272ad3afe92df35d00737b5bd2aaf63c (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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
" load 'bundle' manager
execute pathogen#infect()

syntax on
set number 

"" have the mouse enabled all the time:
set ruler

filetype plugin indent on

" have command-line completion <Tab> (for filenames, help topics, option names)
" first list the available options and complete the longest common part, then
" have further <Tab>s cycle through the possibilities: set wildmode=longest,list,full
set wildmenu
set wildignore+=*.o,*.obj,.git,*.pyc,*.svn,*.png,*.jpg,*.gif,*.pdf,*.bak,*.lo

" display the current mode and partially-typed commands in the status line:
set showmode
set showcmd

" remove the Toolbar in MacVim
set guioptions-=T
colorscheme slate

" use indents of 4 spaces, and have them copied down lines:
set shiftwidth=2
set shiftround
set expandtab
set autoindent
set tabstop=2
set softtabstop=2
"set textwidth=79
set smartindent
set nocompatible
set shiftround " When at 3 spaces and I hit >>, go to 4, not 5.
" allow backspacing over everything in insert mode
set backspace=indent,eol,start 
set history=1000        

" disable autowrap
"set tw=0
"set nowrapscan
"set nowrap
"line wrapping cursor
"set whichwrap=<,>,h,l,[,]

" make sidescroll smoother
set sidescroll=3
" center the cursors on scrolling sidewards
set sidescrolloff=3
set backupdir=~/tmp   
set directory=~/tmp  " Don't clutter my dirs up with swp and tmp files
set scrolloff=3     " keep 3 lines visible at top and bottom 

let NERDTreeIgnore=['\.pyc$', '\~$', '^\.svn', '\.o$']

let mapleader = ','

nmap <leader>v :e $MYVIMRC<CR>
" http://stackoverflow.com/questions/2400264/is-it-possible-to-apply-vim-configurations-without-restarting/2400289#2400289
if has("autocmd")
  augroup myvimrchooks
    au!
    autocmd bufwritepost .vimrc source ~/.vimrc
    autocmd bufwritepost *.snippets call ReloadAllSnippets()
  augroup END
endif

au BufNewFile,BufRead *.mab set filetype=ruby
au BufNewFile,BufRead *.pp  set filetype=puppet
autocmd FileType ruby,eruby,yaml set ai sw=2 sts=2 et
autocmd FileType puppet set ai sw=2 sts=2 et

au BufRead /tmp/mutt-* set tw=72

" highlight the searchresults
set hlsearch

" Highlight the status line --------------------------------------------------
highlight StatusLine ctermfg=blue ctermbg=yellow

" define `Ispell' language and personal dictionary, used in several places
" below:
" set spell
let IspellLang = 'british'
let PersonalDict = '~/.ispell_' . IspellLang

" mark character exceeding the 80 limit as errors
"match Error /\%>80v/

set paste

" FileTypes
" ==================================================================
filetype on
filetype plugin on
" filetype indent off
" filetype plugin indent off

" autowrap for .txt and .tex files
" -------------------------------------------
"autocmd FileType tex setlocal textwidth=78 wrap linebreak spell
"autocmd BufRead,BufNewFile *.txt setlocal textwidth=78 wrap linebreak spell
"autocmd BufRead,BufNewFile *.md setlocal textwidth=78 wrap linebreak spell

nmap <silent> <leader>t :NERDTreeToggle<CR>

" Shortcuts for opening file in same directory as current file {{{2
map <leader>ew :e <C-R>=expand("%:p:h") . "/" <CR>
map <leader>es :sp <C-R>=expand("%:p:h") . "/" <CR>
map <leader>ev :vsp <C-R>=expand("%:p:h") . "/" <CR>
map <leader>et :tabe <C-R>=expand("%:p:h") . "/" <CR>