-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.windows
120 lines (104 loc) · 3.18 KB
/
vimrc.windows
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
syntax on
set nocompatible
set backspace=indent,eol,start
set nobackup
set nowrap
set noautochdir
set number
set ignorecase
set smartcase
set incsearch
set hlsearch
set ruler
set tabstop=8
set shiftwidth=2
set expandtab
set colorcolumn=80
set autoindent
set preserveindent
set foldmethod=manual
set laststatus=2
set encoding=utf8
set splitbelow
set splitright
set linespace=2
if has('gui_running')
set cursorline
set guioptions-=T
set guioptions-=m
set guioptions-=r
set guioptions-=R
set guioptions-=l
set guioptions-=L
set guitablabel=%N:%M%t
set background=dark
colorscheme base16-ocean
if has('gui_gtk2')
set columns=150 lines=43
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 10
elseif has('gui_win32')
set columns=160 lines=45
set guifont=Consolas:h11
elseif has('gui_macvim')
set columns=160 lines=45
set guifont=Source\ Code\ Pro:h13
endif
endif
" One-button compile and run
nnoremap <F5> :make<CR>
nnoremap <F9> :SCCompile<CR>
nnoremap <F10> :SCCompileRun<CR>
if has("win32")
" On Windows we use MinGW's make
set makeprg=mingw32-make
endif
" Open directory tree
nnoremap <C-T> :NERDTreeTabsToggle<CR>
" Navigate more easily between splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Tab management and navigation
"nnoremap <C-S-T> <Esc>:tabnew<CR>
"nnoremap <C-S-W> <Esc>:tabclose<CR>
noremap <Leader>1 1gt
noremap <Leader>2 2gt
noremap <Leader>3 3gt
noremap <Leader>4 4gt
noremap <Leader>5 5gt
noremap <Leader>6 6gt
noremap <Leader>7 7gt
noremap <Leader>8 8gt
noremap <Leader>9 9gt
" Search for the visually selected sequence of characters
vnoremap g/ y/<C-R>"<CR>
" Automatically open, but do not go to (if there are errors) the quickfix /
" location list window, or close it when is has become empty.
" (doesn't seem to work...)
autocmd QuickFixCmdPost [^l]* nested cwindow
autocmd QuickFixCmdPost l* nested lwindow
" Automatically adjust quickfix window height
au FileType qf call AdjustWindowHeight(3, 10)
function! AdjustWindowHeight(minheight, maxheight)
exe max([min([line("$"), a:maxheight]), a:minheight]) . "wincmd _"
endfunction
" Commands to quickly switch between popular indentation styles
command! -nargs=0 T4 :set noexpandtab | :set tabstop=4 | :set shiftwidth=4
command! -nargs=0 T4s :set expandtab | :set tabstop=4 | :set shiftwidth=4
command! -nargs=0 T2 :set noexpandtab | :set tabstop=2 | :set shiftwidth=2
command! -nargs=0 T2s :set expandtab | :set tabstop=2 | :set shiftwidth=2
command! -nargs=0 T8 :set noexpandtab | :set tabstop=8 | :set shiftwidth=8
" Non-standard file extensions
autocmd BufRead,BufNewFile,BufWritePost *.gyp,*.gypi set filetype=python
autocmd BufRead,BufNewFile,BufWritePost *.h++ set filetype=cpp
autocmd BufRead,BufNewFile,BufWritePost *.sage set filetype=python
autocmd BufRead,BufNewFile,BufWritePost *.spyx,*.pyx set filetype=python.c
" Set search path for ctags database
" http://stackoverflow.com/a/741486/249230
set tags=./tags;/
" Fix curly brace error in C++11 lambdas
let c_no_curly_error = 1
if filereadable($HOME."/.vimrc.local")
exec "source ".$HOME."/.vimrc.local"
endif