summaryrefslogtreecommitdiffstats
path: root/.vimrc
blob: 8f75ca3ee06356509d7e8531588f99abfedebb68 (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
" Author: Florian "Bluewind" Pritz <flo@xssn.at>

set nocompatible
set encoding=utf-8               " unicode encoding
if &term =~# '^\(screen\|rxvt*\)$' "tty blinks otherwise
  set t_Co=256
endif
set nobackup
set noexpandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set ruler                        " show me where the cursor is
set rulerformat=%l/%L(%p%%),%c   " a better ruler
set showmatch                    " show matching brackets 
"set cindent
set number                       " show line numbers
set showmode                     " show mode at bottom of screen
set hlsearch                     " highlight all search results
set incsearch                    " increment search
set ignorecase                   " case-insensitive search
set smartcase                    " upper-case sensitive search
set laststatus=2
set mouse=a
set nopaste
set foldmethod=marker
"set smartindent
set scrolloff=3
set showcmd
set display=uhex
"set list
set listchars=tab:>\ ,eol:$
set hidden
set display+=lastline
set undofile

set wildmenu
set wildmode=full
set wildignore=*.o,*.a,*.class,*.mo,*.la,*.swp,*.jpg,*.png,*.xpm,*.gif,*.pyc,*~,.git,.svn,.hg,


let mapleader = ","

call pathogen#infect()

"aliases
cnorea w!! w !sudo tee "%" > /dev/null
"cnorea fb w !fb<CR>
cnorea qpd %!perl -pe 's/\=([0-9A-Fa-f]{2})/chr(hex($1))/ge; s/\=\n//;'

syntax on

filetype plugin indent on

autocmd FileType text setlocal textwidth=78
autocmd BufReadPost *
  \ if line("'\"") > 1 && line("'\"") <= line("$") |
  \   exe "normal! g`\"" |
  \ endif

if !exists(":DiffOrig")
  command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
	  \ | wincmd p | diffthis
endif

set runtimepath+=/usr/share/vim

let python_highlight_all = 1

" common save shortcuts
inoremap <C-s> <esc>:w<cr>a
nnoremap <C-s> :w<cr>
inoremap <C-c> <esc>:q<cr>
nnoremap <C-c> :q<cr>

" movement mappings
nnoremap <C-Right> <C-w>l
nnoremap <C-Left> <C-w>h
nnoremap <C-Down> <C-w>j
nnoremap <C-Up> <C-w>k
nnoremap <Up> gk
nnoremap <Down> gj
nnoremap j gj
nnoremap k gk

"au VimEnter * :NERDTreeToggle
noremap <F2> :NERDTreeToggle<CR>
inoremap <F2> <ESC>:NERDTreeToggle<CR>

noremap <C-f> :FufFile<CR>
inoremap <C-f> <ESC>:FufFile<CR>
"noremap <C-b> :FuzzyFinderBuffer<CR>
"inoremap <C-b> <ESC>:FuzzyFinderBuffer<CR>

noremap <C-h> :nohl<CR>
inoremap <C-h> <ESC>:nohl<CR>a

nmap <silent> ,s :set spell!<CR>

autocmd FileType make setlocal noexpandtab
au FileType python set ts=4 sw=4 softtabstop=4 et
autocmd BufRead,BufNewFile PKGBUILD let is_bash=1 | set ft=sh

"colorscheme gardener
"colorscheme desert256
"colorscheme candycode
colorscheme jellybeans
"colorscheme inkpot
"colorscheme mustang
"colorscheme wombat256
"colorscheme xoria256

" Toggle dark/light default colour theme for shitty terms
"map <F2> :let &background = ( &background == "dark" ? "light" : "dark" )<CR>

" Compile and run keymappings
au FileType php map <F10> :!php %<CR>
au FileType python map <F10> :!python %<CR>
au FileType perl map <F10> :!perl %<CR>
au FileType ruby map <F10> :!ruby %<CR>
au FileType lua map <F10> :!lua %<CR>
au FileType html,xhtml map <F10> :!firefox %<CR>
au FileType tex map <F10> :!texi2pdf -c %<CR>

" MiniBufExplorer
"let g:miniBufExplMapWindowNavVim = 1
"let g:miniBufExplMapWindowNavArrows = 1
"let g:miniBufExplMapCTabSwitchBufs = 1
"let g:miniBufExplModSelTarget = 1 

"set tags+=$HOME/.vim/tags/python.ctags

" Get the commit responsible for the current line
nmap <c-b> :call BlameCurrentLine()<cr>
" Get the current line number & file name, view the git commit that inserted it
fun! BlameCurrentLine()
let lnum = line(".")
let file = @%
exec "!gitBlameFromLineNo " lnum file
endfun

map <F12> <ESC>ggg?G``" apply rot13 for people snooping over shoulder, good fun

highlight ExtraWhitespace ctermbg=red guibg=red
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL

if !has("gui_running")
  if &term == "screen"
    set <C-Right>=Oc
    set <C-Left>=Od
    imap <C-Right> <ESC>:bn<RETURN>
    imap <C-Left> <ESC>:bp<RETURN>
  endif
else
  set guifont=Dejavu\ Sans\ Mono\ 10
  "set guioptions-=m
  set guioptions-=T
  set lines=80 columns=125
endif