forked from tokiclover/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
182 lines (151 loc) · 4.16 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
" -------------------------------------------------- HEADER
" Header: $HOME/.vimrc, 2014/10/01 -tclover Exp
" -------------------------------------------------- DESCRIPTION
" simple and sane vimrc based on https://github.com/W4RH4WK/dotVim/
" gentoo has a rich app-vim category, so take a look at
" cfg/etc/portage/sets/vim for my sets of vim plugins
" -------------------------------------------------- CODE
set nocompatible
" -------------------------------------------------- BEFORE
for f in split(glob('~/.vim/before/*.vim'), '\n')
source f
endfor
" -------------------------------------------------- GLOBAL
if filereadable("/etc/vim/vimrc")
source /etc/vim/vimrc
endif
" -------------------------------------------------- LOCAL
if filereadable("~/.vim/vimrc")
source ~/.vim/vimrc
endif
" -------------------------------------------------- PATHOGEN
call pathogen#infect('/usr/share/vim/vim74/plugin/{}')
call pathogen#infect('/usr/share/vim/vimfiles/plugin/{}')
call pathogen#infect('~/.vim/plugin/{}')
" -------------------------------------------------- PLUGIN
let g:yankring_history_dir='~/.vim/runtime'
" -------------------------------------------------- BASICS
" settings
scriptencoding utf-8
set bs=2
set history=50
set ruler
filetype off
syntax on
set shell=zsh
" handling
set backspace=indent,eol,start
set foldignore=" "
set foldmethod=indent
set formatoptions=cqrt
set ignorecase
set incsearch
set smartcase
set timeoutlen=500
" visual
set background=dark
set encoding=utf-8
set laststatus=2
set lazyredraw
set listchars=tab:>\ ,eol:\
set nohlsearch
set nowrap
set ruler
set showcmd
set ttyfast
" visual gui
set antialias
set background=dark
set guifont=Terminus\ 8
set guioptions=aegi
set mousehide
set noerrorbells
" file handling
set fileencoding=utf-8
set history=50
set modeline
set noswapfile
set tags=./.tags;/
set viminfo="NONE"
" formating
filetype plugin indent on
set autoindent " automatically indent lines
"set expandtab " use spaces to indent
set shiftwidth=4 " number of spaces for indent
set smarttab " backspace over tabs
set softtabstop=0 " tab = softtabstop * spaces
set tabstop=4 " tab stop distance
" set omnifunc
autocmd FileType c set omnifunc=ccomplete#Complete
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
set completeopt=menu
" -------------------------------------------------- COLOR
if $TERM == 'linux'
set t_Co=8
set colorcolumn=0
colorscheme torte
else
set t_Co=256
set colorcolumn=80
colorscheme wombat256mod
endif
" -------------------------------------------------- KEYBINDINGS
" disable forward / backward (tmux)
"noremap <c-b> <NOP>
"noremap <c-f> <NOP>
" redraw screen
nnoremap <leader>r <ESC>:redraw!<CR>
" save as root
nnoremap <leader>w <ESC>:w !sudo tee % > /dev/null<CR>
" tab switch
nnoremap <Tab> <ESC>:tabn<CR>
nnoremap <S-Tab> <ESC>:tabp<CR>
" toggle paste mode
set pastetoggle=<F2>
" trim trailing whitespace
nnoremap <leader>t <ESC>:%s/\s\+$//<CR>
" window movement
nnoremap <c-h> <c-w>h
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>l
nnoremap <S-Tab> <ESC>:tabp<CR>
" toggle paste mode
set pastetoggle=<F2>
" trim trailing whitespace
nnoremap <leader>t <ESC>:%s/\s\+$//<CR>
" window movement
nnoremap <c-h> <c-w>h
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>l
" extended keyboard (numeric pad) mapping when num lk is unset
noremap Ot <Left>
noremap Ox <Up>
noremap Oy <PageUp>
noremap Ov <Right>
noremap Or <Down>
noremap Os <PageDown>
noremap Ow <Home>
noremap Oq <End>
noremap Op <Insert>
noremap On <ESC>
noremap Ou <Del>
noremap OM <CR>
" those key code are combination of <C>+<Left>|<Up>|<Right>|<Down>
" on a funky keyboard
noremap Oa <C-Up>
noremap Ob <C-Down>
noremap Oc <C-Left>
noremap Od <C-Right>
" those key code are combination of <S>+<Left>|<Up>|<Right>|<Down>
" on a funky keyboard
noremap [a <S-Up>
noremap [b <S-Down>
noremap [c <S-Left>
noremap [d <S-Right>
" vim:fenc=utf-8:tw=80:sw=2:sts=2:ts=2: