This commit is contained in:
light jiang
2018-12-17 18:10:33 +08:00
parent 051d1db55d
commit 9aed47964e
10 changed files with 279 additions and 33 deletions
+66 -18
View File
@@ -1,9 +1,54 @@
nnoremap <leader>[ :bp<CR>
nnoremap <leader>] :bn<CR>
" 映射<leader>num到num buffer
"nmap <tab> :bn<cr>
map <leader>1 :b 1<CR>
map <leader>2 :b 2<CR>
map <leader>3 :b 3<CR>
map <leader>4 :b 4<CR>
map <leader>5 :b 5<CR>
map <leader>6 :b 6<CR>
map <leader>7 :b 7<CR>
map <leader>8 :b 8<CR>
map <leader>9 :b 9<CR>
map q :bwipeout<CR>
nmap J 5j
nmap K 5k
nmap H 5h
nmap L 5l
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
" 在文件外修改时自动加载
set autoread
" make 项目
autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr>
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec '!g++ % -o %<'
exec '!time ./%<'
elseif &filetype == 'cpp'
exec '!g++ % -o %<'
exec '!time ./%<'
elseif &filetype == 'python'
exec '!time python %'
elseif &filetype == 'sh'
:!time bash %
elseif &filetype == 'go'
exec 'GoRun'
endif
endfunc
"从不备份
set nobackup
@@ -49,6 +94,11 @@ set nobackup
set noswapfile
"搜索忽略大小写
set ignorecase
" 搜索时忽略大小写,但在有一个或以上大写字母时仍大小写敏感
set ignorecase
set smartcase
"搜索逐字符高亮
set hlsearch
set incsearch
@@ -90,8 +140,16 @@ set whichwrap+=<,>,h,l
map <space>ma :set mouse=a<CR>:set nu<CR>:set nopaste<CR>
map <space>mc :set mouse=c<CR>:set nu!<CR>:set paste<CR>
set mouse=a
set selection=exclusive
set selectmode=mouse,key
" 选中状态下 Ctrl+c 复制
vnoremap <c-c> "+y
" Ctrl+v
"nmap <silent> <C-v> "+p
"set selection=exclusive
"set selectmode=mouse,key
" 通过使用: commands命令,告诉我们文件的哪一行被改变过
set report=0
" 在被分割的窗口间显示空白,便于阅读
@@ -106,22 +164,6 @@ set scrolloff=3
set smartindent
" 高亮显示普通txt文件(需要txt.vim脚本)
au BufRead,BufNewFile * setfiletype txt
"自动补全
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
":inoremap { {<CR>}<ESC>O
":inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
filetype plugin indent on
"打开文件类型检测, 加了这句才可以用智能补全
set completeopt=longest,menu
@@ -146,3 +188,9 @@ if has("autocmd")
autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee,*.vue :call CleanExtraSpaces()
endif
colorscheme slate
highlight Comment ctermfg=blue
au BufNewFile,BufRead *.launch,*.urdf set filetype=xml