summaryrefslogtreecommitdiffstats
path: root/.vimrc
blob: 7c1bddb4423ae80d38279a3793e12e17209fb30a (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
" 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=2
set shiftwidth=2
set softtabstop=2
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 cursorline

let mapleader = ","

"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//;'

let g:qname_hotkey = "<C-b>"

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> :FuzzyFinderFile<CR>
inoremap <C-f> <ESC>:FuzzyFinderFile<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

" 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

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

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\ 7
  "set guioptions-=m
  set guioptions-=T
  set lines=80 columns=125
endif