-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
150 lines (132 loc) · 4.07 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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
" .vimrc by fixje
" required plugins:
" - NERDTree or CtrlP
" - FuzzyFinder
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" General
set ff=unix
set encoding=utf-8
filetype on
filetype plugin on
filetype indent on
" set wrap
set viminfo+=!
let mapleader = ","
" automatically reload vimrc when it's saved
" au BufWritePost .vimrc so ~/.vimrc
"" Colors
set t_Co=256
set background=dark
syntax on
colorscheme molokai
" highlight TODO and FIXME in every filetype
highlight Todo ctermbg=yellow guibg=yellow ctermfg=red guifg=red term=bold gui=bold
highlight Fixme ctermbg=red guibg=red ctermfg=yellow guifg=yellow term=bold gui=bold
match Todo /TODO:*/
match Fixme /FIXME:*/
"" Change the status line based on mode
if version >= 700
au InsertEnter * hi StatusLine term=reverse ctermbg=5 gui=undercurl guisp=Magenta
au InsertLeave * hi StatusLine term=reverse ctermfg=0 ctermbg=2 gui=bold,reverse
endif
"""""" User Interface
set autoindent
set autoread " spell checking
set backspace=2
set nobackup
set nowritebackup
set cursorline " hilight current line
set colorcolumn=160
highlight ColorColumn ctermbg=7 guibg=LightGray
set directory=~/.vim/swap " Don't clutter my dirs up with swp and tmp files
set guioptions-=T " Disallows gui toolbar
set guioptions-=m " Hide menu bar
set hidden " allow to switch buffers without saving
set laststatus=2 " always enable status bar
set linebreak "
set vb " visual bell to prevent beep
set list " show tabs and spaces "nolist" to disable
set listchars=tab:>·,trail:·
set mouse=a " let's do everything with the mouse
set nu! " show line numbers
set numberwidth=4 " width of line number column
set nostartofline
set relativenumber " relative line numbers from cursor
set ruler
set scrolloff=10
set showbreak=↪
set showcmd
set showmatch
set textwidth=0
set wildmenu " menu for command line auto-completion
set wrap
"" Tabs and Spaces
set expandtab " replace tabs by spaces
set tabstop=4 " 1 tab equals X spaces
set shiftwidth=4 " ...
set smarttab
"" Search settings
set incsearch " search while typing
set hlsearch " hilight matches when searching
set smartcase " case insensitive search
"" Turn on omnicomplete
set ofu=syntaxcomplete#Complete
"" Page scroll with cursor in the middle
noremap <C-u> <C-u>zz
noremap <C-d> <C-d>zz
""""" Keyboard Commands
imap <C-s> <esc>:w<CR>
map <C-s> <esc>:w<CR>
noremap YY :qa!<CR>
" Emacs-like beginning and end of line.
imap <c-e> <c-o>$
imap <c-a> <c-o>^
" paste in insert mode: <C-r> {register}| " | * where " is lat yank and * is
" clipboard
" mappings for FuzzyFinder
nnoremap <C-f> :FufBuffer<CR>
" move marked lines up and down
nnoremap <A-j> :m .+1<CR>==
nnoremap <A-k> :m .-2<CR>==
inoremap <A-j> <Esc>:m .+1<CR>==gi
inoremap <A-k> <Esc>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv=gv
vnoremap <A-k> :m '<-2<CR>gv=gv
" same for 7-bit terminal
"" bad idea as it maps Esc!
"nnoremap j :m .+1<CR>==
"inoremap j <Esc>:m .+1<CR>==gi
"vnoremap j :m '>+1<CR>gv=gv
"inoremap k <Esc>:m .-2<CR>==gi
"nnoremap k :m .-2<CR>==
"vnoremap k :m '<-2<CR>gv=gv
"" Leader Commands
map <Leader>nh :nohlsearch<CR>
map <Leader>cd :lcd %:h<CR>
map <Leader>pp :set paste<CR>
map <Leader>np :set nopaste<CR>
map <Leader>mnt :set noexpandtab nolist<CR>
map <Leader>mt :set expandtab list<CR>
" CtrlP buffer and file explorer
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
"" Go to nearest VCS root
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_root_markers = ['pom.xml', '.p4ignore']
"" help function
if !has('python')
finish
endif
function! LeaderHelp()
python << endpython
import re
import os
reg = re.compile("^(i|v|)?(no)?(re)?map.*<[Ll]eader>.*$")
with open(os.environ["HOME"] + "/.vimrc") as rc:
for l in rc:
if reg.match(l):
print l
endpython
endfunction
map <Leader>h :call LeaderHelp()<CR>