-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
160 lines (129 loc) · 3.13 KB
/
vimrc
File metadata and controls
160 lines (129 loc) · 3.13 KB
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
""
"" My vi configuration
""
set history=500
filetype plugin on
filetype indent on
set autoread
let mapleader = ","
let g:mapleader = ","
nmap <leader>w :w!<cr>
map <silent> <leader><cr> :noh<cr>
set so=7
set wildignore=*.o,*~,*.pyc
set ruler
set cmdheight=2
set hid
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" search
set ignorecase
set smartcase
set hlsearch
set incsearch
set showmatch
set mat=2
" shut it up
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" look
syntax enable
colorscheme desert
set background=dark
if has("gui_running")
set guioptions-=T
" set guioptions+=e
" set t_Co=256
set guitablabel=%M\ %t
"FD Maximize window
set guiheadroom=0
set lines=999 columns=999
endif
set encoding=utf8
set ffs=unix,dos,mac
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile
" Indenting done manually
set autoindent " Indent new line same as previous but with TABS
set smartindent " Insert indent after a line ending with {
set noexpandtab
set nosmarttab
set shiftwidth=8
set tabstop=8
map <silent> <leader><tab> :%s/\t/ /g<cr>
" Wrap text after 500 cols in most cases
set nolinebreak
set textwidth=500
set wrap
" Usuful shorcut
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
map <leader>e :edit <c-r>=expand("%:p:h")<cr>/
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Remember info about open buffers on close
set viminfo^=%
set laststatus=2
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ Col:\ %c
map <leader>cc :botright cope<cr>
map <leader>co ggVGy:tabnew<cr>:set syntax=qf<cr>pgg
map <leader>n :cn<cr>
map <leader>p :cp<cr>
map <F6> :cn<cr>
map <S-F6> :cp<cr>
""""""""""""""""""""""""""""""""
"""" FD utility for plugins """"
""""""""""""""""""""""""""""""""
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
en
return ''
endfunction
"""""""""""""""""""""""""""""""""""
"""" FD my personnal shortcuts """"
"""""""""""""""""""""""""""""""""""
set mouse=a
set browsedir=buffer
set noautochdir " Do not change directory, this breaks ctags
map <C-s> :w<cr>
map <C-b> :w<cr>:make -j4<cr><cr>:botright cope<cr>
map s :w<cr>:make -j4<cr><cr>:botright cope<cr>
map K i<cr><Esc>
map Q :bp<cr>
map m :bn<cr>
map T gt
map <S-F2> :!ctags -R .<cr>
map <F2> <C-]>
map <F1> :TlistOpen<cr>
" Spaces and tabs
highlight fdTabs ctermbg=0 guibg=grey30
highlight fdExtraSpaces ctermbg=red guibg=red
autocmd BufWinEnter * match fdTabs /\t/
autocmd BufWinEnter * 2match fdExtraSpaces /\s\+$/
" Mark column 80
highlight ColorColumn ctermbg=0 guibg=grey30
set colorcolumn=80
func GitGrep(...)
let save = &grepprg
set grepprg=git\ grep\ -n\ $*
let s = 'grep'
for i in a:000
let s = s . ' ' . i
endfor
exe s
let &grepprg = save
endfun
command -nargs=? G call GitGrep(<f-args>)
func GitGrepWord()
normal! "zyiw
call GitGrep('-w -e ', getreg('z'))
endf
map <leader>g :call GitGrepWord()<CR>