-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
131 lines (114 loc) · 2.71 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
set nocompatible
set t_Co=256
set bg=dark
set modeline
set relativenumber
set wildignore+=*.DS_Store
set wildignore+=*.pyc
set wildmenu
if has('win32')
autocmd InsertEnter * set noimdisable
autocmd InsertLeave * set imdisable
autocmd FocusGained * set imdisable
autocmd FocusLost * set noimdisable
language messages en
set directory=.,$TEMP
set shellslash
endif
autocmd InsertLeave * set nopaste
set display+=lastline " Show as much as possible of the last line
set display+=uhex " Show unprintable characters as a hex number
set hlsearch " Search with highlight
set laststatus=2
set number
set nrformats-=octal
set scrolloff=3
set showcmd
set showmatch
set sidescroll=1
set sidescrolloff=10
set splitbelow
set splitright
set title
syntax on
" Highlight trailing whitespace
highlight ExtraWhitespace ctermbg=blue guibg=red
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace //
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWritePre * :%s/\s\+$//e
if version >= 702
autocmd BufWinLeave * call clearmatches()
endif
" Text formatting
set autoindent
set expandtab
set smartindent
set softtabstop=4
set shiftwidth=4
set tabstop=4
autocmd FileType c,cpp,java,mkd,markdown
\ setlocal softtabstop=4 shiftwidth=4 tabstop=4
autocmd FileType python
\ setlocal softtabstop=4 shiftwidth=4 tabstop=4
" Disable automatic comment insertion
autocmd FileType *
\ setlocal formatoptions-=c formatoptions-=o
" Mappings
"noremap j gj
"noremap k gk
"noremap <Down> gj
"noremap <Up> gk
"noremap gj j
"noremap gk k
"noremap H ^
"noremap L $
"inoremap <C-A> <ESC>I
"inoremap <C-E> <ESC>A
"cnoremap <C-A> <Home>
"cnoremap <C-E> <End>
" Break the undo block when Ctrl-u
"inoremap <C-U> <C-G>u<C-U>
" Search regex
nnoremap / /\v
vnoremap / /\v
cnoremap %s/ %smagic/
cnoremap \>s/ \>smagic/
" Center display after searching
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#zz
" Reselect visual block after shifting
vnoremap < <gv
vnoremap > >gv
" Splitted windows
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k
nnoremap <C-H> <C-W>h
nnoremap <C-L> <C-W>l
" man page settings
autocmd FileType c,cpp set keywordprg=man
autocmd FileType ruby set keywordprg=ri
augroup colorcolumn
autocmd!
autocmd FileType gitcommit
\ if exists('+colorcolumn') |
\ set colorcolumn=73 |
\ else |
\ let w:m2 = matchadd('ErrorMsg', '\%>72v.\+', -1) |
\ endif
augroup END
" Markdown Vim Mode
let g:vim_markdown_folding_disabled = 1
" For some reason home and end keys are not mapping properly.
" Home key
imap <esc>OH <esc>0i
cmap <esc>OH <home>
nmap <esc>OH 0
" End key
nmap <esc>OF $
imap <esc>OF <esc>$a
cmap <esc>OF <end>