forked from nriitala/conf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
162 lines (123 loc) · 3.44 KB
/
.vimrc
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
160
161
162
" .vimrc by Niko Riitala <[email protected]>. Twitter: @nikoriitala
" No copyright, feel free to use this, as you like.
"
" General VIM settings file. Optimized for OS X term and for PHP coding.
" Most of this file is copied from Tobias Schlitt's version of .vimrc
"cabbr checkjs !js /home/niko/bin/runjslint.js "`cat %`" \| lynx --force-html /dev/fd/5 -dump 5<&0 \| less
" {{{ File handling
au BufRead,BufNewFile *.phps set filetype=php
au BufRead,BufNewFile *.phtml set filetype=php
au BufRead,BufNewFile *.module set filetype=php
au BufRead,BufNewFile *.inc set filetype=php
"au BufRead,BufNewFile *.css set filetype=php
au BufRead,BufNewFile *.txt setlocal ft=txt
au! BufRead,BufNewFile *.mkd setfiletype mkd
au BufRead,BufNewFile *.todo setfiletype todo
" }}}
" {{{ Vim Settings
" for manually compiled Vim 7.3
"let &runtimepath.=',/home/niko/vim/runtime'
"let $VIMRUNTIME = "/home/niko/vim/runtime"
set undofile " Save undo's after file closes
set undodir=/home/niko/vim/undo " where to save undo histories
set undolevels=1000 " How many undos
set undoreload=10000 " number of lines to save for undo
" old vim thingies continue
syntax on
" highlight current line in insert mode.
"autocmd InsertLeave * se nocul
"autocmd InsertEnter * se cul
" switch paste mode off whenever insert mode is left
" autocmd InsertLeave <buffer> se nopaste
" source .vimrc after saving .vimrc
"autocmd bufwritepost .vimrc source $MYVIMRC
" colored column (to see line size violations)
"set colorcolumn=80
" use filetype plugins, e.g. for PHP
filetype plugin on
" show nice info in ruler
set ruler
set laststatus=2
" set standard setting for pear coding standards
set tabstop=4
set shiftwidth=4
" auto expand tabs to spaces
set expandtab
" auto indent after a {
set autoindent
set smartindent
" show line numbers by default
set number
" enable folding by fold markers
set foldmethod=marker
" autoclose folds, when moving out of them
set foldclose=all
" use incremental searching
set incsearch
" do not highlight search results
" set nohlsearch
"set scrolljump=5
set scrolloff=5
" repair wired terminal/vim settings
set backspace=start,eol,indent
" toggle paste
set pastetoggle=§
set wrap
" backup settings
set backup
set backupdir=/home/niko/.vim-backup
fun! InitBex()
let aika = strftime("%y%m%d-%H%M")
let myvar = "set backupext=_". aika
execute myvar
echo myvar
endfun
au BufWritePre * call InitBex()
set backupskip=/tmp/*,/private/tmp/*
" }}}
" {{{ Misc settings, mappings, term settings
" some mappings
map t :tabnew
" write with sudo ":w!!"
cnoremap w!! w !sudo tee % >/dev/null
if &term =~ "xterm"
if has("terminfo")
set t_Co=8
set t_Sf=<Esc>[3%p1%dm
set t_Sb=<Esc>[4%p1%dm
else
set t_Co=8
set t_Sf=<Esc>[3%dm
set t_Sb=<Esc>[4%dm
endif
endif
function! Tab_Or_Complete()
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-N>"
else
return "\<Tab>"
endif
endfunction
:inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
nnoremap <silent> <F8> :TlistToggle<CR>
nnoremap <silent> <F9> :NERDTree<CR>
map <C-t> :tabnew<CR>
map <C-Left> :tabp<CR>
map <C-Right> :tabn<CR>
hi Comment ctermfg=blue
" fix arrow keys
set t_ku=[A
set t_kd=[B
set t_kr=[C
set t_kl=[D
if (&term == "xterm")
set t_ku=OA
set t_kd=OB
set t_kr=OC
set t_kl=OD
" set background=dark
endif
" run zsh inside vim
let g:ConqueTerm_TERM = 'xterm'
command Z :ConqueTermVSplit zsh
" }}}