-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
176 lines (139 loc) · 4.1 KB
/
Copy path.vimrc
File metadata and controls
176 lines (139 loc) · 4.1 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
" options for gui
if has('gui_running')
set guifont=Mono
set guioptions-=T " no toolbar
endif
" Vundle calls
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
"" Bundles
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-dispatch'
Bundle 'tpope/vim-surround'
Bundle 'scrooloose/syntastic'
Bundle 'wincent/Command-T'
Bundle 'L9'
Bundle 'eagletmt/ghcmod-vim'
Bundle 'Shougo/vimproc'
" Indenting, formatting
set tabstop=2
set softtabstop=2
set shiftwidth=2
set cinkeys=0{,0},:,0#,!^F
set smarttab
set smartindent
set expandtab
set autoindent
" No-brainter options
syntax on
filetype plugin indent on
set nocompatible
set number
" folding settings
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "don't fold by default
set foldlevel=1 "this is just what i use
" Wildmenu autocompleting coolness
set wildmenu
"" Mappings
" Leader key is comma
let mapleader = ","
nnoremap <silent><leader>ev :e ~/.vimrc<CR>
nnoremap <silent><leader>zM :fold<CR>
nnoremap <silent><leader>zR :foldopen<CR>
noremap <ESC>[5~ <C-U>
" Useful mapping
vnoremap <leader>" <esc>`<i"<esc>`>la"<esc>
nnoremap H 0
nnoremap L $
inoremap jk <esc>
highlight OverLength ctermbg=darkred ctermfg=white guibg=#
match OverLength /\%81v.\+/
if !exists("autocommands_loaded")
let autocommands_loaded = 1
" auto updating of vimrc
autocmd bufwritepost .vimrc source ~/.vimrc
" Filetype mappings
augroup filetype_perl
autocmd!
autocmd FileType perl nnoremap <buffer> <leader>c I#<esc>
augroup END
augroup filetype_python
autocmd!
autocmd FileType python nnoremap <buffer> <leader>c I#<esc>
autocmd FileType python :iabbrev <buffer> iff if:<left>
augroup END
augroup filetype_javascript
autocmd!
autocmd FileType javascript nnoremap <buffer> <localleader>c I//<esc>
autocmd Filetype javascript :iabbrev <buffer> iff if()<left><esc>xi
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
augroup END
augroup filetype_cpp
autocmd!
autocmd Filetype cpp setlocal omnifunc=cppcomplete#CompleteCPP
autocmd Filetype cpp nnoremap <leader>dt :Dispatch make && make run <CR>
autocmd Filetype cpp setlocal tabstop=4
autocmd Filetype cpp setlocal softtabstop=4
autocmd Filetype cpp setlocal shiftwidth=4
augroup END
" Highlighing
augroup CursorLine
au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline
set cursorline cursorcolumn
augroup END
endif
"" Status Line
set statusline=%f\ -\ FileType:\ %y
"" Colors
if has('gui_running')
colorscheme wombat
set background=dark
else
set background=dark
colorscheme wombat256mod
endif
"" Interface / Highlighting
" Keep a minimum of 7 lines above and below the cursor when possible
let &scrolloff=7-&scrolloff
" When a bracket is inserted, briefly jump to the matching one
set showmatch
" Highlight redudant whitespaces
highlight RedundantSpaces ctermbg=gray guibg=gray
match RedundantSpaces /\s+$| +\ze\t/
"" Command / Key Behavior
" Allow backspacing over autoindent, line breaks, start of insert
set backspace=indent,eol,start
" Allow arrow keys to wrap at eol
set whichwrap=<,>
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>)
function! s:RunShellCommand(cmdline)
let isfirst = 1
let words = []
for word in split(a:cmdline)
if isfirst
let isfirst = 0 " don't change first word (shell command)
else
if word[0] =~ '\v[%#<]'
let word = expand(word)
endif
let word = shellescape(word, 1)
endif
call add(words, word)
endfor
let expanded_cmdline = join(words)
botright new
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
call setline(1, 'You entered: ' . a:cmdline)
call setline(2, 'Expanded to ' . expanded_cmdline)
call append(line('$'), substitute(getline(2), '.', '=', 'g'))
silent execute '$read !' . expanded_cmdline
1
endfunction
" Syntastic options
let g:syntastic_python_flake8_args='--ignore=E111,E121'
let g:syntastic_cpp_compiler = 'clang++'
let g:syntastic_cpp_compiler_options = ' -std=c++11'