aboutsummaryrefslogtreecommitdiffstats
path: root/conf/vimrc
blob: b62ec5e781cb0a1dd30c8c377129dd2408a4a1aa (plain) (blame)
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
" Ressources
" http://nvie.com/posts/how-i-boosted-my-vim/

"
" general setup
"

filetype off
set nocompatible
" Use pathogen to easily modify the runtime path to include all
" plugins under the ~/.vim/bundle directory
"call pathogen#helptags()
"call pathogen#runtime_append_all_bundles()
filetype plugin indent on

set modelines=0

let mapleader=","

nmap <silent> <leader>ve :e $MYVIMRC<CR>
nmap <silent> <leader>vr :so $MYVIMRC<CR>

"
" behavior
"

" wrapping
set wrap
set textwidth=79
set formatoptions=qrn1
set colorcolumn=81
hi ColorColumn ctermbg=0
set winwidth=80

"set hidden

"set tabstop=2
"set shiftwidth=2
"set smarttab
"set softtabstop=2
"
set tabstop=2     " a tab is four spaces
set expandtab
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set autoindent    " always set autoindenting on
set copyindent    " copy the previous indentation on autoindenting
" set number        " always show line numbers
set shiftwidth=2  " number of spaces to use for autoindenting
set shiftround    " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch     " set show matching parenthesis
set ignorecase    " ignore case when searching
set smartcase     " ignore case if search pattern is all lowercase, case-sensitive otherwise
set smarttab      " insert tabs on the start of a line according to shiftwidth, not tabstop
set hlsearch      " highlight search terms
set incsearch     " show search matches as you type

set history=1000         " remember more commands and search history
set undolevels=1000      " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class
set title                " change the terminal's title
set visualbell           " don't beep
set noerrorbells         " don't beep

set nobackup
" set noswapfile

"
" file type
"

filetype plugin indent on
if has('autocmd')
  autocmd filetype python set expandtab
endif

"
" color
"

if &t_Co >= 256 || has("gui_running")
  colorscheme mustang
endif

if &t_Co > 2 || has("gui_running")
  " switch syntax highlighting on, when the terminal has colors
  syntax on
endif

"
" editing
"

"set list
" set listchars=tab:>.,trail:.,extends:#,nbsp:.
" set listchars=trail:.,extends:#,nbsp:.
" set listchars-=tab:>.
"autocmd filetype html,xml set listchars-=tab:>.

"
" paste
"

set pastetoggle=<F2>
map <C-v> "+p
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <ESC>"+p
"nmap <F6> :!read xsel --clipboard --output<CR>

"
" mouse
"

"set mouse=a
"XXX install vim x11
"set ttymouse=xterm2 "to work inside tmux
"noremap <F3> :call <SID>ToggleMouse()<CR>
"inoremap <F3> <Esc>:call <SID>ToggleMouse()<CR>a

"
" bindings
"

nnoremap ; :
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>

" Use Q for formatting the current paragraph (or selection)
vmap Q gq
nmap Q gqap

" Jump to next line in editor, not in file
nnoremap j gj
nnoremap k gk

" Easy window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l

" Clear search
nmap <silent> ,/ :nohlsearch<CR>

" Reopen file with sudo
cmap w!! w !sudo tee % >/dev/null

" Search with ack
nnoremap <leader>a :Ack 

nnoremap <leader>P :ToggleRaibowParenthesis

"
" Plugins
"

" * Command-t - ,t
" * snipMate - for<TAB>

"
" Autosave on focus out
"
au FocusLost * :wa

" ----
" MINE
" ----

" set hlsearch
set guifont="Monospace 9"

" version using tabs
"set tabstop=4
"set shiftwidth=4
"set smarttab
"set expandtab
"set softtabstop=4
"set autoindent
"im :<CR> :<CR><TAB>

" version using spaces
"set tabstop=2
"set shiftwidth=2
"set smarttab
"set expandtab
"set softtabstop=2
"set autoindent
"im :<CR> :<CR><TAB>

" filetype plugin indent on

imap <F4> ===============================================================================<CR>
nmap <F4> a===============================================================================<CR>
imap <F5> ===============================================================================<CR><C-R>=strftime("%Y%m%d-%H%M")<CR><CR>
nmap <F5> a===============================================================================<CR><C-R>=strftime("%Y%m%d-%H%M")<CR><CR>