vimrc update
This commit is contained in:
parent
e8e037ae1e
commit
ac3f2922ee
18
go/vim-go.md
Normal file
18
go/vim-go.md
Normal file
@ -0,0 +1,18 @@
|
||||
# install vim-go
|
||||
|
||||
|
||||
## vundle
|
||||
|
||||
在.vimrc添加
|
||||
|
||||
``` bash
|
||||
Plugin 'fatih/vim-go'
|
||||
```
|
||||
重新打开vim, PluginInstall 安装vim-go
|
||||
|
||||
|
||||
## vim-go
|
||||
|
||||
在vim中使用 :GoInstallBinaries 安装vim-go的一些增强功能, 其中一些包需要翻墙,具体包位置参考 ~/.vim/bundle/vim-go/plugin/go.vim.
|
||||
主要是golang.org/x/tools 包比较困难,可以go get github.com/golang/tools 在复制到golang.org/x/目录下
|
||||
|
||||
57
vim/vimrc
57
vim/vimrc
@ -1,10 +1,15 @@
|
||||
" set the runtime path to include Vundle and initialize
|
||||
set rtp+=~/.fzf/
|
||||
set rtp+=~/.vim/bundle/Vundle.vim
|
||||
call vundle#begin()
|
||||
|
||||
Plugin 'VundleVim/Vundle.vim'
|
||||
|
||||
"Plugin 'junegunn/fzf.vim'
|
||||
Plugin 'junegunn/fzf.vim'
|
||||
nmap <Leader>l :BLines
|
||||
nmap <Leader>L :Lines
|
||||
|
||||
Plugin 'rking/ag.vim'
|
||||
|
||||
|
||||
Plugin 'w0rp/ale'
|
||||
@ -96,6 +101,9 @@ Plugin 'alvan/vim-closetag'
|
||||
let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.launch'
|
||||
|
||||
|
||||
Plugin 'jiangmiao/auto-pairs'
|
||||
|
||||
|
||||
Plugin 'vim-airline/vim-airline'
|
||||
Plugin 'vim-airline-themes'
|
||||
let g:airline_theme='bubblegum'
|
||||
@ -131,8 +139,8 @@ map <leader>9 :b 9<CR>
|
||||
map q :bwipeout<CR>
|
||||
|
||||
" ctags 配置
|
||||
map <F5> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --languages=Python,C++ -f .tags .<CR><CR>
|
||||
imap <F5> <ESC>:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --languages=Python,C++ -f .tags .<CR><CR>
|
||||
map <F4> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --languages=Python,C++ -f .tags .<CR><CR>
|
||||
imap <F4> <ESC>:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --languages=Python,C++ -f .tags .<CR><CR>
|
||||
set tags=tags
|
||||
set tags+=.tags
|
||||
set tags+=./.tags
|
||||
@ -149,6 +157,11 @@ Plugin 'The-NERD-tree'
|
||||
map <F2> :NERDTreeToggle<CR>
|
||||
let NERDTreeWinSize=25
|
||||
|
||||
|
||||
Plugin 'fatih/vim-go'
|
||||
|
||||
|
||||
|
||||
call vundle#end() " required
|
||||
|
||||
" 在文件外修改时自动加载
|
||||
@ -156,6 +169,24 @@ 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
|
||||
@ -258,22 +289,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
|
||||
@ -298,3 +313,7 @@ if has("autocmd")
|
||||
autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee,*.vue :call CleanExtraSpaces()
|
||||
endif
|
||||
|
||||
|
||||
colorscheme slate
|
||||
highlight Comment ctermfg=blue
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user