-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
133 lines (110 loc) · 3.25 KB
/
init.vim
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
call plug#begin()
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
Plug 'Shougo/vimshell'
Plug 'fatih/vim-go'
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/nerdcommenter'
Plug 'nanotech/jellybeans.vim'
Plug 'ap/vim-buftabline'
Plug 'bling/vim-airline'
Plug 'tpope/vim-fugitive'
Plug 'scrooloose/syntastic'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'Valloric/YouCompleteMe'
Plug 'xolox/vim-session'
Plug 'xolox/vim-misc'
Plug 'jlanzarotta/bufexplorer'
Plug 'rbgrouleff/bclose.vim'
Plug 'airblade/vim-gitgutter'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'vimlab/split-term.vim'
Plug 'sebdah/vim-delve'
Plug 'myusuf3/numbers.vim'
call plug#end()
filetype plugin indent on
"Colors
syntax enable
colorscheme jellybeans
set background=dark
filetype plugin on
:set ww+=<,>
"Switch between windows
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>
"Switch between tabs
nnoremap <C-S-Left> :wincmd H<CR>
nnoremap <C-S-Right> :wincmd L<CR>
nnoremap <C-S-Up> :wincmd K<CR>
nnoremap <C-S-Down> :wincmd J<CR>
nnoremap <F28> :Bclose<CR>
"Copy/paste to system
vmap <C-x> "+x
vmap <C-c> "+y
imap <C-v> "+gP
"Saving buffers
nmap <C-s> :w<CR>
imap <C-s> <ESC>:w<CR>i
"Commenter
vmap <C-_> <Plug>NERDCommenterToggle
let g:NERDCompactSexyComs = 1
let g:NERDCommentEmptyLines = 1
"NerdTree
:set mouse=a
let g:NERDTreeMouseMode=2
let NERDTreeShowHidden=1
let NERDTreeMapOpenInTab='t'
let g:nerdtree_tabs_open_on_console_startup=1
nmap <C-n> :NERDTreeToggle<CR>
autocmd VimEnter * NERDTree | wincmd p
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
"Syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_aggregate_errors = 1
"vim-go
let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck']
let g:go_metalinter_autosave = 1
let g:go_gofmt_autosave = 1
nmap <C-LeftMouse> :GoDef<CR>
imap <C-LeftMouse> <ESC>:Godef<CR>
"Autocomplete
set completeopt-=preview
"Sessions saving
let g:session_directory="~/.vim/sessions"
function! OpenBuffer()
let c = 0
let wincount = winnr('$')
while !empty(getbufvar(+expand("<abuf>"), "&buftype")) && c < wincount
exec 'wincmd w'
let c = c + 1
endwhile
exec 'BufExplorer'
endfunction
noremap <silent> <C-b> :call OpenBuffer()<CR>
hi IndentGuidesOdd ctermbg=darkgrey
hi IndentGuidesEven ctermbg=black
let g:indent_guides_start_level=1
let g:indent_guides_guide_size=1
let g:indent_guides_enable_on_vim_startup=1
"Terminals
nnoremap <S-t> :Term <CR>
tnoremap <Esc> <C-\><C-n>
" Use current directory as vimshell prompt.
let g:vimshell_prompt_expr =
\ 'escape(fnamemodify(getcwd(), ":~").">", "\\[]()?! ")." "'
let g:vimshell_prompt_pattern = '^\%(\f\|\\.\)\+> '
set nopaste
set tabstop=4
set shiftwidth=4
set expandtab