aboutsummaryrefslogtreecommitdiff
path: root/vimrc.dot.link
blob: 8609f2f72976e61397fb114be1fbd72260c33cc9 (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
syn on
set nonu

set background=dark
set nobackup
set nowritebackup

set noautoindent
set nosmartindent
set tabstop=2
set shiftwidth=2
set expandtab 
set mouse-=a
set autoread
set nocompatible
set laststatus=2

set title
set titleold="terminal"
set titlestring=vim:\ %F

" Thanks to http://stackoverflow.com/questions/1673649/vimrc-action-onclose
function! ResetTitle(title)
    " disable vim's ability to set the title
    exec "set title t_ts='' t_fs=''"

    " and restore it
    "exec ":!echo -e '\033kbash\033\\'\<CR>"
    exec ":!xtitle " a:title
endfunction

au VimLeave *mutt/*   silent call ResetTitle("mutt")
au VimLeave *remind/* silent call ResetTitle("wyrd")

" Folding
set foldmethod=syntax
set foldlevelstart=1
let g:sh_fold_enabled = 1
let javaScript_fold=1
let perl_fold=1
let php_folding=1
let r_syntax_folding=1
let ruby_fold=1
let sh_fold_enabled=1
let vimsyn_folding='af'
let xml_syntax_folding=1

" PHP
let php_sql_query = 1

au BufNewFile,BufRead *.thtml set ft=php
au BufNewFile,BufRead *.mdwn  set ft=ikiwiki
au BufNewFile,BufRead *.md    set ft=ikiwiki
au BufNewFile,BufRead *.rem   set ft=remind

augroup mkd
 autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:>
augroup END

if has("autocmd")
  " Drupal *.module and *.install files.
  augroup module
    autocmd BufRead,BufNewFile *.profile set filetype=php
    autocmd BufRead,BufNewFile *.module  set filetype=php
    autocmd BufRead,BufNewFile *.install set filetype=php
    autocmd BufRead,BufNewFile *.test    set filetype=php
  augroup END
endif

" Pathogen - https://github.com/tpope/vim-pathogen
call pathogen#infect()
syntax on
filetype plugin indent on

" No modelines
set nomodeline

" Syntax check
let g:syntastic_mode_map = { 'mode': 'passive',
                           \ 'active_filetypes': [],
                           \ 'passive_filetypes': [] }

" Shortcut to open a new tab
nmap <ESC>n :tabnew<CR>

" Quit and close shortcuts
map q :wqa <CR>
map f :wq <CR>
map t :tabclose <CR>
map m :q! <CR>

" NERDTree section
" Thanks to http://stackoverflow.com/questions/1447334/how-do-you-add-nerdtree-to-your-vimrc

"autocmd VimEnter * NERDTree
"autocmd VimEnter * wincmd p

autocmd FileType nerdtree set relativenumber
autocmd FileType taglist  set relativenumber

" Shortcut to open tree from bookmark
cnoreabbrev NF NERDTreeFromBookmark

function OpenNERDTree()
  execute ":NERDTree"
  endfunction
  command -nargs=0 OpenNERDTree :call OpenNERDTree()

  nmap <ESC>t :OpenNERDTree<CR>

" See http://superuser.com/questions/10588/how-to-make-cut-copy-paste-in-gvim-on-ubuntu-work-with-ctrlx-ctrlc-ctrlv
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <C-r><C-o>+

" Color scheme
"colorscheme github
"colorscheme solarized
"colorscheme gentooish
"colorscheme revolutions
"colorscheme two2tango
"colorscheme vj
"colorscheme wood
"colorscheme zenburn
"colorscheme inkpot
colorscheme xoria256