-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
101 lines (88 loc) · 2.52 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
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'bling/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'scrooloose/nerdtree'
"Plugin 'sjl/badwolf'
Plugin 'airblade/vim-gitgutter'
Plugin 'Valloric/YouCompleteMe'
Plugin 'vim-syntastic/syntastic'
Plugin 'rust-lang/rust.vim'
Plugin 'morhetz/gruvbox'
call vundle#end()
filetype indent on
filetype plugin on
syntax on
let g:airline_theme='badcat'
set cursorline
"hi CursorLine ctermbg=236 cterm=bold
set lazyredraw
colorscheme gruvbox
set background=dark
let g:gruvbox_contrast_dark = 'hard'
set number
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smarttab
set autoindent
set smartindent
set showmatch
set smartcase
nmap <silent> <C-a> :NERDTreeToggle<CR>
map t gt
map T gT
"let g:rustfmt_autosave = 1
"YCM compile flag error fix
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
function! DSWI(stat)
let l:extension = expand('%:t:e')
let l:file_name = expand('%:t')
if extension == "c"
if a:stat == "build"
exec "! gcc" l:file_name "-o" expand('%:t:r')
elseif a:stat == "run"
exec "! gcc " l:file_name "-o tmp.out && ./tmp.out"
endif
elseif extension == "cpp"
if a:stat == "build"
exec "! g++" l:file_name "-o" expand('%:t:r')
elseif a:stat == "run"
exec "! g++ " l:file_name "-o /tmp/a.out && /tmp/a.out"
endif
elseif extension == "go"
if a:stat == "run"
exec "! go run" l:file_name
else
exec "! go build" l:file_name
endif
elseif extension == "py"
if a:stat == "run"
exec "! python3" l:file_name
else
exec "! python" l:file_name
endif
elseif extension == "rs"
if a:stat == "run"
exec "! cargo run"
else
exec "! cargo build"
endif
elseif extension == "sh"
if a:stat == "run"
exec "! bash" l:file_name
else
exec "! sh" l:file_name
endif
elseif extension == "lua"
exec "! lua5.3" l:file_name
else
echo "File type not supported:" l:extension
endif
endfunction
nmap <silent> } :call DSWI("run")<CR>
nmap <silent> ] :call DSWI("build")<CR>