-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
101 lines (81 loc) · 3.22 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
" I learned to like Vim in spacemacs so i'm used to space as leader.
let mapleader = "\<Space>"
"*****************************************************************************
"* Plugins
"*****************************************************************************
" Automatic installation of vim-plug
let vimplug_file=expand('~/.local/share/nvim/site/autoload/plug.vim')
let vimplug_repo='https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
if !filereadable(vimplug_file)
silent exec '!curl -fLo '.vimplug_file.' --create-dirs '.vimplug_repo
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
call plug#begin('~/.local/share/nvim/plugged')
Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rsi'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'wincent/command-t'
Plug 'airblade/vim-gitgutter'
Plug 'bronson/vim-trailing-whitespace'
Plug 'neomake/neomake'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
Plug 'AndrewRadev/splitjoin.vim'
Plug 'SirVer/ultisnips'
Plug 'itchyny/lightline.vim'
Plug 'jiangmiao/auto-pairs'
call plug#end()
"*****************************************************************************
"* General editor settings.
"*****************************************************************************
set showcmd " Show current command.
set hlsearch " Highlight searches.
set scrolloff=5 " Tries to keep this many lines before the cursor.
set number " Line numbers.
set autowrite " Write on make.
set hidden " Let buffers stay open in background.
set expandtab " Expands tabs to spaces
set tabstop=4
set shiftwidth=4
set softtabstop=4
" Make vim create backups in a common place.
set backupdir=~/.backup//,/tmp//
set directory=~/.backup//,/tmp//
" Clear highlighting on escape in normal mode
nnoremap <esc> :noh<return><esc>
nnoremap <esc>^[ <esc>^[
" Let Ctrl-C double as Esc
nnoremap <C-c> <esc>
"*****************************************************************************
"* YCM Settings
"*****************************************************************************
" omni complete by syntax
set omnifunc=syntaxcomplete#Complete
"*****************************************************************************
"* GO Settings
"*****************************************************************************
let g:go_list_type = "quickfix"
let g:go_fmt_command = "goimports"
map <C-n> :cnext<CR>
map <C-p> :cprevious<CR>
nnoremap <leader>a :cclose<CR>
autocmd FileType go nmap <leader>r <Plug>(go-run)
autocmd FileType go nmap <leader>t <Plug>(go-test)
" Run :GoBuild or :GoTestCompile based on the go file.
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#cmd#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
endfunction
autocmd FileType go nmap <leader>b :<C-u>call <SID>build_go_files()<CR>
autocmd FileType go nmap <Leader>c <Plug>(go-coverage-toggle)
"*****************************************************************************
"* Misc Plugin Settings
"*****************************************************************************
let g:UltiSnipsExpandTrigger = "<c-j>"