-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
187 lines (150 loc) · 4.61 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
183
184
185
186
187
" most intersting stuff is done through breaking things
set nocompatible
" pathogen plugin, requires filetype plugin indent
filetype plugin indent on
call pathogen#infect()
" required to get help on stuff installed through pathogen
call pathogen#helptags()
" set language for messages and gui menus
let s:langCode = has('win32') ? 'en' : 'en_US.UTF-8'
" must be set before syntax highlight
let &langmenu = s:langCode
execute 'language message '.s:langCode
colorscheme ir_black
" enable syntax coloring
syntax enable
" use utf8 encoding for vim files and for default file encoding
set encoding=utf-8
set fileencoding=utf-8
" auto complete on tab
set wildmenu
" disable arrow key mappings (normal and insert modes)
nnoremap <Up> <nop>
nnoremap <Down> <nop>
nnoremap <Left> <nop>
nnoremap <Right> <nop>
inoremap <Up> <nop>
inoremap <Down> <nop>
inoremap <Left> <nop>
inoremap <Right> <nop>
" move on screen lines (and not actual lines), useful for wrapped lines
nnoremap j gj
nnoremap k gk
" remove useless help, and prompt for search term instead
noremap <F1> <esc>:h
" display a $ at end of change area (thus changed is visually between
" cursor and highlighted $.
" TODO : find how to always make it look different from text color under
" cursor
set cpoptions+=$
" when scrolling, keep a margin for readeability
set scrolloff=4
" tab are replaced by 4 spaces
set expandtab
set tabstop=4
" make deleting on spaces like its tabs
set softtabstop=4
" << / >> right / left shift by 4 spaces
set shiftwidth=4
" copy indent from current line on <CR>
set autoindent
" backspace in insert mode : backspace option
" behave like normal text editor, backspace always delete previous character
set backspace=eol,start,indent
" GUI font
if has("gui_gtk2")
" TODO find appropriate font for gtk2
"set guifont=Luxi\ Mono\ 12
elseif has("gui_win32")
" TODO : find appropriate font for windows xp
set guifont=Consolas:h11
endif
" windows fullscreen toggle
if has('gui_win32')
" note : .dll extention MUST be ommited when using an absolute path
" but that's according to documentation, and does not work without
let g:fullscreenDllPath=expand('%:p:h').'\.vim\bundle\gvimfullscreen_win32\gvimfullscreen.dll'
execute "map <F11> <Esc>:call libcallnr('".g:fullscreenDllPath."', 'ToggleFullScreen', 0)<cr>"
endif
" remove gui icons bar
set guioptions-=T
" remove menus
set guioptions-=m
set guioptions-=g
" remove all scrollbars
set guioptions-=R
set guioptions-=r
set guioptions-=L
set guioptions-=l
" don't redraw while executing macros
set lazyredraw
" display current mode and current command
set showmode
set showcmd
" allow to have hidden buffers not written
set hidden
set laststatus=2
set statusline=%t\ %{fugitive#statusline()}\ [%l,%v]\ %=%{strftime(\"%H:%M\")}
" extra locations required for swap files. will use 1st usable, so win-*nix
" friendly. fixes issues with Gdiff on windows
set directory+=,~/tmp,$TMP
" comma as leader key
let mapleader = ","
" search options
set incsearch
set showmatch
set hlsearch
" search ignore case when all lowercase, case sensitive otherwise
set ignorecase
set smartcase
" hide search highlight on ,<space>
nnoremap <silent><leader><space> :nohlsearch<cr>
" fuzzy-finder mappings
noremap <silent><leader>f :FufFile<cr>
noremap <silent><leader>b :FufBuffer<cr>
noremap <silent><leader>cd :FufDir<cr>
noremap <silent><leader>t :FufTag<cr>
" fuzzy-finder features to explore :
" - file coverage
" - mru file
" - mru command
" - bookmark file
" - bookmark dir
" - tag mode
" - buffer tag mode
" - tagged file
" - jump list
" - change list
" - quickfix
" - line
" fugitive mapped to ,g*
noremap <silent><leader>gs :Gstatus<cr>
noremap <silent><leader>gd :Gdiff<cr>
" closes all fugitive windows in current tab
function! GitClose()
let sep = has('win32') ? '\' : '/'
for buffer in tabpagebuflist()
if 0 < bufnr(buffer)
let bufName = bufname(buffer)
if bufName =~? '^fugitive:' || bufName =~? '\.git'.sep.'index$'
let window = bufwinnr(buffer)
if 0 < window
execute window."wincmd w"
wincmd c
wincmd p
endif
endif
endif
endfor
endfunction
nnoremap <silent><leader>gc :call GitClose()<cr>
" window commands on ,w instead of Ctrl+w
nnoremap <leader>w <c-w>
" diff update on ,du
" TODO : enable it only when in diff mode
nnoremap <silent><leader>du :diffupdate<cr>
" ack integration
" TODO add suitable configuration for windows
let g:ackprg="ack-grep -H --nocolor --nogroup --column"
" localvimrc to handle per location/project settings
let g:localvimrc_ask=0